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