From 583baaa612a0fa2aa89b56ad3c71b265f39d5b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 8 Nov 2017 12:09:01 +0200 Subject: [PATCH] Make windres output in res format instead of in coff This makes the output architecture independent, allowing the x86_64 GNU binutils binary to be used for other architectures as well, including arm/arm64 which aren't supported by binutils. --- Dockerfile | 2 +- README.md | 8 ++++++++ install-wrappers.sh | 4 ++-- wrappers/windres-wrapper.sh | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100755 wrappers/windres-wrapper.sh diff --git a/Dockerfile b/Dockerfile index 49ffdac..d81c13d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN ./install-wrappers.sh $TOOLCHAIN_PREFIX # llvm-rc isn't fully usable as a replacement for windres yet. RUN apt-get update -qq && \ apt-get install -qqy binutils-mingw-w64-x86-64 && \ - cp /usr/bin/x86_64-w64-mingw32-windres $TOOLCHAIN_PREFIX/bin && \ + cp /usr/bin/x86_64-w64-mingw32-windres $TOOLCHAIN_PREFIX/bin/x86_64-w64-mingw32-windresreal && \ apt-get remove -qqy binutils-mingw-w64-x86-64 && \ cd $TOOLCHAIN_PREFIX/bin diff --git a/README.md b/README.md index 493bf40..c393220 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,14 @@ a different version) - and likewise, if configure flags in the build-*.sh scripts have changed, you might need to wipe the build directory under each project for the new configure options to be taken into use. +If building without the dockerfile, manually install a copy of normal +GNU binutils windres with the name `x86_64-w64-mingw32-windresreal`. +Wrappers named `-windres` are installed that call this binary +with the necessary options to make it output in the arch independent +res format, allowing using it for all architectures, even those that +GNU binutils don't support. (LLVM does provide a similar tool, llvm-rc, +but it's not yet ready to actually replace windres in all cases.) + Status diff --git a/install-wrappers.sh b/install-wrappers.sh index 1329214..28f30ca 100755 --- a/install-wrappers.sh +++ b/install-wrappers.sh @@ -11,7 +11,7 @@ PREFIX="$1" : ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}} mkdir -p $PREFIX/bin -cp wrappers/clang-target-wrapper.sh wrappers/objdump-wrapper.sh wrappers/ld-wrapper.sh $PREFIX/bin +cp wrappers/clang-target-wrapper.sh wrappers/objdump-wrapper.sh wrappers/ld-wrapper.sh wrappers/windres-wrapper.sh $PREFIX/bin cd $PREFIX/bin for arch in $ARCHS; do for exec in clang clang++ gcc g++; do @@ -23,7 +23,7 @@ for arch in $ARCHS; do for exec in strip; do ln -sf /bin/true $arch-w64-mingw32-$exec done - for exec in ld objdump; do + for exec in ld objdump windres; do ln -sf $exec-wrapper.sh $arch-w64-mingw32-$exec done done diff --git a/wrappers/windres-wrapper.sh b/wrappers/windres-wrapper.sh new file mode 100755 index 0000000..9f8adb7 --- /dev/null +++ b/wrappers/windres-wrapper.sh @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +x86_64-w64-mingw32-windresreal "$@" --output-format res