Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [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 |
Jiangyi | 4491b0d | 2014-12-08 00:24:25 -0200 | [diff] [blame] | 21 | TARGET_DIR=$OUT |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 22 | elif [ -n "$(gettop)" ]; then |
| 23 | TOP=$(gettop) |
| 24 | DEVICE=$(get_build_var TARGET_DEVICE) |
Jiangyi | 4491b0d | 2014-12-08 00:24:25 -0200 | [diff] [blame] | 25 | TARGET_DIR=$(get_build_var OUT_DIR)/target/product/$DEVICE |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 26 | else |
| 27 | echo "Please run envsetup.sh and lunch before running this script," |
| 28 | echo "or provide the build root directory as the first parameter." |
| 29 | return 1 |
| 30 | fi |
| 31 | |
| 32 | PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE |
| 33 | |
| 34 | if [ -d $PREBUILT_DIR ]; then |
| 35 | rm -rf $PREBUILT_DIR |
| 36 | fi |
| 37 | |
| 38 | mkdir -p $PREBUILT_DIR |
Jiangyi | 4491b0d | 2014-12-08 00:24:25 -0200 | [diff] [blame] | 39 | mkdir -p $PREBUILT_DIR/app |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 40 | mkdir -p $PREBUILT_DIR/lib |
| 41 | |
| 42 | if [ -d $TARGET_DIR ]; then |
| 43 | echo "Copying files..." |
Iftekhar Rifat | 36c3876 | 2015-06-21 20:30:07 +0600 | [diff] [blame] | 44 | cp $TARGET_DIR/system/app/webview/webview.apk $PREBUILT_DIR/app/webview.apk |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 45 | cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 46 | else |
| 47 | echo "Please ensure that you have ran a full build prior to running this script!" |
| 48 | return 1; |
| 49 | fi |
| 50 | |
| 51 | echo "Generating Makefiles..." |
| 52 | |
Jiangyi | 4491b0d | 2014-12-08 00:24:25 -0200 | [diff] [blame] | 53 | HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD) |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 54 | echo $HASH > $PREBUILT_DIR/hash.txt |
| 55 | |
Iftekhar Rifat | 36c3876 | 2015-06-21 20:30:07 +0600 | [diff] [blame] | 56 | (cat << EOF) | sed s/__DEVICE__/$DEVICE/g > $PREBUILT_DIR/Android.mk |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 57 | # Copyright (C) 2014 The OmniROM Project |
| 58 | # |
| 59 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 60 | # you may not use this file except in compliance with the License. |
| 61 | # You may obtain a copy of the License at |
| 62 | # |
| 63 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 64 | # |
| 65 | # Unless required by applicable law or agreed to in writing, software |
| 66 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 67 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 68 | # See the License for the specific language governing permissions and |
| 69 | # limitations under the License. |
| 70 | |
| 71 | LOCAL_PATH := prebuilts/chromium/__DEVICE__/ |
| 72 | |
Iftekhar Rifat | 36c3876 | 2015-06-21 20:30:07 +0600 | [diff] [blame] | 73 | ifeq (\$(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes) |
| 74 | |
| 75 | include \$(CLEAR_VARS) |
| 76 | |
| 77 | LOCAL_MODULE := libwebviewchromium |
| 78 | LOCAL_SRC_FILES := lib/libwebviewchromium.so |
| 79 | LOCAL_MODULE_TAGS := optional |
| 80 | LOCAL_MODULE_SUFFIX := .so |
| 81 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 82 | |
| 83 | include \$(BUILD_PREBUILT) |
| 84 | |
| 85 | endif |
| 86 | |
Jiangyi | 06fdf1c | 2014-07-21 16:26:10 -0400 | [diff] [blame] | 87 | |
| 88 | EOF |
| 89 | |
| 90 | echo "Done!" |