Signed-off-by: Allan McRae <[email protected]>
---
 doc/PKGBUILD.5.txt     |  2 ++
 doc/makepkg.conf.5.txt |  3 ++-
 scripts/makepkg.sh.in  | 25 +++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index 113e2c4..178519b 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -277,6 +277,8 @@ A normal sync or upgrade will not use its value.
        *debug*;;
                Add the user-specified debug flags (DEBUG_CFLAGS, 
DEBUG_CXXFLAGS) to
                their counterpart buildflags as specified in 
linkman:makepkg.conf[5].
+               When used in combination with the `strip' option, a separate 
package
+               containing the debug symbols is created.
 
 build() Function
 ----------------
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index cf7026c..cca4121 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -175,7 +175,8 @@ Options
 
        *debug*;;
                Add the user-specified debug flags as specified in DEBUG_CFLAGS 
and
-               DEBUG_CXXFLAGS to their counterpart buildflags.
+               DEBUG_CXXFLAGS to their counterpart buildflags. Creates a 
separate
+               package containing the debug symbols with used with `strip'.
 
 **INTEGRITY_CHECK=(**check1 ...**)**::
        File integrity checks to use. Multiple checks may be specified; this
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e247cad..e48de31 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1861,6 +1861,28 @@ create_package() {
        fi
 }
 
+create_debug_package() {
+       # check if a debug package was requested
+       if ! check_option "debug" "y" || ! check_option "strip" "y"; then
+               return
+       fi
+
+       pkgdir="${pkgdir}-debug"
+
+       # check if we have any debug symbols to package
+       if dir_is_empty "$pkgdir/usr/lib/debug"; then
+               return
+       fi
+
+       depends=("$pkgname=$(get_full_version)")
+       pkgdesc="Detached debugging symbols for $pkgname"
+       pkgname=$pkgname-debug
+
+       unset groups optdepends provides conflicts replaces backup install 
changelog
+
+       create_package
+}
+
 create_signature() {
        if [[ $SIGNPKG != 'y' ]]; then
                return
@@ -2321,6 +2343,7 @@ run_split_packaging() {
                run_package $pkgname
                tidy_install
                create_package
+               create_debug_package
                restore_package_variables
                pkgdir="${pkgdir%/*}"
        done
@@ -2741,6 +2764,7 @@ if (( INFAKEROOT )); then
                fi
                tidy_install
                create_package
+               create_debug_package
                pkgdir="${pkgdir%/*}"
        else
                run_split_packaging
@@ -2879,6 +2903,7 @@ else
                        fi
                        tidy_install
                        create_package
+                       create_debug_package
                        pkgdir="${pkgdir%/*}"
                else
                        run_split_packaging
-- 
1.7.12.1


Reply via email to