Minor fixes to get-abc script and configure stuff.
[cvc5.git] / contrib / get-abc
1 #!/bin/bash
2 #
3 set -e
4
5 commit=3c5d3319120b
6
7 cd "$(dirname "$0")/.."
8
9 if ! [ -e src/parser/cvc/Cvc.g ]; then
10 echo "$(basename $0): I expect to be in the contrib/ of a CVC4 source tree," >&2
11 echo "but apparently:" >&2
12 echo >&2
13 echo " $(pwd)" >&2
14 echo >&2
15 echo "is not a CVC4 source tree ?!" >&2
16 exit 1
17 fi
18
19 function webget {
20 if which wget &>/dev/null; then
21 wget -c -O "$2" "$1"
22 elif which curl &>/dev/null; then
23 curl "$1" >"$2"
24 else
25 echo "Can't figure out how to download from web. Please install wget or curl." >&2
26 exit 1
27 fi
28 }
29
30 if [ -e abc ]; then
31 echo 'error: file or directory "abc" exists; please move it out of the way.' >&2
32 exit 1
33 fi
34
35 mkdir abc
36 cd abc
37 webget https://bitbucket.org/alanmi/abc/get/$commit.tar.gz abc-$commit.tar.gz
38 gunzip -f abc-$commit.tar.gz
39 tar xfv abc-$commit.tar
40 cd alanmi-abc-$commit
41
42 cp src/base/main/main.c src/base/main/main.c.orig
43 sed 's,^// *#define ABC_LIB *$,#define ABC_LIB,' src/base/main/main.c.orig > src/base/main/main.c
44
45 # Build optimized, without readline, without pthreads.
46 # These aren't necessary for our usage and we don't want the dependencies.
47 make libabc.a OPTFLAGS=-O READLINE=0 PTHREADS=0
48 mv libabc.a libabc-static.a
49 make clean
50 make libabc.a OPTFLAGS='-O -fPIC' READLINE=0 PTHREADS=0
51
52 echo
53 echo ===================== Now configure CVC4 with =====================
54 echo ./configure --with-abc --with-abc-dir=`pwd`