From 87a57ce2af12d40008f71f552a7c55a91a5b948c Mon Sep 17 00:00:00 2001 From: mj-xmr Date: Fri, 9 Jul 2021 18:06:13 +0200 Subject: [PATCH] Depends: mingw32-update-gcc-posix.sh script Extract the setting of the MinGW x-compiled to POSIX into a script. --- .github/workflows/depends.yml | 4 +--- contrib/depends/README.md | 6 +++++ .../depends/util/mingw32-update-gcc-posix.sh | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 contrib/depends/util/mingw32-update-gcc-posix.sh diff --git a/.github/workflows/depends.yml b/.github/workflows/depends.yml index 74d0ceabc0e..b81326fffab 100644 --- a/.github/workflows/depends.yml +++ b/.github/workflows/depends.yml @@ -88,9 +88,7 @@ jobs: if [ -f contrib/depends/sdk-sources/MacOSX${{ matrix.toolchain.osx_sdk }}.sdk.tar.gz ]; then tar -C contrib/depends/SDKs -xf contrib/depends/sdk-sources/MacOSX${{ matrix.toolchain.osx_sdk }}.sdk.tar.gz; fi - name: prepare w64-mingw32 if: ${{ matrix.toolchain.host == 'x86_64-w64-mingw32' || matrix.toolchain.host == 'i686-w64-mingw32' }} - run: | - sudo update-alternatives --set ${{ matrix.toolchain.host }}-g++ $(which ${{ matrix.toolchain.host }}-g++-posix) - sudo update-alternatives --set ${{ matrix.toolchain.host }}-gcc $(which ${{ matrix.toolchain.host }}-gcc-posix) + run: sudo contrib/depends/util/mingw32-update-gcc-posix.sh ${{ matrix.toolchain.host }} - name: build run: | ${{env.CCACHE_SETTINGS}} diff --git a/contrib/depends/README.md b/contrib/depends/README.md index 10866acbe87..f990312cda5 100644 --- a/contrib/depends/README.md +++ b/contrib/depends/README.md @@ -76,6 +76,12 @@ update-alternatives --set x86_64-w64-mingw32-g++ x86_64-w64-mingw32-g++-posix update-alternatives --set x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gcc-posix ``` +or simply: + +```bash +sudo contrib/depends/util/mingw32-update-gcc-posix.sh x86_64-w64-mingw32 +``` + ### Other documentation - [description.md](description.md): General description of the depends system diff --git a/contrib/depends/util/mingw32-update-gcc-posix.sh b/contrib/depends/util/mingw32-update-gcc-posix.sh new file mode 100755 index 00000000000..4ccdda11492 --- /dev/null +++ b/contrib/depends/util/mingw32-update-gcc-posix.sh @@ -0,0 +1,22 @@ +#!/bin/sh -e + +# Sets mingw cross compiler to POSIX version. + +TOOLCHAIN="$1" + +if [ -z "$TOOLCHAIN" ]; then + echo "Please supply the toolchain as the first argument, for example:" + echo "x86_64-w64-mingw32" + echo "i686-w64-mingw32" + exit 1 +fi + +if (! which "${TOOLCHAIN}"-g++-posix); then + echo "Toolchain '${TOOLCHAIN}' is not installed!" + exit 1 +fi + +update-alternatives --set "${TOOLCHAIN}"-g++ $(which "${TOOLCHAIN}"-g++-posix) +update-alternatives --set "${TOOLCHAIN}"-gcc $(which "${TOOLCHAIN}"-gcc-posix) + +echo "Toolchain '$TOOLCHAIN' is set to POSIX successfuly."