source: trunk/build/lol-build @ 948

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

build: fix a typo in the mingw configuration sequence in lol-build and
add set -e to the build-mingw scripts to catch possible regressions.

  • Property svn:executable set to *
File size: 5.5 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#  - android-arm
20#  - ps3-ppu
21#  - windows-i386
22#  - windows-amd64
23#
24
25set -e
26
27action="$1"
28platform="$2"
29
30top_srcdir=$(dirname "$0")/..
31cd $top_srcdir
32top_srcdir="`pwd`"
33
34bootstrap()
35{
36    cd $top_srcdir
37    case "$platform" in
38        ios-arm)
39            # No bootstrapping needed
40            ;;
41        android-arm)
42            # No bootstrapping needed
43            ;;
44        windows-i386|windows-amd64)
45            PATH="$PATH:./contrib/gtk-2.22.1/bin"
46            M4PATH="$M4PATH:./contrib/gtk-2.22.1/share/aclocal"
47            PATH="$PATH" M4PATH="$M4PATH" ./bootstrap
48            ;;
49        *)
50            ./bootstrap
51            ;;
52    esac
53}
54
55configure()
56{
57    cd $top_srcdir
58    case "$platform" in
59        windows-i386)
60            if test "x${MSYSTEM}" = xMINGW32; then
61                :
62            elif i586-mingw32msvc-g++ --version >/dev/null 2>&1; then
63                HOSTFLAGS=--host=i586-mingw32msvc
64                BUILDFLAGS=--build=none
65            elif i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
66                HOSTFLAGS=--host=i686-w64-mingw32
67                BUILDFLAGS=--build=none
68            else
69                echo "Error: could not find win32 compiler" >&2
70                false
71            fi
72            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/i686-w64-mingw32"
73            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/i686-w64-mingw32"
74            ;;
75        windows-amd64)
76            if test "x${MSYSTEM}" = xMINGW64; then
77                :
78            elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
79                HOSTFLAGS=--host=x86_64-w64-mingw32
80                BUILDFLAGS=--build=none
81            else
82                echo "Error: could not find win64 compiler" >&2
83                false
84            fi
85            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
86            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/x86_64-w64-mingw32"
87            ;;
88    esac
89    case "$platform" in
90        ios-arm)
91            # No configuration needed
92            ;;
93        android-arm)
94            cd monsterz/android
95            android update project --path .
96            ;;
97        ps3-ppu)
98            ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
99            ;;
100        windows-i386|windows-amd64)
101            PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
102            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
103            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
104            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
105            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include -DGLEW_STATIC"
106            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
107            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
108            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
109            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
110            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
111            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
112            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
113            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
114            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
115            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib"
116            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib"
117            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
118            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
119            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
120            CPPFLAGS="$CPPFLAGS -mms-bitfields"
121            LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
122            GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
123            GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
124            GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
125            LOL_LIBS="$LOL_LIBS -lSDL_image -lSDL_mixer -lSDLmain -lSDL -lopengl32 -lglew32"
126            PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS" LOL_LIBS="$LOL_LIBS"
127            ;;
128        *)
129            ./configure
130            ;;
131    esac
132}
133
134build()
135{
136    cd $top_srcdir
137    case "$platform" in
138        ios-arm)
139            cd monsterz/ios
140            xcodebuild -configuration Release -sdk iphonesimulator4.3
141            ;;
142        android-arm)
143            cd monsterz/android
144            ndk-build
145            ant compile
146            ;;
147        *)
148            make -j6
149            ;;
150    esac
151}
152
153check()
154{
155    cd $top_srcdir
156    case "$platform" in
157        ios-arm)
158            ;;
159        android-arm)
160            ;;
161        ps3-ppu)
162            ;;
163        *)
164            make check
165            ;;
166    esac
167}
168
169clean()
170{
171    cd $top_srcdir
172    case "$platform" in
173        ios-arm)
174            cd monsterz/ios
175            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
176            ;;
177        android-arm)
178            cd monsterz/android
179            ndk-build distclean
180            ant clean
181            ;;
182        *)
183            make distclean
184            ;;
185    esac
186}
187
188echo "lol-build: executing action '$action' on platform '$platform'" >&2
189eval "$action"
190
Note: See TracBrowser for help on using the repository browser.