summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2020-05-06 10:49:52 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-05-11 07:41:37 +0200
commit5f734311e4fe963ea41e686b1b7bae5b0ac3260f (patch)
tree6cf628528f20cc5b6fad22d87a65e28d8bdaad22 /scripts
parent73fbfa7ed205c36178f95b983e1c7eea175420af (diff)
downloadOSELAS.Toolchain-5f734311e4fe963ea41e686b1b7bae5b0ac3260f.tar.gz
OSELAS.Toolchain-5f734311e4fe963ea41e686b1b7bae5b0ac3260f.tar.xz
use icecc for cross-compiling
Multiple things are needed to make this possible: - the wrapper dir must be first in $PATH to ensure that any available wrapper is used. - when gcc-first and gcc are done building, then a new icecc environment must be created. - use icerun to limit parallelization when xgcc/xg++ is used to build the internal libraries Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/icecc-create-env-wrapper23
-rw-r--r--scripts/lib/ptxd_make_compiler.sh28
-rw-r--r--scripts/lib/ptxd_make_env_init.sh19
3 files changed, 70 insertions, 0 deletions
diff --git a/scripts/icecc-create-env-wrapper b/scripts/icecc-create-env-wrapper
new file mode 100755
index 0000000..31581c9
--- /dev/null
+++ b/scripts/icecc-create-env-wrapper
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if grep -q -- --compression "${PTXDIST_ICECC_CREATE_ENV_REAL}"; then
+ args=( --compression none )
+fi
+
+"${PTXDIST_ICECC_CREATE_ENV_REAL}" "${@}" "${args[@]}" || exit
+
+ptxd_get_path *.tar*
+env="${ptxd_reply}"
+mkdir tmp
+cd tmp
+tar xf "../${env}"
+
+find -type f | xargs strip
+
+tar -ch --numeric-owner -zvf "../${env//.*}.tar.gz" *
+
+cd ..
+rm -rf tmp
+if [ "${env}" != "${env//.*}.tar.gz" ]; then
+ rm "${env}"
+fi
diff --git a/scripts/lib/ptxd_make_compiler.sh b/scripts/lib/ptxd_make_compiler.sh
new file mode 100644
index 0000000..baf6f9a
--- /dev/null
+++ b/scripts/lib/ptxd_make_compiler.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Copyright (C) 2020 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# helper to allow late wrapper / icecc setup
+#
+ptxd_make_setup_target_compiler() {
+ local wrapper_dir sysroot_host
+ local toolchain compiler_prefix
+
+ sysroot_host="$(ptxd_get_ptxconf PTXCONF_SYSROOT_HOST)"
+ wrapper_dir="${sysroot_host}/lib/wrapper"
+
+ toolchain="${1}"
+ compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
+
+ ptxd_lib_setup_target_wrapper &&
+ PTXDIST_ICECC_CREATE_ENV_REAL="${PTXDIST_ICECC_CREATE_ENV}" \
+ PTXDIST_ICECC_CREATE_ENV="${PTXDIST_WORKSPACE}/scripts/icecc-create-env-wrapper" \
+ ptxd_lib_setup_target_icecc
+}
+export -f ptxd_make_setup_target_compiler
+
diff --git a/scripts/lib/ptxd_make_env_init.sh b/scripts/lib/ptxd_make_env_init.sh
new file mode 100644
index 0000000..39b1642
--- /dev/null
+++ b/scripts/lib/ptxd_make_env_init.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright (C) 2020 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# The search paths added with these variables are needed in a BSP because
+# there are two sysroots: The one from the toolchain and the BSP. This is
+# not the case when building a toolchain, so they are not necessary here.
+#
+ptxd_init_cross_env_toolchain() {
+ unset PTXDIST_CROSS_CPPFLAGS
+ unset PTXDIST_CROSS_LDFLAGS
+}
+
+ptxd_init_cross_env_toolchain