package/pkg-utils.mk: move FREESCALE_IMX_EXTRACT_HELPER

This helper was introduced before Freescale was part of NXP. Nowadays,
we have NXP packages, and they do use the same archiving format.

Move the Freescale-specific extract helper to a common location, so
that it can be used by other packages in the future.

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
[yann.morin.1998@free.fr: provide the rationale in the commit log]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Francois Perrad 2022-08-15 18:56:30 +02:00 committed by Yann E. MORIN
parent 11e11b8fda
commit 1c3b7870cf
2 changed files with 25 additions and 25 deletions

View File

@ -6,29 +6,4 @@
FREESCALE_IMX_SITE = http://www.nxp.com/lgfiles/NMG/MAD/YOCTO
# Helper for self-extracting binaries distributed by Freescale.
#
# The --force option makes sure it doesn't fail if the source
# directory already exists. The --auto-accept skips the license check,
# as it is not needed in Buildroot because we have legal-info. Since
# there's a EULA in the binary file, we extract it in this macro, and
# it should therefore be added to the LICENSE_FILES variable of
# packages using this macro. Also, remember to set REDISTRIBUTE to
# "NO". Indeed, this is a legal minefield: the EULA specifies that the
# Board Support Package includes software and hardware (sic!) for
# which a separate license is needed...
#
# $(1): full path to the archive file
#
define FREESCALE_IMX_EXTRACT_HELPER
awk 'BEGIN { start = 0; } \
/^EOEULA/ { start = 0; } \
{ if (start) print; } \
/<<EOEULA/ { start = 1; }' \
$(1) > $(@D)/EULA
cd $(@D) && sh $(1) --force --auto-accept
find $(@D)/$(basename $(notdir $(1))) -mindepth 1 -maxdepth 1 -exec mv {} $(@D) \;
rmdir $(@D)/$(basename $(notdir $(1)))
endef
include $(sort $(wildcard package/freescale-imx/*/*.mk))

View File

@ -275,3 +275,28 @@ legal-deps = \
$(filter-out $(if $(1:host-%=),host-%),\
$(call non-virtual-deps,\
$($(call UPPERCASE,$(1))_FINAL_RECURSIVE_DEPENDENCIES))),$(p) [$($(call UPPERCASE,$(p))_LICENSE)])
# Helper for self-extracting binaries distributed by Freescale.
#
# The --force option makes sure it doesn't fail if the source
# directory already exists. The --auto-accept skips the license check,
# as it is not needed in Buildroot because we have legal-info. Since
# there's a EULA in the binary file, we extract it in this macro, and
# it should therefore be added to the LICENSE_FILES variable of
# packages using this macro. Also, remember to set REDISTRIBUTE to
# "NO". Indeed, this is a legal minefield: the EULA specifies that the
# Board Support Package includes software and hardware (sic!) for
# which a separate license is needed...
#
# $(1): full path to the archive file
#
define FREESCALE_IMX_EXTRACT_HELPER
awk 'BEGIN { start = 0; } \
/^EOEULA/ { start = 0; } \
{ if (start) print; } \
/<<EOEULA/ { start = 1; }' \
$(1) > $(@D)/EULA
cd $(@D) && sh $(1) --force --auto-accept
find $(@D)/$(basename $(notdir $(1))) -mindepth 1 -maxdepth 1 -exec mv {} $(@D) \;
rmdir $(@D)/$(basename $(notdir $(1)))
endef