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 # 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 git clone -b "${VERSION}" https://github.com/capnproto/capnproto.git #fi 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 --host=${HOST} --prefix=${CURRENT_LIB_DIR} --enable-static=yes --enable-shared=no make clean make -j6 make install popd