pkgmeek: strip binary files using multiple threads
This commit is contained in:
parent
750e998c93
commit
1ef86cb3ec
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
######################## main routine ################################
|
######################## main routine ################################
|
||||||
local pkg_dir src_dir work _local_ here url u pkg_utd f DIR TARGET
|
local N pkg_dir src_dir work _local_ here url u pkg_utd f DIR TARGET
|
||||||
local errDL=0; local errUZ=0; local BSDTAR="/usr/bin/bsdtar --format=gnutar"
|
local errDL=0; local errUZ=0; local BSDTAR="/usr/bin/bsdtar --format=gnutar"
|
||||||
declare -A ZFLAG=([xz]="-J" [bz2]="-j" [gz]="-z" [lz4]="--lz4" [zstd]="--zstd")
|
declare -A ZFLAG=([xz]="-J" [bz2]="-j" [gz]="-z" [lz4]="--lz4" [zstd]="--zstd")
|
||||||
parse_options "$@"
|
parse_options "$@"
|
||||||
@ -149,15 +149,17 @@ if [ "$pkg_utd" = 0 ] || [[ "$PKGMK_FORCE $PKGMK_EXTRACT_ONLY" =~ yes ]]; then
|
|||||||
|| { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; }
|
|| { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; }
|
||||||
|
|
||||||
# Strip binaries
|
# Strip binaries
|
||||||
|
N=$(nproc)
|
||||||
[ -n "$ns_filter" ] || [ ! -f "$PKGMK_ROOT/.nostrip" ] \
|
[ -n "$ns_filter" ] || [ ! -f "$PKGMK_ROOT/.nostrip" ] \
|
||||||
|| ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip"
|
|| ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip"
|
||||||
{ while read -r f; do
|
ns_filter+="| xargs -r -L10 -P$N file --no-buffer --separator '>'"
|
||||||
case $(file -b "$f") in
|
ns_filter+=" -e apptype -e text -e encoding -e cdf -e compress -e tar"
|
||||||
*ELF*executable*not\ stripped*) strip --strip-all "$f" ;;
|
|
||||||
*ELF*shared\ object*not\ stripped*) strip --strip-unneeded "$f" ;;
|
< <(eval find pkg -type f -printf "%P\n" $ns_filter) awk 'BEGIN { FS=">[ ]+" }
|
||||||
current\ ar\ archive) strip --strip-debug "$f" ;;
|
$0 ~ /ELF.*executable.*not stripped/ { print "--strip-all \"" $1 "\"" }
|
||||||
esac
|
$0 ~ /ELF.*shared object.*not stripped/ { print "--strip-unneeded \"" $1 "\"" }
|
||||||
done } < <(eval find pkg -type f $ns_filter)
|
$2 == "current ar archive" { print "--strip-debug \"" $1 "\"" }' \
|
||||||
|
| xargs -r -L1 -P$N strip
|
||||||
|
|
||||||
# Compress anything under /man that does not appear to be gzipped
|
# Compress anything under /man that does not appear to be gzipped
|
||||||
find pkg -type f -path "*/man/man*/*" \! -iname '*.gz' \
|
find pkg -type f -path "*/man/man*/*" \! -iname '*.gz' \
|
||||||
|
Loading…
Reference in New Issue
Block a user