summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2022-10-01 14:29:06 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2022-10-04 09:35:35 +0200
commitf6bb8e07d2842959c6d163ccec0f059605ab1a46 (patch)
treeee7909089a64a5cc5dd2a50f0e3a2bd60e8ba4c4
parentb3da3e8ac706775fe8dbb5846007317f20bf0c46 (diff)
downloadOSELAS.Toolchain-f6bb8e07d2842959c6d163ccec0f059605ab1a46.tar.gz
OSELAS.Toolchain-f6bb8e07d2842959c6d163ccec0f059605ab1a46.tar.xz
ptxd_make_toolchain_install: strip installed host binaries
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--scripts/lib/ptxd_make_image_tgz.sh30
-rw-r--r--scripts/lib/ptxd_make_toolchain_install.sh27
2 files changed, 33 insertions, 24 deletions
diff --git a/scripts/lib/ptxd_make_image_tgz.sh b/scripts/lib/ptxd_make_image_tgz.sh
index 3f87aa2..9d0847d 100644
--- a/scripts/lib/ptxd_make_image_tgz.sh
+++ b/scripts/lib/ptxd_make_image_tgz.sh
@@ -6,6 +6,24 @@
# see the README file.
#
+ptxd_make_strip_toolchain() {
+ local -a host_dirs=( \
+ "${sysroot}/lib" \
+ "${sysroot}/libexec" \
+ "${sysroot}/bin" \
+ "${sysroot}/${ptxconf_gnu_target}/bin" \
+ )
+
+ # strip all host binaries
+ find "${host_dirs[@]}" \
+ -wholename "${PTXDIST_SYSROOT_CROSS}${prefix_cross}/lib/gcc" -prune -o \
+ -type f \( -executable -o -name "*.so*" \) -print0 \
+ | xargs -0 -n1 --verbose strip --preserve-dates
+ # only fail if 'find' failed. Ignore 'strip' errors, it will fail for
+ # scripts etc.
+ return "${PIPESTATUS[0]}"
+}
+export -f ptxd_make_strip_toolchain
ptxd_make_image_tgz() {
ptxd_make_image_init || return
@@ -14,23 +32,13 @@ ptxd_make_image_tgz() {
local src="${PTXDIST_SYSROOT_CROSS}${prefix_cross}"
local dst="${pkg_dir}/$(dirname ${prefix_cross})"
local sysroot="${pkg_dir}${prefix_cross}"
- local -a host_dirs=( \
- "${sysroot}/lib" \
- "${sysroot}/libexec" \
- "${sysroot}/bin" \
- "${sysroot}/${ptxconf_gnu_target}/bin" \
- )
rm -rf "${pkg_dir}" &&
rm -f "${image_image}" &&
mkdir -p "${dst}" &&
cp -a "${src}" "${dst}" || return
- # strip all host binaries
- find "${host_dirs[@]}" \
- -wholename "${PTXDIST_SYSROOT_CROSS}${prefix_cross}/lib/gcc" -prune -o \
- -type f \( -executable -o -name "*.so*" \) -print0 \
- | xargs -0 -n1 --verbose strip --preserve-dates
+ ptxd_make_strip_toolchain &&
mkdir -p "$(dirname "${image_image}")" &&
echo "Creating $(ptxd_print_path "${image_image}") ..." &&
diff --git a/scripts/lib/ptxd_make_toolchain_install.sh b/scripts/lib/ptxd_make_toolchain_install.sh
index 4ef49e9..5188922 100644
--- a/scripts/lib/ptxd_make_toolchain_install.sh
+++ b/scripts/lib/ptxd_make_toolchain_install.sh
@@ -8,25 +8,25 @@
ptxd_make_toolchain_install() {
local tmpfile install_helper
- local prefix="$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)"
- local install_prefix="${ptx_install_destdir}${prefix}"
- local install_source="${PTXDIST_SYSROOT_CROSS}${prefix}"
+ local prefix_cross="$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)"
+ local sysroot="${ptx_install_destdir}${prefix_cross}"
+ local install_source="${PTXDIST_SYSROOT_CROSS}${prefix_cross}"
- echo "Installing to ${install_prefix} ..."
+ echo "Installing to ${sysroot} ..."
- if [ -d "${install_prefix}" ]; then
- if [ -z "$(find "${install_prefix}" -maxdepth 0 -empty)" -a -z "${PTXDIST_FORCE}" ]; then
- ptxd_bailout "${install_prefix} is not empty!" \
+ if [ -d "${sysroot}" ]; then
+ if [ -z "$(find "${sysroot}" -maxdepth 0 -empty)" -a -z "${PTXDIST_FORCE}" ]; then
+ ptxd_bailout "${sysroot} is not empty!" \
"Use --force to remove the existing content first."
fi
fi
- mkdir -p "${install_prefix}" 2>/dev/null &&
- tmpfile="$(mktemp "${install_prefix}/touch.XXXXXXXX" 2>/dev/null)" &&
+ mkdir -p "${sysroot}" 2>/dev/null &&
+ tmpfile="$(mktemp "${sysroot}/touch.XXXXXXXX" 2>/dev/null)" &&
rm "${tmpfile}"
if [ $? -ne 0 ]; then
echo
- echo "'${install_prefix}' is not writable."
+ echo "'${sysroot}' is not writable."
read -t 5 -p "Press enter to install with sudo!"
if [ ${?} -ne 0 ]; then
echo
@@ -34,9 +34,10 @@ ptxd_make_toolchain_install() {
fi
install_helper=sudo
fi
- ${install_helper} rm -rf "${install_prefix}" &&
- ${install_helper} mkdir -p $(dirname "${install_prefix}") &&
+ ${install_helper} rm -rf "${sysroot}" &&
+ ${install_helper} mkdir -p $(dirname "${sysroot}") &&
${install_helper} cp -a --no-preserve=ownership \
- "${install_source}" $(dirname "${install_prefix}")
+ "${install_source}" $(dirname "${sysroot}") &&
+ ptxd_make_strip_toolchain
}
export -f ptxd_make_toolchain_install