Skip to content

Commit

Permalink
Add activate/deactivate like in toolchain example
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadeau4 committed Feb 18, 2017
1 parent 34ec668 commit 9b6b3c8
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 12 deletions.
54 changes: 54 additions & 0 deletions recipes/libcf/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

#export CPPFLAGS="-I${PREFIX}/include ${CPPFLAGS}"
#export LDFLAGS="-L${PREFIX}/lib ${LDFLAGS}"
#export LFLAGS="-fPIC ${LFLAGS}"

if [ "$(uname)" == "Darwin" ]
then
#if [ "$(uname)" == "Darwin" ]; then
# export CXXFLAGS="${CXXFLAGS} -fno-common"
# export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | sed -E "s/([0-9]+\.[0-9]+).*/\1/")
# export DYLD_FALLBACK_LIBRARY_PATH=${PREFIX}/lib
# export LDFLAGS="${LDFLAGS} -lpython"
#fi

# for Mac OSX
export CC=clang
export CXX=clang++
export MACOSX_VERSION_MIN="10.9"

This comment has been minimized.

Copy link
@ocefpaf

ocefpaf Feb 18, 2017

Member

Sorry I guess I was not clear you need only to use the flags here in your build scripts or you can use the toolchain at build time as a dependency. You do not need an activation step.

export MACOSX_DEPLOYMENT_TARGET="${MACOSX_VERSION_MIN}"
export CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_VERSION_MIN}"
export CFLAGS="${CFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}"
export CXXFLAGS="${CXXFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}"
export CXXFLAGS="${CXXFLAGS} -stdlib=libc++"
export LDFLAGS="${LDFLAGS} -headerpad_max_install_names"
export LDFLAGS="${LDFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}"
export LDFLAGS="${LDFLAGS} -lc++ -lpython"
export LINKFLAGS="${LDFLAGS}"
elif [ "$(uname)" == "Linux" ]
then
# for Linux
export CC=gcc
export CXX=g++
export CFLAGS="${CFLAGS}"
# Boost wants to enable `float128` support on Linux by default.
# However, we don't install `libquadmath` so it will fail to find
# the needed headers and fail to compile things. Adding this flag
# tells Boost not to support `float128` and avoids this search
# process. As it has confused a few people. We have added it here.
# The idea to add this flag was inspired by this Boost ticked.
#
# https://svn.boost.org/trac/boost/ticket/9240
#
export CXXFLAGS="${CXXFLAGS} -DBOOST_MATH_DISABLE_FLOAT128"
export LDFLAGS="${LDFLAGS}"
export LINKFLAGS="${LDFLAGS}"
else
echo "This system is unsupported by the toolchain."
exit 1
fi

export CFLAGS="${CFLAGS} -m${ARCH} -Wall -pipe -O2 -fPIC"
export CXXFLAGS="${CXXFLAGS} ${CFLAGS}"

7 changes: 0 additions & 7 deletions recipes/libcf/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ if [ "$(uname)" == "Darwin" ]; then
export LDFLAGS="${LDFLAGS} -lpython"
fi

CONDA_LST=`conda list`
if [[ ${CONDA_LST}'y' == *'openmpi'* ]]; then
export CC=mpicc
export CXX=mpicxx
export LC_RPATH="${PREFIX}/lib"
export DYLD_FALLBACK_LIBRARY_PATH=${PREFIX}/lib
fi
./configure --prefix=${PREFIX}
${PYTHON} setup.py install
if [ `uname` == Darwin ]; then install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python @rpath/libpython2.7.dylib ${SP_DIR}/pycf/*.so ; fi
27 changes: 27 additions & 0 deletions recipes/libcf/deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [ "$(uname)" == "Darwin" ];
then
# for Mac OSX
unset CC
unset CXX
unset MACOSX_VERSION_MIN
unset MACOSX_DEPLOYMENT_TARGET
unset CMAKE_OSX_DEPLOYMENT_TARGET
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset LINKFLAGS
elif [ "$(uname)" == "Linux" ]
then
# for Linux
unset CC
unset CXX
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset LINKFLAGS
else
echo "This system is unsupported by our toolchain."
exit 1
fi
16 changes: 11 additions & 5 deletions recipes/libcf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,31 @@ build:

requirements:
build:
- hdf5
- libnetcdf
- python
- hdf5 1.8.17|1.8.17.*
- libnetcdf 4.4.*
- lapack >=3.4.2
- clapack >=3.2.1
- curl
- python
- ossuuid
- gcc
run:
- python
- hdf5
- libnetcdf
- hdf5 1.8.17|1.8.17.*
- libnetcdf 4.4.*
- lapack >=3.4.2
- clapack >=3.2.1
- curl
- ossuuid
- libgcc

test:
commands:
# Verify the scripts are in-place.
{% for state in ["activate", "deactivate"] %}
- test -f "${PREFIX}/etc/conda/{{ state }}.d/toolchain_{{ state }}.sh" # [unix]
{% endfor %}

imports:
- pycf

Expand Down

0 comments on commit 9b6b3c8

Please sign in to comment.