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

Commit f5b9830b authored by Ying Wang's avatar Ying Wang Committed by Gerrit Code Review
Browse files

Merge "Better way to package up the otatools-package."

parents 011a50e4 c45a47b5
Loading
Loading
Loading
Loading
+26 −27
Original line number Diff line number Diff line
@@ -1269,6 +1269,10 @@ DISTTOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
  $(HOST_OUT_EXECUTABLES)/append2simg \
  $(HOST_OUT_EXECUTABLES)/boot_signer

# Shared libraries.
DISTTOOLS += \
  $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX)

OTATOOLS := $(DISTTOOLS) \
  $(HOST_OUT_EXECUTABLES)/aapt

@@ -1281,19 +1285,14 @@ $(BUILT_OTATOOLS_PACKAGE): \
$(BUILT_OTATOOLS_PACKAGE): \
	zip_root := $(intermediate)/otatools

otatools_lib_path := $(notdir $(HOST_OUT_SHARED_LIBRARIES))
$(BUILT_OTATOOLS_PACKAGE): \
		$(OTATOOLS) \
		$(HOST_OUT_SHARED_LIBRARIES)/libc++.so
$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) | $(ACP)
	@echo "Package OTA tools: $@"
	$(hide) rm -rf $@ $(zip_root)
	$(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools $(zip_root)/$(otatools_lib_path)
	$(hide) $(ACP) -p $(OTATOOLS) $(zip_root)/bin
	$(hide) mv $(zip_root)/bin/*.jar $(zip_root)/framework/
	$(hide) $(ACP) $(HOST_OUT_SHARED_LIBRARIES)/libc++.so $(zip_root)/$(otatools_lib_path)
	$(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
	$(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
	$(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools
	$(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
	$(hide) (cd $(zip_root) && zip -qry $(abspath $@) bin framework releasetools $(otatools_lib_path))
	$(hide) (cd $(zip_root) && zip -qry $(abspath $@) *)
	$(hide) zip -qry $(abspath $@) build/target/product/security/
	$(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qry $(abspath $@)>/dev/null || true

+11 −0
Original line number Diff line number Diff line
@@ -2080,6 +2080,17 @@ define transform-prebuilt-to-target-strip-comments
$(copy-file-to-target-strip-comments)
endef

# Copy a list of files/directories to target location, with sub dir structure preserved.
# For example $(HOST_OUT_EXECUTABLES)/aapt -> $(staging)/bin/aapt .
# $(1): the source list of files/directories.
# $(2): the path prefix to strip. In the above example it would be $(HOST_OUT).
# $(3): the target location.
define copy-files-with-structure
$(foreach t,$(1),\
  $(eval s := $(patsubst $(2)%,%,$(t)))\
  $(hide) mkdir -p $(dir $(3)/$(s)); cp -Rf $(t) $(3)/$(s)$(newline))
endef

###########################################################
## On some platforms (MacOS), after copying a static
## library, ranlib must be run to update an internal