|
|
|
VERSION=$(sh "${SCRIPT_DIR}"/get-pEp-version.sh "CAP_N_PROTO_VERSION")
|
|
|
|
REPO_NAME="capnproto"
|
|
|
|
LIB_NAME="libcapnp.a"
|
|
|
|
|
|
|
|
OUTPUT_DIR=${SCRIPT_DIR}/build
|
|
|
|
|
|
|
|
# Exit on errors
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -f "${LIB_DIR}/${LIB_NAME}" ]; then
|
|
|
|
echo "lib exists already in ${LIB_DIR}. If you want to rebuild it, delete the existing one."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
REPO_SRC_DIR="${TMP_DIR}/${REPO_NAME}/c++"
|
|
|
|
if [ ! -d "${REPO_SRC_DIR}" ]; then
|
|
|
|
git clone -b "${VERSION}" https://github.com/capnproto/capnproto.git
|
|
|
|
fi
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# Needed for build
|
|
|
|
# Note: this cap'n proto isntallation is only used (and MUST only be used)
|
|
|
|
# for (cross) _building_ the cap'n proto static libs (i.e. it's the
|
|
|
|
# installation used by `--with-external-capnp` in the actual builds below).
|
|
|
|
# It is *not* used (and MUST NOT be used) anywhere else.
|
|
|
|
###########################################################################
|
|
|
|
CAPNPROTO_USED_FOR_BUILD_PREFIX="${TMP_DIR}/tmpLocal"
|
|
|
|
mkdir -p "${CAPNPROTO_USED_FOR_BUILD_PREFIX}"
|
|
|
|
CPNP_BINARY_USED_FOR_BUILD="${CAPNPROTO_USED_FOR_BUILD_PREFIX}/bin/capnp"
|
|
|
|
|
|
|
|
if [ ! -f "${CPNP_BINARY_USED_FOR_BUILD}" ]; then
|
|
|
|
pushd "${REPO_SRC_DIR}"
|
|
|
|
autoreconf -i
|
|
|
|
./configure --prefix="${CAPNPROTO_USED_FOR_BUILD_PREFIX}"
|
|
|
|
make clean
|
|
|
|
make -j6
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
export CAPNP=${CPNP_BINARY_USED_FOR_BUILD}
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# Build the actual libs
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
export LDFLAGS="-arch ${ARCH}"
|
|
|
|
export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}"
|
|
|
|
export CXX="$(xcrun --sdk ${SDK} -f clang++) -arch ${ARCH} -isysroot ${SDK_PATH}"
|
|
|
|
|
|
|
|
pushd ${REPO_SRC_DIR}
|
|
|
|
autoreconf -i
|
|
|
|
./configure --with-external-capnp --host=${HOST} --prefix=${CURRENT_LIB_DIR} --enable-static=yes --enable-shared=no
|
|
|
|
make clean
|
|
|
|
make -j6
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
unset CAPNP
|