diff options
-rw-r--r-- | config/global/paths.in | 9 | ||||
-rw-r--r-- | scripts/build/internals.sh | 4 | ||||
-rw-r--r-- | scripts/functions | 31 |
3 files changed, 44 insertions, 0 deletions
diff --git a/config/global/paths.in b/config/global/paths.in index b4e93ee0..7c6c30cf 100644 --- a/config/global/paths.in +++ b/config/global/paths.in @@ -85,6 +85,15 @@ config BUILD_MANUALS Build the PDF and HTML manuals for the main components such as binutils, GCC, GDB, and the C library. +config INSTALL_LICENSES + bool "Install licenses" + default y + help + Collect the license files for all the components that went into + producing this toolchain (including the crosstool-NG itself) + and place them in /share/licenses directory within the prefix + directory. + config PREFIX_DIR_RO bool prompt "Render the toolchain read-only" diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index e407de8b..3cd5eeb3 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -144,5 +144,9 @@ do_finish() { CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info} fi + if [ "${CT_INSTALL_LICENSES}" = y ]; then + CT_InstallCopyingInformation + fi + CT_EndStep } diff --git a/scripts/functions b/scripts/functions index ec0d9a16..491c7595 100644 --- a/scripts/functions +++ b/scripts/functions @@ -2399,3 +2399,34 @@ else CT_Error "Not found: paths.sh" fi . "${paths_sh_location}" + +CT_InstallCopyingInformation() +{ + local pkgname + local pkgdir + local licfile + local dstdir + + CT_DoLog EXTRA "Collect license information from: ${CT_SRC_DIR}" + CT_DoLog EXTRA "Put the license information to: ${CT_PREFIX_DIR}/share/licenses" + + shopt -s nullglob + + for pkgdir in ${CT_SRC_DIR}/*; do + pkgname=$(basename "${pkgdir}") + for licfile in ${pkgdir}/{COPYING*,LICENSE*}; do + dstdir="${CT_PREFIX_DIR}/share/licenses/${pkgname}" + mkdir -p "${dstdir}" + CT_DoExecLog ALL cp -av "${licfile}" "${dstdir}/" + done + done + + # Also add crosstool's information + for licfile in ${CT_TOP_DIR}/{COPYING*,LICENSE*,licenses.d}; do + dstdir="${CT_PREFIX_DIR}/share/licenses/crosstool-ng" + mkdir -p "${dstdir}" + CT_DoExecLog ALL cp -av "${licfile}" "${dstdir}/" + done + + shopt -u nullglob +} |