--- /dev/null
+From 9cbc043da8bcbd52ab3ef9b710abcbcd3a72fb84 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Sun, 10 Feb 2013 15:34:02 +0100
+Subject: [PATCH 13/17] Enhance perl cleanup.
+
+.bs files with size == 0 get removed.
+---
+ macros/build.macro | 13 +++----------
+ macros/perl.macro | 19 +++++++++++++++++++
+ 2 files changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/macros/build.macro b/macros/build.macro
+index 4e4d830..0979653 100644
+--- a/macros/build.macro
++++ b/macros/build.macro
+@@ -59,15 +59,6 @@ def MACRO_PYTHON_COMPILE
+ fi
+ end
+
+-MACRO_PERL_CLEANUP
+- # Remove perllocal.pod.
+- rm -f %{BUILDROOT}/usr/lib*/perl*/perllocal.pod
+-
+- # Remove all .packlist files.
+- find %{BUILDROOT}/usr/{lib,share}/perl* -name ".packlist" 2>/dev/null | \
+- xargs --no-run-if-empty rm -f
+-end
+-
+ MACRO_PATCHES = /usr/lib/pakfire/patch --search-path=%{DIR_PATCHES} "%{patches}"
+
+ # Pre-defined build scripts.
+@@ -145,7 +136,9 @@ build
+
+ %{MACRO_INSTALL_FILES}
+ %{MACRO_PYTHON_COMPILE}
+- %{MACRO_PERL_CLEANUP}
++
++ # Cleanup perl modules.
++ %{perl_cleanup}
+
+ %{install_post}
+
+diff --git a/macros/perl.macro b/macros/perl.macro
+index c1be59f..b29e028 100644
+--- a/macros/perl.macro
++++ b/macros/perl.macro
+@@ -7,3 +7,22 @@ perl_vendorarch = %(eval "$(%{perl} -V:installvendorarch)"; echo ${installvendor
+ perl_vendorlib = %(eval "$(%{perl} -V:installvendorlib)"; echo ${installvendorlib})
+ perl_archlib = %(eval "$(%{perl} -V:installarchlib)"; echo ${installarchlib})
+ perl_privlib = %(eval "$(%{perl} -V:installprivlib)"; echo ${installprivlib})
++
++perl_all_paths = {%{perl_vendorarch},%{perl_vendorlib},%{perl_archlib},%{perl_privlib}}
++
++# perl_cleanup: Removes unwanted perl files.
++perl_cleanup
++ # Remove perllocal.pod.
++ rm -f %{BUILDROOT}%{perl_all_paths}/perllocal.pod
++
++ # Remove all .packlist files.
++ find %{BUILDROOT}%{perl_all_paths} -name ".packlist" 2>/dev/null | \
++ xargs --no-run-if-empty rm -f
++
++ # Remove all empty .bs files.
++ find %{BUILDROOT}%{perl_all_paths} -name ".bs" -type f -empty 2>/dev/null | \
++ xargs --no-run-if-empty rm -f
++
++ # Run user-defined stuff.
++ %{perl_cleanup_cmds}
++end
+--
+1.8.1.2
+