#!/bin/bash

set -x

cd c++
autoreconf -vfi

if [[ $target_platform == "linux-"* ]]; then
    export LIBS="-lrt $LIBS"
fi

# see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
# src/kj/exception.c++:1148:15: error: 'uncaught_exceptions' is unavailable: introduced in macOS 10.12
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"

./configure \
    --enable-shared \
    --with-openssl=no \
    --prefix=$PREFIX

make -j${CPU_COUNT} check
make install
