1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-25 04:20:41 +01:00

Cleanup: strip executables in mk.sh

Automagically strip all executables (recursively for subdirectories in lib
and bin) inside the mk.sh build loop.

This removes the necessity in the build scripts to strip the files. This also
allows us to remove the error prone install-strip target from the build
scripts.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-06-17 16:08:11 +02:00
parent 3d30afef75
commit 7204b9dd75
54 changed files with 39 additions and 86 deletions

1
mk.sh
View file

@ -89,6 +89,7 @@ while read pkg; do
run_pkg_command "build"
run_pkg_command "deploy"
deploy_dev_cleanup "$PKGDEPLOYDIR/$PKGNAME"
strip_files ${PKGDEPLOYDIR}/${PKGNAME}/{bin,lib}
restore_toolchain
rm -rf "$PKGBUILDDIR"

View file

@ -21,9 +21,6 @@ deploy() {
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install
strip_files ${DEPLOY}/bin/bash
ln -sv bash "$DEPLOY/bin/sh"
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$DEPLOY"

View file

@ -22,10 +22,7 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
chmod 755 ${DEPLOY}/bin/db_*
strip_files ${DEPLOY}/lib/*.so ${DEPLOY}/bin/db_*
rm -r "$DEPLOY/docs"
}

View file

@ -24,10 +24,7 @@ deploy() {
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
strip_files ${DEPLOY}/{bin,lib}/*
}
check_update() {

View file

@ -21,8 +21,6 @@ deploy() {
make PREFIX="$DEPLOY" install
strip_files ${DEPLOY}/bin/*
rm ${DEPLOY}/bin/{bzegrep,bzfgrep,bzless,bzcmp}
ln -s "/bin/bzgrep" "$DEPLOY/bin/bzegrep"

View file

@ -20,7 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -29,7 +29,6 @@ deploy() {
make DESTDIR="$DEPLOY" install
chmod 755 $DEPLOY/bin/*
strip_files $DEPLOY/bin/*
cat_file_override "dhcpcd.conf" > "$DEPLOY/etc/dhcpcd.conf"
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -20,13 +20,8 @@ deploy() {
local DEPLOY="$2"
make CC=${TARGET}-gcc PREFIX="/" BINDIR="/bin" DESTDIR="$DEPLOY" install
strip_files "$DEPLOY/bin/dnsmasq"
mkdir -p "$DEPLOY/etc"
cat_file_override "dnsmasq.conf" > "$DEPLOY/etc/dnsmasq.conf"
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -20,7 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -25,8 +25,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
rmdir "$DEPLOY/share"
}

View file

@ -20,8 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,8 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -20,8 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -21,8 +21,6 @@ deploy() {
unfuck_libtool
make DESTDIR="$DEPLOY" install
strip_files ${DEPLOY}/lib/*.so*
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -22,7 +22,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -24,7 +24,7 @@ deploy() {
local DEPLOY="$2"
local svc
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp -r ${SCRIPTDIR}/pkg/${PKGNAME}/{etc,lib,share} "$DEPLOY"
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"

View file

@ -22,8 +22,6 @@ deploy() {
mkdir -p "$DEPLOY/var/lib/arpd"
make DESTDIR="$DEPLOY" SYSROOT="$TCDIR/$TARGET" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
strip_files ${DEPLOY}/bin/*
}
check_update() {

View file

@ -20,7 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -21,7 +21,7 @@ deploy() {
local DEPLOY="$2"
local target
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
for target in depmod insmod lsmod modinfo modprobe rmmod; do

View file

@ -21,8 +21,6 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
strip_files ${DEPLOY}/bin/*
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -20,8 +20,6 @@ deploy() {
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install
strip_files ${DEPLOY}/{bin,lib}/*
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
}
check_update() {

View file

@ -20,7 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -25,8 +25,6 @@ deploy() {
cat_file_merge "LDPATH" > "$DEPLOY/etc/ld-musl-${MUSL_CPU}.path"
strip_files ${DEPLOY}/lib/*
find ${DEPLOY}/lib/*.so* -exec stat {} --printf="%n m %a 0 0\\n" \; | \
sed "s#^$DEPLOY/##g" | sed "s/644/444/g" | \
sed "s/755/555/g" > "$DEPLOY/rootfs_files.txt"

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -24,11 +24,7 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
rm "$DEPLOY/bin/ncursesw6-config"
strip_files ${DEPLOY}/bin/* ${DEPLOY}/lib/*.so*
mkdir -p "${DEPLOY}/include/ncurses"
for hdr in ${DEPLOY}/include/ncursesw/*.h; do

View file

@ -20,8 +20,6 @@ deploy() {
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install
strip_files ${DEPLOY}/{bin,lib}/*
}
check_update() {

View file

@ -20,7 +20,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -26,11 +26,7 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
mkdir -p "$DEPLOY/var/lib/sshd"
strip_files ${DEPLOY}/bin/* ${DEPLOY}/libexec/*
install -v -m755 "$SOURCE/contrib/ssh-copy-id" "$DEPLOY/bin"
}

View file

@ -24,8 +24,6 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
strip_files ${DEPLOY}/bin/* ${DEPLOY}/lib/*.so*
}
check_update() {

View file

@ -23,7 +23,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -22,7 +22,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -21,9 +21,7 @@ deploy() {
make SHLIB_LIBS="-lncursesw" DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
chmod 755 ${DEPLOY}/lib/*
strip_files ${DEPLOY}/lib/*
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -24,7 +24,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
sed -i -e 's@HOME=/home@HOME=/usr@g' $DEPLOY/etc/default/useradd

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
}
check_update() {

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -44,7 +44,5 @@ deploy() {
mkdir -p "$DEPLOY/lib"
mv ${TCDIR}/${TARGET}/{include,lib} "$DEPLOY"
rm ${DEPLOY}/lib/*.la
strip_files ${DEPLOY}/lib/*
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -28,8 +28,6 @@ deploy() {
cat_file_override "unbound.conf" > "$DEPLOY/etc/unbound/unbound.conf"
strip_files ${DEPLOY}/{bin,lib}/*
echo "generating trust anchor root.key"
curl --silent -L https://data.iana.org/root-anchors/root-anchors.xml |\

View file

@ -38,7 +38,6 @@ deploy() {
unfuck_libtool
make DESTDIR="$DEPLOY" install
strip_files ${DEPLOY}/{bin,lib}/*
if [ -e "$DEPLOY/sbin" ]; then
mv ${DEPLOY}/sbin/* ${DEPLOY}/bin

View file

@ -19,7 +19,7 @@ deploy() {
local SOURCE="$1"
local DEPLOY="$2"
make DESTDIR="$DEPLOY" install-strip
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
}

View file

@ -22,8 +22,6 @@ deploy() {
make DESTDIR="$DEPLOY" install
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$DEPLOY"
strip_files ${DEPLOY}/lib/*
}
check_update() {

View file

@ -12,10 +12,14 @@ strip_files() {
local f
for f in $@; do
if [ ! -f "$f" ]; then
continue
[ ! -L "$f" ] || continue;
if [ -d "$f" ]; then
strip_files ${f}/*
fi
[ -f "$f" ] || continue;
if file $f | grep -q -i elf; then
${TARGET}-strip --discard-all "$f"
fi