Skip to content

Commit 745e6ae

Browse files
committed
msys2-runtime: avoid stripping to allow code-signing again
Third parties commonly code-sign the MSYS2 runtime when ingesting MinGit, as a way to attest the integrity (_not_ to testify that they have vetted all the supply chain!). This is currently broken, failing with: SignTool Error: SignedCode::Sign returned error: 0x800700C1   %1 is not a valid Win32 application. SignTool Error: An error occurred while attempting to sign: msys-2.0.dll The reason is that the MSYS toolchain's version of `strip.exe` somehow changes the structure of the output files that are incompatible with `signtool.exe`, as had been identified in ffd1140 (bash: avoid stripping after code-signing, 2022-05-02). Therefore, as of 667799c (msys2-runtime: strip it, 2022-12-19), the `msys-2.0.dll` file (and all of the Cygwin utilities like `cygwin-console-helper.exe`) can no longer be signed. So let's revert that change. However, we _must_ be _very_ careful not to regress on the cause for that commit: It was triggered by Cygwin's build process all of a sudden including all the debug information in the `msys-2.0.dll` file, which makes it roughly 10x larger (and it already weighs ~3MB to begin with). The saving grace is that we can put `-g0` into the `CFLAGS`/`CXXFLAGS` variables that are hard-coded in the `PKGBUILD` file. This prevents debug information from being generated in th first place, hence avoiding the need to strip the executables. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6906441 commit 745e6ae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

msys2-runtime/PKGBUILD

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pkgbase=msys2-runtime
55
pkgname=('msys2-runtime' 'msys2-runtime-devel')
66
pkgver=3.6.4
7-
pkgrel=1
7+
pkgrel=2
88
pkgdesc="Cygwin POSIX emulation engine"
99
arch=('x86_64')
1010
url="https://www.cygwin.com/"
@@ -237,8 +237,10 @@ build() {
237237
OPTIM="-O2"
238238
fi
239239

240-
CFLAGS="$OPTIM -pipe -ggdb"
241-
CXXFLAGS="$OPTIM -pipe -ggdb"
240+
# We use `-g0` here to suppress debug symbols, to avoid having to call `strip.exe`
241+
# on the binary files (which would break code-signing those files).
242+
CFLAGS="$OPTIM -pipe -g0"
243+
CXXFLAGS="$OPTIM -pipe -g0"
242244

243245
# otherwise it asks git which appends "-dirty" because of our uncommited patches
244246
CFLAGS+=" -DCYGPORT_RELEASE_INFO=${pkgver}"
@@ -265,6 +267,7 @@ build() {
265267

266268
package_msys2-runtime() {
267269
pkgdesc="Posix emulation engine for Windows"
270+
options=('!strip')
268271
conflicts=('catgets' 'libcatgets' 'msys2-runtime-3.6')
269272
replaces=('catgets' 'libcatgets' 'msys2-runtime-3.6')
270273

0 commit comments

Comments
 (0)