source: trunk/build/lol-build @ 1538

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

build: use "win-*" instead of "windows-*" in build names so that they
appear shorter on the web page.

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