FS#58798 - strip mingw binaries

Attached to Project: Pacman
Opened by Michel (xantares) - Wednesday, 30 May 2018, 17:15 GMT
Last edited by Allan McRae (Allan) - Thursday, 19 July 2018, 03:13 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.1.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I would like makepkg to automatically strip the binaries of mingw packages (mingw-w64-*).

Typically these kind of packages have these options:
options=('!buildflags' 'staticlibs' '!strip')
The !strip tells not to strip as binaries are not elf, but stripping is still needed,
in the package section we always have to strip static (*.a), import (*.dll.a) and runtime libs (*.dll):

${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
(with _arch in {i686-w64-mingw32, x86_64-w64-mingw32})

The ${_arch}-strip programs come from the mingw-w64-binutils package.
This task depends upon

Closed by  Allan McRae (Allan)
Thursday, 19 July 2018, 03:13 GMT
Reason for closing:  Won't implement
Additional comments about closing:  Use a libmakepkg tidy pass to do this.
Comment by Eli Schwartz (eschwartz) - Wednesday, 30 May 2018, 23:53 GMT
What does the "file" command return for these files?

Do you think we should use the arch-dependent objcopy to create debug packages too? Does the logic we use, work for mingw binaries? See https://git.archlinux.org/pacman.git/tree/scripts/libmakepkg/tidy/strip.sh.in
Comment by Allan McRae (Allan) - Thursday, 31 May 2018, 00:13 GMT
I don't think this is a suitable addition to makepkg as it requires identifying just built tools for stripping files. This needs to be handled in the PKGBUILD.
Comment by Eli Schwartz (eschwartz) - Thursday, 31 May 2018, 03:08 GMT
Well, I'm thinking potentially a tidy-mingw routine provided by mingw-w64-binutils. Especially if the goal is to fully duplicate the effects of the tidy routine.

Or, it might be as simple as offering a $STRIP or $STRIP_PREFIX configurable.
Comment by Allan McRae (Allan) - Thursday, 31 May 2018, 03:49 GMT
A mingw pass dropped into libmakepkg by mingw-w64-binutils is a good solution. This does not need any changes to makepkg itself.
Comment by Michel (xantares) - Thursday, 31 May 2018, 13:23 GMT
So how do I do that ? Is it some kind of hook script ?
Comment by Eli Schwartz (eschwartz) - Thursday, 31 May 2018, 14:16 GMT
Well, we need documentation for this, but that's covered by FS#58769 :D

Essentially, just create a new file in /usr/share/makepkg/tidy/ and libmakepkg will automatically source it. See the format of the other files in there (as well as /usr/share/makepkg/tidy.sh itself) to see how each tidy/*.sh file defines a function and hooks that into makepkg's tidy_remove and tidy_modify arrays.

Loading...