David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 1 | #!/bin/sh |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 2 | # |
| 3 | # this script is used to rebuild the Android emulator from sources |
| 4 | # in the current directory. It also contains logic to speed up the |
| 5 | # rebuild if it detects that you're using the Android build system |
| 6 | # |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 7 | # here's the list of environment variables you can define before |
| 8 | # calling this script to control it (besides options): |
| 9 | # |
| 10 | # |
| 11 | |
| 12 | # first, let's see which system we're running this on |
| 13 | cd `dirname $0` |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 14 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 15 | # source common functions definitions |
| 16 | . android/build/common.sh |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 17 | |
| 18 | # Parse options |
| 19 | OPTION_TARGETS="" |
| 20 | OPTION_DEBUG=no |
| 21 | OPTION_IGNORE_AUDIO=no |
| 22 | OPTION_NO_PREBUILTS=no |
| 23 | OPTION_TRY_64=no |
| 24 | OPTION_HELP=no |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame] | 25 | OPTION_DEBUG=no |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 26 | OPTION_STATIC=no |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 27 | OPTION_MINGW=no |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 28 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 29 | GLES_INCLUDE= |
| 30 | GLES_LIBS= |
| 31 | GLES_SUPPORT=no |
| 32 | GLES_PROBE=yes |
| 33 | |
David 'Digit' Turner | e365068 | 2010-12-22 14:44:19 +0100 | [diff] [blame] | 34 | HOST_CC=${CC:-gcc} |
| 35 | OPTION_CC= |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 36 | |
David 'Digit' Turner | 5b2e7c4 | 2011-02-07 18:51:07 +0100 | [diff] [blame] | 37 | TARGET_ARCH=arm |
| 38 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 39 | for opt do |
| 40 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 41 | case "$opt" in |
| 42 | --help|-h|-\?) OPTION_HELP=yes |
| 43 | ;; |
| 44 | --verbose) |
| 45 | if [ "$VERBOSE" = "yes" ] ; then |
| 46 | VERBOSE2=yes |
| 47 | else |
| 48 | VERBOSE=yes |
| 49 | fi |
| 50 | ;; |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame] | 51 | --debug) OPTION_DEBUG=yes |
| 52 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 53 | --install=*) OPTION_TARGETS="$OPTION_TARGETS $optarg"; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 54 | ;; |
| 55 | --sdl-config=*) SDL_CONFIG=$optarg |
| 56 | ;; |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 57 | --mingw) OPTION_MINGW=yes |
| 58 | ;; |
David 'Digit' Turner | e365068 | 2010-12-22 14:44:19 +0100 | [diff] [blame] | 59 | --cc=*) OPTION_CC="$optarg" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 60 | ;; |
| 61 | --no-strip) OPTION_NO_STRIP=yes |
| 62 | ;; |
| 63 | --debug) OPTION_DEBUG=yes |
| 64 | ;; |
| 65 | --ignore-audio) OPTION_IGNORE_AUDIO=yes |
| 66 | ;; |
| 67 | --no-prebuilts) OPTION_NO_PREBUILTS=yes |
| 68 | ;; |
| 69 | --try-64) OPTION_TRY_64=yes |
| 70 | ;; |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 71 | --static) OPTION_STATIC=yes |
| 72 | ;; |
David 'Digit' Turner | 5b2e7c4 | 2011-02-07 18:51:07 +0100 | [diff] [blame] | 73 | --arch=*) TARGET_ARCH=$optarg |
| 74 | ;; |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 75 | --gles-include=*) GLES_INCLUDE=$optarg |
| 76 | GLES_SUPPORT=yes |
| 77 | ;; |
| 78 | --gles-libs=*) GLES_LIBS=$optarg |
| 79 | GLES_SUPPORT=yes |
| 80 | ;; |
| 81 | --no-gles) GLES_PROBE=no |
| 82 | ;; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 83 | *) |
| 84 | echo "unknown option '$opt', use --help" |
| 85 | exit 1 |
| 86 | esac |
| 87 | done |
| 88 | |
| 89 | # Print the help message |
| 90 | # |
| 91 | if [ "$OPTION_HELP" = "yes" ] ; then |
| 92 | cat << EOF |
| 93 | |
| 94 | Usage: rebuild.sh [options] |
| 95 | Options: [defaults in brackets after descriptions] |
| 96 | EOF |
| 97 | echo "Standard options:" |
| 98 | echo " --help print this message" |
| 99 | echo " --install=FILEPATH copy emulator executable to FILEPATH [$TARGETS]" |
David 'Digit' Turner | e365068 | 2010-12-22 14:44:19 +0100 | [diff] [blame] | 100 | echo " --cc=PATH specify C compiler [$HOST_CC]" |
David 'Digit' Turner | 5b2e7c4 | 2011-02-07 18:51:07 +0100 | [diff] [blame] | 101 | echo " --arch=ARM specify target architecture [$TARGET_ARCH]" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 102 | echo " --sdl-config=FILE use specific sdl-config script [$SDL_CONFIG]" |
| 103 | echo " --no-strip do not strip emulator executable" |
| 104 | echo " --debug enable debug (-O0 -g) build" |
| 105 | echo " --ignore-audio ignore audio messages (may build sound-less emulator)" |
| 106 | echo " --no-prebuilts do not use prebuilt libraries and compiler" |
| 107 | echo " --try-64 try to build a 64-bit executable (may crash)" |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 108 | echo " --mingw build Windows executable on Linux" |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 109 | echo " --static build a completely static executable" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 110 | echo " --verbose verbose configuration" |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame] | 111 | echo " --debug build debug version of the emulator" |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 112 | echo " --gles-include=PATH specify path to GLES emulation headers" |
| 113 | echo " --gles-libs=PATH specify path to GLES emulation host libraries" |
| 114 | echo " --no-gles disable GLES emulation support" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 115 | echo "" |
| 116 | exit 1 |
| 117 | fi |
| 118 | |
David 'Digit' Turner | e365068 | 2010-12-22 14:44:19 +0100 | [diff] [blame] | 119 | # On Linux, try to use our 32-bit prebuilt toolchain to generate binaries |
| 120 | # that are compatible with Ubuntu 8.04 |
| 121 | if [ -z "$CC" -a -z "$OPTION_CC" -a "$HOST_OS" = linux -a "$OPTION_TRY_64" != "yes" ] ; then |
| 122 | HOST_CC=`dirname $0`/../../prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/bin/i686-linux-gcc |
| 123 | if [ -f "$HOST_CC" ] ; then |
| 124 | echo "Using prebuilt 32-bit toolchain: $HOST_CC" |
| 125 | CC="$HOST_CC" |
| 126 | fi |
| 127 | fi |
| 128 | |
David 'Digit' Turner | ba313e0 | 2011-02-09 16:01:53 +0100 | [diff] [blame] | 129 | echo "OPTION_CC='$OPTION_CC'" |
| 130 | if [ -n "$OPTION_CC" ]; then |
| 131 | echo "Using specified C compiler: $OPTION_CC" |
| 132 | CC="$OPTION_CC" |
| 133 | fi |
| 134 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 135 | # we only support generating 32-bit binaris on 64-bit systems. |
| 136 | # And we may need to add a -Wa,--32 to CFLAGS to let the assembler |
| 137 | # generate 32-bit binaries on Linux x86_64. |
| 138 | # |
| 139 | if [ "$OPTION_TRY_64" != "yes" ] ; then |
| 140 | force_32bit_binaries |
| 141 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 142 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 143 | case $OS in |
| 144 | linux-*) |
| 145 | TARGET_DLL_SUFFIX=.so |
| 146 | ;; |
| 147 | darwin-*) |
| 148 | TARGET_DLL_SUFFIX=.dylib |
| 149 | ;; |
| 150 | windows*) |
| 151 | TARGET_DLL_SUFFIX=.dll |
| 152 | esac |
| 153 | |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 154 | TARGET_OS=$OS |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 155 | if [ "$OPTION_MINGW" = "yes" ] ; then |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 156 | enable_linux_mingw |
| 157 | TARGET_OS=windows |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 158 | TARGET_DLL_SUFFIX=.dll |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 159 | else |
| 160 | enable_cygwin |
| 161 | fi |
| 162 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 163 | # Are we running in the Android build system ? |
| 164 | check_android_build |
| 165 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 166 | |
| 167 | # Adjust a few things when we're building within the Android build |
| 168 | # system: |
| 169 | # - locate prebuilt directory |
| 170 | # - locate and use prebuilt libraries |
| 171 | # - copy the new binary to the correct location |
| 172 | # |
| 173 | if [ "$OPTION_NO_PREBUILTS" = "yes" ] ; then |
| 174 | IN_ANDROID_BUILD=no |
| 175 | fi |
| 176 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 177 | # This is the list of static and shared host libraries we need to link |
| 178 | # against in order to support OpenGLES emulation properly. Note that in |
| 179 | # the case of a standalone build, we will find these libraries inside the |
| 180 | # platform build tree and copy them into objs/lib/ automatically, unless |
| 181 | # you use --gles-libs to point explicitely to a different directory. |
| 182 | # |
| 183 | GLES_SHARED_LIBRARIES="libOpenglRender libGLES_CM_translator libGLES_V2_translator libEGL_translator" |
| 184 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 185 | if [ "$IN_ANDROID_BUILD" = "yes" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 186 | locate_android_prebuilt |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 187 | |
| 188 | # use ccache if USE_CCACHE is defined and the corresponding |
| 189 | # binary is available. |
| 190 | # |
| 191 | # note: located in PREBUILT/ccache/ccache in the new tree layout |
| 192 | # located in PREBUILT/ccache in the old one |
| 193 | # |
| 194 | if [ -n "$USE_CCACHE" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 195 | CCACHE="$ANDROID_PREBUILT/ccache/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 196 | if [ ! -f $CCACHE ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 197 | CCACHE="$ANDROID_PREBUILT/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 198 | fi |
| 199 | if [ -f $CCACHE ] ; then |
| 200 | CC="$CCACHE $CC" |
| 201 | fi |
| 202 | log "Prebuilt : CCACHE=$CCACHE" |
| 203 | fi |
| 204 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 205 | # finally ensure that our new binary is copied to the 'out' |
| 206 | # subdirectory as 'emulator' |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 207 | HOST_BIN=$(get_android_abs_build_var HOST_OUT_EXECUTABLES) |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 208 | if [ "$TARGET_OS" = "windows" ]; then |
| 209 | HOST_BIN=$(echo $HOST_BIN | sed "s%$OS/bin%windows/bin%") |
| 210 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 211 | if [ -n "$HOST_BIN" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 212 | OPTION_TARGETS="$OPTION_TARGETS $HOST_BIN/emulator$EXE" |
| 213 | log "Targets : TARGETS=$OPTION_TARGETS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 214 | fi |
David 'Digit' Turner | a383d02 | 2009-12-03 13:50:00 -0800 | [diff] [blame] | 215 | |
| 216 | # find the Android SDK Tools revision number |
| 217 | TOOLS_PROPS=$ANDROID_TOP/sdk/files/tools_source.properties |
| 218 | if [ -f $TOOLS_PROPS ] ; then |
| 219 | ANDROID_SDK_TOOLS_REVISION=`awk -F= '/Pkg.Revision/ { print $2; }' $TOOLS_PROPS 2> /dev/null` |
| 220 | log "Tools : Found tools revision number $ANDROID_SDK_TOOLS_REVISION" |
| 221 | else |
| 222 | log "Tools : Could not locate $TOOLS_PROPS !?" |
| 223 | fi |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 224 | |
| 225 | # Try to find the GLES emulation headers and libraries automatically |
| 226 | if [ "$GLES_PROBE" = "yes" ]; then |
| 227 | GLES_SUPPORT=yes |
| 228 | if [ -z "$GLES_INCLUDE" ]; then |
| 229 | log "GLES : Probing for headers" |
| 230 | GLES_INCLUDE=$ANDROID_TOP/development/tools/emulator/opengl/host/include |
| 231 | if [ -d "$GLES_INCLUDE" ]; then |
| 232 | log "GLES : Headers in $GLES_INCLUDE" |
| 233 | else |
| 234 | echo "Warning: Could not find OpenGLES emulation include dir: $GLES_INCLUDE" |
| 235 | echo "Disabling GLES emulation from this build!" |
| 236 | GLES_SUPPORT=no |
| 237 | fi |
| 238 | fi |
| 239 | if [ -z "$GLES_LIBS" ]; then |
| 240 | log "GLES : Probing for host libraries" |
| 241 | GLES_LIBS=$(dirname "$HOST_BIN")/lib |
| 242 | if [ -d "$GLES_LIBS" ]; then |
| 243 | echo "GLES : Libs in $GLES_LIBS" |
| 244 | else |
| 245 | echo "Warning: Could nof find OpenGLES emulation libraries in: $GLES_LIBS" |
| 246 | echo "Disabling GLES emulation from this build!" |
| 247 | GLES_SUPPORT=no |
| 248 | fi |
| 249 | fi |
| 250 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 251 | fi # IN_ANDROID_BUILD = no |
| 252 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 253 | if [ "$GLES_SUPPORT" = "yes" ]; then |
| 254 | if [ -z "$GLES_INCLUDE" -o -z "$GLES_LIBS" ]; then |
| 255 | echo "ERROR: You must use both --gles-include and --gles-libs at the same time!" |
| 256 | echo " Or use --no-gles to disable its support from this build." |
| 257 | exit 1 |
| 258 | fi |
| 259 | |
| 260 | GLES_HEADER=$GLES_INCLUDE/libOpenglRender/render_api.h |
| 261 | if [ ! -f "$GLES_HEADER" ]; then |
| 262 | echo "ERROR: Missing OpenGLES emulation header file: $GLES_HEADER" |
| 263 | echo "Please fix this by using --gles-include to point to the right directory!" |
| 264 | exit 1 |
| 265 | fi |
| 266 | |
| 267 | mkdir -p objs/lib |
| 268 | |
| 269 | for lib in $GLES_SHARED_LIBRARIES; do |
| 270 | GLES_LIB=$GLES_LIBS/${lib}$TARGET_DLL_SUFFIX |
| 271 | if [ ! -f "$GLES_LIB" ]; then |
| 272 | echo "ERROR: Missing OpenGLES emulation host library: $GLES_LIB" |
| 273 | echo "Please fix this by using --gles-libs to point to the right directory!" |
| 274 | if [ "$IN_ANDROID_BUILD" = "true" ]; then |
| 275 | echo "You might also be missing the library because you forgot to rebuild the whole platform!" |
| 276 | fi |
| 277 | exit 1 |
| 278 | fi |
| 279 | cp $GLES_LIB objs/lib |
| 280 | if [ $? != 0 ]; then |
| 281 | echo "ERROR: Could not find required OpenGLES emulation library: $GLES_LIB" |
| 282 | exit 1 |
| 283 | else |
| 284 | log "GLES : Copying $GLES_LIB" |
| 285 | fi |
| 286 | done |
| 287 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 288 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 289 | # we can build the emulator with Cygwin, so enable it |
| 290 | enable_cygwin |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 291 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 292 | setup_toolchain |
The Android Open Source Project | 92c7311 | 2009-03-05 14:34:31 -0800 | [diff] [blame] | 293 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 294 | ### |
| 295 | ### SDL Probe |
| 296 | ### |
| 297 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 298 | if [ -n "$SDL_CONFIG" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 299 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 300 | # check that we can link statically with the library. |
| 301 | # |
| 302 | SDL_CFLAGS=`$SDL_CONFIG --cflags` |
| 303 | SDL_LIBS=`$SDL_CONFIG --static-libs` |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 304 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 305 | # quick hack, remove the -D_GNU_SOURCE=1 of some SDL Cflags |
David 'Digit' Turner | 826b985 | 2011-06-01 15:28:14 +0200 | [diff] [blame] | 306 | 7 # since they break recent Mingw releases |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 307 | SDL_CFLAGS=`echo $SDL_CFLAGS | sed -e s/-D_GNU_SOURCE=1//g` |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 308 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 309 | log "SDL-probe : SDL_CFLAGS = $SDL_CFLAGS" |
| 310 | log "SDL-probe : SDL_LIBS = $SDL_LIBS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 311 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 312 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 313 | EXTRA_CFLAGS="$SDL_CFLAGS" |
| 314 | EXTRA_LDFLAGS="$SDL_LIBS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 315 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 316 | case "$OS" in |
| 317 | freebsd-*) |
| 318 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -lpthread" |
| 319 | ;; |
| 320 | esac |
Alexey Tarasov | 0882322 | 2009-09-01 02:07:51 +1100 | [diff] [blame] | 321 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 322 | cat > $TMPC << EOF |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 323 | #include <SDL.h> |
| 324 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 325 | int main( int argc, char** argv ) { |
David 'Digit' Turner | 81f7429 | 2010-10-14 18:29:45 +0200 | [diff] [blame] | 326 | return SDL_Init (SDL_INIT_VIDEO); |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 327 | } |
| 328 | EOF |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 329 | feature_check_link SDL_LINKING |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 330 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 331 | if [ $SDL_LINKING != "yes" ] ; then |
| 332 | echo "You provided an explicit sdl-config script, but the corresponding library" |
| 333 | echo "cannot be statically linked with the Android emulator directly." |
| 334 | echo "Error message:" |
| 335 | cat $TMPL |
| 336 | clean_exit |
| 337 | fi |
| 338 | log "SDL-probe : static linking ok" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 339 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 340 | # now, let's check that the SDL library has the special functions |
| 341 | # we added to our own sources |
| 342 | # |
| 343 | cat > $TMPC << EOF |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 344 | #include <SDL.h> |
| 345 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 346 | int main( int argc, char** argv ) { |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 347 | int x, y; |
| 348 | SDL_Rect r; |
| 349 | SDL_WM_GetPos(&x, &y); |
| 350 | SDL_WM_SetPos(x, y); |
| 351 | SDL_WM_GetMonitorDPI(&x, &y); |
| 352 | SDL_WM_GetMonitorRect(&r); |
David 'Digit' Turner | 81f7429 | 2010-10-14 18:29:45 +0200 | [diff] [blame] | 353 | return SDL_Init (SDL_INIT_VIDEO); |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 354 | } |
| 355 | EOF |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 356 | feature_check_link SDL_LINKING |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 357 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 358 | if [ $SDL_LINKING != "yes" ] ; then |
| 359 | echo "You provided an explicit sdl-config script in SDL_CONFIG, but the" |
| 360 | echo "corresponding library doesn't have the patches required to link" |
| 361 | echo "with the Android emulator. Unsetting SDL_CONFIG will use the" |
| 362 | echo "sources bundled with the emulator instead" |
| 363 | echo "Error:" |
| 364 | cat $TMPL |
| 365 | clean_exit |
| 366 | fi |
| 367 | |
| 368 | log "SDL-probe : extra features ok" |
| 369 | clean_temp |
| 370 | |
| 371 | EXTRA_CFLAGS= |
| 372 | EXTRA_LDFLAGS= |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 373 | fi |
| 374 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 375 | ### |
| 376 | ### Audio subsystems probes |
| 377 | ### |
| 378 | PROBE_COREAUDIO=no |
| 379 | PROBE_ALSA=no |
| 380 | PROBE_OSS=no |
| 381 | PROBE_ESD=no |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 382 | PROBE_PULSEAUDIO=no |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 383 | PROBE_WINAUDIO=no |
| 384 | |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 385 | case "$TARGET_OS" in |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 386 | darwin*) PROBE_COREAUDIO=yes; |
| 387 | ;; |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 388 | linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes; PROBE_PULSEAUDIO=yes; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 389 | ;; |
Alexey Tarasov | 0882322 | 2009-09-01 02:07:51 +1100 | [diff] [blame] | 390 | freebsd-*) PROBE_OSS=yes; |
| 391 | ;; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 392 | windows) PROBE_WINAUDIO=yes |
| 393 | ;; |
| 394 | esac |
| 395 | |
| 396 | ORG_CFLAGS=$CFLAGS |
| 397 | ORG_LDFLAGS=$LDFLAGS |
| 398 | |
David 'Digit' Turner | 80bc5c8 | 2010-10-20 19:04:51 +0200 | [diff] [blame] | 399 | if [ "$OPTION_IGNORE_AUDIO" = "yes" ] ; then |
| 400 | PROBE_ESD_ESD=no |
| 401 | PROBE_ALSA=no |
| 402 | PROBE_PULSEAUDIO=no |
| 403 | fi |
| 404 | |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 405 | # Probe a system library |
| 406 | # |
| 407 | # $1: Variable name (e.g. PROBE_ESD) |
| 408 | # $2: Library name (e.g. "Alsa") |
| 409 | # $3: Path to source file for probe program (e.g. android/config/check-alsa.c) |
| 410 | # $4: Package name (e.g. libasound-dev) |
| 411 | # |
| 412 | probe_system_library () |
| 413 | { |
| 414 | if [ `var_value $1` = yes ] ; then |
| 415 | CFLAGS="$ORG_CFLAGS" |
| 416 | LDFLAGS="$ORG_LDFLAGS -ldl" |
| 417 | cp -f android/config/check-esd.c $TMPC |
David 'Digit' Turner | a7ef1ac | 2010-12-10 22:33:51 +0100 | [diff] [blame] | 418 | compile |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 419 | if [ $? = 0 ] ; then |
David 'Digit' Turner | 80bc5c8 | 2010-10-20 19:04:51 +0200 | [diff] [blame] | 420 | log "AudioProbe : $2 seems to be usable on this system" |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 421 | else |
| 422 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
David 'Digit' Turner | 80bc5c8 | 2010-10-20 19:04:51 +0200 | [diff] [blame] | 423 | echo "The $2 development files do not seem to be installed on this system" |
| 424 | echo "Are you missing the $4 package ?" |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 425 | echo "Correct the errors below and try again:" |
| 426 | cat $TMPL |
| 427 | clean_exit |
| 428 | fi |
| 429 | eval $1=no |
David 'Digit' Turner | 80bc5c8 | 2010-10-20 19:04:51 +0200 | [diff] [blame] | 430 | log "AudioProbe : $2 seems to be UNUSABLE on this system !!" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 431 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 432 | fi |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 433 | } |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 434 | |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 435 | probe_system_library PROBE_ESD ESounD android/config/check-esd.c libesd-dev |
| 436 | probe_system_library PROBE_ALSA Alsa android/config/check-alsa.c libasound-dev |
| 437 | probe_system_library PROBE_PULSEAUDIO PulseAudio android/config/check-pulseaudio.c libpulse-dev |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 438 | |
| 439 | CFLAGS=$ORG_CFLAGS |
| 440 | LDFLAGS=$ORG_LDFLAGS |
| 441 | |
| 442 | # create the objs directory that is going to contain all generated files |
| 443 | # including the configuration ones |
| 444 | # |
| 445 | mkdir -p objs |
| 446 | |
| 447 | ### |
| 448 | ### Compiler probe |
| 449 | ### |
| 450 | |
| 451 | #### |
| 452 | #### Host system probe |
| 453 | #### |
| 454 | |
| 455 | # because the previous version could be read-only |
| 456 | rm -f $TMPC |
| 457 | |
| 458 | # check host endianess |
| 459 | # |
| 460 | HOST_BIGENDIAN=no |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 461 | if [ "$TARGET_OS" = "$OS" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 462 | cat > $TMPC << EOF |
| 463 | #include <inttypes.h> |
| 464 | int main(int argc, char ** argv){ |
| 465 | volatile uint32_t i=0x01234567; |
Marcus Comstedt | 17d3132 | 2010-10-05 21:54:12 +0200 | [diff] [blame] | 466 | return (*((uint8_t*)(&i))) == 0x01; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 467 | } |
| 468 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 469 | feature_run_exec HOST_BIGENDIAN |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 470 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 471 | |
| 472 | # check size of host long bits |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 473 | HOST_LONGBITS=32 |
| 474 | if [ "$TARGET_OS" = "$OS" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 475 | cat > $TMPC << EOF |
| 476 | int main(void) { |
| 477 | return sizeof(void*)*8; |
| 478 | } |
| 479 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 480 | feature_run_exec HOST_LONGBITS |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 481 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 482 | |
| 483 | # check whether we have <byteswap.h> |
| 484 | # |
David Turner | b8fec3e | 2010-09-09 18:15:23 +0200 | [diff] [blame] | 485 | feature_check_header HAVE_BYTESWAP_H "<byteswap.h>" |
| 486 | feature_check_header HAVE_MACHINE_BSWAP_H "<machine/bswap.h>" |
| 487 | feature_check_header HAVE_FNMATCH_H "<fnmatch.h>" |
David Turner | 80dd126 | 2010-09-09 18:04:49 +0200 | [diff] [blame] | 488 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 489 | # Build the config.make file |
| 490 | # |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 491 | |
David 'Digit' Turner | 81f7429 | 2010-10-14 18:29:45 +0200 | [diff] [blame] | 492 | case $TARGET_OS in |
| 493 | windows) |
| 494 | TARGET_EXEEXT=.exe |
| 495 | ;; |
| 496 | *) |
| 497 | TARGET_EXEEXT= |
| 498 | ;; |
| 499 | esac |
| 500 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 501 | create_config_mk |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 502 | echo "" >> $config_mk |
Jun Nakajima | 334ab47 | 2011-02-02 23:49:59 -0800 | [diff] [blame] | 503 | if [ $TARGET_ARCH = arm ] ; then |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 504 | echo "TARGET_ARCH := arm" >> $config_mk |
Jun Nakajima | 334ab47 | 2011-02-02 23:49:59 -0800 | [diff] [blame] | 505 | fi |
| 506 | |
| 507 | if [ $TARGET_ARCH = x86 ] ; then |
| 508 | echo "TARGET_ARCH := x86" >> $config_mk |
| 509 | fi |
| 510 | |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 511 | echo "HOST_PREBUILT_TAG := $TARGET_OS" >> $config_mk |
David 'Digit' Turner | 81f7429 | 2010-10-14 18:29:45 +0200 | [diff] [blame] | 512 | echo "HOST_EXEEXT := $TARGET_EXEEXT" >> $config_mk |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 513 | echo "PREBUILT := $ANDROID_PREBUILT" >> $config_mk |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 514 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 515 | PWD=`pwd` |
| 516 | echo "SRC_PATH := $PWD" >> $config_mk |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 517 | if [ -n "$SDL_CONFIG" ] ; then |
David 'Digit' Turner | a402668 | 2011-08-24 12:54:01 +0200 | [diff] [blame] | 518 | echo "QEMU_SDL_CONFIG := $SDL_CONFIG" >> $config_mk |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 519 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 520 | echo "CONFIG_COREAUDIO := $PROBE_COREAUDIO" >> $config_mk |
| 521 | echo "CONFIG_WINAUDIO := $PROBE_WINAUDIO" >> $config_mk |
| 522 | echo "CONFIG_ESD := $PROBE_ESD" >> $config_mk |
| 523 | echo "CONFIG_ALSA := $PROBE_ALSA" >> $config_mk |
| 524 | echo "CONFIG_OSS := $PROBE_OSS" >> $config_mk |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 525 | echo "CONFIG_PULSEAUDIO := $PROBE_PULSEAUDIO" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 526 | echo "BUILD_STANDALONE_EMULATOR := true" >> $config_mk |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame] | 527 | if [ $OPTION_DEBUG = yes ] ; then |
| 528 | echo "BUILD_DEBUG_EMULATOR := true" >> $config_mk |
| 529 | fi |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 530 | if [ $OPTION_STATIC = yes ] ; then |
| 531 | echo "CONFIG_STATIC_EXECUTABLE := true" >> $config_mk |
| 532 | fi |
| 533 | |
David 'Digit' Turner | a383d02 | 2009-12-03 13:50:00 -0800 | [diff] [blame] | 534 | if [ -n "$ANDROID_SDK_TOOLS_REVISION" ] ; then |
| 535 | echo "ANDROID_SDK_TOOLS_REVISION := $ANDROID_SDK_TOOLS_REVISION" >> $config_mk |
| 536 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 537 | |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 538 | if [ "$OPTION_MINGW" = "yes" ] ; then |
| 539 | echo "" >> $config_mk |
| 540 | echo "USE_MINGW := 1" >> $config_mk |
| 541 | echo "HOST_OS := windows" >> $config_mk |
| 542 | fi |
| 543 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 544 | if [ "$GLES_INCLUDE" -a "$GLES_LIBS" ]; then |
| 545 | echo "QEMU_OPENGLES_INCLUDE := $GLES_INCLUDE" >> $config_mk |
| 546 | echo "QEMU_OPENGLES_LIBS := $GLES_LIBS" >> $config_mk |
| 547 | fi |
| 548 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 549 | # Build the config-host.h file |
| 550 | # |
| 551 | config_h=objs/config-host.h |
| 552 | echo "/* This file was autogenerated by '$PROGNAME' */" > $config_h |
| 553 | echo "#define CONFIG_QEMU_SHAREDIR \"/usr/local/share/qemu\"" >> $config_h |
| 554 | echo "#define HOST_LONG_BITS $HOST_LONGBITS" >> $config_h |
| 555 | if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then |
David Turner | b8fec3e | 2010-09-09 18:15:23 +0200 | [diff] [blame] | 556 | echo "#define CONFIG_BYTESWAP_H 1" >> $config_h |
| 557 | fi |
| 558 | if [ "$HAVE_MACHINE_BYTESWAP_H" = "yes" ] ; then |
| 559 | echo "#define CONFIG_MACHINE_BSWAP_H 1" >> $config_h |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 560 | fi |
David Turner | 80dd126 | 2010-09-09 18:04:49 +0200 | [diff] [blame] | 561 | if [ "$HAVE_FNMATCH_H" = "yes" ] ; then |
| 562 | echo "#define CONFIG_FNMATCH 1" >> $config_h |
| 563 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 564 | echo "#define CONFIG_GDBSTUB 1" >> $config_h |
| 565 | echo "#define CONFIG_SLIRP 1" >> $config_h |
| 566 | echo "#define CONFIG_SKINS 1" >> $config_h |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 567 | echo "#define CONFIG_TRACE 1" >> $config_h |
David 'Digit' Turner | fd3b1a0 | 2010-05-10 23:47:54 -0700 | [diff] [blame] | 568 | |
David 'Digit' Turner | 826b985 | 2011-06-01 15:28:14 +0200 | [diff] [blame] | 569 | case "$TARGET_OS" in |
| 570 | windows) |
| 571 | echo "#define CONFIG_WIN32 1" >> $config_h |
| 572 | ;; |
| 573 | *) |
| 574 | echo "#define CONFIG_POSIX 1" >> $config_h |
| 575 | ;; |
| 576 | esac |
| 577 | |
| 578 | case "$TARGET_OS" in |
| 579 | linux-*) |
| 580 | echo "#define CONFIG_KVM_GS_RESTORE 1" >> $config_h |
| 581 | ;; |
| 582 | esac |
| 583 | |
David 'Digit' Turner | fd3b1a0 | 2010-05-10 23:47:54 -0700 | [diff] [blame] | 584 | # only Linux has fdatasync() |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 585 | case "$TARGET_OS" in |
David 'Digit' Turner | fd3b1a0 | 2010-05-10 23:47:54 -0700 | [diff] [blame] | 586 | linux-*) |
| 587 | echo "#define CONFIG_FDATASYNC 1" >> $config_h |
| 588 | ;; |
| 589 | esac |
| 590 | |
David 'Digit' Turner | 280afa0 | 2011-05-11 17:37:44 +0200 | [diff] [blame] | 591 | case "$TARGET_OS" in |
| 592 | linux-*|darwin-*) |
| 593 | echo "#define CONFIG_MADVISE 1" >> $config_h |
| 594 | ;; |
| 595 | esac |
| 596 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 597 | # the -nand-limits options can only work on non-windows systems |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 598 | if [ "$TARGET_OS" != "windows" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 599 | echo "#define CONFIG_NAND_LIMITS 1" >> $config_h |
| 600 | fi |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 601 | echo "#define QEMU_VERSION \"0.10.50\"" >> $config_h |
| 602 | echo "#define QEMU_PKGVERSION \"Android\"" >> $config_h |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 603 | case "$CPU" in |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 604 | x86) CONFIG_CPU=I386 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 605 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 606 | ppc) CONFIG_CPU=PPC |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 607 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 608 | x86_64) CONFIG_CPU=X86_64 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 609 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 610 | *) CONFIG_CPU=$CPU |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 611 | ;; |
| 612 | esac |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 613 | echo "#define HOST_$CONFIG_CPU 1" >> $config_h |
Marcus Comstedt | 17d3132 | 2010-10-05 21:54:12 +0200 | [diff] [blame] | 614 | if [ "$HOST_BIGENDIAN" = "1" ] ; then |
| 615 | echo "#define HOST_WORDS_BIGENDIAN 1" >> $config_h |
| 616 | fi |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 617 | BSD=0 |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 618 | case "$TARGET_OS" in |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 619 | linux-*) CONFIG_OS=LINUX |
| 620 | ;; |
| 621 | darwin-*) CONFIG_OS=DARWIN |
| 622 | BSD=1 |
| 623 | ;; |
Alexey Tarasov | 0882322 | 2009-09-01 02:07:51 +1100 | [diff] [blame] | 624 | freebsd-*) CONFIG_OS=FREEBSD |
| 625 | BSD=1 |
| 626 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 627 | windows*) CONFIG_OS=WIN32 |
| 628 | ;; |
| 629 | *) CONFIG_OS=$OS |
| 630 | esac |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 631 | |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 632 | if [ "$OPTION_STATIC" = "yes" ] ; then |
| 633 | echo "CONFIG_STATIC_EXECUTABLE := true" >> $config_mk |
| 634 | echo "#define CONFIG_STATIC_EXECUTABLE 1" >> $config_h |
| 635 | fi |
| 636 | |
David 'Digit' Turner | 377eb2c | 2010-05-20 15:16:28 -0700 | [diff] [blame] | 637 | case $TARGET_OS in |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 638 | linux-*|darwin-*) |
David 'Digit' Turner | 3d66dc7 | 2010-01-27 18:18:41 -0800 | [diff] [blame] | 639 | echo "#define CONFIG_IOVEC 1" >> $config_h |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 640 | ;; |
| 641 | esac |
| 642 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 643 | echo "#define CONFIG_$CONFIG_OS 1" >> $config_h |
| 644 | if [ $BSD = 1 ] ; then |
David 'Digit' Turner | 2c538c8 | 2010-05-10 16:48:20 -0700 | [diff] [blame] | 645 | echo "#define CONFIG_BSD 1" >> $config_h |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 646 | echo "#define O_LARGEFILE 0" >> $config_h |
| 647 | echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h |
| 648 | fi |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 649 | |
David 'Digit' Turner | e92bc56 | 2010-09-07 06:21:25 -0700 | [diff] [blame] | 650 | echo "#define CONFIG_ANDROID 1" >> $config_h |
| 651 | |
David 'Digit' Turner | 0c8c885 | 2011-08-24 13:26:58 +0200 | [diff] [blame] | 652 | if [ "$GLES_INCLUDE" -a "$GLES_LIBS" ]; then |
| 653 | echo "#define CONFIG_ANDROID_OPENGLES 1" >> $config_h |
| 654 | fi |
| 655 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 656 | log "Generate : $config_h" |
| 657 | |
| 658 | echo "Ready to go. Type 'make' to build emulator" |