summaryrefslogtreecommitdiff
path: root/contrib/get-win-dependencies
blob: 5ca969f6bf3382fc5ffe46c6399495f6437e5ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
#
# win32-build script
# Morgan Deters <mdeters@cs.nyu.edu>
# Tue, 15 Jan 2013 11:11:24 -0500
#

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
  echo "WARNING:"
  echo "WARNING: Using default HOST value: $HOST"
  echo "WARNING: You should probably run this script like this:"
  echo "WARNING:"
  echo "WARNING:   HOST=i686-w64-mingw32 win-build"
  echo "WARNING:"
  echo "WARNING: (replacing the i686-w64-mingw32 with your build host)"
  echo "WARNING: to ensure the script builds correctly."
  echo "WARNING:"
fi

GMPVERSION=6.1.2
BOOSTVERSION=1.55.0
BOOSTBASE=boost_1_55_0

function reporterror {
  echo
  echo =============================================================================
  echo
  echo "There was an error setting up the prerequisites.  Look above for details."
  echo
  exit 1
}

function webget {
  if which curl &>/dev/null; then
    curl -L "$1" >"$2"
  elif which wget &>/dev/null; then
    wget -c -O "$2" "$1"
  else
    echo "Can't figure out how to download from web.  Please install wget or curl." >&2
    exit 1
  fi
}

for dir in antlr-3.4 gmp-$GMPVERSION boost-$BOOSTVERSION; do
  if [ -e "$dir" ]; then
    echo "error: $dir directory exists; please move it out of the way." >&2
    exit 1
  fi
done

echo =============================================================================
echo
echo "Setting up ANTLR 3.4..."
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

# 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
echo "Setting up Boost..."
echo
( mkdir boost-$BOOSTVERSION &&
  cd boost-$BOOSTVERSION &&
  webget https://sourceforge.net/projects/boost/files/boost/$BOOSTVERSION/$BOOSTBASE.tar.gz/download $BOOSTBASE.tar.gz &&
  tar xfz $BOOSTBASE.tar.gz &&
  cd $BOOSTBASE &&
  ./bootstrap.sh --with-toolset=gcc --prefix=`pwd`/.. --with-libraries=thread &&
  echo "using gcc : mingw32 : $HOST-gcc ;" >> project-config.jam &&
  cp tools/build/v2/tools/gcc.jam tools/build/v2/tools/gcc.jam.orig &&
  sed 's,option = -pthread ; libs = rt ;,,' tools/build/v2/tools/gcc.jam.orig > tools/build/v2/tools/gcc.jam &&
  ./b2 gcc-mingw32 threadapi=win32 link=static install ) || exit 1
echo
echo =============================================================================
echo
echo 'Now just run:'
echo "  ./configure --enable-static-binary --disable-shared --host=$HOST LDFLAGS=\"-L`pwd`/gmp-$GMPVERSION/lib -L`pwd`/antlr-3.4/lib -L`pwd`/boost-$BOOSTVERSION/lib\" CPPFLAGS=\"-I`pwd`/gmp-$GMPVERSION/include -I`pwd`/antlr-3.4/include -I`pwd`/boost-$BOOSTVERSION/include\" --with-antlr-dir=\"`pwd`/antlr-3.4\" ANTLR=\"`pwd`/antlr-3.4/bin/antlr3\""
echo '  make'
echo
echo =============================================================================
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback