Skip to content

Commit dc86a16

Browse files
authored
Merge pull request #462 from dennisameling/sdk-artifact-arm64
please.sh: teach `create_sdk_artifact` to use `architecture` instead of `bitness`
2 parents e3b0a68 + e292201 commit dc86a16

File tree

1 file changed

+75
-36
lines changed

1 file changed

+75
-36
lines changed

please.sh

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,11 +3091,12 @@ publish_sdk () { #
30913091
git --git-dir="$sdk64"/usr/src/build-extra/.git push origin "$tag"
30923092
}
30933093
3094-
create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitness=(32|64|auto)] [--force] <name>
3094+
create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--architecture=(x86_64|i686|aarch64)] [--bitness=(32|64)] [--force] <name>
30953095
git_sdk_path=/
30963096
output_path=
30973097
force=
3098-
bitness=auto
3098+
architecture=
3099+
bitness=
30993100
keep_worktree=
31003101
while case "$1" in
31013102
--out|-o)
@@ -3124,9 +3125,17 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
31243125
;;
31253126
--bitness=*|-b=*)
31263127
bitness="${1#*=}"
3128+
echo "WARNING: using --bitness or -b is deprecated. Please use --architecture instead."
31273129
;;
31283130
-b*)
31293131
bitness="${1#-?}"
3132+
echo "WARNING: using --bitness or -b is deprecated. Please use --architecture instead."
3133+
;;
3134+
--architecture=*|-a=*)
3135+
architecture="${1#*=}"
3136+
;;
3137+
-a*)
3138+
architecture="${1#-?}"
31303139
;;
31313140
--force|-f)
31323141
force=t
@@ -3146,11 +3155,43 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
31463155
test -n "$output_path" ||
31473156
output_path="$(cygpath -am "$1")"
31483157
3149-
case "$bitness" in
3150-
32|64|auto) ;; # okay
3151-
*) die "Unhandled bitness: %s\n" "$bitness";;
3152-
esac
3158+
if test -n "$bitness"
3159+
then
3160+
case "$bitness" in
3161+
32)
3162+
architecture=i686
3163+
;;
3164+
64)
3165+
architecture=x86_64
3166+
;;
3167+
*) die "Unhandled bitness: %s\n" "$bitness";;
3168+
esac
3169+
elif test -z "$architecture"
3170+
then
3171+
die "Either --architecture or --bitness must be provided for this function to work."
3172+
fi
31533173
3174+
case "$architecture" in
3175+
x86_64)
3176+
MSYSTEM=MINGW64
3177+
PREFIX="/mingw64"
3178+
# TODO update to git-sdk-amd64 after the repo has been updated
3179+
SDK_REPO="git-sdk-64"
3180+
;;
3181+
i686)
3182+
MSYSTEM=MINGW32
3183+
PREFIX="/mingw32"
3184+
# TODO update to git-sdk-x86 after the repo has been updated
3185+
SDK_REPO="git-sdk-32"
3186+
;;
3187+
aarch64)
3188+
MSYSTEM=CLANGARM64
3189+
PREFIX="/clangarm64"
3190+
SDK_REPO="git-sdk-arm64"
3191+
;;
3192+
*) die "Unhandled architecture: %s\n" "$architecture";;
3193+
esac
3194+
31543195
mode=
31553196
case "$1" in
31563197
minimal|git-sdk-minimal) mode=minimal-sdk;;
@@ -3179,32 +3220,21 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
31793220
git_sdk_path="${git_sdk_path%/}/.git"
31803221
test true = "$(git -C "$git_sdk_path" rev-parse --is-inside-git-dir)" ||
31813222
die "Not a Git repository: '%s'\n" "$git_sdk_path"
3182-
3183-
test auto != "$bitness" ||
3184-
if git -C "$git_sdk_path" rev-parse --quiet --verify HEAD:usr/i686-pc-msys 2>/dev/null
3185-
then
3186-
bitness=32
3187-
elif git -C "$git_sdk_path" rev-parse --quiet --verify HEAD:usr/x86_64-pc-msys 2>/dev/null
3188-
then
3189-
bitness=64
3190-
else
3191-
die "'%s' is neither 32-bit nor 64-bit SDK?!?" "$git_sdk_path"
3192-
fi
31933223
else
3194-
test auto != "$bitness" ||
3195-
die "No SDK found at '%s'; Please use \`--bitness=<n>\` to indicate which SDK to use" "$git_sdk_path"
3224+
test -z "$architecture" ||
3225+
die "No SDK found at '%s'; Please use \`--architecture=<a>\` to indicate which SDK to use" "$git_sdk_path"
31963226
31973227
test "z$git_sdk_path" != "z${git_sdk_path%.git}" ||
31983228
git_sdk_path="$git_sdk_path.git"
3199-
git clone --depth 1 --bare https://github.com/git-for-windows/git-sdk-$bitness "$git_sdk_path"
3229+
git clone --depth 1 --bare https://github.com/git-for-windows/$SDK_REPO "$git_sdk_path"
32003230
fi
32013231
32023232
test full-sdk != "$mode" || {
32033233
mkdir -p "$output_path" &&
32043234
git -C "$git_sdk_path" archive --format=tar HEAD -- ':(exclude)ssl' |
3205-
xz -9 >"$output_path"/git-sdk-$bitness.tar.xz &&
3206-
echo "git-sdk-$bitness.tar.xz written to '$output_path'" >&2 ||
3207-
die "Could not write git-sdk-$bitness.tar.xz to '%s'\n" "$output_path"
3235+
xz -9 >"$output_path"/$SDK_REPO.tar.xz &&
3236+
echo "$SDK_REPO.tar.xz written to '$output_path'" >&2 ||
3237+
die "Could not write $SDK_REPO.tar.xz to '%s'\n" "$output_path"
32083238
return 0
32093239
}
32103240
@@ -3261,14 +3291,14 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
32613291
EOF
32623292
git -C "$output_path" checkout -- &&
32633293
mkdir -p "$output_path/tmp" &&
3264-
printf 'export MSYSTEM=MINGW%s\nexport PATH=/mingw%s/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem\n' "$bitness" "$bitness" >"$output_path/etc/profile" &&
3265-
mkdir -p "$output_path/mingw$bitness/bin" &&
3266-
case $bitness in
3267-
32)
3294+
printf 'export MSYSTEM=%s\nexport PATH=%s/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem\n' "$MSYSTEM" "$PREFIX" >"$output_path/etc/profile" &&
3295+
mkdir -p "${output_path}${PREFIX}/bin" &&
3296+
case $architecture in
3297+
i686)
32683298
# copy git.exe, for the libssp test
32693299
git -C "$output_path" show HEAD:mingw32/bin/git.exe \
32703300
>"$output_path/mingw32/bin/git.exe" &&
3271-
BITNESS=32 ARCH=i686 "$output_path/git-cmd.exe" --command=usr\\bin\\sh.exe -lx \
3301+
ARCH=i686 "$output_path/git-cmd.exe" --command=usr\\bin\\sh.exe -lx \
32723302
"${this_script_path%/*}/make-file-list.sh" |
32733303
# escape the `[` in `[.exe`
32743304
sed -e 's|[][]|\\&|g' >>"$sparse_checkout_file" &&
@@ -3296,10 +3326,13 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
32963326
git -C "$git_sdk_path" show HEAD:.sparse/minimal-sdk >"$sparse_checkout_file" &&
32973327
printf '\n' >>"$sparse_checkout_file" &&
32983328
git -C "$git_sdk_path" show HEAD:.sparse/makepkg-git >>"$sparse_checkout_file" &&
3299-
printf '\n' >>"$sparse_checkout_file" &&
3300-
git -C "$git_sdk_path" show HEAD:.sparse/makepkg-git-i686 >>"$sparse_checkout_file" &&
3329+
if test x86_64 = $architecture
3330+
then
3331+
printf '\n' >>"$sparse_checkout_file" &&
3332+
git -C "$git_sdk_path" show HEAD:.sparse/makepkg-git-i686 >>"$sparse_checkout_file"
3333+
fi &&
33013334
printf '\n# markdown, to render the release notes\n/usr/bin/markdown\n\n' >>"$sparse_checkout_file" &&
3302-
BITNESS=64 ARCH=x86_64 "$output_path/git-cmd.exe" --command=usr\\bin\\sh.exe -l \
3335+
ARCH=$architecture "$output_path/git-cmd.exe" --command=usr\\bin\\sh.exe -l \
33033336
"${this_script_path%/*}/make-file-list.sh" | sed -e 's|[][]|\\&|g' -e 's|^|/|' >>"$sparse_checkout_file"
33043337
;;
33053338
esac &&
@@ -3312,10 +3345,10 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
33123345
/usr/bin/msys-stdc++-*.dll
33133346
33143347
# WinToast
3315-
/mingw$bitness/bin/wintoast.exe
3348+
$PREFIX/bin/wintoast.exe
33163349
33173350
# BusyBox
3318-
/mingw$bitness/bin/busybox.exe
3351+
$PREFIX/bin/busybox.exe
33193352
EOF
33203353
mkdir -p "$output_path/.sparse" &&
33213354
cp "$sparse_checkout_file" "$output_path/.sparse/build-installers"
@@ -3326,8 +3359,11 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
33263359
then
33273360
printf '\n' >>"$sparse_checkout_file" &&
33283361
git -C "$git_sdk_path" show HEAD:.sparse/$mode >>"$sparse_checkout_file" &&
3329-
printf '\n' >>"$sparse_checkout_file" &&
3330-
git -C "$git_sdk_path" show HEAD:.sparse/$mode-i686 >>"$sparse_checkout_file"
3362+
if test x86_64 = $architecture
3363+
then
3364+
printf '\n' >>"$sparse_checkout_file" &&
3365+
git -C "$git_sdk_path" show HEAD:.sparse/$mode-i686 >>"$sparse_checkout_file"
3366+
fi
33313367
fi
33323368
;;
33333369
esac &&
@@ -3336,7 +3372,7 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
33363372
then
33373373
if test minimal-sdk = $mode
33383374
then
3339-
printf 'export MSYSTEM=MINGW64\nexport PATH=/mingw64/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem\n' >"$output_path/etc/profile"
3375+
printf 'export MSYSTEM=%s\nexport PATH=%s/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem\n' "$MSYSTEM" "$PREFIX" >"$output_path/etc/profile"
33403376
elif test makepkg-git = $mode
33413377
then
33423378
cat >"$output_path/etc/profile" <<-\EOF
@@ -3353,6 +3389,9 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
33533389
if test MSYS = "$MSYSTEM"
33543390
then
33553391
PATH=/usr/bin:/usr/bin/core_perl:$SYSTEMROOT_MSYS/system32:$SYSTEMROOT_MSYS
3392+
elif test CLANGARM64 = "$MSYSTEM"
3393+
then
3394+
PATH=/clangarm64/bin:/usr/bin:/usr/bin/core_perl:$SYSTEMROOT_MSYS/system32:$SYSTEMROOT_MSYS
33563395
elif test MINGW32 = "$MSYSTEM"
33573396
then
33583397
PATH=/mingw32/bin:/mingw64/bin:/usr/bin:/usr/bin/core_perl:$SYSTEMROOT_MSYS/system32:$SYSTEMROOT_MSYS

0 commit comments

Comments
 (0)