1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-24 16:10:05 -07:00

kiss-new: Added package stripping.

This commit is contained in:
Dylan Araps 2019-06-29 18:09:07 +03:00
parent 7f903ff682
commit 303a80c9d9

View File

@ -319,20 +319,54 @@ pkg_build() {
# structure.
repo_dir=$(pkg_search "$pkg")
# Install built packages to a directory under the package name
# to avod collisions with other packages.
mkdir -p "$pkg_dir/$pkg/var/db/$kiss"
# Move to the build directory and call the build script.
(cd "$mak_dir/$pkg"; "$repo_dir/build" "$pkg_dir") ||
(cd "$mak_dir/$pkg"; "$repo_dir/build" "$pkg_dir/$pkg") ||
die "[$pkg]: Build failed."
# Copy the repository files to the package directory.
# This acts as the database entry.
cp -Rf "$repo_dir" "$pkg_db"
cp -Rf "$repo_dir" "$pkg_dir/$pkg/var/db/$kiss"
log "[$pkg]: Sucessfully built package."
# Create the manifest file early and make it empty.
# This ensure that the manifest is added to the manifest...
: > "$pkg_db/$pkg/manifest"
: > "$pkg_dir/$pkg/var/db/$kiss/$pkg/manifest"
done
log "Stripping packages..."
for pkg; do
# Find the package's repository files. This needs to keep
# happening as we can't store this data in any kind of data
# structure.
repo_dir=$(pkg_search "$pkg")
# Package has stripping disabled, stop here.
[ -f "$repo_dir/nostrip" ] && continue
log "[$pkg]: Stripping binaries and libraries..."
find "$pkg_dir/$pkg" -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 ;;
*) continue ;;
esac
strip "$strip_opts" "$binary" 2>/dev/null
done
done
log "Stripped all binaries and libraries."
}
pkg_checksums() {
@ -397,7 +431,7 @@ setup_caching() {
die "Couldn't create build directory ($mak_dir)."
# Package directory.
mkdir -p "${pkg_db:=${pkg_dir:=$cac_dir/pkg-$pid}/var/db/$kiss}" ||
mkdir -p "${pkg_dir:=$cac_dir/pkg-$pid}" ||
die "Couldn't create package directory ($pkg_dir)."
# Tar directory.