@ -12,13 +12,37 @@ if [ -f "${LIB_DIR}/${LIB_NAME}" ]; then
exit 0
fi
# We must whipe the repo. It seems to hold capnp build dependencies used in build that have been build in previous runs of make (even we `make clean`), which causes "bad CPU type" building the 2nd time for arm64.
rm -rf "${TMP_DIR}/${REPO_NAME}"
REPO_SRC_DIR="${TMP_DIR}/${REPO_NAME}/c++"
# if [ ! -d "${REPO_SRC_DIR}" ]; then
if [ ! -d "${REPO_SRC_DIR}" ]; then
git clone -b "${VERSION}" https://github.com/capnproto/capnproto.git
#fi
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}"
@ -26,8 +50,10 @@ export CXX="$(xcrun --sdk ${SDK} -f clang++) -arch ${ARCH} -isysroot ${SDK_PATH}
pushd ${REPO_SRC_DIR}
autoreconf -i
./configure --host=${HOST} --prefix=${CURRENT_LIB_DIR} --enable-static=yes --enable-shared=no
./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