Skip to content

Commit

Permalink
Add aarch64-pc-cygwin target to advanced.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex authored and github-actions committed Apr 29, 2024
1 parent 2f89bc6 commit 5832a4f
Show file tree
Hide file tree
Showing 26 changed files with 3,812 additions and 52 deletions.
13 changes: 12 additions & 1 deletion .github/scripts/binutils/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$BINUTILS_BUILD_PATH/Makefile" ] ; then
--enable-host-shared \
--enable-64-bit-bfd \
--enable-install-libiberty \
--enable-targets=x86_64-pep \
--with-sysroot=$TOOLCHAIN_PATH \
--with-build-sysroot=$TOOLCHAIN_PATH \
--with-system-zlib \
Expand All @@ -42,6 +41,18 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$BINUTILS_BUILD_PATH/Makefile" ] ; then
;;
esac

case "$ARCH-$PLATFORM" in
x86_64-*cygwin*)
TARGET_OPTIONS="$TARGET_OPTIONS \
--enable-targets=x86_64-pep"
;;
aarch64-*cygwin*)
TARGET_OPTIONS="$TARGET_OPTIONS \
--enable-targets=aarch64-pep \
--disable-sim"
;;
esac

$SOURCE_PATH/$BINUTILS_VERSION/configure \
--prefix=$TOOLCHAIN_PATH \
--build=$BUILD \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ echo "::group::Patch Cygwin binutils"

patch -p2 -i $PATCH_DIR/binutils-2.42-cygwin-config-rpath.patch
patch -p2 -i $PATCH_DIR/binutils-2.42-cygwin-pep-dll-double-definition.patch

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/binutils/0001-aarch64-cygwin.patch
;;
esac
echo "::endgroup::"

echo 'Success!'
14 changes: 8 additions & 6 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ if [ "$RUN_BOOTSTRAP" = 1 ]; then
fi

if [[ "$PLATFORM" =~ cygwin ]]; then
.github/scripts/binutils/patch-cygwin.sh 1
.github/scripts/toolchain/patch-cygwin.sh 1
.github/scripts/binutils/patch-cygwin-binutils.sh
fi

.github/scripts/binutils/build.sh

if [[ "$PLATFORM" =~ cygwin ]]; then
.github/scripts/toolchain/patch-cygwin-gcc.sh
.github/scripts/toolchain/patch-cygwin-mingw.sh
.github/scripts/toolchain/patch-cygwin.sh 1
fi

if [[ "$PLATFORM" =~ linux ]]; then
.github/scripts/toolchain/install-cross-headers-libs.sh
fi
Expand All @@ -51,9 +55,6 @@ fi
if [[ "$PLATFORM" =~ cygwin ]]; then
.github/scripts/toolchain/build-cocom.sh
.github/scripts/toolchain/build-cygwin.sh 1

.github/scripts/binutils/patch-cygwin.sh 2
.github/scripts/toolchain/patch-cygwin.sh 2
fi

.github/scripts/toolchain/build-gcc.sh
Expand All @@ -62,6 +63,7 @@ if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
.github/scripts/toolchain/build-mingw.sh
fi
if [[ "$PLATFORM" =~ cygwin ]]; then
.github/scripts/toolchain/patch-cygwin.sh 2
.github/scripts/toolchain/build-cygwin.sh 2
fi

Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ LIBJPEG_TURBO_VERSION=${LIBJPEG_TURBO_VERSION:-libjpeg-turbo-main}
FFMPEG_VERSION=${FFMPEG_VERSION:-ffmpeg-master}

ARCH=${ARCH:-aarch64}
PLATFORM=${PLATFORM:-w64-mingw32}
PLATFORM=${PLATFORM:-pc-cygwin}
if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
CRT=${CRT:-msvcrt}
else
CRT=${CRT:-libc}
fi
BUILD=x86_64-pc-linux-gnu
HOST=x86_64-pc-linux-gnu
BUILD=`gcc -dumpmachine`
HOST=`gcc -dumpmachine`
TARGET=$ARCH-$PLATFORM
TOOLCHAIN_NAME=${TOOLCHAIN_NAME:-$ARCH-$PLATFORM-$CRT}

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source `dirname ${BASH_SOURCE[0]}`/config.sh

echo "::group::Install Dependencies"
sudo apt update
sudo apt install -y build-essential binutils-for-build texinfo bison flex ccache docbook2x xmlto zlib1g-dev libgmp-dev libmpc-dev libc6-dev-arm64-cross libc6-dev-amd64-cross libisl-dev dejagnu
sudo apt install -y autoconf automake build-essential binutils-for-build texinfo bison flex ccache docbook2x xmlto zlib1g-dev libgmp-dev libmpc-dev libc6-dev-arm64-cross libc6-dev-amd64-cross libisl-dev dejagnu
echo "::endgroup::"

echo 'Success!'
4 changes: 2 additions & 2 deletions .github/scripts/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f build/CMakeCache.txt ] ; then
fi

echo "::group::Build tests"
cmake --build build
cmake --build build ${BUILD_MAKE_OPTIONS//V=1/-v}

case "$PLATFORM" in
w64-mingw32)
Expand All @@ -24,7 +24,7 @@ echo "::group::Build tests"
pc-cygwin)
cp $TOOLCHAIN_PATH/bin/cygwin1.dll build/bin
cp $TOOLCHAIN_PATH/lib/gcc/$TARGET/cyggcc_s-seh-1.dll build/bin
cp $TOOLCHAIN_PATH/lib/gcc/$TARGET/14/cyggomp-1.dll build/bin
cp $TOOLCHAIN_PATH/lib/gcc/$TARGET/14/cyggomp-1.dll build/bin && true
;;
esac
echo "::endgroup::"
7 changes: 7 additions & 0 deletions .github/scripts/toolchain/build-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$CYGWIN_BUILD_PATH/Makefile" ] ; then
echo "::group::Configure Cygwin"
rm -rf $CYGWIN_BUILD_PATH/*

if [ "$DEBUG" = 1 ] ; then
HOST_OPTIONS="$HOST_OPTIONS \
--enable-debug \
--disable-lto"
fi

case "$STAGE" in
1)
TARGET_OPTIONS="$TARGET_OPTIONS \
Expand All @@ -37,6 +43,7 @@ if [ "$RUN_CONFIG" = 1 ] || [ ! -f "$CYGWIN_BUILD_PATH/Makefile" ] ; then
--with-sysroot=$TOOLCHAIN_PATH \
--with-build-sysroot=$TOOLCHAIN_PATH \
--with-cross-bootstrap \
$HOST_OPTIONS \
$TARGET_OPTIONS
echo "::endgroup::"
fi
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/toolchain/build-mingw-crt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ if [ "$RUN_INSTALL" = 1 ] ; then
ln -fs w32api/libuserenv.a .
ln -fs w32api/libnetapi32.a .
ln -fs w32api/libdbghelp.a .
ln -fs w32api/libonecore.a .
ln -fs w32api/libpdh.a .
popd
;;
esac
Expand Down
33 changes: 33 additions & 0 deletions .github/scripts/toolchain/patch-cygwin-gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

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

echo "::group::Patch Cygwin GCC"
cd $SOURCE_PATH/$GCC_VERSION

git reset --hard
git clean -fdx

PATCH_DIR=$SOURCE_PATH/cygwin-packages/gcc
patch -p1 -i $PATCH_DIR/0001-Cygwin-use-SysV-ABI-on-x86_64.patch
patch -p1 -i $PATCH_DIR/0002-Cygwin-add-dummy-pthread-tsaware-and-large-address-a.patch
patch -p1 -i $PATCH_DIR/0003-Cygwin-handle-dllimport-properly-in-medium-model-V2.patch
patch -p1 -i $PATCH_DIR/0004-Cygwin-MinGW-skip-test.patch
patch -p1 -i $PATCH_DIR/0005-Cygwin-define-RTS_CONTROL_ENABLE-and-DTR_CONTROL_ENA.patch
patch -p1 -i $PATCH_DIR/0007-Cygwin-__cxa-atexit.patch
patch -p1 -i $PATCH_DIR/0008-Cygwin-libgomp-soname.patch
patch -p1 -i $PATCH_DIR/0009-Cygwin-g-time.patch
patch -p1 -i $PATCH_DIR/0010-Cygwin-newlib-ftm.patch
patch -p1 -i $PATCH_DIR/0011-Cygwin-define-STD_UNIX.patch
patch -p1 -i $PATCH_DIR/0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch
patch -p1 -i $PATCH_DIR/0102-Cygwin-testsuite-fixes-for-libgccjit.patch

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/gcc/0001-aarch64-cygwin.patch
patch -p1 -i $PATCHES_PATH/gcc/0002-cygming-extern.patch
;;
esac
echo "::endgroup::"

echo 'Success!'
18 changes: 18 additions & 0 deletions .github/scripts/toolchain/patch-cygwin-mingw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

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

echo echo "::group::Patch MinGW"
cd $SOURCE_PATH/$MINGW_VERSION

git reset --hard
git clean -fdx

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/mingw/0001-aarch64-cygwin.patch
;;
esac
echo "::endgroup::"

echo 'Success!'
34 changes: 11 additions & 23 deletions .github/scripts/toolchain/patch-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@ source `dirname ${BASH_SOURCE[0]}`/../config.sh

STAGE=$1

echo "::group::Patch Cygwin GCC"
cd $SOURCE_PATH/$GCC_VERSION

git reset --hard
git clean -fdx

PATCH_DIR=$SOURCE_PATH/cygwin-packages/gcc
patch -p1 -i $PATCH_DIR/0001-Cygwin-use-SysV-ABI-on-x86_64.patch
patch -p1 -i $PATCH_DIR/0002-Cygwin-add-dummy-pthread-tsaware-and-large-address-a.patch
patch -p1 -i $PATCH_DIR/0003-Cygwin-handle-dllimport-properly-in-medium-model-V2.patch
patch -p1 -i $PATCH_DIR/0004-Cygwin-MinGW-skip-test.patch
patch -p1 -i $PATCH_DIR/0005-Cygwin-define-RTS_CONTROL_ENABLE-and-DTR_CONTROL_ENA.patch
patch -p1 -i $PATCH_DIR/0007-Cygwin-__cxa-atexit.patch
patch -p1 -i $PATCH_DIR/0008-Cygwin-libgomp-soname.patch
patch -p1 -i $PATCH_DIR/0009-Cygwin-g-time.patch
patch -p1 -i $PATCH_DIR/0010-Cygwin-newlib-ftm.patch
patch -p1 -i $PATCH_DIR/0011-Cygwin-define-STD_UNIX.patch
patch -p1 -i $PATCH_DIR/0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch
patch -p1 -i $PATCH_DIR/0102-Cygwin-testsuite-fixes-for-libgccjit.patch
echo "::endgroup::"

echo "::group::Patch Cygwin"
cd $SOURCE_PATH/$CYGWIN_VERSION

Expand All @@ -36,13 +15,22 @@ echo "::group::Patch Cygwin"
patch -p1 -i $PATCH_DIR/0001-before-autogen.patch
fi

patch -p1 -i $PATCHES_PATH/cygwin/0003-master.patch

case "$ARCH" in
aarch64)
patch -p1 -i $PATCHES_PATH/cygwin/0004-aarch64-cygwin.patch
if [ "$STAGE" = "2" ]; then
patch -p1 -i $PATCHES_PATH/cygwin/0005-aarch64-gendef.patch
fi
;;
esac

(cd winsup && ./autogen.sh)

if [ "$STAGE" = "1" ]; then
patch -p1 -i $PATCH_DIR/0002-after-autogen.patch
fi

patch -p1 -i $PATCHES_PATH/cygwin/0003-master.patch
echo "::endgroup::"

echo 'Success!'
23 changes: 12 additions & 11 deletions .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ env:
TOOLCHAIN_PATH: ${{ github.workspace }}/cross
TOOLCHAIN_NAME: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }}
TOOLCHAIN_PACKAGE_NAME: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }}-toolchain.tar.gz

TESTS_PACKAGE_NAME: ${{ inputs.arch }}-${{ inputs.crt }}-tests.tar.gz
TESTS_PACKAGE_NAME: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }}-tests.tar.gz

SOURCE_PATH: ${{ github.workspace }}/code
ARTIFACT_PATH: ${{ github.workspace }}/artifact

TEST_TOOLCHAIN: ${{ (inputs.arch == 'aarch64' && inputs.platform == 'w64-mingw32' && inputs.crt == 'msvcrt') || (inputs.arch == 'x86_64' && inputs.platform == 'pc-cygwin') }}
TEST_TOOLCHAIN: ${{ (inputs.arch == 'aarch64' && inputs.platform == 'w64-mingw32' && inputs.crt == 'msvcrt') || inputs.platform == 'pc-cygwin' }}
TEST_PACKAGES: ${{ inputs.arch == 'aarch64' && inputs.platform == 'w64-mingw32' && inputs.crt == 'msvcrt' }}

jobs:
Expand Down Expand Up @@ -205,19 +204,21 @@ jobs:
run: |
.github/scripts/install-libraries.sh
- name: Patch binutils stage1
- name: Patch binutils
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && inputs.platform == 'pc-cygwin' }}
run: |
.github/scripts/binutils/patch-cygwin.sh 1
.github/scripts/binutils/patch-cygwin-binutils.sh
- name: Build binutils
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
run: |
.github/scripts/binutils/build.sh
- name: Patch toolchain stage1
- name: Patch toolchain
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && inputs.platform == 'pc-cygwin' }}
run: |
.github/scripts/toolchain/patch-cygwin-gcc.sh
.github/scripts/toolchain/patch-cygwin-mingw.sh
.github/scripts/toolchain/patch-cygwin.sh 1
- name: Install cross headers and libraries
Expand Down Expand Up @@ -260,11 +261,6 @@ jobs:
run: |
.github/scripts/toolchain/build-cygwin.sh 1
- name: Patch toolchain stage2
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && inputs.platform == 'pc-cygwin' }}
run: |
.github/scripts/toolchain/patch-cygwin.sh 2
- name: Build GCC stage2
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
run: |
Expand All @@ -275,6 +271,11 @@ jobs:
run: |
.github/scripts/toolchain/build-mingw.sh
- name: Patch Cygwin stage2
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && inputs.platform == 'pc-cygwin' }}
run: |
.github/scripts/toolchain/patch-cygwin.sh 2
- name: Build Cygwin stage2
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && inputs.platform == 'pc-cygwin' }}
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ jobs:
crt: ucrt
- platform: pc-cygwin
crt: libc
- platform: pc-cygwin
arch: aarch64

uses: ./.github/workflows/advanced.yml
with:
Expand Down
Loading

0 comments on commit 5832a4f

Please sign in to comment.