Skip to content

Commit

Permalink
Shared libgcc can now be enabled for aarch64-w64-mingw32 (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Sep 12, 2024
1 parent f261fa4 commit d897fe5
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ if ( -not $env:OPENBLAS_TESTS_PATH ) { $env:OPENBLAS_TESTS_PATH = "$PWD\openblas
if ( -not $env:OPENSSL_TESTS_PATH ) { $env:OPENSSL_TESTS_PATH = "$PWD\openssl-tests" }
if ( -not $env:LIBJPEG_TURBO_TESTS_PATH ) { $env:LIBJPEG_TURBO_TESTS_PATH = "$PWD\libjpeg-turbo-tests" }
if ( -not $env:FFMPEG_TESTS_PATH ) { $env:FFMPEG_TESTS_PATH = "$PWD\ffmpeg-tests" }

if ( -not $env:RUNTIME_PACKAGE_NAME ) { $env:RUNTIME_PACKAGE_NAME = "$env:TOOLCHAIN_NAME-runtime.tar.gz" }
if ( -not $env:TESTS_PACKAGE_NAME ) { $env:TESTS_PACKAGE_NAME = "$env:TOOLCHAIN_NAME-tests.tar.gz" }

$env:PATH += ";$env:TOOLCHAIN_PATH\bin;$env:ARTIFACT_PATH\bin"
9 changes: 8 additions & 1 deletion .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ BUILD_MAKE_OPTIONS=${BUILD_MAKE_OPTIONS:-V=1 -j$(nproc)}
TOOLCHAIN_PATH=${TOOLCHAIN_PATH:-~/cross-$TOOLCHAIN_NAME}
TOOLCHAIN_FILE=${TOOLCHAIN_FILE:-$ROOT_PATH/.github/cmake/$TARGET.cmake}
TOOLCHAIN_PACKAGE_NAME=${TOOLCHAIN_PACKAGE_NAME:-$TOOLCHAIN_NAME-toolchain.tar.gz}
RUNTIME_PACKAGE_NAME=${RUNTIME_PACKAGE_NAME:-$TOOLCHAIN_NAME-runtime.tar.gz}
DEJAGNU_FILE=${DEJAGNU_FILE:-$ROOT_PATH/.github/scripts/toolchain/site.exp}

ZLIB_PATH=${ZLIB_PATH:-~/zlib}
Expand All @@ -64,6 +65,12 @@ FFMPEG_TESTS_PATH=${FFMPEG_TESTS_PATH:-~/ffmpeg-tests}
CCACHE_LIB_DIR=/usr/lib/ccache
TOOLCHAIN_CCACHE_LIB_DIR=$TOOLCHAIN_PATH/lib/ccache

if [[ -f $SOURCE_PATH/gcc/gcc/BASE-VER ]]; then
GCC_VERSION=$(cat $SOURCE_PATH/gcc/gcc/BASE-VER)
else
GCC_VERSION="15.0.0"
fi

DEBUG=${DEBUG:-0} # Enable debug build.
CCACHE=${CCACHE:-0} # Enable usage of ccache.
RUN_BOOTSTRAP=${RUN_BOOTSTRAP:-0} # Bootstrap dependencies during the build.
Expand All @@ -74,7 +81,7 @@ RUN_CONFIG=${RUN_CONFIG:-1} # Run configuration step.
RUN_INSTALL=${RUN_INSTALL:-1} # Run installation step.
DELETE_BUILD=${DELETE_BUILD:-0} # Delete build folders after successful builds.

PATH="$PATH:$TOOLCHAIN_PATH/bin"
PATH="$PATH:$TOOLCHAIN_PATH/bin:$ARTIFACT_PATH/bin"
if [[ "$CCACHE" = 1 ]]; then
PATH=$CCACHE_LIB_DIR:$TOOLCHAIN_CCACHE_LIB_DIR:$PATH
export CCACHE_DIR=$CCACHE_DIR_PATH
Expand Down
9 changes: 6 additions & 3 deletions .github/scripts/ffmpeg/unpack-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
. $PSScriptRoot\..\config.ps1

Remove-Item $env:FFMPEG_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Write-Output "::group::Unpack FFmpeg tests"
Remove-Item $env:FFMPEG_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-ffmpeg-tests.zip -DestinationPath $env:FFMPEG_TESTS_PATH
Write-Output "::endgroup::"

Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-ffmpeg-tests.zip -DestinationPath $env:FFMPEG_TESTS_PATH
Write-Output 'Success!'
9 changes: 7 additions & 2 deletions .github/scripts/libjpeg-turbo/unpack-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
. $PSScriptRoot\..\config.ps1

Remove-Item $env:LIBJPEG_TURBO_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-libjpeg-turbo-tests.zip -DestinationPath $env:LIBJPEG_TURBO_TESTS_PATH
Write-Output "::group::Unpack libjpeg-turbo tests"
Remove-Item $env:LIBJPEG_TURBO_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-libjpeg-turbo-tests.zip -DestinationPath $env:LIBJPEG_TURBO_TESTS_PATH
Write-Output "::endgroup::"

Write-Output 'Success!'
9 changes: 7 additions & 2 deletions .github/scripts/openblas/unpack-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
. $PSScriptRoot\..\config.ps1

Remove-Item $env:OPENBLAS_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openblas-tests.zip -DestinationPath $env:OPENBLAS_TESTS_PATH
Write-Output "::group::Unpack OpenBLAS tests"
Remove-Item $env:OPENBLAS_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openblas-tests.zip -DestinationPath $env:OPENBLAS_TESTS_PATH
Write-Output "::endgroup::"

Write-Output 'Success!'
9 changes: 7 additions & 2 deletions .github/scripts/openssl/unpack-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
. $PSScriptRoot\..\config.ps1

Remove-Item $env:OPENSSL_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openssl-tests.zip -DestinationPath $env:OPENSSL_TESTS_PATH
Write-Output "::group::Unpack OpenSSL tests"
Remove-Item $env:OPENSSL_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openssl-tests.zip -DestinationPath $env:OPENSSL_TESTS_PATH
Write-Output "::endgroup::"

Write-Output 'Success!'
4 changes: 1 addition & 3 deletions .github/scripts/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
source `dirname ${BASH_SOURCE[0]}`/../config.sh

echo "::group::Build Aarch64 tests"
cd tests
cd $ROOT_PATH/tests
cmake -S . -B build
cmake --build build

cp $TOOLCHAIN_PATH/$TARGET/bin/*.dll build/bin
echo "::endgroup::"
9 changes: 9 additions & 0 deletions .github/scripts/tests/pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

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

echo "::group::Pack tests"
tar czf $ARTIFACT_PATH/$TESTS_PACKAGE_NAME -C $ROOT_PATH/tests/build/bin/ .
echo "::endgroup::"

echo 'Success!'
7 changes: 7 additions & 0 deletions .github/scripts/tests/unpack.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
. $PSScriptRoot\..\config.ps1

Write-Output "::group::Unpack tests"
tar xzf $env:ARTIFACT_PATH\$env:TESTS_PACKAGE_NAME -C $env:ARTIFACT_PATH
Write-Output "::endgroup::"

Write-Output 'Success!'
5 changes: 0 additions & 5 deletions .github/scripts/toolchain/build-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$GCC_BUILD_PATH/Makefile" ]]; then
TARGET_OPTIONS="$TARGET_OPTIONS \
--disable-libsanitizer"
;;
aarch64-*mingw*)
# CHANGED: --enable-shared to --disable-shared
TARGET_OPTIONS="$TARGET_OPTIONS \
--disable-shared"
;;
esac

$SOURCE_PATH/gcc/configure \
Expand Down
2 changes: 0 additions & 2 deletions .github/scripts/toolchain/build-mingw-crt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$MINGW_BUILD_PATH/Makefile" ]]; then
--disable-lib64 \
--disable-libarm32 \
--enable-libarm64"
CFLAGS="$CFLAGS \
-mno-outline-atomics"
;;
esac

Expand Down
9 changes: 1 addition & 8 deletions .github/scripts/toolchain/build-mingw-winpthreads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,12 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$MINGW_BUILD_PATH/Makefile" ]]; then
--enable-debug"
fi

case "$ARCH" in
aarch64)
CFLAGS="$CFLAGS \
-mno-outline-atomics"
;;
esac

$SOURCE_PATH/mingw/mingw-w64-libraries/winpthreads/configure \
--prefix=$TOOLCHAIN_PATH/$TARGET \
--build=$BUILD \
--host=$TARGET \
--enable-static \
--enable-shared \
--disable-shared \
$HOST_OPTIONS \
$TARGET_OPTIONS \
CFLAGS="$CFLAGS"
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/toolchain/build-mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$MINGW_BUILD_PATH/Makefile" ]]; then
--disable-lib64 \
--disable-libarm32 \
--enable-libarm64"
CFLAGS="$CFLAGS \
-mno-outline-atomics"
;;
esac

Expand Down Expand Up @@ -62,6 +60,8 @@ if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$MINGW_BUILD_PATH/Makefile" ]]; then
--prefix=$TOOLCHAIN_PATH/$TARGET \
--build=$BUILD \
--host=$TARGET \
--enable-static \
--enable-shared \
$HOST_OPTIONS \
$TARGET_OPTIONS \
CFLAGS="$CFLAGS"
Expand Down
10 changes: 10 additions & 0 deletions .github/scripts/toolchain/pack-runtime-mock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

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

echo "::group::Pack runtime mock"
mkdir -p $ARTIFACT_PATH
tar czf $ARTIFACT_PATH/$RUNTIME_PACKAGE_NAME --files-from /dev/null
echo "::endgroup::"

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

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

echo "::group::Pack runtime"
mkdir -p $ARTIFACT_PATH
find $TOOLCHAIN_PATH -name "*.dll" | tar --transform 's|.*/|./bin/|' -czf $ARTIFACT_PATH/$RUNTIME_PACKAGE_NAME -T -
echo "::endgroup::"

echo 'Success!'
7 changes: 7 additions & 0 deletions .github/scripts/toolchain/unpack-runtime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
. $PSScriptRoot\..\config.ps1

Write-Output "::group::Unpack runtime"
tar xzf $env:ARTIFACT_PATH\$env:RUNTIME_PACKAGE_NAME -C $env:ARTIFACT_PATH
Write-Output "::endgroup::"

Write-Output 'Success!'
13 changes: 9 additions & 4 deletions .github/scripts/zlib/unpack.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
. $PSScriptRoot\..\config.ps1

Remove-Item $env:ZLIB_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-zlib.zip -DestinationPath $env:ZLIB_PATH
Copy-Item $env:ZLIB_PATH/bin/*.dll $env:OPENSSL_TESTS_PATH/apps/
Copy-Item $env:ZLIB_PATH/bin/*.dll $env:OPENSSL_TESTS_PATH/test/
Write-Output "::group::Unpack zlib"
Remove-Item $env:ZLIB_PATH -Recurse -Force -ErrorAction Ignore
Set-PSDebug -Trace 0 # echo off
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-zlib.zip -DestinationPath $env:ZLIB_PATH
Copy-Item $env:ZLIB_PATH/bin/*.dll $env:OPENSSL_TESTS_PATH/apps/
Copy-Item $env:ZLIB_PATH/bin/*.dll $env:OPENSSL_TESTS_PATH/test/
Write-Output "::endgroup::"

Write-Output 'Success!'
Loading

0 comments on commit d897fe5

Please sign in to comment.