skin: check that image file of H/W button exist or not
[sdk/emulator/qemu.git] / tizen / emulator_configure.sh
1 #!/bin/sh
2
3 CONFIGURE_APPEND=""
4 EMUL_TARGET_LIST="x86_64-softmmu"
5
6 usage() {
7     echo "usage: build.sh [options] [target]"
8     echo ""
9     echo "target"
10     echo "    emulator target, one of: [i386|x86_64|arm|all]. Defaults to \"x86_64\""
11     echo ""
12     echo "options:"
13     echo "-d, --debug"
14     echo "    build debug configuration"
15     echo "-e|--extra EXTRA"
16     echo "    extra options for QEMU configure"
17     echo "-p|--cross-prefix CROSS_PREFIX"
18     echo "    extra options for QEMU configure"
19     echo "-u|-h|--help|--usage"
20     echo "    display this help message and exit"
21 }
22
23 set_target() {
24   case "$1" in
25   i386)
26     EMUL_TARGET_LIST="i386-softmmu"
27   ;;
28   x86_64)
29     EMUL_TARGET_LIST="x86_64-softmmu"
30   ;;
31   arm)
32     EMUL_TARGET_LIST="arm-softmmu"
33   ;;
34   all)
35     EMUL_TARGET_LIST="i386-softmmu,x86_64-softmmu,arm-softmmu"
36   ;;
37   esac
38 }
39
40 while [ "$#" -gt "0" ]
41 do
42     case $1 in
43     i386|x86_64|arm|all)
44         set_target $1
45     ;;
46     -d|--debug)
47         CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-debug"
48     ;;
49     -e|--extra)
50         shift
51         CONFIGURE_APPEND="$CONFIGURE_APPEND $1"
52     ;;
53     -p|--cross-prefix)
54         shift
55         CROSS_PREFIX="$1"
56     ;;
57     -u|-h|--help|--usage)
58         usage
59         exit 0
60     ;;
61     *)
62         echo "Syntax Error"
63         usage
64         exit 1
65     ;;
66     esac
67     shift
68 done
69
70 hostos=`uname -s`
71 if [ -z "$CROSS_PREFIX" ] ; then
72     targetos=$hostos
73 else
74     # FIXME
75     case "$CROSS_PREFIX" in
76     x86_64*)
77         targetos="CROSS_MINGW64";
78     ;;
79     *)
80         targetos="CROSS_MINGW32";
81     ;;
82     esac
83 fi
84
85 if [ -z "$TIZEN_SDK_DEV_PATH" ] ; then
86     TIZEN_SDK_DEV_PATH=${HOME}/tizen-sdk-dev
87 fi
88
89 if [ ! -z "$CROSS_PREFIX" ] ; then
90     if [ -d "$TIZEN_SDK_DEV_PATH/$CROSS_PREFIX" ] ; then
91         TIZEN_SDK_DEV_PATH=${TIZEN_SDK_DEV_PATH}/$CROSS_PREFIX
92     fi
93 fi
94
95 if [ -d "../.git" ] ; then
96     BRANCH=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
97     if [ -d "$TIZEN_SDK_DEV_PATH/$BRANCH" ] ; then
98         TIZEN_SDK_DEV_PATH="$TIZEN_SDK_DEV_PATH/$BRANCH"
99     fi
100 fi
101
102 if [ ! -z "$EXTRA_CFLAGS" ] ; then
103         CONFIGURE_APPEND="$CONFIGURE_APPEND --extra-cflags=$EXTRA_CFLAGS"
104 fi
105
106 if [ ! -z "$EXTRA_LDFLAGS" ] ; then
107         CONFIGURE_APPEND="$CONFIGURE_APPEND --extra-ldflags=$EXTRA_LDFLAGS"
108 fi
109
110 echo "##### checking for os... Host OS $hostos, Target OS $targetos"
111 echo "##### TIZEN_SDK_DEV_PATH: ${TIZEN_SDK_DEV_PATH}"
112 echo "$*"
113
114 # avoid pkg-config bug on Windows
115 if [ -z ${PKG_CONFIG_PATH} ] ; then
116 export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/lib/pkgconfig
117 else
118 export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/lib/pkgconfig:${PKG_CONFIG_PATH}
119 fi
120
121 # append common options
122 CONFIGURE_APPEND="
123  --target-list=$EMUL_TARGET_LIST
124  --enable-werror
125  --enable-maru
126  --enable-yagl
127  --enable-vigs
128  --enable-qt
129  --enable-libav
130  --enable-libpng
131  --enable-virtfs
132  --disable-bzip2
133  --disable-curl
134  --disable-lzo
135  --disable-snappy
136  --disable-gnutls
137  --disable-gcrypt
138  --disable-nettle
139  --disable-gtk
140  --disable-vte
141  --disable-vnc
142  --disable-spice
143  --disable-curses
144  --disable-xen
145  $CONFIGURE_APPEND"
146
147 CONFIGURE_APPEND_WIN="
148  --extra-ldflags=-static-libgcc
149  --extra-ldflags=-static-libstdc++
150  --audio-drv-list=dsound
151  --winver=0x0600
152  --enable-sdl
153  --with-sdlabi=2.0
154  --enable-hax"
155
156 # append platform specific options
157 case $targetos in
158 Linux*)
159 CONFIGURE_APPEND="
160  --extra-ldflags=-rdynamic
161  --extra-ldflags=-Wl,-rpath,'\$\$ORIGIN'
162  --audio-drv-list=alsa
163  --enable-sdl
164  --enable-kvm
165  $CONFIGURE_APPEND
166 "
167 ;;
168 CROSS_MINGW32*)
169 CONFIGURE_APPEND="
170  --cross-prefix=${CROSS_PREFIX}-
171  --extra-ldflags=-Wl,--large-address-aware
172  $CONFIGURE_APPEND_WIN
173  $CONFIGURE_APPEND
174 "
175 ;;
176 CROSS_MINGW64*)
177 CONFIGURE_APPEND="
178  --cross-prefix=${CROSS_PREFIX}-
179  $CONFIGURE_APPEND_WIN
180  $CONFIGURE_APPEND
181 "
182 ;;
183 MINGW*)
184 CONFIGURE_APPEND="
185  --cc=gcc
186  --cxx=g++
187  --extra-ldflags=-Wl,--large-address-aware
188  $CONFIGURE_APPEND_WIN
189  $CONFIGURE_APPEND
190 "
191 # Do not support building Win64 binary on Windows now
192 ;;
193 Darwin*)
194 CONFIGURE_APPEND="
195  --cc=clang
196  --cxx=clang
197  --extra-cflags=-mmacosx-version-min=10.7
198  --extra-cflags=-Wno-error=deprecated-declarations
199  --extra-ldflags=-lstdc++
200  --extra-ldflags=-Wl,-rpath,'@executable_path'
201  --audio-drv-list=coreaudio
202  --enable-cocoa
203  --enable-hax
204  $CONFIGURE_APPEND
205 "
206 #--extra-ldflags=-rdynamic
207 # TODO: we need general GUI for MacOS
208 # we should use cocoa or sdl
209 ;;
210 esac
211
212 cd ..
213 echo ""
214 echo "##### QEMU configuring for emulator"
215 echo "##### QEMU configure append:" $CONFIGURE_APPEND
216 exec ./configure $CONFIGURE_APPEND