source: trunk/build/lol-build @ 949

Last change on this file since 949 was 949, checked in by sam, 10 years ago

build: move SDL_image and SDL_mixer binaries to an i686-only directory.

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