Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f332da2 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

build: Aggregate CyanogenMod copyright notices

Join and format copyright notices specifically identified as
being from the CyanogenMod project (by presence of a NOTICE.cm
file).

ATTENTION: As copyright holders to the CM modifications, the
CyanogenMod Project kindly requests that you do _NOT_ remove the
aggregation, display, or NOTICE.cm files themselves from your
source tree if you are distributing a derivative of the CyanogenMod
Android distribution, or any component of CM (including device
configuration trees)

Change-Id: I28b6df002e05671f6df3a5d378b57b03bf912a39
parent c31a10ba
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -523,9 +523,14 @@ target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
target_notice_file_cm_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE-CM.txt
target_notice_file_cm_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE-CM.html
target_notice_file_cm_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE-CM.html.gz

kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt

device_notice_file := $(TARGET_OUT_NOTICE_FILES)/CM/src/device.txt

$(eval $(call combine-notice-files, \
			$(target_notice_file_txt), \
			$(target_notice_file_html), \
@@ -540,6 +545,13 @@ $(eval $(call combine-notice-files, \
			$(HOST_OUT_NOTICE_FILES), \
			$(ALL_DEFAULT_INSTALLED_MODULES)))

$(eval $(call combine-notice-files, \
			$(target_notice_file_cm_txt), \
			$(target_notice_file_cm_html), \
			"CyanogenMod Notices for files contained in the filesystem images in this directory:", \
			$(TARGET_OUT_NOTICE_FILES)/CM, \
			$(ALL_DEFAULT_INSTALLED_MODULES) $(device_notice_file)))

# Install the html file at /system/etc/NOTICE.html.gz.
# This is not ideal, but this is very late in the game, after a lot of
# the module processing has already been done -- in fact, we used the
@@ -551,9 +563,16 @@ installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
	$(copy-file-to-target)

# Install the CM html file at /system/etc/NOTICE.html.gz.
$(target_notice_file_cm_html_gz): $(target_notice_file_cm_html) | $(MINIGZIP)
	$(hide) $(MINIGZIP) -9 < $< > $@
installed_notice_html_cm_gz := $(TARGET_OUT)/etc/CM-NOTICE.html.gz
$(installed_notice_html_cm_gz): $(target_notice_file_cm_html_gz) | $(ACP)
	$(copy-file-to-target)

# if we've been run my mm, mmm, etc, don't reinstall this every time
ifeq ($(ONE_SHOT_MAKEFILE),)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz) $(installed_notice_html_cm_gz)
endif

# The kernel isn't really a module, so to get its module file in there, we
@@ -566,6 +585,13 @@ $(kernel_notice_file): \
	$(hide) mkdir -p $(dir $@)
	$(hide) $(ACP) $< $@

# The device isn't a module, either
$(device_notice_file): \
	    $(strip $(wildcard $(TARGET_DEVICE_DIR)/NOTICE.cm)) \
	    | $(ACP)
	@echo Copying device notice: $@
	$(hide) mkdir -p $(dir $@)
	$(hide) $(ACP) $< $@

# -----------------------------------------------------------------
# Build a keystore with the authorized keys in it, used to verify the
@@ -1480,6 +1506,7 @@ sdk_atree_files := \
deps := \
	$(target_notice_file_txt) \
	$(tools_notice_file_txt) \
	$(tools_notice_file_cm_txt) \
	$(OUT_DOCS)/offline-sdk-timestamp \
	$(SYMBOLS_ZIP) \
	$(INSTALLED_SYSTEMIMAGE) \
+74 −0
Original line number Diff line number Diff line
@@ -70,3 +70,77 @@ notice_target := NOTICE-$(if \
    $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
.PHONY: $(notice_target)
$(notice_target): $(installed_notice_file)


###########################################################
## Track CyanogenMod NOTICE files
###########################################################

notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE.cm))

ifdef notice_file

# This relies on the name of the directory in PRODUCT_OUT matching where
# it's installed on the target - i.e. system, data, etc.  This does
# not work for root and isn't exact, but it's probably good enough for
# compliance.
# Includes the leading slash
ifdef LOCAL_INSTALLED_MODULE
  module_installed_filename := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
else
  # This module isn't installable
  ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
    # Stick the static libraries with the dynamic libraries.
    # We can't use xxx_OUT_STATIC_LIBRARIES because it points into
    # device-obj or host-obj.
    module_installed_filename := \
        $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
  else
    ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
      # Stick the static java libraries with the regular java libraries.
      module_leaf := $(notdir $(LOCAL_BUILT_MODULE))
      # javalib.jar is the default name for the build module (and isn't meaningful)
      # If that's what we have, substitute the module name instead.  These files
      # aren't included on the device, so this name is synthetic anyway.
      ifeq ($(module_leaf),javalib.jar)
        module_leaf := $(LOCAL_MODULE).jar
      endif
      module_installed_filename := \
          $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
    else
      $(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
    endif # JAVA_LIBRARIES
  endif # STATIC_LIBRARIES
endif

# In case it's actually a host file
module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))

installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/CM/src/$(module_installed_filename).txt

$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)

$(installed_notice_file): $(notice_file)
	@echo Notice file: $< -- $@
	$(hide) mkdir -p $(dir $@)
	$(hide) cat $< >> $@

ifdef LOCAL_INSTALLED_MODULE
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
# libraries so they get installed along with it.  Make it an order-only
# dependency so we don't re-install a module when the NOTICE changes.
$(LOCAL_INSTALLED_MODULE): | $(installed_notice_file)
endif

else
# NOTICE file does not exist
installed_notice_file :=
endif

# Create a predictable, phony target to build this notice file.
# Define it even if the notice file doesn't exist so that other
# modules can depend on it.
notice_target := NOTICE-$(if \
    $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
.PHONY: $(notice_target)
$(notice_target): $(installed_notice_file)