blob: 4e2159bafe697ba30276de0207d96803e898a1c6 [file] [log] [blame]
ezio84-xda4665a722014-12-22 17:10:51 +01001#!/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...
18if [ $# -eq 1 ]; then
19 TOP=$1
20 DEVICE=$TARGET_DEVICE
21elif [ -n "$(gettop)" ]; then
22 TOP=$(gettop)
23 DEVICE=$(get_build_var TARGET_DEVICE)
24else
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
28fi
29
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040030if [[ $ANDROID_PROMPT_PREFIX == *arm* ]]; then
31 ARCH=arm
32fi
33
34if [[ $ANDROID_PROMPT_PREFIX == *arm64* ]]; then
35 ARCH=arm64
36fi
37
ezio84-xda4665a722014-12-22 17:10:51 +010038TARGET_DIR=$OUT
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040039LIBS_64=$TARGET_DIR/system/lib64
ezio84-xda4665a722014-12-22 17:10:51 +010040PREBUILT_DIR=$TOP/prebuilts/chromium/$DEVICE
41
42if [ -d $PREBUILT_DIR ]; then
43 rm -rf $PREBUILT_DIR
44fi
45
46mkdir -p $PREBUILT_DIR
47mkdir -p $PREBUILT_DIR/app
48mkdir -p $PREBUILT_DIR/lib
49
50if [ -d $TARGET_DIR ]; then
51 echo "Copying files..."
52 cp -r $TARGET_DIR/system/app/webview $PREBUILT_DIR/app
53 cp $TARGET_DIR/system/lib/libwebviewchromium.so $PREBUILT_DIR/lib/libwebviewchromium.so
54 cp $TARGET_DIR/system/lib/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib/libwebviewchromium_plat_support.so
55 cp $TARGET_DIR/system/lib/libwebviewchromium_loader.so $PREBUILT_DIR/lib/libwebviewchromium_loader.so
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040056 if [ -d $LIBS_64 ]; then
57 mkdir -p $PREBUILT_DIR/lib64
58 cp $LIBS_64/libwebviewchromium.so $PREBUILT_DIR/lib64/libwebviewchromium.so
59 cp $LIBS_64/libwebviewchromium_plat_support.so $PREBUILT_DIR/lib64/libwebviewchromium_plat_support.so
60 cp $LIBS_64/libwebviewchromium_loader.so $PREBUILT_DIR/lib64/libwebviewchromium_loader.so
61 fi
ezio84-xda4665a722014-12-22 17:10:51 +010062else
63 echo "Please ensure that you have ran a full build prior to running this script!"
64 return 1;
65fi
66
67echo "Generating Makefiles..."
68
69HASH=$(git --git-dir=$TOP/external/chromium_org/.git --work-tree=$TOP/external/chromium_org rev-parse --verify HEAD)
70echo $HASH > $PREBUILT_DIR/hash.txt
71
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040072sed -e s/__DEVICE__/$DEVICE/g -e s/__ARCH__/$ARCH/g > $PREBUILT_DIR/chromium_prebuilt.mk << EOF
ezio84-xda4665a722014-12-22 17:10:51 +010073# Copyright (C) 2014 The OmniROM Project
74#
75# Licensed under the Apache License, Version 2.0 (the "License");
76# you may not use this file except in compliance with the License.
77# You may obtain a copy of the License at
78#
79# http://www.apache.org/licenses/LICENSE-2.0
80#
81# Unless required by applicable law or agreed to in writing, software
82# distributed under the License is distributed on an "AS IS" BASIS,
83# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84# See the License for the specific language governing permissions and
85# limitations under the License.
86
87LOCAL_PATH := prebuilts/chromium/__DEVICE__/
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040088ARCH := __ARCH__
ezio84-xda4665a722014-12-22 17:10:51 +010089
90PRODUCT_COPY_FILES += \\
91 \$(LOCAL_PATH)/app/webview/webview.apk:system/app/webview/webview.apk \\
92 \$(LOCAL_PATH)/lib/libwebviewchromium.so:system/lib/libwebviewchromium.so \\
93 \$(LOCAL_PATH)/lib/libwebviewchromium_plat_support.so:system/lib/libwebviewchromium_plat_support.so \\
94 \$(LOCAL_PATH)/lib/libwebviewchromium_loader.so:system/lib/libwebviewchromium_loader.so
95
Abhinav Jhanwar234ce722015-07-25 11:56:35 -040096ifeq (\$(ARCH),arm64)
97PRODUCT_COPY_FILES += \\
98 \$(LOCAL_PATH)/lib64/libwebviewchromium.so:system/lib64/libwebviewchromium.so \\
99 \$(LOCAL_PATH)/lib64/libwebviewchromium_plat_support.so:system/lib64/libwebviewchromium_plat_support.so \\
100 \$(LOCAL_PATH)/lib64/libwebviewchromium_loader.so:system/lib64/libwebviewchromium_loader.so
101endif
102
103ifeq (\$(ARCH),arm)
ezio84-xda4665a722014-12-22 17:10:51 +0100104\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm/)
105\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm/libwebviewchromium.so)
Abhinav Jhanwar234ce722015-07-25 11:56:35 -0400106endif
107
108ifeq (\$(ARCH),arm64)
109\$(shell mkdir -p out/target/product/__DEVICE__/system/app/webview/lib/arm64/)
110\$(shell cp -r \$(LOCAL_PATH)/app/webview/lib/arm64/libwebviewchromium.so out/target/product/__DEVICE__/system/app/webview/lib/arm64/libwebviewchromium.so)
111endif
ezio84-xda4665a722014-12-22 17:10:51 +0100112
113EOF
114
115echo "Done!"