Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/scripts/build-hello-world.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

# Sanity check of the GCC binary and its version.
aarch64-w64-mingw32-gcc --version
Expand Down
32 changes: 18 additions & 14 deletions .github/scripts/build-package.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

PACKAGE_REPOSITORY=$1

CLEAN_BUILD=${CLEAN_BUILD:-0}
INSTALL_PACKAGE=${INSTALL_PACKAGE:-0}
NO_EXTRACT=${NO_EXTRACT:-0}

ARGUMENTS="--syncdeps \
--rmdeps \
--noconfirm \
Expand All @@ -21,12 +15,22 @@ ARGUMENTS="--syncdeps \
$([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \
$([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")"

ccache -svv || true

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

ccache -svv || true
echo "::group::Build package"
if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then
makepkg-mingw $ARGUMENTS
else
makepkg $ARGUMENTS
fi
echo "::endgroup::"

if command -v ccache &> /dev/null; then
echo "::group::Ccache statistics after build"
ccache -svv || true
echo "::endgroup::"
fi
19 changes: 19 additions & 0 deletions .github/scripts/clean-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

source `dirname ${BASH_SOURCE[0]}`/../../config.sh

for ENV in "common" "mingw32" "mingw64" "ucrt64" "mingwarm64"; do
PACKAGES=" \
mingw-w64-cross-$ENV-zlib \
mingw-w64-cross-$ENV-gcc \
mingw-w64-cross-$ENV-winpthreads \
mingw-w64-cross-$ENV-crt \
mingw-w64-cross-$ENV-windows-default-manifest \
mingw-w64-cross-$ENV-gcc-stage1 \
mingw-w64-cross-$ENV-binutils \
mingw-w64-cross-$ENV-headers"

for PACKAGE in $PACKAGES; do
pacman -R --noconfirm --cascade $PACKAGE || true
done
done
38 changes: 38 additions & 0 deletions .github/scripts/clean-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

source `dirname ${BASH_SOURCE[0]}`/../../config.sh

for ARCH in "aarch64" "x86_64"; do
PACKAGES=" \
mingw-w64-$ARCH-gcc \
mingw-w64-$ARCH-windows-default-manifest \
mingw-w64-$ARCH-binutils \
mingw-w64-$ARCH-libwinpthread-git
mingw-w64-$ARCH-winpthreads-git \
mingw-w64-$ARCH-crt-git \
mingw-w64-$ARCH-headers-git \
mingw-w64-$ARCH-tools-git \
mingw-w64-$ARCH-libmangle-git \
mingw-w64-$ARCH-mpc \
mingw-w64-$ARCH-isl \
mingw-w64-$ARCH-mpfr \
mingw-w64-$ARCH-gmp \
mingw-w64-$ARCH-zstd \
mingw-w64-$ARCH-ninja \
mingw-w64-$ARCH-zlib \
mingw-w64-$ARCH-bzip2 \
mingw-w64-$ARCH-ncurses \
mingw-w64-$ARCH-gettext \
mingw-w64-$ARCH-libsystre \
mingw-w64-$ARCH-libtre \
mingw-w64-$ARCH-libiconv \
mingw-w64-$ARCH-gperf \
autotools-wrappers \
mingw-w64-$ARCH-autotools \
mingw-w64-$ARCH-pkgconf \
mingw-w64-$ARCH-libtool"

for PACKAGE in $PACKAGES; do
pacman -R --noconfirm --cascade $PACKAGE || true
done
done
17 changes: 17 additions & 0 deletions .github/scripts/create-repository.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

source `dirname ${BASH_SOURCE[0]}`/../../config.sh

echo "::group::Create MSYS2 packages repository"
mkdir -p repository/x86_64
mv -f mingw-w64-cross-*.pkg.* repository/x86_64/
pushd repository/x86_64
repo-add woarm64.db.tar.gz *.pkg.*
popd

mkdir -p repository/aarch64
mv -f mingw-w64-aarch64-*.pkg.* repository/aarch64/
pushd repository/aarch64
repo-add woarm64-native.db.tar.gz *.pkg.*
popd
echo "::endgroup::"
14 changes: 7 additions & 7 deletions .github/scripts/download-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

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

for NEED in $NEEDS; do
echo "Downloading $NEED artifact."
/mingw64/bin/gh run download $RUN_ID -n $NEED
for ARG in "${@:2}"; do
NEEDS=`echo "$ARG" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'`
for NEED in $NEEDS; do
echo "Downloading $NEED artifact."
/mingw64/bin/gh run download $RUN_ID -n $NEED || true
done
done
35 changes: 29 additions & 6 deletions .github/scripts/enable-ccache.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

DIR="`dirname ${BASH_SOURCE[0]}`/../.."
DIR=`realpath $DIR`
CCACHE_DIR=$DIR/ccache
if [[ -n "$GITHUB_WORKSPACE" ]]; then
echo "CCACHE_DIR=$DIR/ccache" >> "$GITHUB_ENV"
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
echo timestamp=$(date -u --iso-8601=seconds) >> "$GITHUB_OUTPUT"
fi

apply_patch () {
if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then
echo "Patch $1 is already applied"
else
patch -p1 -b -i "$1"
fi
}

mkdir -p $CCACHE_DIR

pushd /
echo "::group::/etc/makepkg.conf"
patch -p1 -b -i "$DIR/patches/ccache/0001-makepkg.patch"
apply_patch "$DIR/patches/ccache/0001-makepkg.patch"
cat /etc/makepkg.conf
echo "::endgroup::"

echo "::group::/etc/makepkg_mingw.conf"
patch -p1 -b -i "$DIR/patches/ccache/0002-makepkg-mingw.patch"
apply_patch "$DIR/patches/ccache/0002-makepkg-mingw.patch"
cat /etc/makepkg_mingw.conf
echo "::endgroup::"
popd

pacman -S --noconfirm ccache

pushd /usr/lib/ccache/bin
echo "::group::Add aarch64 toolchain to ccache"
export MSYS=winsymlinks
ln -sf /usr/bin/ccache aarch64-w64-mingw32-c++
ln -sf /usr/bin/ccache aarch64-w64-mingw32-g++
ln -sf /usr/bin/ccache aarch64-w64-mingw32-gcc
if [[ "$FLAVOR" = "CROSS" ]]; then
ln -sf /usr/bin/true makeinfo
fi
echo "::endgroup::"
popd
10 changes: 6 additions & 4 deletions .github/scripts/install-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

pacman -U --noconfirm *.pkg.tar.zst
if [[ $(ls *.pkg.tar.zst 2>/dev/null) != "" ]]; then
pacman -U --noconfirm *.pkg.tar.zst
else
echo "No package file found. Skipping installation."
fi
34 changes: 34 additions & 0 deletions .github/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

source `dirname ${BASH_SOURCE[0]}`/../../config.sh

DEPENDENCIES=$1

case $FLAVOR in
"CROSS")
pacman -S --noconfirm \
git \
base-devel \
$DEPENDENCIES
;;
"NATIVE_WITH_CROSS")
pacman -S --noconfirm \
git \
base-devel \
mingw-w64-cross-mingwarm64-gcc \
mingw-w64-cross-mingwarm64-windows-default-manifest \
mingw-w64-x86_64-gcc-libs \
$DEPENDENCIES
;;
"NATIVE_WITH_NATIVE")
pacman -S --noconfirm \
git \
base-devel \
mingw-w64-aarch64-gcc \
$DEPENDENCIES
;;
*)
echo "Unknown flavor: $FLAVOR"
exit 1
;;
esac
5 changes: 2 additions & 3 deletions .github/scripts/pthread-headers-hack-after.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

pacman -R --noconfirm mingw-w64-cross-mingw64-winpthreads || true
rm -rf /opt/aarch64-w64-mingw32/include/pthread_signal.h
rm -rf /opt/aarch64-w64-mingw32/include/pthread_unistd.h
rm -rf /opt/aarch64-w64-mingw32/include/pthread_time.h
rm -rf /opt/aarch64-w64-mingw32/include/pthread_compat.h
5 changes: 2 additions & 3 deletions .github/scripts/pthread-headers-hack-before.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error
source `dirname ${BASH_SOURCE[0]}`/../../config.sh

pacman -S --noconfirm mingw-w64-cross-mingw64-winpthreads
cp /opt/x86_64-w64-mingw32/include/pthread_signal.h /opt/aarch64-w64-mingw32/include/
cp /opt/x86_64-w64-mingw32/include/pthread_unistd.h /opt/aarch64-w64-mingw32/include/
cp /opt/x86_64-w64-mingw32/include/pthread_time.h /opt/aarch64-w64-mingw32/include/
cp /opt/x86_64-w64-mingw32/include/pthread_compat.h /opt/aarch64-w64-mingw32/include/
45 changes: 45 additions & 0 deletions .github/scripts/setup-mingwarm64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

source `dirname ${BASH_SOURCE[0]}`/../../config.sh

if [ -z "$GITHUB_WORKSPACE" ]; then
DIR=`pwd`
else
DIR=`cygpath "$GITHUB_WORKSPACE"`
fi

apply_patch () {
if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then
echo "Patch $1 is already applied"
else
patch -p1 -b -i "$1"
fi
}

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Patch MSYS2 environment"
apply_patch "$DIR/patches/makepkg/0001-mingwarm64.patch"
if [[ "$FLAVOR" != "NATIVE_WITH_NATIVE" ]]; then
apply_patch "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch"
fi
if [[ "$DEBUG_BUILD" = "1" ]]; then
apply_patch "$DIR/patches/makepkg/0003-enable-debug.patch"
fi
echo "::endgroup::"

echo "::group::/etc/makepkg_mingw.conf"
cat /etc/makepkg_mingw.conf
echo "::endgroup::"

echo "::group::/etc/profile"
cat /etc/profile
echo "::endgroup::"

echo "::group::/usr/share/makepkg/tidy/strip.sh"
cat /usr/share/makepkg/tidy/strip.sh
echo "::endgroup::"
popd
22 changes: 17 additions & 5 deletions .github/scripts/setup-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ set -o pipefail # fail of any command in pipeline is an error
DIR="`dirname ${BASH_SOURCE[0]}`/../.."
DIR=`realpath $DIR`

pushd /
echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"
apply_patch () {
if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then
echo "Patch $1 is already applied"
else
patch -p1 -b -i "$1"
fi
}

echo "::group::Install patch"
pacman -S --noconfirm patch
echo "::endgroup::"

pushd /
echo "::group::Add WoArm64 repository"
patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-repository.patch"
if [[ "$FLAVOR" = "NATIVE_WITH_NATIVE" ]]; then
apply_patch "$DIR/patches/pacman/0002-add-woarm64-native-repository.patch"
else
apply_patch "$DIR/patches/pacman/0001-add-woarm64-cross-repository.patch"
fi
echo "::endgroup::"

echo "::group::Update packages database"
Expand Down
Loading