common-dependency-build-hel.../buildcode/sequoia.code

42 lines
1.3 KiB
Plaintext

if [ -f "${PREFIX}/lib/libsequoia_openpgp_ffi.a" ]; then
echo "lib exists already in ${LIB_DIR}. If you want to rebuild it, delete the existing one."
exit 0
fi
VERSION=$(sh "${SCRIPT_DIR}/get-pEp-version.sh" "SEQUOIA_VERSION")
SEQUOIA_DIR="${TMP_DIR}/sequoia"
if [ ! -d "${SEQUOIA_DIR}" ]; then
git clone -b ${VERSION} --depth 1 https://gitlab.com/sequoia-pgp/sequoia.git
fi
build_ios()
{
cargo update
PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=1 PKG_CONFIG_PATH=$OUTPUT_DIR/${ARCH}/lib/pkgconfig RUSTFLAGS="-L ${PREFIX}/lib" cargo build --target ${TARGET} -p sequoia-openpgp-ffi --release
# copy artefacts
cp "${SEQUOIA_DIR}/target/${TARGET}/release"/*.a "${CURRENT_LIB_DIR}/lib"
}
build_macos()
{
cargo update
SDKROOT=$(xcrun -sdk ${SDK} --show-sdk-path) \
# JSONAdapter needlessly requires libsequoia_ffi.a
PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=full PKG_CONFIG_PATH=${CURRENT_LIB_DIR}/lib/pkgconfig RUSTFLAGS="-L ${PREFIX}/lib" cargo build --target ${HOST} --release
cp "${SEQUOIA_DIR}/target/${HOST}/release"/*.a "${CURRENT_LIB_DIR}/lib"
}
pushd ${SEQUOIA_DIR}
rm -rf rust-toolchain
if [[ $TARGET == *"ios"* ]]; then
build_ios
else
build_macos
fi
popd
# copy headers
cp -R "${SEQUOIA_DIR}/openpgp-ffi/include"/* "${CURRENT_LIB_DIR}/include/"