Split strip function into system specific subfunctions.

After the rewrite of add_files in the Irix function library permissions
where not assigned correctly. This has been fixed.
This commit is contained in:
Tom G. Christensen 2004-07-14 14:28:41 +00:00
parent 5def702b56
commit 2ff1b5e084
3 changed files with 124 additions and 53 deletions

View File

@ -61,7 +61,7 @@ BASENAME=/bin/basename
DIRNAME=/bin/dirname DIRNAME=/bin/dirname
TR=/bin/tr TR=/bin/tr
DIFF=/usr/local/bin/diff # *Must* support -u (like GNU Diff) DIFF=/usr/local/bin/diff # *Must* support -u (like GNU Diff)
FILE=/usr/bin/file # Used by strip() FILE=/usr/bin/file # Used by do_strip()
# Groff stuff for manpages # Groff stuff for manpages
NEQN=/usr/local/bin/neqn NEQN=/usr/local/bin/neqn
@ -96,6 +96,7 @@ _sharedir=share
_mandir=man _mandir=man
_infodir=info _infodir=info
_includedir=include _includedir=include
_sysconfdir=etc
tmpdir=/tmp tmpdir=/tmp
@ -321,42 +322,23 @@ clean()
esac esac
} }
# strip(): strip binaries in stagedir # do_strip(): strip binaries in stagedir
# params: none # params: none
# Automatically switches to $stagedir # Automatically switches to $stagedir
# On exit cwd is $stagedir # On exit cwd is $stagedir
strip() do_strip()
{ {
local f local f
setdir stage setdir stage
# Strip ELF binaries (see brp-strip from RPM) # Strip ELF binaries (see brp-strip from RPM)
if [ $dostrip_elf -eq 1 ]; then if [ $dostrip_elf -eq 1 ]; then
echo "Stripping ELF binaries..." do_strip_bin
for f in `$FIND . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec $FILE {} \; | \
$GREP -v ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP $strip_elf_args $f || :
done
fi fi
if [ $dostrip_shared -eq 1 ]; then if [ $dostrip_shared -eq 1 ]; then
echo "Stripping ELF shared objects..." do_strip_shared
# Strip ELF shared objects (see brp-strip-shared from RPM)
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
for f in `$FIND . -type f -a -exec $FILE {} \; | \
grep ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP $strip_shared_args $f
done
fi fi
if [ $dostrip_static -eq 1 ]; then if [ $dostrip_static -eq 1 ]; then
echo "Stripping static archives..." do_strip_static
# Strip static libraries. (see brp-strip-static-archive from RPM)
for f in `$FIND . -type f -a -exec $FILE {} \; | \
$GREP 'current ar archive' | \
$SED -n -e 's/^\(.*\):[ ]*current ar archive,.*/\1/p'`; do
$STRIP $strip_static_args $f
done
fi fi
} }
@ -533,7 +515,7 @@ generic_install()
error $E_BAD_MAKE generic_install error $E_BAD_MAKE generic_install
fi fi
if [ $dostrip -eq 1 ]; then if [ $dostrip -eq 1 ]; then
strip do_strip
fi fi
} }

View File

@ -9,7 +9,6 @@ GENDIST="/usr/sbin/gendist"
GZIP=/usr/people/tgc/bin/gzip GZIP=/usr/people/tgc/bin/gzip
BZIP2=/usr/local/bin/bzip2 BZIP2=/usr/local/bin/bzip2
STRIP=/bin/true
# This is the hostname command we'll want on Irix # This is the hostname command we'll want on Irix
HOSTNAME=/usr/bsd/hostname HOSTNAME=/usr/bsd/hostname
@ -27,11 +26,17 @@ hidefile=$metadir/hide
catman=1 catman=1
# strip? # strip?
dostrip=0 dostrip=1
# Setup default args for strip. They match /usr/bin/strip in Irix 6.2
# Change these if you're using strip from GNU Binutils (recommended)
strip_elf_args="" # GNU default is -g
strip_shared_args="-f" # GNU default is --strip-unneeded
strip_static_args="" # GNU default is -g
# Other # Other
usedepend=0 # Don't use depend file even if it's available usedepend=1 # Don't use depend file even if it's available
usescripts=0 # Don't add ops even if they're available usescripts=1 # Don't add ops even if they're available
ignore_unpackaged_files=0 # default to check for unpackaged files in the stage area ignore_unpackaged_files=0 # default to check for unpackaged files in the stage area
# Comment these declarations to get it to run with ksh # Comment these declarations to get it to run with ksh
@ -198,6 +203,8 @@ add_files()
if [ "$defperm" == "-" ]; then if [ "$defperm" == "-" ]; then
permlist=`$LS -l "$i" | $CUT -d " " -f 1` permlist=`$LS -l "$i" | $CUT -d " " -f 1`
perm=$(compute_octal $permlist) perm=$(compute_octal $permlist)
else
perm=$defperm
fi fi
doop=$(check_ops "$i") doop=$(check_ops "$i")
fname=$(fix_fname "$i") fname=$(fix_fname "$i")
@ -223,7 +230,9 @@ add_files()
IFS=$OIFS IFS=$OIFS
if [ "$defperm" == "-" ]; then if [ "$defperm" == "-" ]; then
permlist=`$LS -l "$i" | $CUT -d " " -f 1` permlist=`$LS -l "$i" | $CUT -d " " -f 1`
perm=`compute_octal $permlist` perm=$(compute_octal $permlist)
else
perm=$defperm
fi fi
local temp=`$LS -l "$i"|$CUT -d '>' -f 2` local temp=`$LS -l "$i"|$CUT -d '>' -f 2`
local symval=${temp# } local symval=${temp# }
@ -311,6 +320,46 @@ fetch_ops()
fi fi
} }
# do_strip_bin(): Strip binaries
# params: none
do_strip_bin()
{
echo "Stripping ELF binaries..."
for f in `$FIND . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec $FILE {} \; | \
$GREP -v ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do
$STRIP $strip_elf_args $f || :
done
}
# do_strip_shared(): Strip shared libraries
# params: none
do_strip_shared()
{
echo "Stripping ELF shared objects..."
# Strip ELF shared objects (see brp-strip-shared from RPM)
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
for f in `$FIND . -type f -a -exec $FILE {} \; | \
grep ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*\(not stripped\).*/\1/p'`; do
$STRIP $strip_shared_args $f
done
}
# do_strip_static(): Strip static archives
# params: none
do_strip_static()
{
echo "Stripping static archives..."
# Strip static libraries. (see brp-strip-static-archive from RPM)
for f in `$FIND . -type f -a -exec $FILE {} \; | \
$GREP 'current ar archive' | \
$SED -n -e 's/^\(.*\):[ ]*current ar archive .*/\1/p'`; do
$STRIP $strip_static_args $f
done
}
################################## ##################################
# "external" functions # "external" functions
################################## ##################################

View File

@ -412,6 +412,46 @@ get_pkgrev()
echo $secver echo $secver
} }
# do_strip_bin(): Strip binaries
# params: none
do_strip_binaries()
{
echo "Stripping ELF binaries..."
for f in `$FIND . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec $FILE {} \; | \
$GREP -v ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP $strip_elf_args $f || :
done
}
# do_strip_shared(): Strip shared libraries
# params: none
do_strip_shared()
{
echo "Stripping ELF shared objects..."
# Strip ELF shared objects (see brp-strip-shared from RPM)
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
for f in `$FIND . -type f -a -exec $FILE {} \; | \
grep ' dynamic lib ' | \
$SED -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP $strip_shared_args $f
done
}
# do_strip_static(): Strip static archives
# params: none
do_strip_static()
{
echo "Stripping static archives..."
# Strip static libraries. (see brp-strip-static-archive from RPM)
for f in `$FIND . -type f -a -exec $FILE {} \; | \
$GREP 'current ar archive' | \
$SED -n -e 's/^\(.*\):[ ]*current ar archive,.*/\1/p'`; do
$STRIP $strip_static_args $f
done
}
##################################################### #####################################################
# Define generic functions for different build stages # Define generic functions for different build stages
##################################################### #####################################################