about summary refs log tree commit diff homepage
path: root/scripts/build/solver-stp.sh
blob: 2e65ca30c2d38e3f36d53134c116efca872f31ad (plain) (blame)
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
#!/bin/bash -x

# TODO: For OSX we can prepare bottled formulas for STP and minisat

# Make sure we exit if there is a failure
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
source "${DIR}/common-defaults.sh"

cd ${BASE}
if [ "x${STP_VERSION}" != "x" ]; then
  # Build minisat
  git_clone_or_update https://github.com/stp/minisat "${BASE}/minisat"
  mkdir -p "${BASE}/minisat/build"
  cd "${BASE}/minisat/build"
  MINISAT_DIR="$(pwd)"
  if [[ "$TRAVIS_OS_NAME" == "linux" || "$TRAVIS_OS_NAME" == "osx" ]]; then
    CFLAGS="${SANITIZER_C_FLAGS}" \
    CXXFLAGS="${SANITIZER_CXX_FLAGS}" \
    LDFLAGS="${SANITIZER_LD_FLAGS}" \
    cmake -DCMAKE_INSTALL_PREFIX="${BASE}/minisat-install" \
      ${SANITIZER_CMAKE_C_COMPILER} \
      ${SANITIZER_CMAKE_CXX_COMPILER} \
      "${BASE}/minisat"
  else
    echo "Unhandled TRAVIS_OS_NAME \"${TRAVIS_OS_NAME}\""
    exit 1
  fi
  make
  make install

  # Build STP
  git_clone_or_update git://github.com/stp/stp.git "${BASE}/stp-${STP_VERSION}" ${STP_VERSION}
  mkdir -p "${BASE}/stp-${STP_VERSION}-build"
  cd "${BASE}/stp-${STP_VERSION}-build"

  STP_CMAKE_FLAGS=( \
     "-DENABLE_PYTHON_INTERFACE:BOOL=OFF" \
     -DNO_BOOST:BOOL=ON \
     -DENABLE_PYTHON_INTERFACE:BOOL=OFF \
     ${SANITIZER_CMAKE_C_COMPILER} \
     ${SANITIZER_CMAKE_CXX_COMPILER} \
  )
  # Disabling building of shared libs is a workaround.
  # Don't build against boost because that is broken when mixing packaged boost libraries and gcc 4.8
  CFLAGS="${SANITIZER_C_FLAGS}" \
  CXXFLAGS="${SANITIZER_CXX_FLAGS}" \
  LDFLAGS="${SANITIZER_LD_FLAGS}" \
  cmake ${STP_CMAKE_FLAGS} \
        -DCMAKE_PREFIX_PATH="${BASE}/minisat-install" "${BASE}/stp-${STP_VERSION}" \
        -DCMAKE_INSTALL_PREFIX="${BASE}/stp-${STP_VERSION}-install"
  make
  make install
else
  echo "No STP_VERSION given or empty"
  exit 1
fi