Skip to content

Commit

Permalink
build and link boost program options statically
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lees committed Oct 12, 2018
1 parent 7f4fb9b commit c66d8cb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
49 changes: 45 additions & 4 deletions recipes/seer/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,54 @@
#!/bin/bash

# build gzstream for static linking
pushd gzstream
make clean
make CXX="$CXX $CXXFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$PREFIX/include" AR="$AR cr"
popd

# build boost program options for static linking
# see
# https://github.com/conda-forge/boost-cpp-feedstock/blob/master/recipe/build.sh
# https://github.com/boostorg/program_options/blob/develop/.travis.yml
pushd boost
python2 tools/boostdep/depinst/depinst.py program_options --include example
./bootstrap.sh --with-libraries=program_options
./b2 install toolset=gcc

CXXFLAGS="${CXXFLAGS} -fPIC"
INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
LINKFLAGS="${LINKFLAGS} -L${LIBRARY_PATH}"

cat <<EOF > tools/build/src/site-config.jam
using gcc : custom : ${CXX} ;
EOF

BOOST_BUILT="${SRC_DIR}/boost_built"
mkdir $BOOST_BUILT
./bootstrap.sh --prefix="${BOOST_BUILT}" --with-libraries=program_options --with-toolset=gcc
./b2 -q \
variant=release \
address-model="${ARCH}" \
architecture=x86 \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=static,shared \
toolset=gcc-custom \
include="${INCLUDE_PATH}" \
cxxflags="${CXXFLAGS}" \
linkflags="${LINKFLAGS}" \
--layout=system \
-j"${CPU_COUNT}" \
install
popd

# build seer, statically linking boost manually
pushd src
make CXXFLAGS="$CXXFLAGS"
make install
make CXXFLAGS="$CXXFLAGS" \
SEER_LDLIBS="-L../gzstream -L${BOOST_BUILT}/lib -L/usr/local/hdf5/lib -lhdf5 -lgzstream -lz -larmadillo -Wl,-Bstatic -lboost_program_options -Wl,-Bdynamic -llapack -lblas -lpthread" \
MAP_LDLIBS="-L${BOOST_BUILT}/lib -Wl,-Bstatic -lboost_program_options -Wl,-Bdynamic -lpthread" \
COMBINE_LDLIBS="-L${BOOST_BUILT}/lib -L../gzstream -L/lib -lgzstream -lz -Wl,-Bstatic -lboost_program_options -Wl,-Bdynamic" \
FILTER_LDLIBS="-L${BOOST_BUILT}/lib -Wl,-Bstatic -lboost_program_options -Wl,-Bdynamic" \
CPPFLAGS="-I${BOOST_BUILT}/include -I../gzstream -I../dlib -I/usr/local/hdf5/include -D DLIB_NO_GUI_SUPPORT=1 -D DLIB_USE_BLAS=1 -D DLIB_USE_LAPACK=1 -DARMA_USE_HDF5=1"
make install BINDIR="${PREFIX}/bin"
popd
2 changes: 1 addition & 1 deletion recipes/seer/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package:

source:
url: https://github.com/johnlees/{{ name|lower }}/releases/download/v{{ version }}/{{ name|lower }}_v{{ version }}_submodules.tar.gz
sha256: d83b53b5e16d7aeda003e512890961a36089ad914837be21ce96871bda9a5e4a
sha256: db35dc61374ebd593093f0dbf07305a8d97e41307562c3858608c28f3829a41e

build:
skip: True # [osx]
Expand Down

0 comments on commit c66d8cb

Please sign in to comment.