diff options
author | Andres Noetzli <noetzli@stanford.edu> | 2017-10-26 02:04:40 -0700 |
---|---|---|
committer | Andres Noetzli <noetzli@stanford.edu> | 2017-10-26 02:04:40 -0700 |
commit | 26ee0ebac47ec01d10fa0a025be786569ffd1bd4 (patch) | |
tree | 4d55636dd542ecf210f265b90ceeb5a65e8a2f97 | |
parent | 541f97576a218e9e13277be384b40dbb0b848ed1 (diff) |
Add option to build shared Windows dependencies
This commit adds an option to the contrib/get-win-dependencies script
(-s) to build shared library versions of ANTLR and GMP, which enables
building the shared versions of the CVC4 libraries needed for language
bindings.
-rwxr-xr-x | contrib/get-antlr-3.4 | 27 | ||||
-rwxr-xr-x | contrib/win-build | 32 | ||||
-rw-r--r-- | src/bindings/compat/java/Makefile.am | 1 |
3 files changed, 44 insertions, 16 deletions
diff --git a/contrib/get-antlr-3.4 b/contrib/get-antlr-3.4 index 6a36681cb..87d6ea450 100755 --- a/contrib/get-antlr-3.4 +++ b/contrib/get-antlr-3.4 @@ -4,6 +4,10 @@ set -e cd "$(dirname "$0")/.." +if [ -z "${BUILD_TYPE}" ]; then + BUILD_TYPE="--disable-shared --enable-static" +fi + if ! [ -e src/parser/cvc/Cvc.g ]; then echo "$(basename $0): I expect to be in the contrib/ of a CVC4 source tree," >&2 echo "but apparently:" >&2 @@ -60,18 +64,29 @@ gunzip -f libantlr3c-3.4.tar.gz tar xfv libantlr3c-3.4.tar cd libantlr3c-3.4 +# Use an absolute path for the installation directory to avoid spurious libtool +# warnings about the ANTLR library having moved +PREFIX=$(realpath `pwd`/../..) + +# Make antlr3debughandlers.c empty to avoid unreferenced symbols +rm -rf src/antlr3debughandlers.c && touch src/antlr3debughandlers.c if [ ${MACHINE_TYPE} == 'x86_64' ]; then # 64-bit stuff here - ./configure --enable-64bit --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS + ./configure --enable-64bit --disable-antlrdebug --prefix="${PREFIX}" $ANTLR_CONFIGURE_ARGS $BUILD_TYPE else # 32-bit stuff here - ./configure --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS + ./configure --disable-antlrdebug --prefix="${PREFIX}" $ANTLR_CONFIGURE_ARGS $BUILD_TYPE fi cp Makefile Makefile.orig sed 's,^\(CFLAGS = .*\),\1 -fexceptions,' Makefile.orig > Makefile -make +make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" make install + +if [[ $WINDOWS_BUILD == "yes" ]]; then + exit 0 +fi + cd ../.. mv lib/libantlr3c.a lib/libantlr3c-static.a @@ -80,15 +95,15 @@ make clean if [ ${MACHINE_TYPE} == 'x86_64' ]; then # 64-bit stuff here - ./configure --enable-64bit --with-pic --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS + ./configure --enable-64bit --with-pic --disable-antlrdebug --prefix="${PREFIX}" $ANTLR_CONFIGURE_ARGS $BUILD_TYPE else # 32-bit stuff here - ./configure --with-pic --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS + ./configure --with-pic --disable-antlrdebug --prefix="${PREFIX}" $ANTLR_CONFIGURE_ARGS $BUILD_TYPE fi cp Makefile Makefile.orig sed 's,^\(CFLAGS = .*\),\1 -fexceptions,' Makefile.orig > Makefile -make +make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" make install cd ../.. mv lib/libantlr3c.la lib/libantlr3c.la.orig diff --git a/contrib/win-build b/contrib/win-build index 9a1a257a0..3e2537eff 100755 --- a/contrib/win-build +++ b/contrib/win-build @@ -5,12 +5,23 @@ # Tue, 15 Jan 2013 11:11:24 -0500 # -if [ $# -ne 0 ]; then - echo "usage: `basename $0`" >&2 - echo >&2 - echo "This script attempts to build CVC4 for Win32/64 using mingw-w64." >&2 - exit 1 -fi +export WINDOWS_BUILD=yes +export MAKE_CFLAGS= +export MAKE_CXXFLAGS= +export MAKE_LDFLAGS= +export BUILD_TYPE="--disable-shared --enable-static" +while getopts ":s" opt; do + case ${opt} in + s ) + MAKE_CFLAGS="-static-libgcc -static-libstdc++" + MAKE_CXXFLAGS="-static-libgcc -static-libstdc++" + # CVC4 uses some internal symbols of ANTLR, so all symbols need to be + # exported + MAKE_LDFLAGS="-no-undefined -Wl,--export-all-symbols" + BUILD_TYPE="--enable-shared --disable-static" + ;; + esac +done if [ -z "$HOST" ]; then HOST=i686-w64-mingw32 @@ -49,7 +60,7 @@ function webget { fi } -for dir in antlr-3.4 gmp-$GMPVERSION boost-$BOOSTVERSION; do +for dir in antlr-3.4; do if [ -e "$dir" ]; then echo "error: $dir directory exists; please move it out of the way." >&2 exit 1 @@ -60,9 +71,10 @@ echo =========================================================================== echo echo "Setting up ANTLR 3.4..." echo -MACHINE_TYPE=x86 ANTLR_CONFIGURE_ARGS=--host=$HOST contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir=' +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 +exit 0 echo ============================================================================= echo echo "Setting up GMP $GMPVERSION..." @@ -76,8 +88,8 @@ echo webget ftp://ftp.gmplib.org/pub/gmp-$GMPVERSION/gmp-$GMPVERSION.tar.bz2 gmp-$GMPVERSION.tar.bz2 && tar xfj gmp-$GMPVERSION.tar.bz2 && cd gmp-$GMPVERSION && - ./configure --host=$HOST --prefix="$gmpprefix" --enable-cxx && - make && + ./configure --host=$HOST --prefix="$gmpprefix" --enable-cxx ${BUILD_TYPE} && + make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" && make install ) || exit 1 echo diff --git a/src/bindings/compat/java/Makefile.am b/src/bindings/compat/java/Makefile.am index 5b052568d..eae498368 100644 --- a/src/bindings/compat/java/Makefile.am +++ b/src/bindings/compat/java/Makefile.am @@ -29,6 +29,7 @@ if CVC4_LANGUAGE_BINDING_JAVA javalib_LTLIBRARIES += libcvc4compatjni.la javadata_DATA += CVC4compat.jar libcvc4compatjni_la_LDFLAGS = \ + -no-undefined \ -module \ -shrext $(CVC4_JAVA_MODULE_EXT) \ -version-info $(LIBCVC4BINDINGS_VERSION) |