Skip to content

Commit

Permalink
Merge dashpay#6390: guix: build only supported targets using `guix-st…
Browse files Browse the repository at this point in the history
…art`, update `guix-start` and `guix-check` to work correctly outside of containers

c5d482e chore: suppress `git config` output (UdjinM6)
8ce9bfe chore: tweak error message (UdjinM6)
f4d879a guix: more sanity checks for `WORKSPACE_PATH` (UdjinM6)
07f056a guix: Let `XCODE_SOURCE` be specified via env (UdjinM6)
74489dc chore: Log when preparing macOS SDK or adding `safe.directory` option (UdjinM6)
3ac5739 guix: "Invert" `guix-start`/`guix-check` cmd-line argument behaviour, defaults to `pwd` (UdjinM6)
187a4f1 guix: Avoid adding duplicate `safe.directory` option (UdjinM6)
87c9786 guix: `guix-start` should respect `SDK_PATH` (UdjinM6)
ee5f62b guix: build only supported targets using Guix container (Kittywhiskers Van Gogh)

Pull request description:

  ## Issue being fixed or feature implemented
  dashpay#6382 (comment) dashpay#6388 (comment)

  alternative to dashpay#6388

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    ACK c5d482e

Tree-SHA512: c0271f243f5912f55276fcb371a135f443f23cc1f29480f303ea77deeadb6fd7d3d97e07e6a1fa323a2b2bad1d65aa6298da33978832eb68a0a6303db3e0063c
  • Loading branch information
PastaPastaPasta committed Nov 14, 2024
2 parents 2625984 + c5d482e commit 9bfb700
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/guix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
-v ${{ github.workspace }}/.cache:/home/ubuntu/.cache \
-w /src/dash \
ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-guix-builder:${{ needs.build-image.outputs.image-tag }} && \
docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start'
docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start /src/dash'
- name: Ensure build passes
run: |
Expand Down
10 changes: 3 additions & 7 deletions contrib/containers/guix/scripts/guix-check
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

set -eo pipefail

if [[ -n "${1}" ]]; then
WORKSPACE_PATH="$1"
else
WORKSPACE_PATH="/src/dash"
fi
WORKSPACE_PATH="${1:-$(pwd)}"

if [[ ! -d "$WORKSPACE_PATH" ]]; then
echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!"
if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPACE_PATH}/contrib/guix/libexec/prelude.bash" ]]; then
echo "${0##*/}: ${WORKSPACE_PATH} is not the top directory of the Dash Core repository, exiting!"
exit 1
fi

Expand Down
33 changes: 21 additions & 12 deletions contrib/containers/guix/scripts/guix-start
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,39 @@

set -eo pipefail

if [[ -n "${1}" ]]; then
WORKSPACE_PATH="$1"
else
WORKSPACE_PATH="/src/dash"
fi
WORKSPACE_PATH="${1:-$(pwd)}"

if [[ ! -d "$WORKSPACE_PATH" ]]; then
echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!"
if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPACE_PATH}/contrib/guix/guix-build" ]]; then
echo "${0##*/}: ${WORKSPACE_PATH} is not the top directory of the Dash Core repository, exiting!"
exit 1
fi

XCODE_VERSION="12.2"
XCODE_RELEASE="12B45b"
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}"

# Check if macOS SDK is present, if not, download it
if [ ! -d "${WORKSPACE_PATH}/depends/SDKs/${XCODE_ARCHIVE}" ]
then
mkdir -p "${WORKSPACE_PATH}/depends/SDKs"
curl -L https://bitcoincore.org/depends-sources/sdks/${XCODE_ARCHIVE}.tar.gz | tar -xz -C "${WORKSPACE_PATH}/depends/SDKs"
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)
if [[ -n "${1}" ]]; then
# Avoid adding duplicates
git config --global --fixed-value --get safe.directory "${WORKSPACE_PATH}" >> /dev/null || \
(echo "Adding safe.directory" && git config --global --add safe.directory "${WORKSPACE_PATH}")
fi

cd "${WORKSPACE_PATH}"
git config --global --add safe.directory "${WORKSPACE_PATH}"
git status >> /dev/null

export HOSTS="${HOSTS:-x86_64-linux-gnu aarch64-linux-gnu riscv64-linux-gnu
x86_64-w64-mingw32
x86_64-apple-darwin arm64-apple-darwin}"

./contrib/guix/guix-build

0 comments on commit 9bfb700

Please sign in to comment.