[Automate patching of android build tree clinton@unknownlamer.org**20091005231906 Ignore-this: 922633a6e28cbca96296affae7ffdd76 For replicant to work a few minor patches are needed to the android build system to relax l10n requirements, follow symlinks in a few places, and remove an invalid makefile line. ] adddir ./patches addfile ./patches/0001-follow-symlinks-when-searching-for-products.patch hunk ./patches/0001-follow-symlinks-when-searching-for-products.patch 1 +From 330a753608e6a535ed189c50b39eaf037a1fe2d3 Mon Sep 17 00:00:00 2001 +From: Clinton Ebadi +Date: Mon, 5 Oct 2009 14:03:36 -0400 +Subject: [PATCH 1/3] follow symlinks when searching for products + This allows replicant to be overlaid onto an AOSP source tree + +--- + core/product.mk | 2 +- + core/product_config.mk | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/core/product.mk b/core/product.mk +index adc81c3..05b3904 100644 +--- a/core/product.mk ++++ b/core/product.mk +@@ -23,7 +23,7 @@ + # $(call ) isn't necessary. + # + define _find-android-products-files +-$(shell test -d vendor && find vendor -maxdepth 6 -name AndroidProducts.mk) \ ++$(shell test -d vendor && find -L vendor -maxdepth 6 -name AndroidProducts.mk) \ + $(SRC_TARGET_DIR)/product/AndroidProducts.mk + endef + +diff --git a/core/product_config.mk b/core/product_config.mk +index 7cfa5f4..3b8f767 100644 +--- a/core/product_config.mk ++++ b/core/product_config.mk +@@ -74,7 +74,7 @@ endif + ########################################################### + + define find-copy-subdir-files +-$(shell find $(2) -name "$(1)" | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g") ++$(shell find $(2) -L -name "$(1)" | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g") + endef + + # --------------------------------------------------------------- +-- +1.6.4.3 + addfile ./patches/0002-Remove-invalid-makefile-bit.patch hunk ./patches/0002-Remove-invalid-makefile-bit.patch 1 +From b39e73e72f6fcf523a45f2e7b192f7ea0bacc477 Mon Sep 17 00:00:00 2001 +From: Clinton Ebadi +Date: Mon, 5 Oct 2009 14:04:12 -0400 +Subject: [PATCH 2/3] Remove invalid @# makefile bit + This breaks the build with the GNU Make in Debian unstable + +--- + core/package.mk | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/core/package.mk b/core/package.mk +index 6b09bda..b8a3400 100644 +--- a/core/package.mk ++++ b/core/package.mk +@@ -264,7 +264,6 @@ ifneq ($(full_classes_jar),) + $(add-dex-to-package) + endif + $(sign-package) +- @# Alignment must happen after all other zip operations. + $(align-package) + + # Save information about this package +-- +1.6.4.3 + addfile ./patches/0003-Don-t-require-resource-localization.patch hunk ./patches/0003-Don-t-require-resource-localization.patch 1 +From 723eed5f6282da5d5d2e88f8d52bd289738c8ca0 Mon Sep 17 00:00:00 2001 +From: Clinton Ebadi +Date: Mon, 5 Oct 2009 14:04:39 -0400 +Subject: [PATCH 3/3] Don't require resource localization + This is fine for the core google apps, but breaks a lot of external + apps. + +--- + core/definitions.mk | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/core/definitions.mk b/core/definitions.mk +index 9b3a03d..20309cf 100644 +--- a/core/definitions.mk ++++ b/core/definitions.mk +@@ -1158,7 +1158,7 @@ endef + define create-resource-java-files + @mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR) + @mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) +-$(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m -z \ ++$(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \ + $(eval # PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \ + $(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \ + $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \ +@@ -1301,7 +1301,7 @@ endef + #values; applications can override these by explicitly stating + #them in their manifest. + define add-assets-to-package +-$(hide) $(AAPT) package -z -u $(PRIVATE_AAPT_FLAGS) \ ++$(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \ + $(addprefix -c , $(PRODUCT_AAPT_CONFIG)) \ + $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \ + $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \ +-- +1.6.4.3 + addfile ./scripts/patch-android-source hunk ./scripts/patch-android-source 1 - +#!/bin/sh +guile -l scripts/utils.scm -c '(patch-android-source!)' hunk ./scripts/utils.scm 83 +(define android-patches + '("patches/0001-follow-symlinks-when-searching-for-products.patch" + "patches/0002-Remove-invalid-makefile-bit.patch" + "patches/0003-Don-t-require-resource-localization.patch")) + hunk ./scripts/utils.scm 96 + +(define (patch-android-source!) + (apply system* `( "git" + "--git-dir" ,(absolutize "android/build") + "--work-tree" ,(absolutize "android/build") + "apply" ,@android-patches + "--directory" ,(absolutize "android/build")))) +