4 # Copyright (C) 2014-2015 ARM Limited. All rights reserved.
6 # Copyright (C) 2008 The Android Open Source Project
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # You may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
21 # Android K script for LLVM 3.5 and above support
23 # This script applies two minor patches and checks-out libcxx and libcxxabi libraries
24 # adding C++11 support in Android K required for LLVM3.5 and above.
27 if [ -z "$ANDROID_BUILD_TOP" ]; then
28 echo "[ANDROID-PATCH] This script must be executed in an Android build environment"
29 echo " ANDROID_BUILD_TOP is undefined"
30 echo " please do \"source build/envseup.sh; lunch\"."
34 ANDROID_REPOSITORY_URL
="https://android.googlesource.com/"
38 # Proccess arguments. Valid arguments are:
39 # -u ARG Override the Android repository url
40 # -r ARG Provide a path to a reference git repository
41 while getopts "u:r:" opt
; do
44 ANDROID_REPOSITORY_URL
=$OPTARG
48 REFERENCE_ARGUMENT
="--reference "$OPTARG
52 echo "Invalid option: -$OPTARG" >&2
57 echo "Option -$OPTARG requires an argument." >&2
66 cd $ANDROID_BUILD_TOP/external
68 #Checkout libcxx from Android Master required by LLVM due to c++11
69 git clone
$ANDROID_REPOSITORY_URL/platform
/external
/libcxx
$REFERENCE_ARGUMENT
72 if [[ $ret_code != 0 ]] ; then
73 echo "[ANDROID-PATCH] git clone of libcxx failed."
79 git checkout
27ae7cb782821a4f2d3813522ee411cd978bcd85
-q
82 if [[ $ret_code != 0 ]] ; then
83 echo "[ANDROID-PATCH] checkout of libcxx@27ae7cb782821a4f2d3813522ee411cd978bcd85 revision failed."
88 patch -p1 < $MIDGARD_DDK_WD/android
/patches
/K
/libcxx.
diff
91 if [[ $ret_code != 0 ]] ; then
92 echo "[ANDROID-PATCH] Patching libcxx failed."
98 #Checkout libcxxabi from Android Master required by LLVM due to c++11
99 cd $ANDROID_BUILD_TOP/external
100 git clone
$ANDROID_REPOSITORY_URL/platform
/external
/libcxxabi
$REFERENCE_ARGUMENT
103 if [[ $ret_code != 0 ]] ; then
104 echo "[ANDROID-PATCH] git clone of libcxxabi failed."
110 git checkout
285d67f35f6044cf733091e36248405ca967c62c
-q
113 if [[ $ret_code != 0 ]] ; then
114 echo "[ANDROID-PATCH] checkout of libcxxabi@285d67f35f6044cf733091e36248405ca967c62c revision failed."
120 #Apply patch to bioncs
121 cd $ANDROID_BUILD_TOP/bionic
/
122 patch -p1 < $MIDGARD_DDK_WD/android
/patches
/K
/bionics.
diff
125 if [[ $ret_code != 0 ]] ; then
126 echo "[ANDROID-PATCH] Patching bionics failed."
132 #Add locale support to bioncs
133 cd $ANDROID_BUILD_TOP/bionic
/
134 patch -p1 < $MIDGARD_DDK_WD/android
/patches
/K
/locale.
diff
137 if [[ $ret_code != 0 ]] ; then
138 echo "[ANDROID-PATCH] Adding locale support failed."
144 #Add LLVM backend ARM fix to support -O0 compilation
145 cd $ANDROID_BUILD_TOP/external
/llvm
/
146 patch -p1 < $MIDGARD_DDK_WD/android
/patches
/K
/llvm.
diff
149 if [[ $ret_code != 0 ]] ; then
150 echo "[ANDROID-PATCH] Fixing ARM LLVM backend failed."
156 echo "[ANDROID-PATCH] Patching completed successfully"