ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright (C) 2014 The OmniROM Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # This works, but there has to be a better way of reliably getting the root build directory... |
| 18 | if [ $# -eq 1 ]; then |
| 19 | TOP=$1 |
| 20 | DEVICE=$TARGET_DEVICE |
| 21 | elif [ -n "$(gettop)" ]; then |
| 22 | TOP=$(gettop) |
| 23 | DEVICE=$(get_build_var TARGET_DEVICE) |
| 24 | else |
| 25 | echo "Please run envsetup.sh and lunch before running this script," |
| 26 | echo "or provide the build root directory as the first parameter." |
| 27 | return 1 |
| 28 | fi |
| 29 | |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 30 | if [[ $ANDROID_PROMPT_PREFIX == *arm* ]]; then |
| 31 | ARCH=arm |
| 32 | fi |
| 33 | |
| 34 | if [[ $ANDROID_PROMPT_PREFIX == *arm64* ]]; then |
| 35 | ARCH=arm64 |
| 36 | fi |
| 37 | |
Sean Hoyt | 350ccf3 | 2015-07-29 08:27:52 +0200 | [diff] [blame^] | 38 | if [[ $ANDROID_PROMPT_PREFIX == *x86* ]]; then |
| 39 | ARCH=x86 |
| 40 | fi |
| 41 | |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 42 | TARGET_DIR=$OUT |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 43 | LIBS_64=$TARGET_DIR/system/lib64 |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 44 | PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE |
| 45 | |
| 46 | if [ -d $PREBUILT_DIR ]; then |
| 47 | rm -rf $PREBUILT_DIR |
| 48 | fi |
| 49 | |
| 50 | mkdir -p $PREBUILT_DIR |
| 51 | mkdir -p $PREBUILT_DIR/app |
| 52 | mkdir -p $PREBUILT_DIR/lib |
| 53 | |
| 54 | if [ -d $TARGET_DIR ]; then |
| 55 | echo "Copying files..." |
| 56 | cp -r $TARGET_DIR/system/app/webview $PREBUILT_DIR/app |
| 57 | cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so |
| 58 | cp $TARGET_DIR/system/lib/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib/libwebviewchromium_plat_support.so |
| 59 | cp $TARGET_DIR/system/lib/libwebviewchromium_loader.so $PREBUILT_DIR/lib/libwebviewchromium_loader.so |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 60 | if [ -d $LIBS_64 ]; then |
| 61 | mkdir -p $PREBUILT_DIR/lib64 |
| 62 | cp $LIBS_64/libwebviewchromium.so $PREBUILT_DIR/lib64/libwebviewchromium.so |
| 63 | cp $LIBS_64/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib64/libwebviewchromium_plat_support.so |
| 64 | cp $LIBS_64/libwebviewchromium_loader.so $PREBUILT_DIR/lib64/libwebviewchromium_loader.so |
| 65 | fi |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 66 | else |
| 67 | echo "Please ensure that you have ran a full build prior to running this script!" |
| 68 | return 1; |
| 69 | fi |
| 70 | |
| 71 | echo "Generating Makefiles..." |
| 72 | |
| 73 | HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD) |
| 74 | echo $HASH > $PREBUILT_DIR/hash.txt |
| 75 | |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 76 | sed -e s/__DEVICE__/$DEVICE/g -e s/__ARCH__/$ARCH/g > $PREBUILT_DIR/chromium_prebuilt.mk << EOF |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 77 | # Copyright (C) 2014 The OmniROM Project |
| 78 | # |
| 79 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 80 | # you may not use this file except in compliance with the License. |
| 81 | # You may obtain a copy of the License at |
| 82 | # |
| 83 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 84 | # |
| 85 | # Unless required by applicable law or agreed to in writing, software |
| 86 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 87 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 88 | # See the License for the specific language governing permissions and |
| 89 | # limitations under the License. |
| 90 | |
| 91 | LOCAL_PATH := prebuilts/chromium/__DEVICE__/ |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 92 | ARCH := __ARCH__ |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 93 | |
| 94 | PRODUCT_COPY_FILES += \\ |
| 95 | \$(LOCAL_PATH)/app/webview/webview.apk:system/app/webview/webview.apk \\ |
| 96 | \$(LOCAL_PATH)/lib/libwebviewchromium.so:system/lib/libwebviewchromium.so \\ |
| 97 | \$(LOCAL_PATH)/lib/libwebviewchromium_plat_support.so:system/lib/libwebviewchromium_plat_support.so \\ |
| 98 | \$(LOCAL_PATH)/lib/libwebviewchromium_loader.so:system/lib/libwebviewchromium_loader.so |
| 99 | |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 100 | ifeq (\$(ARCH),arm64) |
| 101 | PRODUCT_COPY_FILES += \\ |
| 102 | \$(LOCAL_PATH)/lib64/libwebviewchromium.so:system/lib64/libwebviewchromium.so \\ |
| 103 | \$(LOCAL_PATH)/lib64/libwebviewchromium_plat_support.so:system/lib64/libwebviewchromium_plat_support.so \\ |
| 104 | \$(LOCAL_PATH)/lib64/libwebviewchromium_loader.so:system/lib64/libwebviewchromium_loader.so |
| 105 | endif |
| 106 | |
| 107 | ifeq (\$(ARCH),arm) |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 108 | \$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm/) |
| 109 | \$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm/libwebviewchromium.so) |
Abhinav Jhanwar | 234ce72 | 2015-07-25 11:56:35 -0400 | [diff] [blame] | 110 | endif |
| 111 | |
| 112 | ifeq (\$(ARCH),arm64) |
| 113 | \$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm64/) |
| 114 | \$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm64/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm64/libwebviewchromium.so) |
| 115 | endif |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 116 | |
Sean Hoyt | 350ccf3 | 2015-07-29 08:27:52 +0200 | [diff] [blame^] | 117 | ifeq (\$(ARCH),x86) |
| 118 | \$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/x86/) |
| 119 | \$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/x86/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/x86/libwebviewchromium.so) |
| 120 | endif |
| 121 | |
ezio84-xda | 4665a72 | 2014-12-22 17:10:51 +0100 | [diff] [blame] | 122 | EOF |
| 123 | |
| 124 | echo "Done!" |