mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-11-05 04:06:38 +08:00
cookbook: Add LTO plugin to strip
This commit is contained in:
parent
332fb5e785
commit
b4f6410529
@ -415,12 +415,25 @@ function cookbook_python {
|
||||
"#;
|
||||
|
||||
pub(crate) static BUILD_POSTSCRIPT: &str = r#"
|
||||
STRIP="${GNU_TARGET}-strip"
|
||||
STRIP_ARGS="-v"
|
||||
|
||||
if [[ "$REDOXER_USE_CLANG" = "1" || "$REDOXER_USE_CLANG" = "true" ]]; then
|
||||
STRIP="llvm-strip"
|
||||
STRIP_ARGS="--verbose"
|
||||
elif [[ "$REDOXER_USE_LTO" = "1" || "$REDOXER_USE_LTO" = "true" ]]; then
|
||||
GCC_BIN=$(command -v "${GNU_TARGET}-gcc")
|
||||
GCC_VER=$("${GNU_TARGET}-gcc" -dumpfullversion)
|
||||
PLUGIN_PATH=$(realpath "$(dirname "$GCC_BIN")/../libexec/gcc/${GNU_TARGET}/${GCC_VER}/liblto_plugin.so")
|
||||
[ -f "$PLUGIN_PATH" ] && STRIP_ARGS="--plugin=${PLUGIN_PATH} -v" || echo "DEBUG: $PLUGIN_PATH not found"
|
||||
fi
|
||||
|
||||
# Strip binaries
|
||||
for dir in "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/usr/bin" "${COOKBOOK_STAGE}/libexec" "${COOKBOOK_STAGE}/usr/libexec"
|
||||
do
|
||||
if [ -d "${dir}" ] && [ -z "${COOKBOOK_NOSTRIP}" ]
|
||||
then
|
||||
find "${dir}" -type f -exec "${GNU_TARGET}-strip" -v {} ';'
|
||||
find "${dir}" -type f -exec "${STRIP}" ${STRIP_ARGS} {} ';'
|
||||
fi
|
||||
done
|
||||
|
||||
@ -432,7 +445,7 @@ do
|
||||
find "${dir}" -type f -name '*.la' -exec rm -fv {} ';'
|
||||
if [ -z "${COOKBOOK_NOSTRIP}" ]
|
||||
then
|
||||
find "${dir}" -type f -exec "${GNU_TARGET}-strip" --strip-debug -v {} ';'
|
||||
find "${dir}" -type f -exec "${STRIP}" ${STRIP_ARGS} --strip-debug {} ';'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user