The following sets of commands were moved into tidy_install() * Remove info/doc files. * Move usr/share/man to usr/man * Compress man pages. * Strip debug symbols from binaries/libraries. * Remove libtool *.la files. * Remove empty directories. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 5ec5e03..03d8eb1 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -356,6 +356,67 @@ removedeps() { fi } +tidy_install () { + if [ "$(check_option docs)" = "n" ]; then + # remove info/doc files + msg "$(gettext "Removing info/doc files...")" + cd "$startdir/pkg" + #fix flyspray bug #5021 + rm -rf ${DOC_DIRS[@]} + fi + + # move /usr/share/man files to /usr/man + if [ -d $startdir/pkg/usr/share/man ]; then + cd "$startdir" + mkdir -p pkg/usr/man + cp -a pkg/usr/share/man/* pkg/usr/man/ + rm -rf pkg/usr/share/man + fi + + # compress man pages + msg "$(gettext "Compressing man pages...")" + find "$startdir"/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do + ext="${i##*.}" + fn="${i##*/}" + if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then + # update symlinks to this manpage + find "$startdir"/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do + rm -f "$ln" + ln -sf "${fn}.gz" "${ln}.gz" + done + # compress the original + gzip -9 "$i" + fi + done + + cd "$startdir" + + # strip binaries + if [ "$(check_option strip)" = "y" ]; then + msg "$(gettext "Stripping debugging symbols from libraries...")" + find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \ + -exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \ + | grep -v "No such file" | grep -v "format not recognized" + msg "$(gettext "Stripping symbols from binaries...")" + find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \ + -exec /usr/bin/strip '{}' \; 2>&1 \ + | grep -v "No such file" | grep -v "format not recognized" + fi + + # remove libtool (.la) files + if [ "$(check_option libtool)" = "n" ]; then + msg "$(gettext "Removing libtool .la files...")" + find pkg -type f -name "*.la" -exec rm -f -- '{}' \; + fi + + # remove empty directories + if [ "$(check_option emptydirs)" = "n" ]; then + msg "$(gettext "Removing empty directories...")" + cd "$startdir/pkg" + find -depth -type d -empty -delete; + fi +} + create_package () { cd "$startdir"/pkg msg "$(gettext "Creating package...")" @@ -1019,64 +1080,7 @@ else fi fi -if [ "$(check_option docs)" = "n" ]; then - # remove info/doc files - msg "$(gettext "Removing info/doc files...")" - cd "$startdir/pkg" - #fix flyspray bug #5021 - rm -rf ${DOC_DIRS[@]} -fi - -# move /usr/share/man files to /usr/man -if [ -d $startdir/pkg/usr/share/man ]; then - cd "$startdir" - mkdir -p pkg/usr/man - cp -a pkg/usr/share/man/* pkg/usr/man/ - rm -rf pkg/usr/share/man -fi - -# compress man pages -msg "$(gettext "Compressing man pages...")" -find "$startdir"/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do - ext="${i##*.}" - fn="${i##*/}" - if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then - # update symlinks to this manpage - find "$startdir"/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do - rm -f "$ln" - ln -sf "${fn}.gz" "${ln}.gz" - done - # compress the original - gzip -9 "$i" - fi -done - -cd "$startdir" - -# strip binaries -if [ "$(check_option strip)" = "y" ]; then - msg "$(gettext "Stripping debugging symbols from libraries...")" - find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \ - -exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \ - | grep -v "No such file" | grep -v "format not recognized" - msg "$(gettext "Stripping symbols from binaries...")" - find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name "*.dll" -not -name "*.exe" \ - -exec /usr/bin/strip '{}' \; 2>&1 \ - | grep -v "No such file" | grep -v "format not recognized" -fi - -# remove libtool (.la) files -if [ "$(check_option libtool)" = "n" ]; then - msg "$(gettext "Removing libtool .la files...")" - find pkg -type f -name "*.la" -exec rm -f -- '{}' \; -fi - -# remove empty directories -if [ "$(check_option emptydirs)" = "n" ]; then - msg "$(gettext "Removing empty directories...")" - cd "$startdir/pkg" - find -depth -type d -empty -delete; -fi +tidy_install create_package -- 1.5.0.6