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.
 

61 lines
1.7 KiB

#!/bin/bash
# Builds fat lib for macOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult.
set -e
SCRIPT_DIR=$(dirname "$0")
PREFIX=$1
VERSION=$(sh "${SCRIPT_DIR}/get-pEp-version.sh" "SEQUOIA_4_MAC_OS_VERSION")
# Get Absolute Paths & Setup
# Get Absolute Paths & Setup
SCRIPT_DIR=$(dirname "$0")
pushd "${SCRIPT_DIR}"
SCRIPT_DIR=$(pwd)
popd
if [ "${PREFIX}" = "" ]; then
PREFIX="${SCRIPT_DIR}/local"
fi
mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
# Go, Build
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
TMP_DIR="${SCRIPT_DIR}/tmp"
mkdir -p "${TMP_DIR}"
pushd "${TMP_DIR}"
SEQUOIA_4_MACOS_DIR="${TMP_DIR}/sequoia4macos"
if [ ! -d "${SEQUOIA_4_MACOS_DIR}" ]; then
git clone -b "${VERSION}" http://pep-security.lu/gitlab/macos/sequoia4macos.git
fi
pushd ${SEQUOIA_4_MACOS_DIR}
sh build.sh
popd
# Copy artefacts ...
cp "${SEQUOIA_4_MACOS_DIR}/build/lib/libgmp.a" "${PREFIX}/lib/"
cp "${SEQUOIA_4_MACOS_DIR}/build/lib/libhogweed.a" "${PREFIX}/lib/"
cp "${SEQUOIA_4_MACOS_DIR}/build/lib/libnettle.a" "${PREFIX}/lib/"
cp "${SEQUOIA_4_MACOS_DIR}/build/lib/libsequoia_ffi.a" "${PREFIX}/lib/"
cp "${SEQUOIA_4_MACOS_DIR}/build/lib/libsequoia_openpgp_ffi.a" "${PREFIX}/lib/"
# ... and headers
cp -R "${SEQUOIA_4_MACOS_DIR}/build/include/nettle" "${PREFIX}/include/"
cp -R "${SEQUOIA_4_MACOS_DIR}/build/include/sequoia" "${PREFIX}/include/"
cp "${SEQUOIA_4_MACOS_DIR}/build/include/gmp.h" "${PREFIX}/include/"
popd
# Cleanup
rm -rf "${TMP_DIR}/x86_64"
rm -rf "${TMP_DIR}/arm64"
export MACOSX_DEPLOYMENT_TARGET=10.10