source: trunk/build/lol-build @ 1156

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

win32: no longer ship GDI+ because MinGW ships a working version, including
for Win64.

  • 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-i386
19#  - nacl-amd64
20#  - ios-arm
21#  - osx-amd64
22#  - android-arm
23#  - ps3-ppu
24#  - windows-i386
25#  - windows-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        windows-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            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-i386)
123            ./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"
124            ;;
125        nacl-amd64)
126            ./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"
127            ;;
128        ps3-ppu)
129            PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=powerpc
130            ;;
131        windows-i386|windows-amd64)
132            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
133            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
134            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
135            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include/GL -DGLEW_STATIC"
136            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
137            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
138            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
139            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
140            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
141            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
142            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
143            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
144            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
145            CPPFLAGS="$CPPFLAGS -mms-bitfields"
146            LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
147            GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
148            GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
149            GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
150            PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
151            ;;
152        *)
153            PATH="$PATH" ./configure
154            ;;
155    esac
156}
157
158build()
159{
160    cd $top_srcdir
161    case "$platform" in
162        ios-arm)
163            cd monsterz/ios
164            xcodebuild -configuration Release -sdk iphonesimulator4.3
165            ;;
166        android-arm)
167            cd monsterz/android
168            ndk-build
169            ant compile
170            ;;
171        *)
172            make -j6
173            ;;
174    esac
175}
176
177check()
178{
179    cd $top_srcdir
180    case "$platform" in
181        ios-arm)
182            ;;
183        android-arm)
184            ;;
185        ps3-ppu)
186            ;;
187        nacl-*)
188            ;;
189        windows-i386)
190            # If neither $MSYSTEM or $DISPLAY are set, and xvfb-run
191            # exists, use it to run the test suite.
192            if test "x${MSYSTEM}${DISPLAY}" = x \
193               && xvfb-run --help 2>&1 >/dev/null; then
194                xvfb-run make check
195            else
196                make check
197            fi
198            ;;
199        windows-amd64)
200            # No support for Wine64 yet
201            ;;
202        *)
203            make check
204            ;;
205    esac
206}
207
208clean()
209{
210    cd $top_srcdir
211    case "$platform" in
212        ios-arm)
213            cd monsterz/ios
214            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
215            ;;
216        android-arm)
217            cd monsterz/android
218            ndk-build distclean
219            ant clean
220            ;;
221        *)
222            make distclean
223            ;;
224    esac
225}
226
227__init__
228echo "lol-build: executing action '$action' on platform '$platform'" >&2
229eval "$action"
230
Note: See TracBrowser for help on using the repository browser.