Add contrib/get-gmp script. (#2292)
authorMathias Preiner <mathias.preiner@gmail.com>
Wed, 15 Aug 2018 21:34:12 +0000 (14:34 -0700)
committerAndres Noetzli <andres.noetzli@gmail.com>
Wed, 15 Aug 2018 21:34:12 +0000 (14:34 -0700)
contrib/get-gmp [new file with mode: 0755]
contrib/get-win-dependencies

diff --git a/contrib/get-gmp b/contrib/get-gmp
new file mode 100755 (executable)
index 0000000..02602e4
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# This script should only be used if your distribution does not ship with the
+# GMP configuration you need. For example, contrib/get-win-dependencies
+# cross-compiles GMP for Windows. You can also use the script if your
+# distribution does not ship with static GMP libraries (e.g., Arch Linux) and
+# you want to build CVC4 statically.
+# In most of the cases the GMP version installed on your system is the one you
+# want and should use.
+#
+
+source "$(dirname "$0")/get-script-header.sh"
+
+[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="--disable-shared --enable-static"
+[ -n "$HOST" ] && HOST="--host=$HOST"
+[ -z "$GMPVERSION" ] && GMPVERSION=6.1.2
+
+echo =============================================================================
+echo
+echo "Setting up GMP $GMPVERSION..."
+echo
+( set -ex
+  mkdir gmp-$GMPVERSION
+  cd gmp-$GMPVERSION
+  gmpprefix=`pwd` &&
+  mkdir src &&
+  cd src &&
+  webget https://gmplib.org/download/gmp/gmp-$GMPVERSION.tar.bz2 gmp-$GMPVERSION.tar.bz2 &&
+  tar xfj gmp-$GMPVERSION.tar.bz2 &&
+  cd gmp-$GMPVERSION &&
+  ./configure ${HOST} --prefix="$gmpprefix" --enable-cxx ${BUILD_TYPE} &&
+  make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" &&
+  make install
+) || exit 1
+echo
index ee33391d74270beaddcc2d80ea438b6cb0d98387..5ca969f6bf3382fc5ffe46c6399495f6437e5ad1 100755 (executable)
@@ -74,23 +74,16 @@ echo
 MACHINE_TYPE="x86_64" ANTLR_CONFIGURE_ARGS="--host=$HOST" contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir='
 [ ${PIPESTATUS[0]} -eq 0 ] || reporterror
 echo
-echo =============================================================================
-echo
-echo "Setting up GMP $GMPVERSION..."
-echo
-( set -ex
-  mkdir gmp-$GMPVERSION
-  cd gmp-$GMPVERSION
-  gmpprefix=`pwd` &&
-  mkdir src &&
-  cd src &&
-  webget https://gmplib.org/download/gmp/gmp-$GMPVERSION.tar.bz2 gmp-$GMPVERSION.tar.bz2 &&
-  tar xfj gmp-$GMPVERSION.tar.bz2 &&
-  cd gmp-$GMPVERSION &&
-  ./configure --host=$HOST --prefix="$gmpprefix" --enable-cxx ${BUILD_TYPE} &&
-  make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" &&
-  make install
-) || exit 1
+
+# Setup GMP
+HOST="$HOST" \
+BUILD_TYPE="$BUILD_TYPE" \
+MAKE_CFLAGS="$MAKE_CFLAGS" \
+MAKE_CXXFLAGS="$MAKE_CXXFLAGS" \
+MAKE_LDFLAGS="$MAKE_LDFLAGS" \
+GMPVERSION="$GMPVERSION" \
+  contrib/get-gmp || reporterror
+
 echo
 echo =============================================================================
 echo