8199539: Provide a standard way for the build to filter un-needed legal .md files
Reviewed-by: tbell, ihse
This commit is contained in:
parent
e17e623bd4
commit
98cd47840a
@ -80,10 +80,15 @@ ifneq ($(MAN_DIR), )
|
||||
DEPS += $(call CacheFind, $(MAN_DIR))
|
||||
endif
|
||||
|
||||
# If a specific modules_legal dir exists for this module, only pick up files
|
||||
# from there. These files were explicitly filtered or modified in <module>-copy
|
||||
# targets. For the rest, just pick up everything from the source legal dirs.
|
||||
LEGAL_NOTICES := \
|
||||
$(call uniq, $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
|
||||
$(call FindModuleLegalDirs, $(MODULE))) \
|
||||
#
|
||||
$(SUPPORT_OUTPUTDIR)/modules_legal/common \
|
||||
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(call FindModuleLegalSrcDirs, $(MODULE)) \
|
||||
)
|
||||
|
||||
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
|
||||
DEPS += $(call CacheFind, $(LEGAL_NOTICES))
|
||||
|
@ -394,12 +394,11 @@ ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
||||
endif
|
||||
LEGAL_SUBDIRS += share/legal
|
||||
|
||||
# Find all legal dirs for a particular module
|
||||
# Find all legal src dirs for a particular module
|
||||
# $1 - Module to find legal dirs for
|
||||
FindModuleLegalDirs = \
|
||||
FindModuleLegalSrcDirs = \
|
||||
$(strip $(wildcard \
|
||||
$(addsuffix /$(strip $1), $(SUPPORT_OUTPUTDIR)/modules_legal \
|
||||
$(IMPORT_MODULES_LEGAL)) \
|
||||
$(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \
|
||||
$(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))) \
|
||||
))
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#
|
||||
|
||||
include CopyCommon.gmk
|
||||
include Modules.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
|
||||
@ -224,12 +225,27 @@ JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \
|
||||
FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \
|
||||
DEST := $(LEGAL_DST_DIR), \
|
||||
DEST := $(COMMON_LEGAL_DST_DIR), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_JDK_NOTICES)
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Copy and filter the legal files depending on what 3rd party components are
|
||||
# bundled or linked from the OS.
|
||||
#
|
||||
ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
LEGAL_EXCLUDES += zlib.md
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
EXCLUDES := $(LEGAL_EXCLUDES), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_LEGAL)
|
||||
|
||||
################################################################################
|
||||
# Optionally copy libffi.so.? into the the image
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#
|
||||
|
||||
include CopyCommon.gmk
|
||||
include Modules.gmk
|
||||
|
||||
$(eval $(call IncludeCustomExtension, copy/Copy-java.desktop.gmk))
|
||||
|
||||
@ -48,3 +49,34 @@ $(LIB_DST_DIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
|
||||
TARGETS += $(PSFONTPROPFILE_TARGET_FILES)
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Copy and filter the legal files depending on what 3rd party components are
|
||||
# bundled or linked from the OS.
|
||||
#
|
||||
ifeq ($(USE_EXTERNAL_LIBJPEG), true)
|
||||
LEGAL_EXCLUDES += jpeg.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LIBGIF), true)
|
||||
LEGAL_EXCLUDES += giflib.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LIBPNG), true)
|
||||
LEGAL_EXCLUDES += libpng.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LCMS), true)
|
||||
LEGAL_EXCLUDES += lcms.md
|
||||
endif
|
||||
|
||||
ifeq ($(FREETYPE_TO_USE), system)
|
||||
LEGAL_EXCLUDES += freetype.md
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
EXCLUDES := $(LEGAL_EXCLUDES), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_LEGAL)
|
||||
|
||||
################################################################################
|
||||
|
@ -26,6 +26,7 @@
|
||||
LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
|
||||
CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
|
||||
LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)
|
||||
COMMON_LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/common
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -60,3 +61,23 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
|
||||
|
||||
TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Setup make rules for copying legal files. This is only needed if the files
|
||||
# need to be filtered due to optional components being enabled/disabled.
|
||||
# Otherwise CreateJmods.gmk will find the legal files in the original src dirs.
|
||||
#
|
||||
# Parameter 1 is the name of the rule.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# EXCLUDES : List of filenames to exclude from copy
|
||||
SetupCopyLegalFiles = $(NamedParamsMacroTemplate)
|
||||
define SetupCopyLegalFilesBody
|
||||
$$(eval $$(call SetupCopyFiles, $1, \
|
||||
SRC := $$(CUSTOM_ROOT), \
|
||||
DEST := $$(LEGAL_DST_DIR), \
|
||||
FILES := $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \
|
||||
$$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
endef
|
||||
|
Loading…
Reference in New Issue
Block a user