about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh')
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh b/nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh
new file mode 100644
index 000000000000..22322468f76d
--- /dev/null
+++ b/nixpkgs/pkgs/build-support/setup-hooks/strip-java-archives.sh
@@ -0,0 +1,16 @@
+# This setup hook makes the fixup phase to repack all java archives in a
+# deterministic fashion. The most important change being done is the resetting
+# of the modification times of the archive entries
+
+fixupOutputHooks+=('stripJavaArchivesIn $prefix')
+
+stripJavaArchivesIn() {
+    local dir="$1"
+    echo "stripping java archives in $dir"
+    find $dir -type f -regextype posix-egrep -regex ".*\.(jar|war|hpi|apk)$" -print0 |
+    while IFS= read -rd '' f; do
+        echo "stripping java archive $f"
+        strip-nondeterminism --type jar "$f"
+    done
+}
+