Repository navigation
build(metadata-generator): use the trimmed LLVM 17.0.8 bundle #550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,55 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| set -euo pipefail | ||
| source "$(dirname "$0")/build_utils.sh" | ||
|
|
||
| LLVM_VERSION="17.0.6" | ||
| # Installs the prebuilt clang/LLVM static libraries the metadata generator links, | ||
| # built by NativeScript/ios-llvm, into ./llvm/<version>/{include,lib_<arch>}. | ||
| LLVM_VERSION="17.0.8" | ||
| ARCHS=() | ||
| FORCE=0 | ||
|
|
||
| function download_llvm() { | ||
| checkpoint "Downloading llvm (version $LLVM_VERSION)..." | ||
| mkdir -p /tmp/llvm-dl/ | ||
| curl -L https://github.com/NativeScript/ios-llvm/releases/download/v$LLVM_VERSION/llvm-$LLVM_VERSION.tgz -o /tmp/llvm-dl/llvm-$LLVM_VERSION.tgz | ||
| mkdir -p ./llvm/ | ||
| checkpoint 'extracting llvm...' | ||
| tar -xzf /tmp/llvm-dl/llvm-$LLVM_VERSION.tgz -C ./llvm/ | ||
| usage() { | ||
| cat <<EOF | ||
| Usage: $(basename "$0") [--arch <arm64|x86_64>]... [--force] | ||
|
|
||
| --arch <arch> Architecture to install (repeatable; default: arm64 and x86_64) | ||
| --force Reinstall even if the architecture is already in place | ||
| EOF | ||
| } | ||
|
|
||
| if [ ! -d "./llvm/$LLVM_VERSION" ]; then | ||
| download_llvm | ||
| fi | ||
| while [ $# -gt 0 ]; do | ||
| case "$1" in | ||
| --arch) | ||
| [ $# -ge 2 ] || { echo "--arch requires a value" >&2; usage >&2; exit 2; } | ||
| case "$2" in | ||
| arm64|x86_64) ARCHS+=("$2") ;; | ||
| *) echo "unsupported arch: $2" >&2; exit 2 ;; | ||
| esac | ||
| shift ;; | ||
| --force) FORCE=1 ;; | ||
| -h|--help) usage; exit 0 ;; | ||
| *) echo "unknown argument: $1" >&2; usage >&2; exit 2 ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| # Every archive carries the same include/ apart from the host triple in | ||
| # llvm/Config/llvm-config.h, which the generator does not use; arm64 goes last | ||
| # so it is the one left in place. | ||
| [ "${#ARCHS[@]}" -gt 0 ] || ARCHS=(x86_64 arm64) | ||
|
|
||
| DEST="./llvm" | ||
| mkdir -p "$DEST" | ||
| TMP_DIR=$(mktemp -d) | ||
| trap 'rm -rf "$TMP_DIR"' EXIT | ||
|
|
||
| for arch in "${ARCHS[@]}"; do | ||
| if [ "$FORCE" = 0 ] && [ -d "$DEST/$LLVM_VERSION/lib_$arch" ] && [ -d "$DEST/$LLVM_VERSION/include" ]; then | ||
| continue | ||
| fi | ||
| archive="llvm-$LLVM_VERSION-$arch.tgz" | ||
| checkpoint "Downloading llvm $LLVM_VERSION ($arch)..." | ||
| curl -fL --retry 3 "https://github.com/NativeScript/ios-llvm/releases/download/v$LLVM_VERSION/$archive" -o "$TMP_DIR/$archive" | ||
| rm -rf "${DEST:?}/$LLVM_VERSION/lib_$arch" | ||
| tar -xzf "$TMP_DIR/$archive" -C "$DEST" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: NativeScript/ios
Length of output: 4970
Script executed:
Repository: NativeScript/ios
Length of output: 17685
Script executed:
Repository: NativeScript/ios
Length of output: 17579
Script executed:
Repository: NativeScript/ios
Length of output: 4175
Do not mark a failed extraction as installed.
If extraction fails after it creates
lib_$arch, the next normal build can skip the incomplete directory and fail to link the metadata generator. This can also replace a working installation during--force.Extract into staging and make the skip check depend on a completed installation.