LuK1337 | c2175e7 | 2015-02-10 16:05:49 +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 | |
| 30 | TARGET_DIR=$OUT |
| 31 | PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE |
| 32 | |
| 33 | if [ -d $PREBUILT_DIR ]; then |
| 34 | rm -rf $PREBUILT_DIR |
| 35 | fi |
| 36 | |
| 37 | mkdir -p $PREBUILT_DIR |
| 38 | mkdir -p $PREBUILT_DIR/app |
| 39 | mkdir -p $PREBUILT_DIR/lib |
| 40 | |
| 41 | if [ -d $TARGET_DIR ]; then |
| 42 | echo "Copying files..." |
| 43 | cp -r $TARGET_DIR/system/app/webview $PREBUILT_DIR/app |
| 44 | cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so |
| 45 | cp $TARGET_DIR/system/lib/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib/libwebviewchromium_plat_support.so |
| 46 | cp $TARGET_DIR/system/lib/libwebviewchromium_loader.so $PREBUILT_DIR/lib/libwebviewchromium_loader.so |
| 47 | else |
| 48 | echo "Please ensure that you have ran a full build prior to running this script!" |
| 49 | return 1; |
| 50 | fi |
| 51 | |
| 52 | echo "Generating Makefiles..." |
| 53 | |
| 54 | HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD) |
| 55 | echo $HASH > $PREBUILT_DIR/hash.txt |
| 56 | |
| 57 | (cat << EOF) | sed s/__DEVICE__/$DEVICE/g > $PREBUILT_DIR/chromium_prebuilt.mk |
| 58 | # Copyright (C) 2014 The OmniROM Project |
| 59 | # |
| 60 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 61 | # you may not use this file except in compliance with the License. |
| 62 | # You may obtain a copy of the License at |
| 63 | # |
| 64 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 65 | # |
| 66 | # Unless required by applicable law or agreed to in writing, software |
| 67 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 68 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 69 | # See the License for the specific language governing permissions and |
| 70 | # limitations under the License. |
| 71 | |
| 72 | LOCAL_PATH := prebuilts/chromium/__DEVICE__/ |
| 73 | |
| 74 | PRODUCT_COPY_FILES += \\ |
| 75 | \$(LOCAL_PATH)/app/webview/webview.apk:system/app/webview/webview.apk \\ |
| 76 | \$(LOCAL_PATH)/lib/libwebviewchromium.so:system/lib/libwebviewchromium.so \\ |
| 77 | \$(LOCAL_PATH)/lib/libwebviewchromium_plat_support.so:system/lib/libwebviewchromium_plat_support.so \\ |
| 78 | \$(LOCAL_PATH)/lib/libwebviewchromium_loader.so:system/lib/libwebviewchromium_loader.so |
| 79 | |
| 80 | \$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm/) |
| 81 | \$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm/libwebviewchromium.so) |
| 82 | EOF |
| 83 | |
| 84 | echo "Done!" |