summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-09-03 15:09:36 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-09-05 08:35:31 +0200
commit00d88a79453255ec56439af359aa3e805f1176dd (patch)
treefd9f5c9f1104930c8549212f247306982c71b721
parentd09ce5d4409b0a54f43815286dca1fb9f560c72f (diff)
downloadOSELAS.Toolchain-00d88a79453255ec56439af359aa3e805f1176dd.tar.gz
add make target to install the toolchain
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/post/ptxd_make_install.make21
-rw-r--r--scripts/lib/ptxd_make_toolchain_install.sh42
2 files changed, 63 insertions, 0 deletions
diff --git a/rules/post/ptxd_make_install.make b/rules/post/ptxd_make_install.make
new file mode 100644
index 0000000..c05655a
--- /dev/null
+++ b/rules/post/ptxd_make_install.make
@@ -0,0 +1,21 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2019 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+.PHONY: install
+
+toolchain/install = \
+ $(call ptx/env) \
+ ptx_install_destdir=$(DESTDIR) \
+ ptxd_make_toolchain_install
+
+install: world
+ @$(call targetinfo)
+ @$(call toolchain/install)
+ @$(call finish)
+
+# vim: syntax=make
diff --git a/scripts/lib/ptxd_make_toolchain_install.sh b/scripts/lib/ptxd_make_toolchain_install.sh
new file mode 100644
index 0000000..4ef49e9
--- /dev/null
+++ b/scripts/lib/ptxd_make_toolchain_install.sh
@@ -0,0 +1,42 @@
+#!/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_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}"
+
+ echo "Installing to ${install_prefix} ..."
+
+ 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!" \
+ "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)" &&
+ rm "${tmpfile}"
+ if [ $? -ne 0 ]; then
+ echo
+ echo "'${install_prefix}' is not writable."
+ read -t 5 -p "Press enter to install with sudo!"
+ if [ ${?} -ne 0 ]; then
+ echo
+ return 1
+ fi
+ install_helper=sudo
+ fi
+ ${install_helper} rm -rf "${install_prefix}" &&
+ ${install_helper} mkdir -p $(dirname "${install_prefix}") &&
+ ${install_helper} cp -a --no-preserve=ownership \
+ "${install_source}" $(dirname "${install_prefix}")
+}
+export -f ptxd_make_toolchain_install