summaryrefslogtreecommitdiffstats
path: root/scripts/lib/ptxd_make_toolchain.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/ptxd_make_toolchain.sh')
-rw-r--r--scripts/lib/ptxd_make_toolchain.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_toolchain.sh b/scripts/lib/ptxd_make_toolchain.sh
new file mode 100644
index 0000000..3ffa560
--- /dev/null
+++ b/scripts/lib/ptxd_make_toolchain.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_toolchain_cleanup() {
+ local sysroot_cross="$(ptxd_get_ptxconf PTXCONF_SYSROOT_CROSS)"
+ local sysroot_target="$(ptxd_get_ptxconf PTXCONF_SYSROOT_TARGET)"
+
+ # packages install to pkgdir anyways and this avoid empty directories
+ # in the final toolchain
+ rmdir --ignore-fail-on-non-empty \
+ {"${sysroot_cross}","${sysroot_target}"{,/usr}}/{etc,lib,{,s}bin,include,{,share/}man/{man*,},share}
+ # errors may occur when multiple toolchains are built at the same time
+ true
+}
+
+ptxd_make_toolchain_cleanup