I was working on a bash function to help me to compile packages:
make_package() {
local PACKAGE_NAME=$1
local PACKAGE_VERSION=$2
local PACKAGE_INSTALL_DIR=$3
local PACKAGE_CONFIGURE_PARAMETERS=$4
echo "Make ${PACKAGE_NAME}-${PACKAGE_VERSION}"
local BUILD_DIRECTORY=build/${PACKAGE_NAME}-${PACKAGE_VERSION}_build
if [ -d ${BUILD_DIRECTORY} ]; then
rm -rf ${BUILD_DIRECTORY}/*
else
mkdir -p ${BUILD_DIRECTORY}
fi
cd ${BUILD_DIRECTORY} && \
../../${PACKAGE_NAME}-${PACKAGE_VERSION}/configure $4 --prefix=`pwd`/../$3 && \
make && \
make install && \
cd ../../
if [ $? -ne 0 ]; then
echo "Make ${PACKAGE_NAME} error!"
exit 1
fi
}
It was working fine for things like
make_package "popt" "1.16" "arm_sdk" "--host=arm-linux-gnueabihf"
make_package "ncurses" "5.6" "arm_sdk" "--host=arm-linux-gnueabihf --without-ada"
But I'm stuck at:
make_package "OpenIPMI" "2.0.28" "--host=arm-linux-gnueabihf LDFLAGS=\"-L`pwd`/build/arm_sdk/lib\" CPPFLAGS=\"-I`pwd`/build/arm_sdk/include -I`pwd`/build/arm_sdk/include/ncurses\""
The problem comes from the:
CPPFLAGS=\"-I`pwd`/build/arm_sdk/include -I`pwd`/build/arm_sdk/include/ncurses\"
Because of this I get an error:
configure: error: unrecognized option: `-I/home/me/build/arm_sdk/include/ncurses"'
So I'm stuck here... Is there a way to pass such configure arguments as a parameter to a function in bash?