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 | # |
| 7 | # in this case, it will use prebuilt binaries for the compiler, |
| 8 | # the audio library and the SDL library. You can disable this |
| 9 | # by using the --no-prebuilt-libs and --cc=<compiler> options |
| 10 | # |
| 11 | # |
| 12 | # here's the list of environment variables you can define before |
| 13 | # calling this script to control it (besides options): |
| 14 | # |
| 15 | # |
| 16 | |
| 17 | # first, let's see which system we're running this on |
| 18 | cd `dirname $0` |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 19 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 20 | # source common functions definitions |
| 21 | . android/build/common.sh |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 22 | |
| 23 | # Parse options |
| 24 | OPTION_TARGETS="" |
| 25 | OPTION_DEBUG=no |
| 26 | OPTION_IGNORE_AUDIO=no |
| 27 | OPTION_NO_PREBUILTS=no |
| 28 | OPTION_TRY_64=no |
| 29 | OPTION_HELP=no |
| 30 | |
| 31 | if [ -z "$CC" ] ; then |
| 32 | CC=gcc |
| 33 | fi |
| 34 | |
| 35 | for opt do |
| 36 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 37 | case "$opt" in |
| 38 | --help|-h|-\?) OPTION_HELP=yes |
| 39 | ;; |
| 40 | --verbose) |
| 41 | if [ "$VERBOSE" = "yes" ] ; then |
| 42 | VERBOSE2=yes |
| 43 | else |
| 44 | VERBOSE=yes |
| 45 | fi |
| 46 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 47 | --install=*) OPTION_TARGETS="$OPTION_TARGETS $optarg"; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 48 | ;; |
| 49 | --sdl-config=*) SDL_CONFIG=$optarg |
| 50 | ;; |
| 51 | --cc=*) CC="$optarg" ; HOSTCC=$CC |
| 52 | ;; |
| 53 | --no-strip) OPTION_NO_STRIP=yes |
| 54 | ;; |
| 55 | --debug) OPTION_DEBUG=yes |
| 56 | ;; |
| 57 | --ignore-audio) OPTION_IGNORE_AUDIO=yes |
| 58 | ;; |
| 59 | --no-prebuilts) OPTION_NO_PREBUILTS=yes |
| 60 | ;; |
| 61 | --try-64) OPTION_TRY_64=yes |
| 62 | ;; |
| 63 | *) |
| 64 | echo "unknown option '$opt', use --help" |
| 65 | exit 1 |
| 66 | esac |
| 67 | done |
| 68 | |
| 69 | # Print the help message |
| 70 | # |
| 71 | if [ "$OPTION_HELP" = "yes" ] ; then |
| 72 | cat << EOF |
| 73 | |
| 74 | Usage: rebuild.sh [options] |
| 75 | Options: [defaults in brackets after descriptions] |
| 76 | EOF |
| 77 | echo "Standard options:" |
| 78 | echo " --help print this message" |
| 79 | echo " --install=FILEPATH copy emulator executable to FILEPATH [$TARGETS]" |
| 80 | echo " --cc=PATH specify C compiler [$CC]" |
| 81 | echo " --sdl-config=FILE use specific sdl-config script [$SDL_CONFIG]" |
| 82 | echo " --no-strip do not strip emulator executable" |
| 83 | echo " --debug enable debug (-O0 -g) build" |
| 84 | echo " --ignore-audio ignore audio messages (may build sound-less emulator)" |
| 85 | echo " --no-prebuilts do not use prebuilt libraries and compiler" |
| 86 | echo " --try-64 try to build a 64-bit executable (may crash)" |
| 87 | echo " --verbose verbose configuration" |
| 88 | echo "" |
| 89 | exit 1 |
| 90 | fi |
| 91 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 92 | # we only support generating 32-bit binaris on 64-bit systems. |
| 93 | # And we may need to add a -Wa,--32 to CFLAGS to let the assembler |
| 94 | # generate 32-bit binaries on Linux x86_64. |
| 95 | # |
| 96 | if [ "$OPTION_TRY_64" != "yes" ] ; then |
| 97 | force_32bit_binaries |
| 98 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 99 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 100 | # Are we running in the Android build system ? |
| 101 | check_android_build |
| 102 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 103 | |
| 104 | # Adjust a few things when we're building within the Android build |
| 105 | # system: |
| 106 | # - locate prebuilt directory |
| 107 | # - locate and use prebuilt libraries |
| 108 | # - copy the new binary to the correct location |
| 109 | # |
| 110 | if [ "$OPTION_NO_PREBUILTS" = "yes" ] ; then |
| 111 | IN_ANDROID_BUILD=no |
| 112 | fi |
| 113 | |
| 114 | if [ "$IN_ANDROID_BUILD" = "yes" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 115 | locate_android_prebuilt |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 116 | |
| 117 | # use ccache if USE_CCACHE is defined and the corresponding |
| 118 | # binary is available. |
| 119 | # |
| 120 | # note: located in PREBUILT/ccache/ccache in the new tree layout |
| 121 | # located in PREBUILT/ccache in the old one |
| 122 | # |
| 123 | if [ -n "$USE_CCACHE" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 124 | CCACHE="$ANDROID_PREBUILT/ccache/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 125 | if [ ! -f $CCACHE ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 126 | CCACHE="$ANDROID_PREBUILT/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 127 | fi |
| 128 | if [ -f $CCACHE ] ; then |
| 129 | CC="$CCACHE $CC" |
| 130 | fi |
| 131 | log "Prebuilt : CCACHE=$CCACHE" |
| 132 | fi |
| 133 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 134 | # if the user didn't specify an sdl-config script, get the prebuilt one |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 135 | if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then |
| 136 | # always use our own static libSDL by default |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 137 | SDL_CONFIG=$ANDROID_PREBUILT/sdl/bin/sdl-config |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 138 | log "Prebuilt : SDL_CONFIG=$SDL_CONFIG" |
| 139 | fi |
| 140 | |
| 141 | # finally ensure that our new binary is copied to the 'out' |
| 142 | # subdirectory as 'emulator' |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 143 | HOST_BIN=$(get_android_abs_build_var HOST_OUT_EXECUTABLES) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 144 | if [ -n "$HOST_BIN" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 145 | OPTION_TARGETS="$OPTION_TARGETS $HOST_BIN/emulator$EXE" |
| 146 | log "Targets : TARGETS=$OPTION_TARGETS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 147 | fi |
| 148 | fi # IN_ANDROID_BUILD = no |
| 149 | |
| 150 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 151 | # we can build the emulator with Cygwin, so enable it |
| 152 | enable_cygwin |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 153 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 154 | setup_toolchain |
The Android Open Source Project | 92c7311 | 2009-03-05 14:34:31 -0800 | [diff] [blame] | 155 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 156 | ### |
| 157 | ### SDL Probe |
| 158 | ### |
| 159 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 160 | # if the user didn't specify a sdl-config script, get the prebuilt one |
| 161 | if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then |
| 162 | # try to find one from our git repository |
| 163 | SDL_CONFIG=../sdl/out/$OS/bin/sdl-config |
| 164 | if [ -f $SDL_CONFIG ] ; then |
| 165 | log "Prebuilt : SDL_CONFIG=$SDL_CONFIG" |
| 166 | else |
| 167 | echo "WARNING: YOU SHOULD USE THE --sdl-config OPTION" |
| 168 | SDL_CONFIG= |
| 169 | fi |
| 170 | fi |
| 171 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 172 | # For now, we require an external libSDL library, if SDL_CONFIG is not |
| 173 | # defined, try to grab it from the environment |
| 174 | # |
| 175 | if [ -z "$SDL_CONFIG" ] ; then |
| 176 | SDL_CONFIG=`which sdl-config` |
| 177 | if [ $? != 0 ] ; then |
| 178 | echo "Please ensure that you have the emulator's patched libSDL" |
| 179 | echo "built somewhere and point to its sdl-config script either" |
| 180 | echo "with the SDL_CONFIG env. variable, or the --sdl-config=<script>" |
| 181 | echo "option." |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 182 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 183 | fi |
| 184 | fi |
| 185 | |
| 186 | # check that we can link statically with the library. |
| 187 | # |
| 188 | SDL_CFLAGS=`$SDL_CONFIG --cflags` |
| 189 | SDL_LIBS=`$SDL_CONFIG --static-libs` |
| 190 | |
| 191 | # quick hack, remove the -D_GNU_SOURCE=1 of some SDL Cflags |
| 192 | # since they break recent Mingw releases |
| 193 | SDL_CFLAGS=`echo $SDL_CFLAGS | sed -e s/-D_GNU_SOURCE=1//g` |
| 194 | |
| 195 | log "SDL-probe : SDL_CFLAGS = $SDL_CFLAGS" |
| 196 | log "SDL-probe : SDL_LIBS = $SDL_LIBS" |
| 197 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 198 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 199 | EXTRA_CFLAGS="$SDL_CFLAGS" |
| 200 | EXTRA_LDFLAGS="$SDL_LIBS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 201 | |
| 202 | cat > $TMPC << EOF |
| 203 | #include <SDL.h> |
| 204 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 205 | int main( int argc, char** argv ) { |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 206 | return SDL_Init (SDL_INIT_VIDEO); |
| 207 | } |
| 208 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 209 | feature_check_link SDL_LINKING |
| 210 | |
| 211 | if [ $SDL_LINKING != "yes" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 212 | echo "You provided an explicit sdl-config script, but the corresponding library" |
| 213 | echo "cannot be statically linked with the Android emulator directly." |
| 214 | echo "Error message:" |
| 215 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 216 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 217 | fi |
| 218 | log "SDL-probe : static linking ok" |
| 219 | |
| 220 | # now, let's check that the SDL library has the special functions |
| 221 | # we added to our own sources |
| 222 | # |
| 223 | cat > $TMPC << EOF |
| 224 | #include <SDL.h> |
| 225 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 226 | int main( int argc, char** argv ) { |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 227 | int x, y; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 228 | SDL_Rect r; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 229 | SDL_WM_GetPos(&x, &y); |
| 230 | SDL_WM_SetPos(x, y); |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 231 | SDL_WM_GetMonitorDPI(&x, &y); |
| 232 | SDL_WM_GetMonitorRect(&r); |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 233 | return SDL_Init (SDL_INIT_VIDEO); |
| 234 | } |
| 235 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 236 | feature_check_link SDL_LINKING |
| 237 | |
| 238 | if [ $SDL_LINKING != "yes" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 239 | echo "You provided an explicit sdl-config script in SDL_CONFIG, but the" |
| 240 | echo "corresponding library doesn't have the patches required to link" |
| 241 | echo "with the Android emulator. Unsetting SDL_CONFIG will use the" |
| 242 | echo "sources bundled with the emulator instead" |
| 243 | echo "Error:" |
| 244 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 245 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 246 | fi |
| 247 | |
| 248 | log "SDL-probe : extra features ok" |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 249 | clean_temp |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 250 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 251 | EXTRA_CFLAGS= |
| 252 | EXTRA_LDFLAGS= |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 253 | |
| 254 | ### |
| 255 | ### Audio subsystems probes |
| 256 | ### |
| 257 | PROBE_COREAUDIO=no |
| 258 | PROBE_ALSA=no |
| 259 | PROBE_OSS=no |
| 260 | PROBE_ESD=no |
| 261 | PROBE_WINAUDIO=no |
| 262 | |
| 263 | case "$OS" in |
| 264 | darwin*) PROBE_COREAUDIO=yes; |
| 265 | ;; |
| 266 | linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes; |
| 267 | ;; |
| 268 | windows) PROBE_WINAUDIO=yes |
| 269 | ;; |
| 270 | esac |
| 271 | |
| 272 | ORG_CFLAGS=$CFLAGS |
| 273 | ORG_LDFLAGS=$LDFLAGS |
| 274 | |
| 275 | if [ "$PROBE_ESD" = yes ] ; then |
| 276 | CFLAGS="$ORG_CFLAGS" |
| 277 | LDFLAGS="$ORG_LDFLAGS -ldl" |
| 278 | cp -f android/config/check-esd.c $TMPC |
| 279 | compile && link && $TMPE |
| 280 | if [ $? = 0 ] ; then |
| 281 | log "AudioProbe : ESD seems to be usable on this system" |
| 282 | else |
| 283 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 284 | echo "the EsounD development files do not seem to be installed on this system" |
| 285 | echo "Are you missing the libesd-dev package ?" |
| 286 | echo "Correct the errors below and try again:" |
| 287 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 288 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 289 | fi |
| 290 | PROBE_ESD=no |
| 291 | log "AudioProbe : ESD seems to be UNUSABLE on this system !!" |
| 292 | fi |
| 293 | fi |
| 294 | |
| 295 | if [ "$PROBE_ALSA" = yes ] ; then |
| 296 | CFLAGS="$ORG_CFLAGS" |
| 297 | LDFLAGS="$ORG_CFLAGS -ldl" |
| 298 | cp -f android/config/check-alsa.c $TMPC |
| 299 | compile && link && $TMPE |
| 300 | if [ $? = 0 ] ; then |
| 301 | log "AudioProbe : ALSA seems to be usable on this system" |
| 302 | else |
| 303 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 304 | echo "the ALSA development files do not seem to be installed on this system" |
| 305 | echo "Are you missing the libasound-dev package ?" |
| 306 | echo "Correct the erros below and try again" |
| 307 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 308 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 309 | fi |
| 310 | PROBE_ALSA=no |
| 311 | log "AudioProbe : ALSA seems to be UNUSABLE on this system !!" |
| 312 | fi |
| 313 | fi |
| 314 | |
| 315 | CFLAGS=$ORG_CFLAGS |
| 316 | LDFLAGS=$ORG_LDFLAGS |
| 317 | |
| 318 | # create the objs directory that is going to contain all generated files |
| 319 | # including the configuration ones |
| 320 | # |
| 321 | mkdir -p objs |
| 322 | |
| 323 | ### |
| 324 | ### Compiler probe |
| 325 | ### |
| 326 | |
| 327 | #### |
| 328 | #### Host system probe |
| 329 | #### |
| 330 | |
| 331 | # because the previous version could be read-only |
| 332 | rm -f $TMPC |
| 333 | |
| 334 | # check host endianess |
| 335 | # |
| 336 | HOST_BIGENDIAN=no |
| 337 | cat > $TMPC << EOF |
| 338 | #include <inttypes.h> |
| 339 | int main(int argc, char ** argv){ |
| 340 | volatile uint32_t i=0x01234567; |
| 341 | return (*((uint8_t*)(&i))) == 0x67; |
| 342 | } |
| 343 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 344 | feature_run_exec HOST_BIGENDIAN |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 345 | |
| 346 | # check size of host long bits |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 347 | cat > $TMPC << EOF |
| 348 | int main(void) { |
| 349 | return sizeof(void*)*8; |
| 350 | } |
| 351 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 352 | feature_run_exec HOST_LONGBITS |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 353 | |
| 354 | # check whether we have <byteswap.h> |
| 355 | # |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 356 | feature_check_header HAVE_BYTESWAP_H "<byteswap.h>" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 357 | |
| 358 | # Build the config.make file |
| 359 | # |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 360 | |
| 361 | create_config_mk |
| 362 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 363 | PWD=`pwd` |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 364 | echo "TARGET_ARCH := arm" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 365 | echo "SRC_PATH := $PWD" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 366 | echo "SDL_CONFIG := $SDL_CONFIG" >> $config_mk |
| 367 | echo "CONFIG_COREAUDIO := $PROBE_COREAUDIO" >> $config_mk |
| 368 | echo "CONFIG_WINAUDIO := $PROBE_WINAUDIO" >> $config_mk |
| 369 | echo "CONFIG_ESD := $PROBE_ESD" >> $config_mk |
| 370 | echo "CONFIG_ALSA := $PROBE_ALSA" >> $config_mk |
| 371 | echo "CONFIG_OSS := $PROBE_OSS" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 372 | echo "BUILD_STANDALONE_EMULATOR := true" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 373 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 374 | |
| 375 | # Build the config-host.h file |
| 376 | # |
| 377 | config_h=objs/config-host.h |
| 378 | echo "/* This file was autogenerated by '$PROGNAME' */" > $config_h |
| 379 | echo "#define CONFIG_QEMU_SHAREDIR \"/usr/local/share/qemu\"" >> $config_h |
| 380 | echo "#define HOST_LONG_BITS $HOST_LONGBITS" >> $config_h |
| 381 | if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then |
| 382 | echo "#define HAVE_BYTESWAP_H 1" >> $config_h |
| 383 | fi |
| 384 | echo "#define CONFIG_GDBSTUB 1" >> $config_h |
| 385 | echo "#define CONFIG_SLIRP 1" >> $config_h |
| 386 | echo "#define CONFIG_SKINS 1" >> $config_h |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 387 | echo "#define CONFIG_TRACE 1" >> $config_h |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 388 | # the -nand-limits options can only work on non-windows systems |
| 389 | if [ "$OS" != "windows" ] ; then |
| 390 | echo "#define CONFIG_NAND_LIMITS 1" >> $config_h |
| 391 | fi |
| 392 | echo "#define QEMU_VERSION \"0.8.2\"" >> $config_h |
| 393 | case "$CPU" in |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 394 | x86) CONFIG_CPU=I386 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 395 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 396 | ppc) CONFIG_CPU=PPC |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 397 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 398 | x86_64) CONFIG_CPU=X86_64 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 399 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 400 | *) CONFIG_CPU=$CPU |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 401 | ;; |
| 402 | esac |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 403 | echo "#define HOST_$CONFIG_CPU 1" >> $config_h |
| 404 | BSD=0 |
| 405 | case "$OS" in |
| 406 | linux-*) CONFIG_OS=LINUX |
| 407 | ;; |
| 408 | darwin-*) CONFIG_OS=DARWIN |
| 409 | BSD=1 |
| 410 | ;; |
| 411 | windows*) CONFIG_OS=WIN32 |
| 412 | ;; |
| 413 | *) CONFIG_OS=$OS |
| 414 | esac |
| 415 | echo "#define CONFIG_$CONFIG_OS 1" >> $config_h |
| 416 | if [ $BSD = 1 ] ; then |
| 417 | echo "#define _BSD 1" >> $config_h |
| 418 | echo "#define O_LARGEFILE 0" >> $config_h |
| 419 | echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h |
| 420 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 421 | log "Generate : $config_h" |
| 422 | |
| 423 | echo "Ready to go. Type 'make' to build emulator" |