removed brp-strip & related macros

This commit is contained in:
Alexey Tourbin 2011-09-23 02:54:33 +04:00
parent 9e15c26f3f
commit 4d747a6312
7 changed files with 7 additions and 419 deletions

2
.gitignore vendored
View File

@ -63,7 +63,6 @@ Makefile.in
/scripts/brp-compress
/scripts/brp-fix-perms
/scripts/brp-fixup
/scripts/brp-strip
/scripts/brp-verify-info
/scripts/brp-verify_elf
/scripts/compress_files
@ -77,7 +76,6 @@ Makefile.in
/scripts/ldd
/scripts/posttrans-filetriggers
/scripts/rpmlib.req.files
/scripts/strip_files
/scripts/verify-elf
/tools/dump

View File

@ -244,9 +244,6 @@ BuildRoot.
%_verify_info_method:
метод, используемый при проверке info-файлов в секции %install;
%_strip_method:
метод, используемый при обработке ELF-файлов в секции %install;
%_perl_req_method
: метод, используемый при поиске зависимостей в perl-скриптах;
@ -254,11 +251,11 @@ BuildRoot.
: список каталогов, в которых производится поиск ELF-файлов на
наличие предоставляемых зависимостей;
%_{cleanup,compress,fixup,strip,verify_elf,findreq,findprov}_topdir:
%_{cleanup,compress,fixup,verify_elf,findreq,findprov}_topdir:
точка начала поиска файлов, обрабатываемых соответствующим
методом;
%_{cleanup,compress,fixup,strip,verify_elf,findreq,findprov}_skiplist:
%_{cleanup,compress,fixup,verify_elf,findreq,findprov}_skiplist:
список шаблонов файлов, которые будут пропущены при обработке
соответствующим методом;
@ -266,14 +263,14 @@ BuildRoot.
параметр, определяющий влияние неупакованных файлов на
результат сборки;
%set_{cleanup,compress,fixup,strip,verify_{elf,info},perl_req}_method:
%set_{cleanup,compress,fixup,verify_{elf,info},perl_req}_method:
изменить значение соответствующего макроса;
%set_{cleanup,compress,fixup,strip,verify_elf,findreq,findprov}_{topdi
%set_{cleanup,compress,fixup,verify_elf,findreq,findprov}_{topdi
r,skiplist}:
изменить значение соответствующего макроса;
%add_{cleanup,compress,fixup,strip,verify_elf,findreq,findprov}_skipli
%add_{cleanup,compress,fixup,verify_elf,findreq,findprov}_skipli
st:
добавить значение в соответствующий список;
@ -291,27 +288,12 @@ BuildRoot.
%find_lang:
вызов /usr/lib/rpm/find-lang
%strip_executable:
вызов /usr/lib/rpm/brp-strip для обработки ELF executables;
%strip_relocatable:
вызов /usr/lib/rpm/brp-strip для обработки ELF relocatables;
%strip_shared:
вызов /usr/lib/rpm/brp-strip для обработки ELF shared objects;
%strip_static:
вызов /usr/lib/rpm/brp-strip для обработки ELF ar archives;
%cleanup_build:
вызов /usr/lib/rpm/brp-cleanup;
%compress_docs:
вызов /usr/lib/rpm/brp-compress;
%strip_binaries:
вызов /usr/lib/rpm/brp-strip;
%clean_buildroot:
выполнение rm -rf %buildroot, если %buildroot не указывает на
настоящий /.
@ -561,25 +543,6 @@ BuildRoot.
Значение по умолчанию для макроса %_verify_elf_method в данный момент
равно normal, что эквивалентно rpath=normal,textrel=normal.
Автоматическое удаление отладочной информации из ELF-файлов с поддержкой
различных стратегий выбора файлов, подлежащих обработке.
Зачастую возможно уменьшить размер получаемых в результате сборки
пакета ELF-файлов без потери качества за счёт удаления из них
отладочной информации. Поэтому по окончании работы секции %install все
ELF-файлы выбранных типов обрабатываются программой strip. Выбор типов
файлов определяется значением макроса %_strip_method, которое есть
набор из следующих возможных значений:
* executable: ELF executable;
* relocatable: ELF relocatable;
* shared: ELF shared object;
* static: ar archive.
Кроме того, есть возможность вызывать strip вручную, для этой цели
предназначены макросы %strip_executable, %strip_relocatable,
%strip_shared, %strip_static. Синтаксис этих макросов подробно изложен
в ``/usr/lib/rpm/brp-strip -help''.
Автоматическая перекомпиляция python-модулей.
Как известно, python-модули обычно компилируют в байтовую форму для

View File

@ -930,7 +930,6 @@ AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt
scripts/brp-debuginfo
scripts/brp-fix-perms
scripts/brp-fixup
scripts/brp-strip
scripts/brp-verify_elf
scripts/brp-verify-info
scripts/compress_files
@ -960,7 +959,6 @@ AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt
scripts/shell.prov
scripts/shell.req
scripts/static.req
scripts/strip_files
scripts/symlinks.req
scripts/verify-elf
scripts/posttrans-filetriggers

View File

@ -201,7 +201,6 @@
@alt@ %{?_cleanup_method:export RPM_CLEANUP_METHOD=\"%_cleanup_method\"}\
@alt@ %{?_compress_method:export RPM_COMPRESS_METHOD=\"%_compress_method\"}\
@alt@ %{?_fixup_method:export RPM_FIXUP_METHOD=\"%_fixup_method\"}\
@alt@ %{?_strip_method:export RPM_STRIP_METHOD=\"%_strip_method\"}\
@alt@ %{?_verify_elf_method:export RPM_VERIFY_ELF_METHOD=\"%_verify_elf_method\"}\
@alt@ %{?_verify_info_method:export RPM_VERIFY_INFO_METHOD=\"%_verify_info_method\"}\
@alt@ %{?_findreq_method:export RPM_FINDREQ_METHOD=\"%_findreq_method\"}\
@ -209,14 +208,12 @@
@alt@ %{?_cleanup_topdir:export RPM_CLEANUP_TOPDIR=\"%_cleanup_topdir\"}\
@alt@ %{?_compress_topdir:export RPM_COMPRESS_TOPDIR=\"%_compress_topdir\"}\
@alt@ %{?_fixup_topdir:export RPM_FIXUP_TOPDIR=\"%_fixup_topdir\"}\
@alt@ %{?_strip_topdir:export RPM_STRIP_TOPDIR=\"%_strip_topdir\"}\
@alt@ %{?_verify_elf_topdir:export RPM_VERIFY_ELF_TOPDIR=\"%_verify_elf_topdir\"}\
@alt@ %{?_findreq_topdir:export RPM_FINDREQ_TOPDIR=\"%_findreq_topdir\"}\
@alt@ %{?_findprov_topdir:export RPM_FINDPROV_TOPDIR=\"%_findprov_topdir\"}\
@alt@ %{?_cleanup_skiplist:export RPM_CLEANUP_SKIPLIST=\"%_cleanup_skiplist\"}\
@alt@ %{?_compress_skiplist:export RPM_COMPRESS_SKIPLIST=\"%_compress_skiplist\"}\
@alt@ %{?_fixup_skiplist:export RPM_FIXUP_SKIPLIST=\"%_fixup_skiplist\"}\
@alt@ %{?_strip_skiplist:export RPM_STRIP_SKIPLIST=\"%_strip_skiplist\"}\
@alt@ %{?_verify_elf_skiplist:export RPM_VERIFY_ELF_SKIPLIST=\"%_verify_elf_skiplist\"}\
@alt@ %{?_findreq_skiplist:export RPM_FINDREQ_SKIPLIST=\"%_findreq_skiplist\"}\
@alt@ %{?_findprov_skiplist:export RPM_FINDPROV_SKIPLIST=\"%_findprov_skiplist\"}\
@ -436,12 +433,10 @@
@alt@%_verify_elf_method default
@alt@%_verify_info_method normal
@alt@%_fixup_method binconfig pkgconfig libtool desktop
@alt@%_strip_method %{?_enable_debug:none}%{!?_enable_debug:executable shared}
@alt@
@alt@%_cleanup_topdir %nil
@alt@%_compress_topdir %_usr
@alt@%_fixup_topdir %nil
@alt@%_strip_topdir %nil
@alt@%_verify_elf_topdir %nil
@alt@%_findreq_topdir %nil
@alt@%_findprov_topdir %nil
@ -449,7 +444,6 @@
@alt@%_cleanup_skiplist %nil
@alt@%_compress_skiplist %nil
@alt@%_fixup_skiplist %nil
@alt@%_strip_skiplist */debug/*
@alt@%_verify_elf_skiplist %nil
@alt@%_findreq_skiplist %_docdir/*
@alt@%_findprov_skiplist %_docdir/*
@ -460,14 +454,12 @@
@alt@%set_cleanup_method() %global _cleanup_method %*
@alt@%set_compress_method() %global _compress_method %*
@alt@%set_fixup_method() %global _fixup_method %*
@alt@%set_strip_method() %global _strip_method %*
@alt@%set_verify_elf_method() %global _verify_elf_method %*
@alt@%set_verify_info_method() %global _verify_info_method %*
@alt@
@alt@%set_cleanup_topdir() %global _cleanup_topdir %*
@alt@%set_compress_topdir() %global _compress_topdir %*
@alt@%set_fixup_topdir() %global _fixup_topdir %*
@alt@%set_strip_topdir() %global _strip_topdir %*
@alt@%set_verify_elf_topdir() %global _verify_elf_topdir %*
@alt@%set_findreq_topdir() %global _findreq_topdir %*
@alt@%set_findprov_topdir() %global _findprov_topdir %*
@ -475,7 +467,6 @@
@alt@%set_cleanup_skiplist() %global _cleanup_skiplist %*
@alt@%set_compress_skiplist() %global _compress_skiplist %*
@alt@%set_fixup_skiplist() %global _fixup_skiplist %*
@alt@%set_strip_skiplist() %global _strip_skiplist %*
@alt@%set_verify_elf_skiplist() %global _verify_elf_skiplist %*
@alt@%set_findreq_skiplist() %global _findreq_skiplist %*
@alt@%set_findprov_skiplist() %global _findprov_skiplist %*
@ -486,7 +477,6 @@
@alt@%add_cleanup_skiplist() %global _cleanup_skiplist %_cleanup_skiplist %*
@alt@%add_compress_skiplist() %global _compress_skiplist %_compress_skiplist %*
@alt@%add_fixup_skiplist() %global _fixup_skiplist %_fixup_skiplist %*
@alt@%add_strip_skiplist() %global _strip_skiplist %_strip_skiplist %*
@alt@%add_verify_elf_skiplist() %global _verify_elf_skiplist %_verify_elf_skiplist %*
@alt@%add_findreq_skiplist() %global _findreq_skiplist %_findreq_skiplist %*
@alt@%add_findprov_skiplist() %global _findprov_skiplist %_findprov_skiplist %*
@ -522,17 +512,10 @@
@alt@%global _buildrequires_build %_buildrequires_build gcc%_gcc_version \
@alt@%nil
@alt@
@alt@%strip_executable RPM_STRIP_METHOD=executable @RPMCONFIGDIR@/brp-strip
@alt@%strip_relocatable RPM_STRIP_METHOD=relocatable @RPMCONFIGDIR@/brp-strip
@alt@%strip_shared RPM_STRIP_METHOD=shared @RPMCONFIGDIR@/brp-strip
@alt@%strip_static RPM_STRIP_METHOD=static @RPMCONFIGDIR@/brp-strip
@alt@
@alt@%cleanup_build @RPMCONFIGDIR@/brp-cleanup
@alt@
@alt@%compress_docs @RPMCONFIGDIR@/brp-compress
@alt@
@alt@%strip_binaries @RPMCONFIGDIR@/brp-strip
@alt@
@alt@# Alternate build section header for "multi-build" packages.
@alt@%buildmulti \
@alt@%global __spec_install_pre %{___build_pre}\

View File

@ -10,7 +10,7 @@ EXTRA_DIST = \
find-scriptlet-requires \
brp-adjust_libraries brp-alt brp-bytecompile_python \
brp-cleanup brp-compress brp-debuginfo \
brp-fix-perms brp-fixup brp-strip \
brp-fix-perms brp-fixup \
brp-verify_elf brp-verify-info \
compress_files \
cpp.req cpp.req.files \
@ -25,7 +25,6 @@ EXTRA_DIST = \
rpm2cpio.sh \
shebang.req shebang.req.files \
shell.req shell.req.files shell.prov shell.prov.files \
strip_files \
static.req static.req.files \
symlinks.req symlinks.req.files \
tmpdir.sh \
@ -45,7 +44,7 @@ config_SCRIPTS = \
find-scriptlet-requires \
brp-adjust_libraries brp-alt brp-bytecompile_python \
brp-cleanup brp-compress brp-debuginfo \
brp-fix-perms brp-fixup brp-strip \
brp-fix-perms brp-fixup \
brp-verify_elf brp-verify-info \
compress_files \
cpp.req cpp.req.files \
@ -60,7 +59,6 @@ config_SCRIPTS = \
rpm2cpio.sh \
shebang.req shebang.req.files \
shell.req shell.req.files shell.prov shell.prov.files \
strip_files \
static.req static.req.files \
symlinks.req symlinks.req.files \
tmpdir.sh \

View File

@ -1,254 +0,0 @@
#!/bin/sh -e
#
# brp-strip - strip ELF binaries.
# Inspired by brp-strip script from RPM source code.
#
# Copyright (C) 2000,2003 Dmitry V. Levin <ldv@altlinux.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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
Usage()
{
[ "$1" = 0 ] || exec >&2
cat <<EOF
brp-strip - strip ELF binaries.
brp-strip is free software, covered by the GNU General Public License.
brp-strip comes with ABSOLUTELY NO WARRANTY, see license for details.
Usage: $PROG [options] [files]
Valid options are:
-h, --help
Show a summary of the options to brp-strip and exit.
-p, --preserve-dates
Preserve modified/access timestamps of stripped files.
-R <name>, --remove-section=<name>
Remove the named section from files. This option may be given more than once.
-s, --strip-all
Remove all symbols.
-g, -S, --strip-debug
Remove all debugging symbols.
--skip-files=<pattern>
Skip files matched by specified pattern.
--strip-unneeded
Remove all symbols not needed by relocations.
-N, --strip-symbol=<name>
Do not copy named symbol.
-K, --keep-symbol=<name>
Only copy named symbol.
-x, --discard-all
Remove all non-global symbols.
-X, --discard-locals
Remove any compiler-generated symbols.
-v, --verbose
List all object files modified.
-T <name>, --topdir=<name>
Start file lookup at named directory, \$RPM_BUILD_ROOT by default.
files is list of files or directory trees where files to be stripped.
By default, all files in TOPDIR, specified by \$RPM_STRIP_METHOD, will be stripped.
EOF
[ -n "$1" ] && exit "$1" || exit
}
TEMP=`getopt -n "$PROG" -o hpR:sgSN:K:xXvT: -l help,preserve-dates,remove-section:,skip-files:,strip-all,strip-unneeded,strip-symbol:,keep-symbol:,discard-all,discard-locals,verbose,topdir: -- "$@"` || Usage
eval set -- "$TEMP"
: ${RPM_STRIP_SKIPLIST:=}
: ${RPM_STRIP_TOPDIR:=}
export RPM_STRIP_SKIPLIST
export STRIP_FORCED=
export STRIP_FORCED_OPTS=
AddForcedOpts()
{
if [ -z "$STRIP_FORCED_OPTS" ]; then
STRIP_FORCED_OPTS="$*"
else
STRIP_FORCED_OPTS="$STRIP_FORCED_OPTS $*"
fi
}
while :; do
case "$1" in
-h|--help)
Usage 0
;;
-p|--preserve-dates)
AddForcedOpts -p
shift
;;
-R|--remove-section)
shift
AddForcedOpts -R "$1"
shift
STRIP_FORCED=1
;;
--skip-files)
shift
RPM_STRIP_SKIPLIST="$RPM_STRIP_SKIPLIST $1"
shift
;;
-s|--strip-all)
AddForcedOpts -s
shift
STRIP_FORCED=1
;;
-g|-S|--strip-debug)
AddForcedOpts -g
shift
STRIP_FORCED=1
;;
--strip-unneeded)
AddForcedOpts --strip-unneeded
shift
STRIP_FORCED=1
;;
-N|--strip-symbol)
shift
AddForcedOpts -N "$1"
shift
STRIP_FORCED=1
;;
-K|--keep-symbol)
shift
AddForcedOpts -K "$1"
shift
STRIP_FORCED=1
;;
-x|--discard-all)
AddForcedOpts -x
shift
STRIP_FORCED=1
;;
-X|--discard-locals)
AddForcedOpts -X
shift
STRIP_FORCED=1
;;
-v|--verbose)
AddForcedOpts -v
shift
;;
-T|--topdir)
shift
TOPDIR="$1"
shift
;;
--)
shift
break
;;
*)
Fatal "unrecognized option: $1"
;;
esac
done
if [ -z "$TOPDIR" ]; then
TOPDIR="$RPM_BUILD_ROOT"
cd "$TOPDIR"
cd "$OLDPWD"
[ -d "$TOPDIR$RPM_STRIP_TOPDIR" ] || exit 0
TOPDIR="$TOPDIR$RPM_STRIP_TOPDIR"
else
cd "$TOPDIR"
cd "$OLDPWD"
fi
TOPDIR="$(printf %s "$TOPDIR" |sed '
s:/\(\./\)\+:/:g
s:/\+:/:g
s:/$::
')"
SHOW_METHODS=
AddShowMethods()
{
if [ -z "$SHOW_METHODS" ]; then
SHOW_METHODS="$*"
else
SHOW_METHODS="$SHOW_METHODS,$*"
fi
}
export STRIP_EXECUTABLE=
export STRIP_RELOCATABLE=
export STRIP_SHARED=
export STRIP_STATIC=
for t in `printf %s "$RPM_STRIP_METHOD" |tr , ' '`; do
case "$t" in
false|no|none|off|skip)
exit 0
;;
exec*)
STRIP_EXECUTABLE=executable
AddShowMethods executable
;;
reloc*)
STRIP_RELOCATABLE=relocatable
AddShowMethods relocatable
;;
share*)
STRIP_SHARED=shared
AddShowMethods shared
;;
static*)
STRIP_STATIC=static
AddShowMethods static
;;
*)
Fatal "Unrecognized strip method: $t"
;;
esac
done
if [ -z "$STRIP_EXECUTABLE" -a -z "$STRIP_RELOCATABLE" -a -z "$STRIP_SHARED" -a -z "$STRIP_STATIC" ]; then
# Nothing to do
exit 0
fi
StripTree()
{
echo "Stripping binaries in $1 ($SHOW_METHODS)"
local space=' '
find "$1" -type f |
file -NF$'\t' -f - |
LC_ALL=C fgrep "${space}ELF${space}
${space}current ar archive" |
cut -f1 |
@RPMCONFIGDIR@/strip_files
}
if [ -n "$*" ]; then
for d in "$@"; do
if [ -d "$d" ]; then
StripTree "$d"
else
@RPMCONFIGDIR@/strip_files "$d"
fi
done
else
[ -n "$TOPDIR" ] || Fatal "non-/ TOPDIR expected"
StripTree "$TOPDIR"
fi

View File

@ -1,98 +0,0 @@
#!/bin/sh -ef
#
# strip_files - strip files helper.
#
# Copyright (C) 2000-2004 Dmitry V. Levin <ldv@altlinux.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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
DoStrip()
{
f="$1"
shift
local opts=
[ -n "$STRIP_FORCED" ] || opts="-p -R .comment $*"
strip $opts $STRIP_FORCED_OPTS "$f"
}
rc=0
StripFile()
{
f="$1"
if [ ! -f "$f" ]; then
Info "$f: file unavailable"
rc=1
continue
fi
fname="${f#$RPM_BUILD_ROOT}"
fname="${fname#.}"
if [ -n "$RPM_STRIP_SKIPLIST" ]; then
for skip in $RPM_STRIP_SKIPLIST; do
if [ -z "${fname##$skip}" ]; then
continue 2
fi
done
fi
t="$(file -b "$f")"
if [ -z "${t/*ELF*executable,*/}" ]; then
if [ -n "$STRIP_EXECUTABLE" ]; then
DoStrip "$f"
fi
continue
fi
if [ -z "${t/*ELF*relocatable,*/}" ]; then
if [ -n "$STRIP_RELOCATABLE" ]; then
DoStrip "$f" --strip-unneeded
fi
continue
fi
if [ -z "${t/*ELF*shared object,*/}" ]; then
if [ -n "$STRIP_SHARED" ]; then
DoStrip "$f" --strip-unneeded
fi
continue
fi
if [ -z "${t/*current ar archive/}" ]; then
if [ -n "$STRIP_STATIC" ]; then
DoStrip "$f" --strip-unneeded
fi
continue
fi
}
if [ $# -gt 0 ]; then
for f; do
StripFile "$f"
done
else
while read -r f; do
StripFile "$f"
done
fi
exit $rc