Last active
August 29, 2015 14:22
-
-
Save luk1337/0b5851bbdb6ba1207e21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5c6b761e8e393a8ad133bd7080841c37a748da51 Mon Sep 17 00:00:00 2001 | |
From: Jiangyi <sam.andrew.jiang@gmail.com> | |
Date: Fri, 18 Jul 2014 15:53:13 -0400 | |
Subject: [PATCH] build: Add chromium prebuilt support to envsetup.sh && The | |
core Makefile | |
This adds a chromium_prebuilt function to envsetup.sh that is invoked by lunch to check | |
whether the chromium prebuilts are up-to-date or not. If not, it will be built from source | |
and then the new source built version will be pulled during brunch/mka bacon to become the | |
new prebuilts for future builds. | |
This is all opt-in through the USE_PREBUILT_CHROMIUM flag. Without it being set to 1, | |
none of this would be ran, and regular operations will go on. | |
PS13: | |
-use export TARGET_DEVICE | |
-replace git -C with params compatible to old git versions | |
Change-Id: I40f8c8dbd2a8a84a5c1b9f47ee04180a71ef4e07 | |
Conflicts: | |
core/Makefile | |
--- | |
core/Makefile | 7 +++++++ | |
envsetup.sh | 19 +++++++++++++++++++ | |
2 files changed, 26 insertions(+) | |
diff --git a/core/Makefile b/core/Makefile | |
index 739df82..662eeb1 100644 | |
--- a/core/Makefile | |
+++ b/core/Makefile | |
@@ -1662,6 +1662,13 @@ else | |
endif | |
@echo -e ${CL_BLD}${CL_CYN}"================================================================================"${CL_RST} | |
+ifeq ($(USE_PREBUILT_CHROMIUM),1) | |
+ifneq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes) | |
+ @echo "Running Chromium prebuilt setup script..." | |
+ $(hide) . $(TOPDIR)vendor/aosp/utils/chromium_prebuilt.sh $(TOP) | |
+endif | |
+endif | |
+ | |
endif # recovery_fstab is defined | |
endif # TARGET_NO_KERNEL != true | |
endif # TARGET_DEVICE != generic* | |
diff --git a/envsetup.sh b/envsetup.sh | |
index 0529553..3310d59 100644 | |
--- a/envsetup.sh | |
+++ b/envsetup.sh | |
@@ -568,6 +568,13 @@ function lunch() | |
echo | |
+ if [[ $USE_PREBUILT_CHROMIUM -eq 1 ]]; then | |
+ chromium_prebuilt | |
+ else | |
+ # Unset flag in case user opts out later on | |
+ export PRODUCT_PREBUILT_WEBVIEWCHROMIUM="" | |
+ fi | |
+ | |
set_stuff_for_environment | |
printconfig | |
} | |
@@ -2101,7 +2108,19 @@ function make() | |
return $ret | |
} | |
+function chromium_prebuilt() { | |
+ T=$(gettop) | |
+ export TARGET_DEVICE=$(get_build_var TARGET_DEVICE) | |
+ hash=$T/prebuilts/chromium/$TARGET_DEVICE/hash.txt | |
+ if [ -r $hash ] && [ $(git --git-dir=$T/external/chromium_org/.git --work-tree=$T/external/chromium_org rev-parse --verify HEAD) == $(cat $hash) ]; then | |
+ export PRODUCT_PREBUILT_WEBVIEWCHROMIUM=yes | |
+ echo "** Prebuilt Chromium is up-to-date; Will be used for build **" | |
+ else | |
+ export PRODUCT_PREBUILT_WEBVIEWCHROMIUM=no | |
+ echo "** Prebuilt Chromium out-of-date/not found; Will build from source **" | |
+ fi | |
+} | |
if [ "x$SHELL" != "x/bin/bash" ]; then | |
case `ps -o command -p $$` in | |
-- | |
2.1.4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e442a9c8fe574fe7f4a2bcd3a4e1980b79b26fb9 Mon Sep 17 00:00:00 2001 | |
From: Jiangyi <sam.andrew.jiang@gmail.com> | |
Date: Fri, 18 Jul 2014 10:50:52 -0400 | |
Subject: [PATCH] frameworks/webview: Use prebuilt java library for building if | |
using prebuilt Chromium | |
webviewchromium requires android_java_webview for building, but if prebuilt Chromium is | |
used, android_java_webview does not get built. Therefore, in this case, get webviewchromium | |
to rely on a prebuilt android_java_webview jar in order to not break build. | |
Change-Id: I60f8f0fc7d63eb16b90ddce03690782b1b2f3026 | |
(cherry picked from commit 3d6c233caf5177fe7b11237b844301733b323c4d) | |
Conflicts: | |
chromium/Android.mk | |
--- | |
chromium/Android.mk | 7 +++++++ | |
1 file changed, 7 insertions(+) | |
diff --git a/chromium/Android.mk b/chromium/Android.mk | |
index edcfdb2..a0c933e 100644 | |
--- a/chromium/Android.mk | |
+++ b/chromium/Android.mk | |
@@ -19,6 +19,13 @@ | |
LOCAL_PATH := $(call my-dir) | |
CHROMIUM_PATH := external/chromium_org | |
+# Use prebuilt android_webview_java to satisfy webviewchromium's dependency | |
+# if we are working with prebuilt Chromium | |
+ifeq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes) | |
+include $(CLEAR_VARS) | |
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := android_webview_java:../../../prebuilts/chromium/$(TARGET_DEVICE)/android_webview_java.jar | |
+include $(BUILD_MULTI_PREBUILT) | |
+endif | |
# Native support library (libwebviewchromium_plat_support.so) - does NOT link | |
# any native chromium code. | |
include $(CLEAR_VARS) | |
-- | |
2.1.4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From bb2ca8d5501a765dba2967ada88d9ab857d08e20 Mon Sep 17 00:00:00 2001 | |
From: LuK1337 <priv.luk@gmail.com> | |
Date: Tue, 10 Feb 2015 16:05:49 +0100 | |
Subject: [PATCH] vendor/aosp: Add chromium_prebuilt.sh | |
This is squash of | |
- https://github.com/AOGP-L/android_vendor_aogp/commit/dc66afe9fe16580111126aadc60510bea8dc6444 | |
- https://github.com/AOGP-L/android_vendor_aogp/commit/7fdc21224f93c404224e5176c012cd3b3f5a4989 | |
- https://github.com/AOGP-L/android_vendor_aogp/commit/d1e9359c34aa9c42bb56d099752dff1b2d7fe9e9 | |
Change-Id: Iff6b7f8c0204f4ae96de5e61be94c21f761d69cb | |
--- | |
common.mk | 5 +++ | |
utils/chromium_prebuilt.sh | 84 ++++++++++++++++++++++++++++++++++++++++++++++ | |
2 files changed, 89 insertions(+) | |
create mode 100755 utils/chromium_prebuilt.sh | |
diff --git a/common.mk b/common.mk | |
index 8ab4913..b713e04 100644 | |
--- a/common.mk | |
+++ b/common.mk | |
@@ -102,6 +102,11 @@ PRODUCT_PACKAGE_OVERLAYS += \ | |
vendor/aosp/overlay/common \ | |
vendor/aosp/overlay/dictionaries | |
+# Chromium Prebuilt | |
+ifeq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes) | |
+-include prebuilts/chromium/$(TARGET_DEVICE)/chromium_prebuilt.mk | |
+endif | |
+ | |
# by default, do not update the recovery with system updates | |
PRODUCT_PROPERTY_OVERRIDES += persist.sys.recovery_update=false | |
diff --git a/utils/chromium_prebuilt.sh b/utils/chromium_prebuilt.sh | |
new file mode 100755 | |
index 0000000..f3d6f30 | |
--- /dev/null | |
+++ b/utils/chromium_prebuilt.sh | |
@@ -0,0 +1,84 @@ | |
+#!/bin/sh | |
+ | |
+# Copyright (C) 2014 The OmniROM Project | |
+# | |
+# Licensed under the Apache License, Version 2.0 (the "License"); | |
+# you may not use this file except in compliance with the License. | |
+# You may obtain a copy of the License at | |
+# | |
+# http://www.apache.org/licenses/LICENSE-2.0 | |
+# | |
+# Unless required by applicable law or agreed to in writing, software | |
+# distributed under the License is distributed on an "AS IS" BASIS, | |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+# See the License for the specific language governing permissions and | |
+# limitations under the License. | |
+ | |
+# This works, but there has to be a better way of reliably getting the root build directory... | |
+if [ $# -eq 1 ]; then | |
+ TOP=$1 | |
+ DEVICE=$TARGET_DEVICE | |
+elif [ -n "$(gettop)" ]; then | |
+ TOP=$(gettop) | |
+ DEVICE=$(get_build_var TARGET_DEVICE) | |
+else | |
+ echo "Please run envsetup.sh and lunch before running this script," | |
+ echo "or provide the build root directory as the first parameter." | |
+ return 1 | |
+fi | |
+ | |
+TARGET_DIR=$OUT | |
+PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE | |
+ | |
+if [ -d $PREBUILT_DIR ]; then | |
+ rm -rf $PREBUILT_DIR | |
+fi | |
+ | |
+mkdir -p $PREBUILT_DIR | |
+mkdir -p $PREBUILT_DIR/app | |
+mkdir -p $PREBUILT_DIR/lib | |
+ | |
+if [ -d $TARGET_DIR ]; then | |
+ echo "Copying files..." | |
+ cp -r $TARGET_DIR/system/app/webview $PREBUILT_DIR/app | |
+ cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so | |
+ cp $TARGET_DIR/system/lib/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib/libwebviewchromium_plat_support.so | |
+ cp $TARGET_DIR/system/lib/libwebviewchromium_loader.so $PREBUILT_DIR/lib/libwebviewchromium_loader.so | |
+else | |
+ echo "Please ensure that you have ran a full build prior to running this script!" | |
+ return 1; | |
+fi | |
+ | |
+echo "Generating Makefiles..." | |
+ | |
+HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD) | |
+echo $HASH > $PREBUILT_DIR/hash.txt | |
+ | |
+(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > $PREBUILT_DIR/chromium_prebuilt.mk | |
+# Copyright (C) 2014 The OmniROM Project | |
+# | |
+# Licensed under the Apache License, Version 2.0 (the "License"); | |
+# you may not use this file except in compliance with the License. | |
+# You may obtain a copy of the License at | |
+# | |
+# http://www.apache.org/licenses/LICENSE-2.0 | |
+# | |
+# Unless required by applicable law or agreed to in writing, software | |
+# distributed under the License is distributed on an "AS IS" BASIS, | |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+# See the License for the specific language governing permissions and | |
+# limitations under the License. | |
+ | |
+LOCAL_PATH := prebuilts/chromium/__DEVICE__/ | |
+ | |
+PRODUCT_COPY_FILES += \\ | |
+ \$(LOCAL_PATH)/app/webview/webview.apk:system/app/webview/webview.apk \\ | |
+ \$(LOCAL_PATH)/lib/libwebviewchromium.so:system/lib/libwebviewchromium.so \\ | |
+ \$(LOCAL_PATH)/lib/libwebviewchromium_plat_support.so:system/lib/libwebviewchromium_plat_support.so \\ | |
+ \$(LOCAL_PATH)/lib/libwebviewchromium_loader.so:system/lib/libwebviewchromium_loader.so | |
+ | |
+\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm/) | |
+\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm/libwebviewchromium.so) | |
+EOF | |
+ | |
+echo "Done!" | |
-- | |
2.1.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment