source: trunk/build/lol-build @ 1025

Last change on this file since 1025 was 1025, checked in by sam, 8 years ago

build: use xvfb-run to run the windows-i386 test suite on a non-mingw
build host.

  • Property svn:executable set to *
File size: 6.7 KB
Line 
1#!/bin/sh
2
3#
4# Lol Engine build script
5# Usage:
6#   lol-build <action> [<platform>]
7#
8# Where <action> is one of:
9#  - bootstrap
10#  - configure
11#  - build
12#  - check
13#  - clean
14#
15# And <platform> is one of:
16#  - linux-i386
17#  - linux-amd64
18#  - ios-arm
19#  - osx-amd64
20#  - android-arm
21#  - ps3-ppu
22#  - windows-i386
23#  - windows-amd64
24#
25
26set -e
27
28action="$1"
29platform="$2"
30
31__init__()
32{
33    top_srcdir=$(dirname "$0")/..
34    cd $top_srcdir
35    top_srcdir="`pwd`"
36
37    case "${MSYSTEM}" in
38        MINGW32|MINGW64)
39            PATH="$PATH:./contrib/gtk-2.22.1/bin"
40            M4PATH="$M4PATH:./contrib/gtk-2.22.1/share/aclocal"
41            ;;
42    esac
43}
44
45bootstrap()
46{
47    cd $top_srcdir
48    case "$platform" in
49        ios-arm)
50            # No bootstrapping needed
51            ;;
52        android-arm)
53            # No bootstrapping needed
54            ;;
55        *)
56            PATH="$PATH" M4PATH="$M4PATH" ./bootstrap
57            ;;
58    esac
59}
60
61configure()
62{
63    cd $top_srcdir
64    case "$platform" in
65        windows-i386)
66            if test "x${MSYSTEM}" = xMINGW32; then
67                :
68            elif i586-mingw32msvc-g++ --version >/dev/null 2>&1; then
69                HOSTFLAGS=--host=i586-mingw32msvc
70                BUILDFLAGS=--build=none
71            elif i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
72                HOSTFLAGS=--host=i686-w64-mingw32
73                BUILDFLAGS=--build=none
74            else
75                echo "Error: could not find win32 compiler" >&2
76                false
77            fi
78            if test "x${MSYSTEM}" = xMINGW64; then
79                # If using mingw64, we're not really cross-compiling
80                BUILDFLAGS=
81            fi
82            PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
83            LDFLAGS="$LDFLAGS -L$PWD/contrib/gdiplus/lib"
84            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/i686-w64-mingw32"
85            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/i686-w64-mingw32"
86            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/i686-w64-mingw32"
87            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/i686-w64-mingw32"
88            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
89            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
90            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
91            ;;
92        windows-amd64)
93            if test "x${MSYSTEM}" = xMINGW64; then
94                :
95            elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
96                HOSTFLAGS=--host=x86_64-w64-mingw32
97                BUILDFLAGS=--build=none
98            else
99                echo "Error: could not find win64 compiler" >&2
100                false
101            fi
102            if test "x${MSYSTEM}" = xMINGW32; then
103                # If using mingw32, we're not really cross-compiling
104                BUILDFLAGS=
105            fi
106            PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/x86_64-w64-mingw32/pkgconfig"
107            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
108            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/x86_64-w64-mingw32"
109            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/x86_64-w64-mingw32"
110            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/x86_64-w64-mingw32"
111            ;;
112    esac
113    case "$platform" in
114        ios-arm)
115            # No configuration needed
116            ;;
117        android-arm)
118            cd monsterz/android
119            android update project --path .
120            ;;
121        ps3-ppu)
122            PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
123            ;;
124        windows-i386|windows-amd64)
125            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gdiplus/include"
126            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
127            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
128            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
129            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include/GL -DGLEW_STATIC"
130            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
131            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
132            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
133            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
134            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
135            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
136            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
137            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
138            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
139            CPPFLAGS="$CPPFLAGS -mms-bitfields"
140            LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
141            GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
142            GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
143            GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
144            PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
145            ;;
146        *)
147            PATH="$PATH" ./configure
148            ;;
149    esac
150}
151
152build()
153{
154    cd $top_srcdir
155    case "$platform" in
156        ios-arm)
157            cd monsterz/ios
158            xcodebuild -configuration Release -sdk iphonesimulator4.3
159            ;;
160        android-arm)
161            cd monsterz/android
162            ndk-build
163            ant compile
164            ;;
165        *)
166            make -j6
167            ;;
168    esac
169}
170
171check()
172{
173    cd $top_srcdir
174    case "$platform" in
175        ios-arm)
176            ;;
177        android-arm)
178            ;;
179        ps3-ppu)
180            ;;
181        windows-i386)
182            # If neither $MSYSTEM or $DISPLAY are set, and xvfb-run
183            # exists, use it to run the test suite.
184            if test "x${MSYSTEM}${DISPLAY}" = x \
185               && xvfb-run --help 2>&1 >/dev/null; then
186                xvfb-run make check
187            else
188                make check
189            fi
190            ;;
191        windows-amd64)
192            # No support for Wine64 yet
193            ;;
194        *)
195            make check
196            ;;
197    esac
198}
199
200clean()
201{
202    cd $top_srcdir
203    case "$platform" in
204        ios-arm)
205            cd monsterz/ios
206            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
207            ;;
208        android-arm)
209            cd monsterz/android
210            ndk-build distclean
211            ant clean
212            ;;
213        *)
214            make distclean
215            ;;
216    esac
217}
218
219__init__
220echo "lol-build: executing action '$action' on platform '$platform'" >&2
221eval "$action"
222
Note: See TracBrowser for help on using the repository browser.