summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/tidy
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/libmakepkg/tidy')
-rw-r--r--scripts/libmakepkg/tidy/docs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/emptydirs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/libtool.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/purge.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/staticlibs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/strip.sh.in27
-rw-r--r--scripts/libmakepkg/tidy/zipman.sh.in2
7 files changed, 29 insertions, 10 deletions
diff --git a/scripts/libmakepkg/tidy/docs.sh.in b/scripts/libmakepkg/tidy/docs.sh.in
index ac86573b..0919f201 100644
--- a/scripts/libmakepkg/tidy/docs.sh.in
+++ b/scripts/libmakepkg/tidy/docs.sh.in
@@ -2,7 +2,7 @@
#
# docs.sh - Remove documentation files from the package
#
-# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2008-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/libmakepkg/tidy/emptydirs.sh.in b/scripts/libmakepkg/tidy/emptydirs.sh.in
index 85ab39df..2b16afdf 100644
--- a/scripts/libmakepkg/tidy/emptydirs.sh.in
+++ b/scripts/libmakepkg/tidy/emptydirs.sh.in
@@ -2,7 +2,7 @@
#
# emptydirs.sh - Remove empty directories from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/libmakepkg/tidy/libtool.sh.in b/scripts/libmakepkg/tidy/libtool.sh.in
index e8187c78..b844c792 100644
--- a/scripts/libmakepkg/tidy/libtool.sh.in
+++ b/scripts/libmakepkg/tidy/libtool.sh.in
@@ -2,7 +2,7 @@
#
# libtool.sh - Remove libtool files from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/libmakepkg/tidy/purge.sh.in b/scripts/libmakepkg/tidy/purge.sh.in
index 501d7531..5d37ded5 100644
--- a/scripts/libmakepkg/tidy/purge.sh.in
+++ b/scripts/libmakepkg/tidy/purge.sh.in
@@ -2,7 +2,7 @@
#
# purge.sh - Remove unwanted files from the package
#
-# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2008-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/libmakepkg/tidy/staticlibs.sh.in b/scripts/libmakepkg/tidy/staticlibs.sh.in
index 07282a80..643932dd 100644
--- a/scripts/libmakepkg/tidy/staticlibs.sh.in
+++ b/scripts/libmakepkg/tidy/staticlibs.sh.in
@@ -2,7 +2,7 @@
#
# staticlibs.sh - Remove static library files from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 1c7aacfd..76562808 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -2,7 +2,7 @@
#
# strip.sh - Strip debugging symbols from binary files
#
-# Copyright (c) 2007-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2007-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,12 @@ tidy_modify+=('tidy_strip')
build_id() {
- LANG=C readelf -n $1 | sed -n '/Build ID/ { s/.*: //p; q; }'
+ LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }'
+}
+
+source_files() {
+ LANG=C readelf "$1" --debug-dump | \
+ awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{print $8 "/" name}'
}
strip_file() {
@@ -50,6 +55,18 @@ strip_file() {
return
fi
+ # copy source files to debug directory
+ local f t
+ while read -r f; do
+ t=${f/"$srcdir"/$dbgsrc}
+ mkdir -p "${t%/*}"
+ cp -- "$f" "$t"
+ done < <(source_files "$binary")
+
+ # adjust debug symbols to point at sources
+ debugedit -b "${srcdir}" -d /usr/src/debug/ -i "$binary" &> /dev/null
+
+ # copy debug symbols to debug directory
mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
@@ -88,8 +105,10 @@ tidy_strip() {
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then
- dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
- mkdir -p "$dbgdir"
+
+ dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
+ dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/src/debug"
+ mkdir -p "$dbgdir" "$dbgsrc"
fi
local binary strip_flags
diff --git a/scripts/libmakepkg/tidy/zipman.sh.in b/scripts/libmakepkg/tidy/zipman.sh.in
index 7ef4d5c3..ff82d43c 100644
--- a/scripts/libmakepkg/tidy/zipman.sh.in
+++ b/scripts/libmakepkg/tidy/zipman.sh.in
@@ -2,7 +2,7 @@
#
# zipman.sh - Compress man and info pages
#
-# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2011-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by