mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
ci: deduplicate macOS SDK setup logic
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
8dd0db7de9
commit
04ce1fea52
@ -40,26 +40,11 @@ builder-image:
|
|||||||
needs:
|
needs:
|
||||||
- builder-image
|
- builder-image
|
||||||
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
|
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
|
||||||
variables:
|
|
||||||
SDK_URL: https://bitcoincore.org/depends-sources/sdks
|
|
||||||
XCODE_VERSION: "15.0"
|
|
||||||
XCODE_BUILD_ID: 15A240d
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo HOST=$HOST
|
|
||||||
- |
|
- |
|
||||||
if [ "$HOST" = "x86_64-apple-darwin" ]; then
|
echo HOST=${HOST}
|
||||||
mkdir -p depends/SDKs
|
if [[ "${HOST}" == "x86_64-apple-darwin" ]]; then
|
||||||
mkdir -p depends/sdk-sources
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
|
|
||||||
OSX_SDK_PATH="depends/sdk-sources/${OSX_SDK_BASENAME}"
|
|
||||||
if [ ! -f "$OSX_SDK_PATH" ]; then
|
|
||||||
echo "Downloading MacOS SDK"
|
|
||||||
curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
if [ -f "$OSX_SDK_PATH" ]; then
|
|
||||||
echo "Extracting MacOS SDK"
|
|
||||||
tar -C depends/SDKs -xf "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
script:
|
script:
|
||||||
- make -j$(nproc) -C depends HOST=$HOST $DEP_OPTS
|
- make -j$(nproc) -C depends HOST=$HOST $DEP_OPTS
|
||||||
|
@ -20,17 +20,8 @@ mkdir -p $CACHE_DIR/sdk-sources
|
|||||||
ln -s $CACHE_DIR/depends ${DEPENDS_DIR}/built
|
ln -s $CACHE_DIR/depends ${DEPENDS_DIR}/built
|
||||||
ln -s $CACHE_DIR/sdk-sources ${DEPENDS_DIR}/sdk-sources
|
ln -s $CACHE_DIR/sdk-sources ${DEPENDS_DIR}/sdk-sources
|
||||||
|
|
||||||
mkdir -p ${DEPENDS_DIR}/SDKs
|
if [[ "${HOST}" == "x86_64-apple-darwin" ]]; then
|
||||||
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
if [ -n "$XCODE_VERSION" ]; then
|
|
||||||
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
|
|
||||||
OSX_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${OSX_SDK_BASENAME}"
|
|
||||||
if [ ! -f "$OSX_SDK_PATH" ]; then
|
|
||||||
curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
if [ -f "$OSX_SDK_PATH" ]; then
|
|
||||||
tar -C ${DEPENDS_DIR}/SDKs -xf "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
||||||
|
@ -81,14 +81,15 @@ COPY --from=docker_root ./motd.txt /etc/motd
|
|||||||
COPY --from=docker_root ./scripts/entrypoint /usr/local/bin/entrypoint
|
COPY --from=docker_root ./scripts/entrypoint /usr/local/bin/entrypoint
|
||||||
COPY --from=docker_root ./scripts/guix-check /usr/local/bin/guix-check
|
COPY --from=docker_root ./scripts/guix-check /usr/local/bin/guix-check
|
||||||
COPY --from=docker_root ./scripts/guix-start /usr/local/bin/guix-start
|
COPY --from=docker_root ./scripts/guix-start /usr/local/bin/guix-start
|
||||||
|
COPY --from=docker_root ./scripts/setup-sdk /usr/local/bin/setup-sdk
|
||||||
|
|
||||||
# Create directories for mounting to save/restore cache and grant necessary permissions
|
# Create directories for mounting to save/restore cache and grant necessary permissions
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
/home/${USERNAME}/.cache \
|
/home/${USERNAME}/.cache \
|
||||||
/src/dash/depends/{built,sources,work} && \
|
/src/dash/depends/{built,sources,work}; \
|
||||||
chown -R ${USER_ID}:${GROUP_ID} \
|
chown -R ${USER_ID}:${GROUP_ID} \
|
||||||
/home/${USERNAME}/.cache \
|
/home/${USERNAME}/.cache \
|
||||||
/src
|
/src;
|
||||||
|
|
||||||
WORKDIR "/src/dash"
|
WORKDIR "/src/dash"
|
||||||
|
|
||||||
|
@ -9,19 +9,10 @@ if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPAC
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
XCODE_VERSION="15.0"
|
|
||||||
XCODE_RELEASE="15A240d"
|
|
||||||
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
|
|
||||||
XCODE_SOURCE="${XCODE_SOURCE:-https://bitcoincore.org/depends-sources/sdks}"
|
|
||||||
|
|
||||||
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
|
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
|
||||||
|
export SDK_SRCS="${SDK_PATH:-${WORKSPACE_PATH}/depends/sdk-sources}"
|
||||||
|
|
||||||
# Check if macOS SDK is present, if not, download it
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
if [[ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]]; then
|
|
||||||
echo "Preparing macOS SDK..."
|
|
||||||
mkdir -p "${SDK_PATH}"
|
|
||||||
curl -L "${XCODE_SOURCE}/${XCODE_ARCHIVE}.tar.gz" | tar -xz -C "${SDK_PATH}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
|
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
|
||||||
if [[ -n "${1}" ]]; then
|
if [[ -n "${1}" ]]; then
|
||||||
|
27
contrib/containers/guix/scripts/setup-sdk
Executable file
27
contrib/containers/guix/scripts/setup-sdk
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright (c) 2024 The Dash Core developers
|
||||||
|
# Distributed under the MIT software license, see the accompanying
|
||||||
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
SDK_URL="${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}"
|
||||||
|
SDK_PATH="${SDK_PATH:-depends/SDKs}"
|
||||||
|
SDK_SRCS="${SDK_SOURCES:-depends/sdk-sources}"
|
||||||
|
XCODE_VERSION="${XCODE_VERSION:-15.0}"
|
||||||
|
XCODE_RELEASE="${XCODE_RELEASE:-15A240d}"
|
||||||
|
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
|
||||||
|
XCODE_AR_PATH="${SDK_SRCS}/${XCODE_ARCHIVE}.tar.gz"
|
||||||
|
|
||||||
|
if [ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]; then
|
||||||
|
if [ ! -f "${XCODE_AR_PATH}" ]; then
|
||||||
|
echo "Downloading macOS SDK..."
|
||||||
|
mkdir -p "${SDK_SRCS}"
|
||||||
|
curl --location --fail "${SDK_URL}/${XCODE_ARCHIVE}.tar.gz" -o "${XCODE_AR_PATH}"
|
||||||
|
fi
|
||||||
|
echo "Extracting macOS SDK..."
|
||||||
|
mkdir -p "${SDK_PATH}"
|
||||||
|
tar -C "${SDK_PATH}" -xf "${XCODE_AR_PATH}"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user