#!/bin/bash # Script to make the ActiveMQ-CPP 3.7.0 libraries. # Command line must be either of: # ./acc_build -production [-cleaner] # ./acc_build -debug [-cleaner] #set -x # Query Build type then set default compiler if ( [ "${DIST_BUILD}" ] ) ; then DIST_F90="${DIST_F90}" ; elif ( [ "${ACC_SET_F_COMPILER}" ] ) ; then DIST_F90="${ACC_SET_F_COMPILER}" ; else DIST_F90="ifort" ; fi # Just incase the gmake -j level is not set, we'll set it here, to "2". if [ -z ${ACC_SET_GMAKE_JOBS} ] || [ "${ACC_SET_GMAKE_JOBS}" == "0" ] ; then export ACC_SET_GMAKE_JOBS=2 ; fi # If OpenMP is enabled, set compiler and Linker flags case "$ACC_ENABLE_OPENMP" in "Y" | "y" | "1" ) export CFLAGS="-fopenmp ${CFLAGS}" if ( [ "${DIST_F90}" == "gfortran" ] ) then export FFLAGS="-fopenmp" export LDFLAGS="-lgomp" else export FFLAGS="-openmp" fi ;; *);; esac # Base C Flags for OS if ( [ `uname` == "Linux" ] && [ `uname -m` == "x86_64" ] ) then export BASE_OPTS="-std=gnu99 -Wall -fPIC -Wno-trigraphs -Wno-unused -g" export LDFLAGS="${LDFLAGS}" elif ( [ `uname` == "Darwin" ] ) then export VER=$(uname -r | cut -d. -f1) export BASE_OPTS="-DSTDC_HEADERS -std=gnu99 -Wall -fPIC -Wno-trigraphs -Wno-unused -g" if ( [ "${VER}" -gt 11 ] && [ ! -d "/opt/local/share/macports/" ] ) ; then export CFLAGS="" ; export CC=cc ; fi # Disable openmp and use Apple Clang due to bug in Apple gcc on Mac OS 10.7 and above export LDFLAGS="-v" else export BASE_OPTS="-std=gnu99 -Wall -Wno-trigraphs -Wno-unused -g" export LDFLAGS="${LDFLAGS}" fi # Make the Production or Debug directory BUILD_TYPE=$(echo $1 | cut -d- -f2) OUTPUT_DIR="`pwd`/../"${BUILD_TYPE}"" WORK_DIR="`pwd`/"${BUILD_TYPE}"" if [ ! -d ${BUILD_TYPE} ] ; then mkdir ${BUILD_TYPE} ; fi if [ ! -d ${OUTPUT_DIR} ] ; then mkdir -p ${OUTPUT_DIR} ; fi # Set C Flags for Debug or Production and then build if [ $2 == '-cleaner' > /dev/null 2>&1 ]; then rm -rf ${OUTPUT_DIR}/include/activemq-cpp-3.7.0 rm -f ${OUTPUT_DIR}/bin/example rm -f ${OUTPUT_DIR}/bin/activemqcpp-config rm -f ${OUTPUT_DIR}/lib/libactivemq-cpp* rm -f ${OUTPUT_DIR}/lib/pkgconfig/libactivemq-cpp* rm -rf ${BUILD_TYPE} elif [ $1 == '-debug' > /dev/null 2>&1 ]; then if [ ! -e ${BUILD_TYPE}/src/main/.libs/libactivemq-cpp.a ] ; then export CFLAGS="-O0 ${BASE_OPTS} ${CFLAGS}" echo -e "\nPreparing "${BUILD_TYPE}" build of `cat VERSION`...\n" ( cd `pwd` ; tar --exclude=production --exclude=debug --exclude=.svn -cf - . ) | ( cd ${WORK_DIR} ; tar -xf - ) cd ${WORK_DIR} ./autogen.sh ./configure --prefix ${OUTPUT_DIR} gmake -j ${ACC_SET_GMAKE_JOBS} gmake install else echo -e "\nThe "${BUILD_TYPE}" build already exists. To force a rebuild, please type: \n\n mkd cleaner \n\nthen type:\n\n mkd\n" fi elif [ $1 == '-production' > /dev/null 2>&1 ]; then if [ ! -e ${BUILD_TYPE}/src/main/.libs/libactivemq-cpp.a ] ; then export CFLAGS="-O2 ${BASE_OPTS} ${CFLAGS}" echo -e "\nPreparing "${BUILD_TYPE}" build of `cat VERSION`...\n" ( cd `pwd` ; tar --exclude=production --exclude=debug --exclude=.svn -cf - . ) | ( cd ${WORK_DIR} ; tar -xf - ) cd ${WORK_DIR} ./autogen.sh ./configure --prefix ${OUTPUT_DIR} gmake -j ${ACC_SET_GMAKE_JOBS} gmake install else echo -e "\nThe "${BUILD_TYPE}" build already exists. To force a rebuild, please type: \n\n mk cleaner \n\nthen type:\n\n mk\n" fi else echo -e "\nError in acc_build: Command line argument $1 must be '-debug' or '-production'\n" exit 1 fi # Clean up variables unset CFLAGS unset FFLAGS unset LDFLAGS unset BASE_OPTS #