forked from xqemu/xqemu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·141 lines (130 loc) · 3.73 KB
/
build.sh
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
#!/usr/bin/env bash
set -e # exit if a command fails
set -o pipefail # Will return the exit status of make if it fails
package_windows() { # Script to prepare the windows exe
mkdir -p dist
cp i386-softmmu/qemu-system-i386.exe dist/xqemu.exe
cp i386-softmmu/qemu-system-i386w.exe dist/xqemuw.exe
python3 ./get_deps.py dist/xqemu.exe dist
strip dist/xqemu.exe
strip dist/xqemuw.exe
}
postbuild=''
debug_opts='--enable-debug'
user_opts=''
build_cflags='-O0 -g'
job_count='4'
while [ ! -z ${1} ]
do
case "${1}" in
'-j'*)
job_count="${1:2}"
shift
;;
'--release')
build_cflags='-O3'
debug_opts=''
shift
;;
*)
user_opts="${user_opts} ${1}"
shift
;;
esac
done
readlink=$(command -v readlink)
case "$(uname -s)" in # adjust compilation option based on platform
Linux)
echo 'Compiling for Linux…'
sys_cflags='-march=native -Wno-error=redundant-decls -Wno-error=unused-but-set-variable'
sys_opts='--enable-kvm --disable-xen --disable-werror'
;;
Darwin)
echo 'Compiling for MacOS…'
sys_cflags='-march=native'
sys_opts='--disable-cocoa'
# necessary to find libffi, which is required by gobject
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}/usr/local/opt/libffi/lib/pkgconfig"
# macOS needs greadlink for a GNU compatible version of readlink
if readlink=$(command -v greadlink); then
echo 'GNU compatible readlink detected'
else
echo 'Could not find a GNU compatible readlink. Please install coreutils with homebrew'
exit -1
fi
;;
CYGWIN*|MINGW*|MSYS*)
echo 'Compiling for Windows…'
sys_cflags='-Wno-error'
sys_opts='--python=python3 --disable-cocoa --disable-opengl --disable-fortify-source'
postbuild='package_windows' # set the above function to be called after build
;;
*)
echo "could not detect OS $(uname -s), aborting" >&2
exit -1
;;
esac
# find absolute path (and resolve symlinks) to build out of tree
configure="$(dirname "$($readlink -f "${0}")")/configure"
set -x # Print commands from now on
"${configure}" \
--extra-cflags="-DXBOX=1 ${build_cflags} ${sys_cflags} ${CFLAGS}" \
${debug_opts} \
${sys_opts} \
--target-list=i386-softmmu \
--enable-trace-backends="nop" \
--enable-sdl \
--disable-curl \
--disable-vnc \
--disable-vnc-sasl \
--disable-docs \
--disable-tools \
--disable-guest-agent \
--disable-tpm \
--disable-live-block-migration \
--disable-rdma \
--disable-replication \
--disable-capstone \
--disable-fdt \
--disable-libiscsi \
--disable-spice \
--disable-user \
--disable-stack-protector \
--disable-glusterfs \
--disable-bluez \
--disable-gtk \
--disable-curses \
--disable-gnutls \
--disable-nettle \
--disable-gcrypt \
--disable-crypto-afalg \
--disable-virglrenderer \
--disable-vhost-net \
--disable-vhost-crypto \
--disable-vhost-vsock \
--disable-vhost-user \
--disable-virtfs \
--disable-libssh2 \
--disable-snappy \
--disable-bzip2 \
--disable-vde \
--disable-libxml2 \
--disable-seccomp \
--disable-numa \
--disable-lzo \
--disable-smartcard \
--disable-usb-redir \
--disable-bochs \
--disable-cloop \
--disable-dmg \
--disable-vdi \
--disable-vvfat \
--disable-qcow1 \
--disable-qed \
--disable-parallels \
--disable-sheepdog \
--without-default-devices \
--disable-blobs \
${user_opts}
time make -j"${job_count}" subdir-i386-softmmu 2>&1 | tee build.log
${postbuild} # call post build functions