1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 [[ -n $BASH_VERSION ]] && shopt -s extglob
8 if [[ -z $prefix ]]; then
9 echo >&2 "$SELF: strip command not defined ('prefix' variable not set)"
13 if [[ $1 = +keep
]]; then
17 stripcomm
=" -R .comment"
22 if [[ -z $TARGETS ]]; then
23 echo >&2 "$SELF: no directories / files specified"
24 echo >&2 "usage: $SELF [PATH...]"
28 find $TARGETS -type f
-a -exec file {} \
; | \
29 while IFS
= read -r line
; do
32 V
=${F##*/fake-+([!/])/}
33 P
=${F##*/pkg-+([!/])/}
40 *ELF
*executable
*statically\ linked
*)
42 *ELF
*relocatable
*,\ not\ stripped
*)
46 *ELF
*executable
*,\ not\ stripped
*)
48 */lib
/modules
/3.
*.o
:*ELF
*relocatable
*,\ not\ stripped
* | \
49 */lib
/modules
/3.
*.ko
:*ELF
*relocatable
*,\ not\ stripped
*)
50 # kernel module parametres must not be stripped off
51 T
="$T --strip-unneeded $(echo $(${prefix}nm $F | \
52 sed -n -e '/__param_/s/^.*__param_/-K /p' \
53 -e '/__module_parm_/s/^.*__module_parm_/-K /p'))"
55 *ELF
*shared\ object
*,\ not\ stripped
*)
57 *current\
ar\ archive
*)
66 if [[ $debug -ne 0 ]];then
67 eval "mkdir -p $D/usr/lib/debug/$Q"
68 eval "$O --only-keep-debug $F $D/usr/lib/debug/$P.debug"
71 if [[ $debug -ne 0 ]];then
72 eval "cd $D/usr/lib/debug/$Q && $O --add-gnu-debuglink=$R.debug $F"