strip: split off file stripping and debug package creation

Some projects might duplicate the file in multiple locations for one
reason or another. When debug packages are enabled, `makepkg` will only
strip the first occurrence of the binary and abort early on all the
other binaries.

Signed-off-by: Morten Linderud <morten@linderud.pw>
This commit is contained in:
Morten Linderud 2022-12-21 17:52:57 +01:00
parent 8d38746586
commit 7a4fff3310
No known key found for this signature in database
GPG key ID: 9C02FF419FECBE16

View file

@ -66,7 +66,7 @@ package_source_files() {
done < <(source_files "$binary")
}
strip_file() {
collect_debug_symbols() {
local binary=$1; shift
if check_option "debug" "y"; then
@ -118,7 +118,10 @@ strip_file() {
ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug"
fi
fi
}
strip_file(){
local binary=$1; shift
local tempfile=$(mktemp "$binary.XXXXXX")
if strip "$@" "$binary" -o "$tempfile"; then
cat "$tempfile" > "$binary"
@ -174,6 +177,7 @@ tidy_strip() {
*)
continue ;;
esac
collect_debug_symbols "$binary"
strip_file "$binary" ${strip_flags}
(( STRIPLTO )) && strip_lto "$binary"
done