Fixed focal glibc build issues for ubuntu and windows
[sdk/emulator/qemu.git] / package / build.linux
1 #!/bin/sh -xe
2 # check build environment
3 prepare()
4 {
5         if [ "${TARGET_OS}" != "windows-32" ] && [ "${TARGET_OS}" != "windows-64" ] \
6                 && ["${TARGET_OS}" != "ubuntu-32" ] && ["${TARGET_OS}" != "ubuntu-64" ]
7         then
8                 exit 1
9         fi
10
11         if [ "${TARGET_OS}" = "windows-32" ] || [ "${TARGET_OS}" = "windows-64" ]
12         then
13                 # for Windows target (cross compiling)
14
15                 # we should use cross compiler from mingw-x package
16                 if [ "${TARGET_OS}" = "windows-32" ]
17                 then
18                         export PATH=/opt/mingw32/bin:$PATH
19                         export CROSS_PREFIX=i686-w64-mingw32
20                 else
21                         export PATH=/opt/mingw64/bin:$PATH
22                         export CROSS_PREFIX=x86_64-w64-mingw32
23                 fi
24
25                 # correct pc's prefix since windows install script is not run
26                 # on linux
27                 cd ${ROOTDIR}/lib/pkgconfig
28                 ${ROOTDIR}/correct_pc_prefix.sh
29                 cd ${ROOTDIR}
30
31                 # mingw-x doesn't have zlib, so we use our own.
32                 export EXTRA_CFLAGS=-I${ROOTDIR}/include
33                 export EXTRA_LDFLAGS=-L${ROOTDIR}/lib
34         else
35                 # for linux target
36
37                 REQUIRED_PKG="ant python3 zlib1g-dev libglib2.0-dev libsdl1.2-dev \
38                         libasound2-dev libx11-dev libv4l-dev libxcomposite-dev \
39                         libpixman-1-dev libcurl4-gnutls-dev     libcap-dev libattr1-dev"
40
41                 echo "Checking required packages before compling!!"
42                 for pkg in ${REQUIRED_PKG}
43                 do
44                         dpkg -s ${pkg} > /dev/null
45                         if [ "x$?" = "x0" ]
46                         then
47                                 echo "checking ${pkg} ... OK"
48                         else
49                                 echo "checking ${pkg} ... failure"
50                                 exit 1
51                         fi
52                 done
53         fi
54 }
55
56 # clean
57 clean()
58 {
59         echo "nothing to do"
60 }
61
62 # build
63 build()
64 {
65         . $SRCDIR/package/build.common
66         build_common
67 }
68
69 # install
70 install()
71 {
72         . $SRCDIR/package/build.common
73         install_common
74 }