FS#42848 - [pacman] 'makepkg' should be more cross-compiler friendly

Attached to Project: Pacman
Opened by Anatol Pomozov (anatolik) - Wednesday, 19 November 2014, 15:49 GMT
Last edited by Doug Newgard (Scimmia) - Wednesday, 19 November 2014, 16:10 GMT
Task Type Bug Report
Category Packages: Extra
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

There are issues when using standard Arch toolset for cross-compiled projects.

makepkg strips libraries. It uses "strip" native binary that works only for current architecture binaries. This is the problem for cross-compiled packages. Although these packages are created for user's architectures (x86) they contain binaries for some other arch (arm/arm64/avr/...). And proper toolchain should be used - e.g. arm-none-eabi-strip should be used for arm embedded libs.

Currently makepkg does not strip such cross-compiled binaries correctly. The package maintainers have to use '!strip' option and call *-strip manually.

The code that does stripping comes from makepkg.in https://projects.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n1750 function strip_file()

It is not clear for me how this function should find exact toolchain. Here are several ideas:

1) Use information from 'file' to find what toolchain to use. It is example of output for 'arm-none-eabi' arch
$ file /usr/arm-none-eabi/lib/crt0.o
/usr/arm-none-eabi/lib/crt0.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped

2) It seems all (??) cross-compile libraries are kept in /usr/arm-none-eabi/lib/. Thus we can check if a package contains /usr/XXX/lib then assume XXX is architecture.

3) Check if make dependencies contains XXX-binutils. e.g. arm-none-eabi-binutils. If it presents assume user builds corss-compiled package.




An example of such cross-compile project is https://aur.archlinux.org/packages/libopencm3-git that uses arm-none-eabi toolchain.
This task depends upon

Loading...