2023-06-27 16:50:42 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
2024-11-12 13:13:51 +01:00
|
|
|
WORKSPACE_PATH="${1:-$(pwd)}"
|
2023-06-28 20:59:16 +02:00
|
|
|
|
2024-11-12 14:33:04 +01:00
|
|
|
if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPACE_PATH}/contrib/guix/guix-build" ]]; then
|
2024-11-13 19:09:03 +01:00
|
|
|
echo "${0##*/}: ${WORKSPACE_PATH} is not the top directory of the Dash Core repository, exiting!"
|
2023-06-28 20:59:16 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-03 08:45:08 +02:00
|
|
|
XCODE_VERSION="12.2"
|
|
|
|
XCODE_RELEASE="12B45b"
|
2023-06-27 16:50:42 +02:00
|
|
|
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
|
2024-11-12 14:16:20 +01:00
|
|
|
XCODE_SOURCE="${XCODE_SOURCE:-https://bitcoincore.org/depends-sources/sdks}"
|
2023-06-27 16:50:42 +02:00
|
|
|
|
2024-11-11 11:33:32 +01:00
|
|
|
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
|
|
|
|
|
2023-06-27 16:50:42 +02:00
|
|
|
# Check if macOS SDK is present, if not, download it
|
2024-11-11 11:33:32 +01:00
|
|
|
if [[ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]]; then
|
2024-11-12 13:28:55 +01:00
|
|
|
echo "Preparing macOS SDK..."
|
2024-11-11 11:33:32 +01:00
|
|
|
mkdir -p "${SDK_PATH}"
|
2024-11-12 14:16:20 +01:00
|
|
|
curl -L "${XCODE_SOURCE}/${XCODE_ARCHIVE}.tar.gz" | tar -xz -C "${SDK_PATH}"
|
2023-06-27 16:50:42 +02:00
|
|
|
fi
|
|
|
|
|
2024-11-12 13:13:51 +01:00
|
|
|
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
|
|
|
|
if [[ -n "${1}" ]]; then
|
|
|
|
# Avoid adding duplicates
|
2024-11-12 13:28:55 +01:00
|
|
|
git config --global --fixed-value --get safe.directory "${WORKSPACE_PATH}" || \
|
|
|
|
(echo "Adding safe.directory" && git config --global --add safe.directory "${WORKSPACE_PATH}")
|
2024-11-12 13:13:51 +01:00
|
|
|
fi
|
2024-11-12 13:13:31 +01:00
|
|
|
|
2023-06-28 20:59:16 +02:00
|
|
|
cd "${WORKSPACE_PATH}"
|
2023-06-27 16:50:42 +02:00
|
|
|
git status >> /dev/null
|
|
|
|
|
2024-11-10 21:51:29 +01:00
|
|
|
export HOSTS="${HOSTS:-x86_64-linux-gnu aarch64-linux-gnu riscv64-linux-gnu
|
|
|
|
x86_64-w64-mingw32
|
|
|
|
x86_64-apple-darwin arm64-apple-darwin}"
|
|
|
|
|
2023-06-27 16:50:42 +02:00
|
|
|
./contrib/guix/guix-build
|