forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang: add helper script to keep package updated
We'll need to update our clang when Msys2 updates theirs and reapply our customisations every time, so a script makes this job less tedious and leaves no room to miss a step of the process. This script performs the same steps as the previous two commits. (it was used to generate the files for those) Signed-off-by: Matthias Aßhauer <[email protected]>
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/bash | ||
die () { | ||
printf "$@" >&2 | ||
cleanup | ||
exit 1 | ||
} | ||
cleanup(){ | ||
rm -rf upstream | ||
} | ||
|
||
pkgname=mingw-w64-clang | ||
|
||
old_pkgver="$(sed -ne 's/pkgver=\([.0-9]*\).*/\1/p' -e 's/_version=\([.0-9]*\).*/\1/p' < PKGBUILD)" | ||
old_pkgrel="$(sed -ne 's/pkgrel=\([0-9]*\).*/\1/p' < PKGBUILD)" | ||
|
||
test -n "$old_pkgver" || | ||
die "$0: could not determine current pkgver\n" | ||
|
||
test -n "$old_pkgrel" || | ||
die "$0: could not determine current pkgrel\n" | ||
|
||
git clone --sparse --depth 1 https://github.com/msys2/MINGW-packages upstream | ||
cd upstream | ||
git sparse-checkout add $pkgname | ||
cd .. | ||
|
||
new_pkgver="$(sed -ne 's/pkgver=\([.0-9]*\).*/\1/p' -e 's/_version=\([.0-9]*\).*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
new_pkgrel="$(sed -ne 's/pkgrel=\([0-9]*\).*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
rc="$(sed -ne 's/_rc="\(*\)".*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
|
||
test -n "$new_pkgver" || | ||
die "$0: could not determine new pkgver\n" | ||
|
||
test -n "$new_pkgrel" || | ||
die "$0: could not determine new pkgrel\n" | ||
|
||
test -z "$rc" || | ||
die "$0: MSYS2 is currently on an RC version. This script is not able to handle RC versions." | ||
|
||
test "$new_pkgver" = "$old_pkgver" && | ||
new_pkgrel="$old_pkgrel" | ||
|
||
new_pkgrel=$(("$new_pkgrel"+1)) | ||
|
||
rm -f *.patch | ||
mv upstream/$pkgname/*.patch ./ | ||
rm -f PKGBUILD | ||
mv upstream/$pkgname/PKGBUILD ./ | ||
rm -f README-patches.md | ||
mv upstream/$pkgname/README-patches.md ./ | ||
|
||
sed -i "s/pkgrel=[.0-9]\+\(.*\)/pkgrel=$new_pkgrel\1/" PKGBUILD | ||
|
||
ed -i 's/1d33da596dcef12272389cb81277db205dd2153e2e52612d2d01ab3f0e7b3fb7/SKIP/' PKGBUILD # The hash of this patch doesn't stay stable for some reason | ||
|
||
sed -i 's/-DCMAKE_BUILD_TYPE=Release/-DCMAKE_BUILD_TYPE=MinSizeRel/' PKGBUILD # size is the main reason we build our own clang | ||
sed -i 's/-DLLVM_TARGETS_TO_BUILD=".*"/-DLLVM_TARGETS_TO_BUILD="host"/' PKGBUILD # we don't need any cross-compilation targets | ||
sed -i 's/-DLLVM_ENABLE_SPHINX=ON/-DLLVM_ENABLE_SPHINX=OFF/' PKGBUILD # we don't need to spend time building documentation that we don't ship | ||
sed -n '/^check()/{p;:a;N;/\n}/!ba;s/.*\n/echo \n/};p' -i PKGBUILD # skip about an hour of linker tests | ||
|
||
|
||
cleanup |