OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Sets up environment for building Chromium on Android. Only Android NDK, | 7 # Sets up environment for building Chromium on Android. Only Android NDK, |
8 # Revision 6b on Linux or Mac is offically supported. | 8 # Revision 6b on Linux or Mac is offically supported. |
9 # | 9 # |
10 # To run this script, the system environment ANDROID_NDK_ROOT must be set | 10 # To run this script, the system environment ANDROID_NDK_ROOT must be set |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 export CHROME_SRC=$(readlink -f .) | 61 export CHROME_SRC=$(readlink -f .) |
62 fi | 62 fi |
63 | 63 |
64 if [ ! -d "${CHROME_SRC}" ]; then | 64 if [ ! -d "${CHROME_SRC}" ]; then |
65 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 | 65 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 |
66 return 1 | 66 return 1 |
67 fi | 67 fi |
68 | 68 |
69 # Performs a gyp_chromium run to convert gyp->Makefile for android code. | 69 # Performs a gyp_chromium run to convert gyp->Makefile for android code. |
70 android_gyp() { | 70 android_gyp() { |
71 CROSS_CC="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" \ | |
72 CROSS_CXX="$(firstword "${ANDROID_TOOLCHAIN}"/*-g++)" \ | |
73 CROSS_LINK="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" \ | |
74 HOST_CC=`which gcc` \ | |
75 HOST_CXX=`which g++` \ | |
76 HOST_LINK=`which g++` \ | |
77 LIBGCC_FILE_NAME=`${ANDROID_TOOLCHAIN}/arm-linux-androideabi-gcc \ | |
Peter Beverloo
2012/03/13 14:58:59
This seems to defeat the purpose of the firstword-
bulach
2012/03/13 15:12:09
good point, let me fix this..
| |
78 -print-libgcc-file-name` \ | |
71 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" | 79 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" |
72 } | 80 } |
73 | 81 |
82 android_goma_gyp() { | |
83 CROSS_CC="$GOMA_DIR/gomacc $(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" \ | |
84 CROSS_CXX="$GOMA_DIR/gomacc $(firstword "${ANDROID_TOOLCHAIN}"/*-g++)" \ | |
85 CROSS_LINK="$GOMA_DIR/gomacc $(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" \ | |
86 HOST_CC=$GOMA_DIR/gcc \ | |
87 HOST_CXX=$GOMA_DIR/g++ \ | |
88 HOST_LINK=$GOMA_DIR/g++\ | |
89 LIBGCC_FILE_NAME=`${ANDROID_TOOLCHAIN}/arm-linux-androideabi-gcc \ | |
90 -print-libgcc-file-name` \ | |
91 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" | |
92 } | |
93 | |
74 firstword() { | 94 firstword() { |
75 echo "${1}" | 95 echo "${1}" |
76 } | 96 } |
77 | 97 |
78 export CROSS_AR="$(firstword "${ANDROID_TOOLCHAIN}"/*-ar)" | |
79 export CROSS_CC="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" | |
80 export CROSS_CXX="$(firstword "${ANDROID_TOOLCHAIN}"/*-g++)" | |
81 export CROSS_LINK="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)" | |
82 export CROSS_RANLIB="$(firstword "${ANDROID_TOOLCHAIN}"/*-ranlib)" | |
83 export OBJCOPY="$(firstword "${ANDROID_TOOLCHAIN}"/*-objcopy)" | 98 export OBJCOPY="$(firstword "${ANDROID_TOOLCHAIN}"/*-objcopy)" |
84 export STRIP="$(firstword "${ANDROID_TOOLCHAIN}"/*-strip)" | 99 export STRIP="$(firstword "${ANDROID_TOOLCHAIN}"/*-strip)" |
85 | 100 |
86 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories | 101 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories |
87 # to canonicalize them (remove double '/', remove trailing '/', etc). | 102 # to canonicalize them (remove double '/', remove trailing '/', etc). |
88 DEFINES="OS=android" | 103 DEFINES="OS=android" |
89 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. | 104 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. |
90 DEFINES+=" host_os=${host_os}" | 105 DEFINES+=" host_os=${host_os}" |
91 DEFINES+=" linux_fpic=1" | 106 DEFINES+=" linux_fpic=1" |
92 DEFINES+=" release_optimize=s" | 107 DEFINES+=" release_optimize=s" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 export GYP_DEFINES="${DEFINES}" | 139 export GYP_DEFINES="${DEFINES}" |
125 | 140 |
126 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 141 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
127 export GYP_GENERATORS="make-android" | 142 export GYP_GENERATORS="make-android" |
128 | 143 |
129 # Use our All target as the default | 144 # Use our All target as the default |
130 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 145 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
131 | 146 |
132 # We want to use our version of "all" targets. | 147 # We want to use our version of "all" targets. |
133 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | 148 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
OLD | NEW |