summaryrefslogtreecommitdiff
path: root/tizen/emulator_configure.sh
blob: c8393f4c720ab27aa03cda97ea67b3008d81f744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/sh

if [ -z "$TIZEN_SDK_DEV_PATH" ] ; then
	TIZEN_SDK_DEV_PATH=${HOME}/tizen-sdk-dev
fi

CONFIGURE_APPEND=""
EMUL_TARGET_LIST=""
VIRTIOGL_EN=""
YAGL_EN=""
YAGL_STATS_EN=""
VIGS_EN=""

usage() {
    echo "usage: build.sh [options] [target]"
    echo ""
    echo "target"
    echo "    emulator target, one of: [x86|i386|i486|i586|i686|arm|all]. Defaults to \"all\""
    echo ""
    echo "options:"
    echo "-d, --debug"
    echo "    build debug configuration"
    echo "-vgl|--virtio-gl"
    echo "    enable virtio GL support"
    echo "-yagl|--yagl-device"
    echo "    enable YaGL passthrough device"
    echo "-ys|--yagl-stats"
    echo "    enable YaGL stats"
    echo "-vigs|--vigs-device"
    echo "    enable VIGS device"
    echo "-e|--extra"
    echo "    extra options for QEMU configure"
    echo "-u|-h|--help|--usage"
    echo "    display this help message and exit"
}

virtgl_enable() {
  case "$1" in
  0|no|disable)
    VIRTIOGL_EN="no"
  ;;
  1|yes|enable)
    VIRTIOGL_EN="yes"
  ;;
  *)
    usage
    exit 1
  ;;
  esac
}

yagl_enable() {
  case "$1" in
  0|no|disable)
    YAGL_EN="no"
  ;;
  1|yes|enable)
    YAGL_EN="yes"
  ;;
  *)
    usage
    exit 1
  ;;
  esac
}

yagl_stats_enable() {
  case "$1" in
  0|no|disable)
    YAGL_STATS_EN="no"
  ;;
  1|yes|enable)
    YAGL_STATS_EN="yes"
  ;;
  *)
    usage
    exit 1
  ;;
  esac
}

vigs_enable() {
  case "$1" in
  0|no|disable)
    VIGS_EN="no"
  ;;
  1|yes|enable)
    VIGS_EN="yes"
  ;;
  *)
    usage
    exit 1
  ;;
  esac
}

set_target() {
  if [ ! -z "$EMUL_TARGET_LIST" ] ; then
      usage
      exit 1
  fi

  case "$1" in
  x86|i386|i486|i586|i686)
    EMUL_TARGET_LIST="i386-softmmu"
    if [ -z "$VIRTIOGL_EN" ] ; then
      virtgl_enable yes
    fi
    if [ -z "$YAGL_EN" ] ; then
      yagl_enable yes
    fi
    if [ -z "$VIGS_EN" ] ; then
      vigs_enable yes
    fi
  ;;
  arm)
    EMUL_TARGET_LIST="arm-softmmu"
    if [ -z "$YAGL_EN" ] && [ "$targetos" != "Darwin" ] ; then
      yagl_enable yes
    fi
    if [ -z "$VIGS_EN" ] && [ "$targetos" != "Darwin" ] ; then
      vigs_enable yes
    fi
  ;;
  all)
#    EMUL_TARGET_LIST="i386-softmmu,arm-softmmu"
    EMUL_TARGET_LIST="i386-softmmu"
    if [ -z "$VIRTIOGL_EN" ] ; then
      virtgl_enable yes
    fi
    if [ -z "$YAGL_EN" ] ; then   
        yagl_enable yes
    fi
    if [ -z "$VIGS_EN" ] ; then
      vigs_enable yes
    fi
  ;;
  esac
}


# OS specific
targetos=`uname -s`
echo "##### checking for os... targetos $targetos"

echo "##### TIZEN_SDK_DEV_PATH: ${TIZEN_SDK_DEV_PATH}"

echo "$*"

while [ "$#" -gt "0" ]
do
    case $1 in
    x86|i386|i486|i586|i686|arm|all)
        set_target $1
    ;;
    -d|--debug)
        CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-debug"
    ;;
    -e|--extra)
        shift
        CONFIGURE_APPEND="$CONFIGURE_APPEND $1"
    ;;
    -vgl|--virtio-gl)
        virtgl_enable 1
    ;;
    -yagl|--yagl-device)
        yagl_enable 1
    ;;
    -ys|--yagl-stats)
        yagl_stats_enable 1
    ;;
    -vigs|--vigs-device)
        vigs_enable 1
    ;;
    -u|-h|--help|--usage)
        usage
        exit 0
    ;;
    *)
        echo "Syntax Error"
        usage
        exit 1
    ;;
    esac
    shift
done

if [ -z "$EMUL_TARGET_LIST" ] ; then
  set_target all
fi

CONFIGURE_APPEND="--target-list=$EMUL_TARGET_LIST $CONFIGURE_APPEND"

if test "$VIRTIOGL_EN" = "yes" ; then
  CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-gl"
else
  CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-gl"
fi

if test "$YAGL_EN" = "yes" ; then
  CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-yagl"
else
  CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-yagl"
fi

if test "$YAGL_STATS_EN" = "yes" ; then
  CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-yagl-stats"
else
  CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-yagl-stats"
fi

if test "$VIGS_EN" = "yes" ; then
  CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-vigs"
else
  CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-vigs"
fi

# append common flags
CONFIGURE_APPEND="--enable-maru --enable-libav --enable-curl --disable-gtk $CONFIGURE_APPEND"

if [ -z ${PKG_CONFIG_PATH} ] ; then	# avoid pkg-config bug on Windows
export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/distrib/lib/pkgconfig
else
export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/distrib/lib/pkgconfig:${PKG_CONFIG_PATH}
fi

case $targetos in
Linux*)
cd ..
echo ""
echo "##### QEMU configuring for emulator"
echo "##### QEMU configure append:" $CONFIGURE_APPEND
exec ./configure \
 --enable-werror \
 --audio-drv-list=alsa \
 --disable-vnc \
 --disable-pie \
 --enable-virtfs \
 --disable-xen \
 --enable-png \
 $CONFIGURE_APPEND \
;;
MINGW*)
cd ..
echo ""
echo "##### QEMU configuring for emulator"
echo "##### QEMU configure append:" $CONFIGURE_APPEND
exec ./configure \
 --extra-cflags=-Werror=implicit-function-declaration \
 --extra-cflags=-Werror=implicit-int \
 --extra-ldflags=-Wl,--large-address-aware \
 --cc=gcc \
 --audio-drv-list=winwave \
 --enable-hax \
 --disable-vnc \
 --enable-png \
 $CONFIGURE_APPEND \
;;
Darwin*)
cd ..
echo ""
echo "##### QEMU configuring for emulator"
echo "##### QEMU configure append:" $CONFIGURE_APPEND
./configure \
 --extra-cflags=-mmacosx-version-min=10.4 \
 --audio-drv-list=coreaudio \
 --enable-shm \
 --enable-hax \
 --disable-vnc \
 --disable-cocoa \
 --disable-sdl \
 $CONFIGURE_APPEND \
;;
esac