pkg_strip: add initial support

This commit is contained in:
Muhammad Herdiansyah 2019-06-10 11:43:55 +07:00
parent fe00112963
commit c2974e0179

14
puke
View File

@ -83,6 +83,19 @@ pkg_build() {
log "Sucessfully built $pkg." 2> "$pkg_db/$name/manifest"
}
pkg_strip() {
find "$pkg_dir" -type f | while read -r binary; do
case "$(file -bi "$binary")" in
application/x-sharedlib*|application/x-pie-executable*)
strip_opts="--strip-unneeded"
;;
application/x-archive*) strip_opts="--strip-debug" ;;
application/x-executable*) strip_opts="--strip-all" ;;
esac
strip "$strip_opts" "$binary" 2>/dev/null
done
}
pkg_manifest() {
(cd "$pkg_dir" && find ./*) | sed ss.ss | tac |
tee manifest > "$pkg_db/$name/manifest"
@ -147,6 +160,7 @@ args() {
pkg_verify
pkg_extract
pkg_build
pkg_strip
pkg_manifest
pkg_tar ;;