Files
impala/bin/make-impala-udf-devel-rpm.sh
Abhishek Rawat f4c0c396ff IMPALA-14175: Generate impala-udf-devel package using the build script
Added '-udf_devel_package' option to buildall.sh. This generates
impala-udf-devel rpm which includes udf headers and static libraries -
ImpalaUdf-retail.a and ImpalaUdf-debug.a.

Testing:
- Tested that rpm is generated using build script:
 ./buildall.sh -release_and_debug -notests -udf_devel_package
- Tested that the rpm is also generated using standalone script:
 ./bin/make-impala-udf-devel-rpm.sh
- Generated impala-udf-devel package and tested compiling
impala_udf_samples:
https://github.com/cloudera/impala-udf-samples

Change-Id: I5b85df9c3f680a7e5551f067a97a5650daba9b50
Reviewed-on: http://gerrit.cloudera.org:8080/23060
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2025-09-09 22:42:05 +00:00

75 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
VERSION=${IMPALA_VERSION%%-*}
PKG_NAME=impala-udf-devel
TOPDIR=${IMPALA_HOME}/${PKG_NAME}-rpmbuild
SRC_DIR=${IMPALA_HOME}/${PKG_NAME}-${VERSION}
INCLUDE_DIR=${SRC_DIR}/usr/include/impala_udf
LIB_DIR=${SRC_DIR}/usr/lib64
SPEC_FILE=impala-udf-devel.spec
rm -rf "$SRC_DIR"
mkdir -p "$INCLUDE_DIR" "$LIB_DIR"
cp be/src/udf/uda-test-harness-impl.h \
be/src/udf/uda-test-harness.h \
be/src/udf/udf-debug.h \
be/src/udf/udf-test-harness.h \
be/src/udf/udf.h "$INCLUDE_DIR/"
# UDF SDK uses impala_udf namespace to avoid namespace collision
sed -i 's|#include "udf/\(.*\)"|#include <impala_udf/\1>|' ${INCLUDE_DIR}/*.h
SO_ORIG=$(find be/build/release/udf -name libImpalaUdf.a | head -n1)
if [ -z "$SO_ORIG" ]; then
echo "be/build/release/udf/libImpalaUdf.a not found."
echo "Build with ./buildall.sh -release_and_debug -notests -udf_devel_package."
exit 1
fi
cp "$SO_ORIG" "$LIB_DIR/libImpalaUdf-retail.a"
SO_ORIG=$(find be/build/debug/udf -name libImpalaUdf.a | head -n1)
if [ -z "$SO_ORIG" ]; then
echo "be/build/debug/udf/libImpalaUdf.a not found."
echo "Build with ./buildall.sh -release_and_debug -notests -udf_devel_package."
exit 1
fi
cp "$SO_ORIG" "$LIB_DIR/libImpalaUdf-debug.a"
cd ~
mkdir -p "$TOPDIR"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar czf "$TOPDIR/SOURCES/${PKG_NAME}-${VERSION}.tar.gz" -C \
"${IMPALA_HOME}" "${PKG_NAME}-${VERSION}"
echo "Copying .spec file..."
cp "${IMPALA_HOME}/bin/$SPEC_FILE" "$TOPDIR/SPECS/"
echo "Building RPM..."
rpmbuild -ba "$TOPDIR/SPECS/$SPEC_FILE" --define "_topdir $TOPDIR" \
--define "version ${VERSION}"
echo "Done. RPM available at:"
find "$TOPDIR/RPMS" -name "${PKG_NAME}*.rpm"