Forum: Cfengine Help Subject: Re: Error compiling cf3.1.2 on Solaris 10 Author: berntjernberg Link to topic: https://cfengine.com/forum/read.php?3,19853,19860#msg-19860
Hi, I use this script to build a static version of cfengine on Solaris 10. Regards Bernt Jernberg #!/usr/bin/bash # # CFEngine and dependencies # #------------------------------------------------------------------------------------------------------ # Author: Bernt Jernberg #------------------------------------------------------------------------------------------------------ export PATH=/usr/sfw/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/local/bin:/usr/ccs/bin BUILD_ROOT=/path/to/build_root DEST_ROOT=/path/to/dest_root # # OpenSSL # OPENSSL_VERSION=1.0.0c OPENSSL_SRC=openssl-${OPENSSL_VERSION}.tar.gz OPENSSL_DIR=${BUILD_ROOT}/openssl-${OPENSSL_VERSION} # # PCRE - Perl Compatible Regular Expressions # PCRE_VERSION=8.10 PCRE_SRC=pcre-${PCRE_VERSION}.tar.gz PCRE_DIR=${BUILD_ROOT}/pcre-${PCRE_VERSION} # # BerkleyDB # DB_VERSION=5.1.19 DB_SRC=db-${DB_VERSION}.tar.gz DB_DIR=${BUILD_ROOT}/db-${DB_VERSION} # # Cfengine # CFE_VERSION=3.1.2 CFE_SRC=cfengine-${CFE_VERSION}.tar.gz CFE_DIR=${BUILD_ROOT}/cfengine-${CFE_VERSION} ###################### # Build OpenSSL ###################### function build_openssl { cd $BUILD_ROOT if [ -f ${OPENSSL_SRC} ] then if [ -d $OPENSSL_DIR ] then echo "Removing $OPENSSL_DIR... " rm -rf $OPENSSL_DIR fi if [ -d ${DEST_ROOT}/ssl ] then echo "Removing ${DEST_ROOT}/ssl... " rm -rf ${DEST_ROOT}/ssl fi echo "Unpacking ${BUILD_ROOT}/${OPENSSL_SRC}... " gzip -cd ${OPENSSL_SRC} | tar xf - [ $? -eq 0 ] || exit 1 cd $OPENSSL_DIR ./Configure solaris-sparcv9-gcc \ --prefix=${DEST_ROOT}/ssl \ --openssldir=${DEST_ROOT}/ssl \ no-shared [ $? -eq 0 ] || exit 1 gmake [ $? -eq 0 ] || exit 1 gmake install [ $? -eq 0 ] || exit 1 else echo "${OPENSSL_SRC}: no such file!" exit 1 fi } ################# # Buil PCRE ################# function build_pcre { cd $BUILD_ROOT if [ -f ${PCRE_SRC} ] then if [ -d $PCRE_DIR ] then echo "Removing $PCRE_DIR... " rm -rf $PCRE_DIR fi if [ -d ${DEST_ROOT}/pcre ] then echo "Removing ${DEST_ROOT}/pcre... " rm -rf ${DEST_ROOT}/pcre fi echo "Unpacking ${BUILD_ROOT}/${PCRE_SRC}... " gzip -cd ${PCRE_SRC} | tar xf - [ $? -eq 0 ] || exit 1 cd $PCRE_DIR ./configure --prefix=${DEST_ROOT}/pcre \ FLAGS="-g -O3" \ CC=/usr/sfw/bin/gcc \ --enable-utf8 --enable-unicode-properties \ --enable-static \ --disable-shared \ --disable-cpp \ [ $? -eq 0 ] || exit 1 gmake [ $? -eq 0 ] || exit 1 gmake install [ $? -eq 0 ] || exit 1 else echo "${PCRE_SRC}: no such file!" exit 1 fi } ######################### # Build Berkley db ######################### function build_bdb { cd $BUILD_ROOT if [ -f ${DB_SRC} ] then if [ -d $DB_DIR ] then echo "Removing $DB_DIR... " rm -rf $DB_DIR fi if [ -d ${DEST_ROOT}/db ] then echo "Removing ${DEST_ROOT}/db... " rm -rf ${DEST_ROOT}/db fi echo "Unpacking ${BUILD_ROOT}/${DB_SRC}... " gzip -cd ${DB_SRC} | tar xf - [ $? -eq 0 ] || exit 1 cd ${DB_DIR}/build_unix ../dist/configure --prefix=${DEST_ROOT}/db \ --enable-static \ --disable-shared [ $? -eq 0 ] || exit 1 gmake [ $? -eq 0 ] || exit 1 gmake install [ $? -eq 0 ] || exit 1 else echo "${DB_SRC}: no such file!" exit 1 fi } ##################### # Build Cfengine ##################### function build_cfe { export LD_LIBRARY_FLAGS=/usr/sfw/lib:/usr/local/lib:/usr/lib cd $BUILD_ROOT if [ -f ${CFE_SRC} ] then if [ -d $CFE_DIR ] then echo "Removing $CFE_DIR... " rm -rf $CFE_DIR fi if [ -d ${DEST_ROOT}/cfe ] then echo "Removing ${DEST_ROOT}/cfe... " rm -rf ${DEST_ROOT}/cfe fi echo "Unpacking ${BUILD_ROOT}/${CFE_SRC}... " gzip -cd ${CFE_SRC} | tar xf - [ $? -eq 0 ] || exit 1 cd ${CFE_DIR} ./configure --prefix=/var/cfengine \ --with-openssl=${DEST_ROOT}/ssl \ --with-pcre=${DEST_ROOT}/pcre \ --with-berkeleydb=${DEST_ROOT}/db \ --without-sql \ --with-gnu-ld \ --enable-static \ --disable-shared \ CC=/usr/sfw/bin/gcc \ LD=/usr/sfw/bin/ld \ CFLAGS='-fPIC' [ $? -eq 0 ] || exit 1 for file in `find . -name Makefile` do sed -e "s|-ldb|${DEST_ROOT}/db/lib/libdb.a|" \ -e "s|-lcrypto|${DEST_ROOT}/ssl/lib/libcrypto.a|" \ -e "s|-lpcre|${DEST_ROOT}/pcre/lib/libpcre.a|" \ -e "s|/usr/ccs/bin/ld|/usr/sfw/bin/ld|" \ -e "s|/usr/ccs/bin/ar|/usr/sfw/bin/ar|" \ -e "s|/usr/ccs/bin/nm|/usr/sfw/bin/nm|" \ -e "s|-pthread|-pthreads|" $file > /tmp/Makefile.$$ [ $? -eq 0 ] || exit 1 mv /tmp/Makefile.$$ $file [ $? -eq 0 ] || exit 1 done gmake [ $? -eq 0 ] || exit 1 export DESTDIR=${DEST_ROOT}/cfe gmake install [ $? -eq 0 ] || exit 1 else echo "${CFE_SRC}: no such file!" exit 1 fi } ################## # Main ################## build_openssl build_pcre build_bdb build_cfe _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine