source: trunk/build/lol-build @ 1082

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

core: port all code to NativeClient. Nothing runs for now, but it builds.

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