#!/usr/bin/env bash # SPDX-License-Identifier: BSD-3-Clause # Copyright 2014-2020, Intel Corporation # # build-rpm.sh - Script for building rpm packages # set -e SCRIPT_DIR=$(dirname $0) source $SCRIPT_DIR/pkg-common.sh check_tool rpmbuild check_file $SCRIPT_DIR/pkg-config.sh source $SCRIPT_DIR/pkg-config.sh # # usage -- print usage message and exit # usage() { [ "$1" ] && echo Error: $1 cat >&2 < $RPM_SPEC_FILE if [ "$DISTRO" = "SLES_like" ] then sed -i '/^#.*bugzilla.redhat/d' $RPM_SPEC_FILE fi # do not split on space IFS=$'\n' # experimental features if [ "${EXPERIMENTAL}" = "y" ] then # no experimental features for now RPMBUILD_OPTS+=( ) fi # libpmem2 if [ "${PMEM2_INSTALL}" == "y" ] then RPMBUILD_OPTS+=(--define "_pmem2_install 1") fi # librpmem & rpmemd if [ "${BUILD_RPMEM}" = "y" ] then RPMBUILD_OPTS+=(--with fabric) else RPMBUILD_OPTS+=(--without fabric) fi # daxio & RAS if [ "${NDCTL_ENABLE}" = "n" ] then RPMBUILD_OPTS+=(--without ndctl) else RPMBUILD_OPTS+=(--with ndctl) fi # use specified testconfig file or default if [[( -n "${TEST_CONFIG_FILE}") && ( -f "$TEST_CONFIG_FILE" ) ]] then echo "Test config file: $TEST_CONFIG_FILE" RPMBUILD_OPTS+=(--define "_testconfig $TEST_CONFIG_FILE") else echo -e "Test config file $TEST_CONFIG_FILE does not exist.\n"\ "Default test config will be used." fi # run make check or not if [ "${BUILD_PACKAGE_CHECK}" == "n" ] then RPMBUILD_OPTS+=(--define "_skip_check 1") fi tar zcf $PACKAGE_TARBALL $PACKAGE_SOURCE # Create directory structure for rpmbuild mkdir -v BUILD SPECS echo "opts: ${RPMBUILD_OPTS[@]}" rpmbuild --define "_topdir `pwd`"\ --define "_rpmdir ${OUT_DIR}"\ --define "_srcrpmdir ${OUT_DIR}"\ -ta $PACKAGE_TARBALL \ ${RPMBUILD_OPTS[@]} echo "Building rpm packages done" exit 0