You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
2.0 KiB

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
NETTLE_BINDINGS="${SCRIPT_DIR}/buildcode/sequoia_resources/nettle-bindings.rs"
build_ios()
{
cargo update
rustup run nightly cargo update
NETTLE_PREGENERATED_BINDINGS="${NETTLE_BINDINGS}" PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=1 PKG_CONFIG_PATH=$OUTPUT_DIR/${ARCH}/lib/pkgconfig RUSTFLAGS="-L ${CURRENT_LIB_DIR}/lib" rustup run nightly cargo build --target ${TARGET} -p sequoia-openpgp-ffi --release -Z build-std=core,alloc,std
}
build_macos()
{
if [ ${ARCH} == "arm64" ]; then
rustup run nightly cargo update
SDKROOT=$(xcrun -sdk ${SDK} --show-sdk-path) \
# JSONAdapter needlessly requires libsequoia_ffi.a
NETTLE_PREGENERATED_BINDINGS="${SCRIPT_DIR}/nettle-bindings.rs" PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=full PKG_CONFIG_PATH=${CURRENT_LIB_DIR}/lib/pkgconfig RUSTFLAGS="-L ${PREFIX}/lib" rustup run nightly cargo build --target ${HOST} --release -Z build-std=core,alloc,std
elif [ ${ARCH} == "x86_64" ]; then
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
else
echo "Unhandled ARCH"
exit 1
fi
}
pushd ${SEQUOIA_DIR}
if [[ $TARGET == *"ios"* ]]; then
build_ios
else
build_macos
fi
popd
# copy artefacts
cp "${SEQUOIA_DIR}/target/${TARGET}/release"/*.a "${CURRENT_LIB_DIR}/lib"
cp -R "${SEQUOIA_DIR}/openpgp-ffi/include"/* "${CURRENT_LIB_DIR}/include/"