source: trunk/build/lol-build @ 961

Last change on this file since 961 was 961, checked in by sam, 9 years ago

build: fix a shitload of build errors introduced by the Image refactoring
and the OS X port.

  • Property svn:executable set to *
File size: 6.2 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/glew-1.7.0/lib/i686-w64-mingw32"
84            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/i686-w64-mingw32"
85            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/i686-w64-mingw32"
86            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/i686-w64-mingw32"
87            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
88            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
89            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
90            ;;
91        windows-amd64)
92            if test "x${MSYSTEM}" = xMINGW64; then
93                :
94            elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
95                HOSTFLAGS=--host=x86_64-w64-mingw32
96                BUILDFLAGS=--build=none
97            else
98                echo "Error: could not find win64 compiler" >&2
99                false
100            fi
101            if test "x${MSYSTEM}" = xMINGW32; then
102                # If using mingw32, we're not really cross-compiling
103                BUILDFLAGS=
104            fi
105            PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/x86_64-w64-mingw32/pkgconfig"
106            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
107            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/x86_64-w64-mingw32"
108            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/x86_64-w64-mingw32"
109            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/x86_64-w64-mingw32"
110            ;;
111    esac
112    case "$platform" in
113        ios-arm)
114            # No configuration needed
115            ;;
116        android-arm)
117            cd monsterz/android
118            android update project --path .
119            ;;
120        ps3-ppu)
121            PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
122            ;;
123        windows-i386|windows-amd64)
124            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
125            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
126            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
127            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include/GL -DGLEW_STATIC"
128            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
129            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
130            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
131            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
132            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
133            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
134            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
135            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
136            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
137            CPPFLAGS="$CPPFLAGS -mms-bitfields"
138            LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
139            GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
140            GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
141            GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
142            PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
143            ;;
144        *)
145            PATH="$PATH" ./configure
146            ;;
147    esac
148}
149
150build()
151{
152    cd $top_srcdir
153    case "$platform" in
154        ios-arm)
155            cd monsterz/ios
156            xcodebuild -configuration Release -sdk iphonesimulator4.3
157            ;;
158        android-arm)
159            cd monsterz/android
160            ndk-build
161            ant compile
162            ;;
163        *)
164            make -j6
165            ;;
166    esac
167}
168
169check()
170{
171    cd $top_srcdir
172    case "$platform" in
173        ios-arm)
174            ;;
175        android-arm)
176            ;;
177        ps3-ppu)
178            ;;
179        windows-amd64)
180            # No support for Wine64 yet
181            ;;
182        *)
183            make check
184            ;;
185    esac
186}
187
188clean()
189{
190    cd $top_srcdir
191    case "$platform" in
192        ios-arm)
193            cd monsterz/ios
194            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
195            ;;
196        android-arm)
197            cd monsterz/android
198            ndk-build distclean
199            ant clean
200            ;;
201        *)
202            make distclean
203            ;;
204    esac
205}
206
207__init__
208echo "lol-build: executing action '$action' on platform '$platform'" >&2
209eval "$action"
210
Note: See TracBrowser for help on using the repository browser.