From 112a4a28002fc93bbd33261d3eb9977d9fe17ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= Date: Fri, 30 Jun 2023 21:49:59 +0200 Subject: [PATCH] clang: add helper script to keep package updated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- mingw-w64-clang/update-clang-from-msys2.sh | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 mingw-w64-clang/update-clang-from-msys2.sh diff --git a/mingw-w64-clang/update-clang-from-msys2.sh b/mingw-w64-clang/update-clang-from-msys2.sh new file mode 100644 index 0000000000000..11adbe77c59d2 --- /dev/null +++ b/mingw-w64-clang/update-clang-from-msys2.sh @@ -0,0 +1,58 @@ +#!/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 --filter=blob:none https://github.com/msys2/MINGW-packages upstream +git -C upstream sparse-checkout add $pkgname + +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 ./ || die "$0: failed to replace existing files with upstream files" + +sed -e "s/pkgrel=[.0-9]\+\(.*\)/pkgrel=$new_pkgrel\1/" \ + -e 's/1d33da596dcef12272389cb81277db205dd2153e2e52612d2d01ab3f0e7b3fb7/SKIP/' \ + -e 's/-DCMAKE_BUILD_TYPE=Release/-DCMAKE_BUILD_TYPE=MinSizeRel/' \ + -e 's/-DLLVM_TARGETS_TO_BUILD=".*"/-DLLVM_TARGETS_TO_BUILD="host"/' \ + -e 's/-DLLVM_ENABLE_SPHINX=ON/-DLLVM_ENABLE_SPHINX=OFF/'\ + -e '/^check()/,/^}/d' \ + -i PKGBUILD + +cleanup