Merge remote-tracking branch 'origin/1.0.x'
[cvc5.git] / contrib / mac-build
1 #!/bin/bash
2 #
3 # mac-build script
4 # Morgan Deters <mdeters@cs.nyu.edu>
5 # Tue, 25 Sep 2012 15:44:27 -0400
6 #
7
8 macports_prereq="boost gmp gtime readline"
9
10 export PATH="/opt/local/bin:$PATH"
11
12 if [ $# -ne 0 ]; then
13 echo "usage: `basename $0`" >&2
14 echo >&2
15 echo "This script attempts to set up the build requirements for CVC4 for Mac OS X." >&2
16 echo "MacPorts must be installed (but this script installs prerequisite port" >&2
17 echo "packages for CVC4). If this script is successful, it prints a configure" >&2
18 echo "line that you can use to configure CVC4." >&2
19 fi
20
21 function reporterror {
22 echo
23 echo =============================================================================
24 echo
25 echo "There was an error setting up the prerequisites. Look above for details."
26 echo
27 exit 1
28 }
29
30 echo =============================================================================
31 echo
32 echo "running: sudo port install $macports_prereq"
33 if which port &>/dev/null; then
34 echo "You may be asked for your password to install these packages."
35 echo
36 sudo port install $macports_prereq || reporterror
37 else
38 echo
39 echo "ERROR: You must have MacPorts installed for Mac builds of CVC4."
40 echo "ERROR: See http://www.macports.org/"
41 reporterror
42 fi
43 echo
44 echo =============================================================================
45 echo
46 contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir='
47 [ ${PIPESTATUS[0]} -eq 0 ] || reporterror
48 echo
49 echo =============================================================================
50 echo
51 echo 'Now just run:'
52 echo ' ./configure LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3'
53 echo ' make'
54 echo
55 echo =============================================================================