diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-06-29 15:09:07 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-06-29 15:09:07 +0000 |
commit | dba11ac3f2902e9594dfecb042f0760ad0995e1c (patch) | |
tree | 00a8ca585a4faf2895a00601bf0ac4ae6bca934c /kiss-new | |
parent | 9d0f5648a23cb02514c12c4cf8ded92654a9c27c (diff) | |
download | cpt-dba11ac3f2902e9594dfecb042f0760ad0995e1c.tar.gz |
kiss-new: Added package stripping.
FossilOrigin-Name: 3c9ac3670356e71820021023c00c4c31c89766fa7d67e2f76ee3f8eb596ec9a6
Diffstat (limited to 'kiss-new')
-rwxr-xr-x | kiss-new | 42 |
1 files changed, 38 insertions, 4 deletions
@@ -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. |