diff --git a/scripts/pkgmeek b/scripts/pkgmeek index 1972c02..91512e8 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -8,7 +8,7 @@ main() { ######################## 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" declare -A ZFLAG=([xz]="-J" [bz2]="-j" [gz]="-z" [lz4]="--lz4" [zstd]="--zstd") 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"; } # Strip binaries + N=$(nproc) [ -n "$ns_filter" ] || [ ! -f "$PKGMK_ROOT/.nostrip" ] \ || ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip" - { while read -r f; do - case $(file -b "$f") in - *ELF*executable*not\ stripped*) strip --strip-all "$f" ;; - *ELF*shared\ object*not\ stripped*) strip --strip-unneeded "$f" ;; - current\ ar\ archive) strip --strip-debug "$f" ;; - esac - done } < <(eval find pkg -type f $ns_filter) + ns_filter+="| xargs -r -L10 -P$N file --no-buffer --separator '>'" + ns_filter+=" -e apptype -e text -e encoding -e cdf -e compress -e tar" + + < <(eval find pkg -type f -printf "%P\n" $ns_filter) awk 'BEGIN { FS=">[ ]+" } + $0 ~ /ELF.*executable.*not stripped/ { print "--strip-all \"" $1 "\"" } + $0 ~ /ELF.*shared object.*not stripped/ { print "--strip-unneeded \"" $1 "\"" } + $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 find pkg -type f -path "*/man/man*/*" \! -iname '*.gz' \