Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add aarch64-pc-cygwin target to advanced.yml #123

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
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/configure \
--prefix=$TOOLCHAIN_PATH \
--build=$BUILD \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ echo "::group::Patch Cygwin binutils"
fi

PATCH_DIR=$SOURCE_PATH/cygwin-packages/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
patch -p2 -i $PATCH_DIR/binutils-2.43-cygwin-config-rpath.patch

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

echo 'Success!'
17 changes: 14 additions & 3 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ fi
if [[ "$APPLY_PATCHES" = 1 ]]; then
case "$PLATFORM" in
*cygwin*)
$ROOT_PATH/.github/scripts/binutils/patch-cygwin.sh 1
$ROOT_PATH/.github/scripts/binutils/patch-cygwin-binutils.sh 1
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin-gcc.sh 1
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin-mingw.sh 1
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin.sh 1
;;
esac
Expand Down Expand Up @@ -61,8 +63,8 @@ fi
if [[ "$APPLY_PATCHES" = 1 ]]; then
case "$PLATFORM" in
*cygwin*)
$ROOT_PATH/.github/scripts/binutils/patch-cygwin.sh 2
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin.sh 2
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin-gcc.sh 2
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin-mingw.sh 2
;;
esac
fi
Expand All @@ -76,6 +78,15 @@ $ROOT_PATH/.github/scripts/toolchain/build-gcc.sh
if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
$ROOT_PATH/.github/scripts/toolchain/build-mingw.sh
fi

if [[ "$APPLY_PATCHES" = 1 ]]; then
case "$PLATFORM" in
*cygwin*)
$ROOT_PATH/.github/scripts/toolchain/patch-cygwin.sh 2
;;
esac
fi

if [[ "$PLATFORM" =~ cygwin ]]; then
$ROOT_PATH/.github/scripts/toolchain/build-cygwin.sh 2
fi
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

ARCH=${ARCH:-aarch64}
PLATFORM=${PLATFORM:-w64-mingw32}
PLATFORM=${PLATFORM:-pc-cygwin}
if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then
CRT=${CRT:-msvcrt}
else
Expand Down Expand Up @@ -59,9 +59,9 @@ TOOLCHAIN_CCACHE_LIB_DIR=$TOOLCHAIN_PATH/lib/ccache

DEBUG=${DEBUG:-0} # Enable debug build.
CCACHE=${CCACHE:-0} # Enable usage of ccache.
RUN_BOOTSTRAP=${RUN_BOOTSTRAP:-0} # Bootstrap dependencies during the build.
UPDATE_SOURCES=${UPDATE_SOURCES:-0} # Update source code repositories.
RESET_SOURCES=${RESET_SOURCES:-0} # Reset source code repositories before update.
RUN_BOOTSTRAP=${RUN_BOOTSTRAP:-1} # Bootstrap dependencies during the build.
UPDATE_SOURCES=${UPDATE_SOURCES:-1} # Update source code repositories.
RESET_SOURCES=${RESET_SOURCES:-1} # Reset source code repositories before update.
APPLY_PATCHES=${APPLY_PATCHES:-1} # Patch source repositories for targets requiring it.
RUN_CONFIG=${RUN_CONFIG:-1} # Run configuration step.
RUN_INSTALL=${RUN_INSTALL:-1} # Run installation step.
Expand Down
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
34 changes: 34 additions & 0 deletions .github/scripts/toolchain/patch-cygwin-gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

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

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

if [[ "$RESET_SOURCES" = 1 ]]; then
git reset --hard HEAD
git clean -fdx
fi

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
;;
esac
echo "::endgroup::"

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

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

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

if [[ "$RESET_SOURCES" = 1 ]]; then
git reset --hard HEAD
git clean -fdx
fi

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

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

STAGE=$1

# Force source reset for Cygwin stage 2 build.
if [[ "$STAGE" = 2 && "$PLATFORM" =~ cygwin ]]; then
RESET_SOURCES=1
fi

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

if [[ "$RESET_SOURCES" = 1 ]]; then
git reset --hard HEAD
git clean -fdx
fi

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

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

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!'
18 changes: 12 additions & 6 deletions .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ env:
FFMPEG_BRANCH: release/6.1

TOOLCHAIN_PATH: ${{ github.workspace }}/cross
TOOLCHAIN_NAME: aarch64-w64-mingw32-msvcrt
TOOLCHAIN_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-toolchain.tar.gz
TOOLCHAIN_NAME: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }}
TOOLCHAIN_PACKAGE_NAME: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }}-toolchain.tar.gz

SOURCE_PATH: ${{ github.workspace }}/code
BUILD_PATH: ${{ github.workspace }}/build
Expand Down Expand Up @@ -129,8 +129,6 @@ jobs:
crt: ucrt
- platform: pc-cygwin
crt: libc
- platform: pc-cygwin
arch: aarch64

env:
ARCH: ${{ matrix.arch }}
Expand Down Expand Up @@ -240,11 +238,13 @@ jobs:
- name: Patch binutils stage1
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && matrix.platform == 'pc-cygwin' }}
run: |
.github/scripts/binutils/patch-cygwin.sh 1
.github/scripts/binutils/patch-cygwin-binutils.sh 1

- name: Patch toolchain stage1
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && matrix.platform == 'pc-cygwin' }}
run: |
.github/scripts/toolchain/patch-cygwin-gcc.sh 1
.github/scripts/toolchain/patch-cygwin-mingw.sh 1
.github/scripts/toolchain/patch-cygwin.sh 1

- name: Install libraries
Expand Down Expand Up @@ -314,7 +314,8 @@ jobs:
- name: Patch toolchain stage2
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && matrix.platform == 'pc-cygwin' }}
run: |
.github/scripts/toolchain/patch-cygwin.sh 2
.github/scripts/toolchain/patch-cygwin-gcc.sh 2
.github/scripts/toolchain/patch-cygwin-mingw.sh 2

- name: Install libraries
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
Expand All @@ -331,6 +332,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' && matrix.platform == 'pc-cygwin' }}
run: |
Expand Down
Loading