diff options
author | Marek Vavruša <marek.vavrusa@nic.cz> | 2015-02-11 19:46:49 +0100 |
---|---|---|
committer | Marek Vavruša <marek.vavrusa@nic.cz> | 2015-02-12 01:15:05 +0100 |
commit | 1067795b4d8368756e5ac8b2a66d1a5a3332fde5 (patch) | |
tree | e3acd2f6fc12e88fe0f62d5b41044102c26e4edb /scripts/bootstrap-depends.sh | |
parent | build: ported to libknot-2.0-pre API, no depends yet (diff) | |
download | knot-resolver-1067795b4d8368756e5ac8b2a66d1a5a3332fde5.tar.xz knot-resolver-1067795b4d8368756e5ac8b2a66d1a5a3332fde5.zip |
build: updated build script to cover (gmp,nettle,gnutls,jansson)
Diffstat (limited to 'scripts/bootstrap-depends.sh')
-rwxr-xr-x | scripts/bootstrap-depends.sh | 126 |
1 files changed, 78 insertions, 48 deletions
diff --git a/scripts/bootstrap-depends.sh b/scripts/bootstrap-depends.sh index c22d789f..ae3c5d30 100755 --- a/scripts/bootstrap-depends.sh +++ b/scripts/bootstrap-depends.sh @@ -2,64 +2,94 @@ set -e CMOCKA_TAG="cmocka-0.4.1" +CMOCKA_URL="git://git.cryptomilk.org/projects/cmocka.git" LIBUV_TAG="v1.3.0" +LIBUV_URL="https://github.com/libuv/libuv.git" KNOT_TAG="master" +KNOT_URL="https://github.com/CZNIC-Labs/knot.git" +GMP_TAG="6.0.0" +GMP_URL="https://gmplib.org/download/gmp/gmp-${GMP_TAG}.tar.xz" +JANSSON_TAG="2.7" +JANSSON_URL="http://www.digip.org/jansson/releases/jansson-${JANSSON_TAG}.tar.gz" +NETTLE_TAG="2.7.1" +NETTLE_URL="https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_TAG}.tar.gz" +GNUTLS_TAG="3.3.12" +GNUTLS_URL="ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-${GNUTLS_TAG}.tar.xz" -# prepare build env -PREFIX=${1}; [ -z ${PREFIX} ] && PREFIX="${HOME}/.local" -PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" +# prepare install prefix +PREFIX=${1}; [ -z ${PREFIX} ] && export PREFIX="${HOME}/.local" install -d ${PREFIX}/{lib,libexec,include,bin,sbin,man,share,etc,info,doc,var} -[ ! -d .depend ] && mkdir .depend; cd .depend -# platform-specific -DEPEND_CACHE="https://dl.dropboxusercontent.com/u/2255176/resolver-${TRAVIS_OS_NAME}-cache.tgz" +# prepare build env +export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" +export BUILD_DIR="$(pwd)/.build-depend" +export LOG=$(pwd)/build.log +[ ! -e ${BUILD_DIR} ] && mkdir ${BUILD_DIR}; cd ${BUILD_DIR} +echo "building in ${BUILD_DIR} log ${LOG}" | tee ${LOG} + +function fetch_pkg { + if [ "${2##*.}" == git ]; then + [ ! -e $1 ] && git clone -b $3 "$2" $1 &> /dev/null + else + [ ! -f $1.tar.${2##*.} ] && curl "$2" > $1.tar.${2##*.} + tar xf $1.tar.${2##*.} + fi + cd $1 +} + +function build_pkg { + if [ -f CMakeLists.txt ]; then + [ -e cmake-build ] && rm -r cmake-build; mkdir cmake-build; cd cmake-build + cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. + else + if [ ! -e ./configure ]; then + [ -e autogen.sh ] && sh autogen.sh || autoreconf -if + fi + ./configure --prefix=${PREFIX} --enable-shared --disable-static $* + fi + make ${MAKEOPTS} + make install +} + +function pkg { + if [ ! -e ${PREFIX}/$4 ]; then + cd ${BUILD_DIR} + echo "[x] fetching $1-$3" + fetch_pkg "$1-$3" "$2" $3 >> ${LOG} + echo "[x] building $1-$3" + shift 4 + (build_pkg $*) >> ${LOG} 2>&1 + fi +} + +# gnutls + dependencies +pkg gmp ${GMP_URL} ${GMP_TAG} include/gmp.h +pkg nettle ${NETTLE_URL} ${NETTLE_TAG} include/nettle \ + --disable-documentation --with-lib-path=${PREFIX}/lib --with-include-path=${PREFIX}/include +export GMP_CFLAGS="-I${PREFIX}/include" +export GMP_LIBS="-L${PREFIX}/lib -lgmp" +pkg gnutls ${GNUTLS_URL} ${GNUTLS_TAG} include/gnutls \ + --disable-tests --disable-doc --disable-valgrind-tests +# jansson +pkg jansson ${JANSSON_URL} ${JANSSON_TAG} include/jansson.h +# libknot +pkg libknot ${KNOT_URL} ${KNOT_TAG} include/libknot \ + --with-lmdb=no --disable-fastparser --disable-daemon --disable-utilities --disable-documentation +# cmocka +pkg cmocka ${CMOCKA_URL} ${CMOCKA_TAG} +# libuv +pkg libuv ${LIBUV_URL} ${LIBUV_TAG} include/uv.h + +# travis-specific PIP_PKGS="${TRAVIS_BUILD_DIR}/tests/pydnstest/requirements.txt cpp-coveralls" if [ "${TRAVIS_OS_NAME}" == "osx" ]; then - if curl "${DEPEND_CACHE}" > cache.tgz; then - echo "extracting prebuilt dependencies from ${DEPEND_CACHE}" - tar -xz -C ${HOME} -f cache.tgz || true - fi - brew install --force makedepend - brew install --force python + DEPEND_CACHE="https://dl.dropboxusercontent.com/u/2255176/resolver-${TRAVIS_OS_NAME}-cache.tar.gz" + curl "${DEPEND_CACHE}" > cache.tar.gz && tar -xz -C ${HOME} -f cache.tar.gz || true + brew install --force makedepend python brew link --overwrite python pip install --upgrade pip pip install -r ${PIP_PKGS} fi if [ "${TRAVIS_OS_NAME}" == "linux" ]; then pip install --user ${USER} -r ${PIP_PKGS} -fi - -# libknot -if [ ! -e ${PREFIX}/include/libknot ]; then - git clone -b ${KNOT_TAG} https://github.com/CZNIC-Labs/knot.git || true - cd knot - autoreconf -i - if [ $(uname) == "Darwin" ]; then # Workaround for crypto version check on OS X - export libcrypto_CFLAGS="-I /usr/local/opt/openssl/include" - export libcrypto_LIBS="-L/usr/local/opt/openssl/lib -lcrypto" - fi - ./configure --prefix=${PREFIX} --with-lmdb=no --disable-fastparser --disable-dependency-tracking \ - --disable-daemon --disable-utilities --disable-documentation - make ${MAKEOPTS} && make install - cd .. -fi - -# cmocka -if [ ! -e ${PREFIX}/include/cmocka.h ]; then - git clone -b ${CMOCKA_TAG} git://git.cryptomilk.org/projects/cmocka.git || true - cd cmocka - mkdir build || true - cd build - cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. - make ${MAKEOPTS} && make install - cd ../.. -fi - -# libuv -if [ ! -e ${PREFIX}/include/uv.h ]; then - git clone -b ${LIBUV_TAG} https://github.com/libuv/libuv.git || true - cd libuv - sh autogen.sh - ./configure --prefix=${PREFIX} --disable-dependency-tracking - make ${MAKEOPTS} && make install -fi +fi
\ No newline at end of file |