<commit_before>#
# We OVERRIDE conda's default value for MACOSX_DEPLOYMENT_TARGET,
#  because we want to link against libc++ (not stdlibc++) for C++ libraries (like vigra)
#

if [[ `uname` == 'Darwin' ]]; then
    export MACOSX_DEPLOYMENT_TARGET=10.7
    LIBRARY_SEARCH_VAR=DYLD_FALLBACK_LIBRARY_PATH
    DEFAULT_CC="clang"
    DEFAULT_CXX="clang++"
    DEFAULT_CXX_FLAGS="-stdlib=libc++"
    DEFAULT_CXX_LDFLAGS="-stdlib=libc++"
else
    LIBRARY_SEARCH_VAR=LD_LIBRARY_PATH
    DEFAULT_CC="gcc"
    DEFAULT_CXX="g++"
    DEFAULT_CXX_FLAGS=""
    DEFAULT_CXX_LDFLAGS=""
fi

if [ -z "${CC}" ] || [ "${CC}" == "<UNDEFINED>" ];
then
    CC=$DEFAULT_CC
fi
if [ -z "${CXX}" ] || [ "${CXX}" == "<UNDEFINED>" ];
then
    CXX=$DEFAULT_CXX
fi
if [ -z "${CXX_FLAGS}" ] || [ "${CXX_FLAGS}" == "<UNDEFINED>" ];
then
    CXX_FLAGS=$DEFAULT_CXX_FLAGS
fi
if [ -z "${CXX_LDFLAGS}" ] || [ "${CXX_LDFLAGS}" == "<UNDEFINED>" ];
then
    CXX_LDFLAGS=$DEFAULT_CXX_LDFLAGS
fi

CXX_FLAGS="${CXXFLAGS} ${CXX_FLAGS} -std=c++11"
CXX_LDFLAGS="${LDFLAGS} ${CXX_LDFLAGS} -std=c++11"

# CONFIGURE
SRC=$(pwd)
mkdir -pv build
cd build
BLD=$(pwd)

cmake ${SRC}\
        -DCMAKE_MACOSX_RPATH=false \
\
        -DCMAKE_PREFIX_PATH="${PREFIX}" \
\
        -DCMAKE_SHARED_LINKER_FLAGS="${CXX_LDFLAGS}" \
\
        -DCMAKE_CXX_LINK_FLAGS="${CXX_FLAGS}" \
        -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \
\
        -DBOOST_ROOT="${PREFIX}" \
        -DVIGRA_ROOT="${PREFIX}" \
\
        -DPYTHON_EXECUTABLE="${PYTHON}" \
\

# BUILD (in parallel)
eval ${LIBRARY_SEARCH_VAR}=$PREFIX/lib make -j${CPU_COUNT}

# "install" to the build prefix (conda will relocate these files afterwards)
eval ${LIBRARY_SEARCH_VAR}=$PREFIX/lib make install<commit_msg>rank_filter.recipe/build.sh: Use `patchelf` on Linux to remove the unnecessary linkage to `vigranumpycore.so`.<commit_after>#
# We OVERRIDE conda's default value for MACOSX_DEPLOYMENT_TARGET,
#  because we want to link against libc++ (not stdlibc++) for C++ libraries (like vigra)
#

if [[ `uname` == 'Darwin' ]]; then
    export MACOSX_DEPLOYMENT_TARGET=10.7
    LIBRARY_SEARCH_VAR=DYLD_FALLBACK_LIBRARY_PATH
    DEFAULT_CC="clang"
    DEFAULT_CXX="clang++"
    DEFAULT_CXX_FLAGS="-stdlib=libc++"
    DEFAULT_CXX_LDFLAGS="-stdlib=libc++"
else
    LIBRARY_SEARCH_VAR=LD_LIBRARY_PATH
    DEFAULT_CC="gcc"
    DEFAULT_CXX="g++"
    DEFAULT_CXX_FLAGS=""
    DEFAULT_CXX_LDFLAGS=""
fi

if [ -z "${CC}" ] || [ "${CC}" == "<UNDEFINED>" ];
then
    CC=$DEFAULT_CC
fi
if [ -z "${CXX}" ] || [ "${CXX}" == "<UNDEFINED>" ];
then
    CXX=$DEFAULT_CXX
fi
if [ -z "${CXX_FLAGS}" ] || [ "${CXX_FLAGS}" == "<UNDEFINED>" ];
then
    CXX_FLAGS=$DEFAULT_CXX_FLAGS
fi
if [ -z "${CXX_LDFLAGS}" ] || [ "${CXX_LDFLAGS}" == "<UNDEFINED>" ];
then
    CXX_LDFLAGS=$DEFAULT_CXX_LDFLAGS
fi

CXX_FLAGS="${CXXFLAGS} ${CXX_FLAGS} -std=c++11"
CXX_LDFLAGS="${LDFLAGS} ${CXX_LDFLAGS} -std=c++11"

# CONFIGURE
SRC=$(pwd)
mkdir -pv build
cd build
BLD=$(pwd)

cmake ${SRC}\
        -DCMAKE_MACOSX_RPATH=false \
\
        -DCMAKE_PREFIX_PATH="${PREFIX}" \
\
        -DCMAKE_SHARED_LINKER_FLAGS="${CXX_LDFLAGS}" \
\
        -DCMAKE_CXX_LINK_FLAGS="${CXX_FLAGS}" \
        -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \
\
        -DBOOST_ROOT="${PREFIX}" \
        -DVIGRA_ROOT="${PREFIX}" \
\
        -DPYTHON_EXECUTABLE="${PYTHON}" \
\

# BUILD (in parallel)
eval ${LIBRARY_SEARCH_VAR}=$PREFIX/lib make -j${CPU_COUNT}

# "install" to the build prefix (conda will relocate these files afterwards)
eval ${LIBRARY_SEARCH_VAR}=$PREFIX/lib make install

if [[ `uname` == 'Linux' ]]; then
    patchelf --remove-needed vigranumpycore.so $PREFIX/lib/python2.7/site-packages/rank_filter.so
fi
{'fraction_non_alphanumeric': 0.17588769611891, 'fraction_numerical': 0.004404073768235618, 'mean_word_length': 4.125528913963328, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4710243', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1364, 'n_words': 255}