[doit] add flag to strip binaries
diff --git a/doit b/doit
index 8575a47..f4c41ef 100755
--- a/doit
+++ b/doit
@@ -5,6 +5,7 @@
PARALLEL=
FETCH=0
QUIET=0
+STRIP=0
GNU_MIRROR=https://mirrors.kernel.org/gnu
ARCHIVES=archives
PATCHES=./patches/
@@ -36,6 +37,7 @@
echo " -h|-? display this help message"
echo " -j<#> use <#> parallel workers to build"
echo " -q make the build quieter"
+ echo " -s strip the binaries"
exit 1
}
@@ -108,7 +110,7 @@
help
fi
-while getopts a:cfhj:q? arg
+while getopts a:cfhj:qs? arg
do
case $arg in
a ) ARCHES=$OPTARG ;;
@@ -116,6 +118,7 @@
j ) PARALLEL="-j$OPTARG" ;;
f ) FETCH=1 ;;
q ) QUIET=1 ;;
+ s ) STRIP=1 ;;
h ) help ;;
? ) help ;;
* ) echo "unrecognized option '$arg'" ; exit 1 ;;
@@ -251,6 +254,14 @@
touch built.txt
popd
fi
+
+ # Optionally strip the binaries
+ if [ "${STRIP}" = "1" ]; then
+ find "${INSTALLPATH}/bin" -type f -executable -exec strip {} \;
+ for filename in $(find "${INSTALLPATH}/libexec" -type f -executable); do
+ (file "${filename}" | grep -q ELF) && strip "${filename}"
+ done
+ fi
done
echo all done