summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2015-12-03 18:15:14 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2016-06-04 07:12:04 +0200
commitcb7bdc29aa1c04229efca35fcd5083b06f753ac0 (patch)
treee558e6a1406534aa34305b0f60d847721ce2571e
parent73bc7977d57a8609ce7957cbe820d718dddd5a22 (diff)
downloadOSELAS.Toolchain-cb7bdc29aa1c04229efca35fcd5083b06f753ac0.tar.gz
scripts: add helper to copy license files
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--scripts/lib/ptxd_make_world_copy_license.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_world_copy_license.sh b/scripts/lib/ptxd_make_world_copy_license.sh
new file mode 100644
index 0000000..cbb3afd
--- /dev/null
+++ b/scripts/lib/ptxd_make_world_copy_license.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright (C) 2015 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_world_copy_license() {
+ ptxd_make_world_license_init || return
+
+ local license_dir="$(ptxd_get_ptxconf PTXCONF_SYSROOT_CROSS)/share/compliance"
+ local license_url="file://\$(PTXDIST_PLATFORMDIR)/selected_toolchain/../share/compliance"
+ local name="${pkg_label#host-}"
+ name="${name#cross-}"
+ pkg_license_target="${pkg_license_target:-${pkg_label}}"
+ pkg_license_target_license="${pkg_license_target_license:-${pkg_license}}"
+ pkg_license_target_pattern="${pkg_license_target_pattern:-*}"
+
+ echo "Exporting license information..."
+
+ rm -rf "${license_dir}/${name}" &&
+ mkdir -p "${license_dir}/${name}" &&
+ cp "${pkg_license_dir}/license/"* \
+ "${license_dir}/${name}" &&
+ rm "${license_dir}/${name}/MD5SUM"
+ (
+ local TARGET="$(ptxd_name_to_NAME ${pkg_license_target})"
+ echo "${TARGET}_LICENSE := ${pkg_license_target_license}" &&
+ echo -n "${TARGET}_LICENSE_FILES := " &&
+ cd "${license_dir}/${name}" &&
+ md5sum ${pkg_license_target_pattern} | \
+ sed -n -e "s@\([^ ]*\) \(.*\)@\t${license_url}/${name}/\2;md5=\1@" \
+ -e H -e '${g;s/\n/ \\\n/g;p}'
+ check_pipe_status
+ ) > "${license_dir}/${pkg_license_target}.make"
+}
+export -f ptxd_make_world_copy_license