Skip to content

Commit 8b9e233

Browse files
committed
Build and deploy native MinGW toolchain packages together with cross-compilation one.
1 parent 83f80ed commit 8b9e233

25 files changed

+1072
-176
lines changed

.github/scripts/build-package.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ ARGUMENTS="--syncdeps \
2121
$([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \
2222
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"
2323

24-
ccache -svv || true
25-
26-
if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
27-
makepkg-mingw $ARGUMENTS
28-
else
29-
makepkg $ARGUMENTS
24+
if command -v ccache &> /dev/null; then
25+
echo "::group::Ccache statistics before build"
26+
ccache -svv || true
27+
echo "::endgroup::"
3028
fi
3129

32-
ccache -svv || true
30+
echo "::group::Build package"
31+
if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
32+
makepkg-mingw $ARGUMENTS
33+
else
34+
makepkg $ARGUMENTS
35+
fi
36+
echo "::endgroup::"
37+
38+
if command -v ccache &> /dev/null; then
39+
echo "::group::Ccache statistics after build"
40+
ccache -svv || true
41+
echo "::endgroup::"
42+
fi

.github/scripts/clean-cross.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e # exit on error
4+
set -x # echo on
5+
6+
for ENV in "common" "mingw32" "mingw64" "ucrt64" "mingwarm64"; do
7+
PACKAGES=" \
8+
mingw-w64-cross-$ENV-zlib \
9+
mingw-w64-cross-$ENV-gcc \
10+
mingw-w64-cross-$ENV-winpthreads \
11+
mingw-w64-cross-$ENV-crt \
12+
mingw-w64-cross-$ENV-windows-default-manifest \
13+
mingw-w64-cross-$ENV-gcc-stage1 \
14+
mingw-w64-cross-$ENV-binutils \
15+
mingw-w64-cross-$ENV-headers"
16+
17+
for PACKAGE in $PACKAGES; do
18+
pacman -R --noconfirm --cascade $PACKAGE || true
19+
done
20+
done

.github/scripts/clean-native.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
set -e # exit on error
4+
set -x # echo on
5+
6+
for ARCH in "aarch64" "x86_64"; do
7+
PACKAGES=" \
8+
mingw-w64-$ARCH-gcc \
9+
mingw-w64-$ARCH-windows-default-manifest \
10+
mingw-w64-$ARCH-binutils \
11+
mingw-w64-$ARCH-libwinpthread-git
12+
mingw-w64-$ARCH-winpthreads-git \
13+
mingw-w64-$ARCH-crt-git \
14+
mingw-w64-$ARCH-headers-git \
15+
mingw-w64-$ARCH-mpc \
16+
mingw-w64-$ARCH-isl \
17+
mingw-w64-$ARCH-mpfr \
18+
mingw-w64-$ARCH-gmp \
19+
mingw-w64-$ARCH-zstd \
20+
mingw-w64-$ARCH-ninja \
21+
mingw-w64-$ARCH-zlib \
22+
mingw-w64-$ARCH-bzip2 \
23+
mingw-w64-$ARCH-ncurses \
24+
mingw-w64-$ARCH-gettext \
25+
mingw-w64-$ARCH-libsystre \
26+
mingw-w64-$ARCH-libtre \
27+
mingw-w64-$ARCH-libiconv \
28+
mingw-w64-$ARCH-gperf \
29+
mingw-w64-$ARCH-autotools \
30+
autotools-wrappers \
31+
mingw-w64-$ARCH-pkgconf \
32+
mingw-w64-$ARCH-libtool"
33+
34+
for PACKAGE in $PACKAGES; do
35+
pacman -R --noconfirm --cascade $PACKAGE || true
36+
done
37+
done
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e # exit on error
4+
set -x # echo on
5+
set -o pipefail # fail of any command in pipeline is an error
6+
7+
echo "::group::Create MSYS2 packages repository"
8+
mkdir -p repository/x86_64
9+
mv -f mingw-w64-cross-*.pkg.* repository/x86_64/
10+
pushd repository/x86_64
11+
repo-add woarm64.db.tar.gz *.pkg.*
12+
popd
13+
14+
mkdir -p repository/aarch64
15+
mv -f mingw-w64-aarch64-*.pkg.* repository/aarch64/
16+
pushd repository/aarch64
17+
repo-add woarm64-native.db.tar.gz *.pkg.*
18+
popd
19+
echo "::endgroup::"

.github/scripts/download-artifacts.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ set -x # echo on
55
set -o pipefail # fail of any command in pipeline is an error
66

77
RUN_ID=$1
8-
NEEDS=`echo "$2" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'`
98

10-
for NEED in $NEEDS; do
11-
echo "Downloading $NEED artifact."
12-
/mingw64/bin/gh run download $RUN_ID -n $NEED
9+
for ARG in "${@:2}"; do
10+
NEEDS=`echo "$ARG" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'`
11+
for NEED in $NEEDS; do
12+
echo "Downloading $NEED artifact."
13+
/mingw64/bin/gh run download $RUN_ID -n $NEED
14+
done
1315
done

.github/scripts/enable-ccache.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ set -o pipefail # fail of any command in pipeline is an error
66

77
DIR="`dirname ${BASH_SOURCE[0]}`/../.."
88
DIR=`realpath $DIR`
9+
CCACHE_DIR=$DIR/ccache
910
if [[ -n "$GITHUB_WORKSPACE" ]]; then
10-
echo "CCACHE_DIR=$DIR/ccache" >> "$GITHUB_ENV"
11+
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
1112
echo timestamp=$(date -u --iso-8601=seconds) >> "$GITHUB_OUTPUT"
1213
fi
1314

15+
mkdir -p $CCACHE_DIR
16+
1417
pushd /
1518
echo "::group::/etc/makepkg.conf"
1619
patch -p1 -b -i "$DIR/patches/ccache/0001-makepkg.patch"
@@ -22,3 +25,17 @@ pushd /
2225
cat /etc/makepkg_mingw.conf
2326
echo "::endgroup::"
2427
popd
28+
29+
pacman -S --noconfirm ccache
30+
31+
pushd /usr/lib/ccache/bin
32+
echo "::group::Add aarch64 toolchain to ccache"
33+
export MSYS=winsymlinks
34+
ln -sf /usr/bin/ccache aarch64-w64-mingw32-c++
35+
ln -sf /usr/bin/ccache aarch64-w64-mingw32-g++
36+
ln -sf /usr/bin/ccache aarch64-w64-mingw32-gcc
37+
if [[ "$FLAVOR" = "CROSS" ]]; then
38+
ln -sf /usr/bin/true makeinfo
39+
fi
40+
echo "::endgroup::"
41+
popd
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
FLAVOR=${1:-$FLAVOR}
4+
DEPENDENCIES=$2
5+
6+
case $FLAVOR in
7+
"CROSS")
8+
pacman -S --noconfirm \
9+
base-devel \
10+
$DEPENDENCIES
11+
;;
12+
"NATIVE_WITH_CROSS")
13+
pacman -S --noconfirm \
14+
base-devel \
15+
mingw-w64-cross-mingwarm64-gcc \
16+
mingw-w64-cross-mingwarm64-windows-default-manifest \
17+
mingw-w64-x86_64-gcc-libs \
18+
$DEPENDENCIES
19+
;;
20+
"NATIVE_WITH_NATIVE")
21+
pacman -S --noconfirm \
22+
base-devel \
23+
mingw-w64-aarch64-gcc \
24+
$DEPENDENCIES
25+
;;
26+
*)
27+
echo "Unknown flavor: $FLAVOR"
28+
exit 1
29+
;;
30+
esac
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
set -e # exit on error
4+
set -x # echo on
5+
set -o pipefail # fail of any command in pipeline is an error
6+
7+
if [ -z "$GITHUB_WORKSPACE" ]; then
8+
DIR=`pwd`
9+
else
10+
DIR=`cygpath "$GITHUB_WORKSPACE"`
11+
fi
12+
13+
echo "::group::Install patch"
14+
pacman -S --noconfirm patch
15+
echo "::endgroup::"
16+
17+
pushd /
18+
echo "::group::Patch MSYS2 environment"
19+
patch -p1 -b -i "$DIR/patches/makepkg/0001-mingwarm64.patch"
20+
if [[ "$FLAVOR" != "NATIVE_WITH_NATIVE" ]]; then
21+
patch -p1 -b -i "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch"
22+
fi
23+
if [[ "$DEBUG_BUILD" = "1" ]]; then
24+
patch -p1 -b -i "$DIR/patches/makepkg/0003-enable-debug.patch"
25+
fi
26+
echo "::endgroup::"
27+
28+
echo "::group::/etc/makepkg_mingw.conf"
29+
cat /etc/makepkg_mingw.conf
30+
echo "::endgroup::"
31+
32+
echo "::group::/etc/profile"
33+
cat /etc/profile
34+
echo "::endgroup::"
35+
36+
echo "::group::/usr/share/makepkg/tidy/strip.sh"
37+
cat /usr/share/makepkg/tidy/strip.sh
38+
echo "::endgroup::"
39+
popd

.github/scripts/setup-repository.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ pushd /
1313
echo "::endgroup::"
1414

1515
echo "::group::Add WoArm64 repository"
16-
patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-repository.patch"
16+
if [[ "$FLAVOR" = "NATIVE_WITH_NATIVE" ]]; then
17+
patch -p1 -b -i "$DIR/patches/pacman/0002-add-woarm64-native-repository.patch"
18+
else
19+
patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-cross-repository.patch"
20+
fi
1721
echo "::endgroup::"
1822

1923
echo "::group::Update packages database"

0 commit comments

Comments
 (0)