]> Dogcows Code - chaz/yoink/blob - arch/win32/makedeps.sh
cc8a8bf45cb1a26567bc4c3c4bb4d7162cd0097c
[chaz/yoink] / arch / win32 / makedeps.sh
1 #!/bin/sh
2
3 #
4 # Yoink
5 # Run this script to download and cross-compile dependencies for win32.
6 #
7 # A directory named deps will be created and/or populated in the current
8 # directory. Upon successful completion (be patient), the compiled
9 # dependencies will be packaged into an archive named deps.tar.bz2 in the
10 # current directory. To install the dependencies, execute this command:
11 #
12 # tar xjf deps.tar.bz2 -C $PREFIX
13 #
14 # where $PREFIX is the path to your mingw32 toolchain. If problems occur,
15 # check stdout and stderr for clues. You may be able to easily determine
16 # the problem and make the necessary corrections. These packages will be
17 # downloaded and built:
18 #
19 # SDL 1.2.14
20 # boost 1.43.0 (headers only)
21 # libogg 1.2.0
22 # libpng 1.4.2
23 # libvorbis 1.3.1
24 # lua 5.1.4
25 # openal-soft 1.12.854
26 # zlib 1.2.5
27 #
28 # This script requires a working mingw32 toolchain and other basic tools.
29 #
30 # Example usage:
31 # ./makedeps.sh -H i486-mingw32 -p /usr/i486-mingw32 -m "-j8"
32 #
33 # Bugs: Each time the script is run, all of the dependencies will be
34 # rebuilt, even the ones which were already built successfully.
35 #
36
37 showhelp()
38 {
39 echo "Usage: $0 [-h] [-m makeopts] -H host -p prefix"
40 echo " Downloads and cross-compiles dependencies for win32."
41 echo ""
42 echo " -H Specify the name of your toolchain, like i486-mingw32."
43 echo " -h Show this help an exit."
44 echo " -m Specify options to be passed to make."
45 echo " -p Specify the path to your toolchain installation."
46 }
47
48 while getopts ":H:hm:p:" opt
49 do
50 case $opt in
51 H)
52 HOST="$OPTARG"
53 ;;
54 h)
55 showhelp
56 exit 0
57 ;;
58 m)
59 MAKEOPTS="$OPTARG"
60 ;;
61 p)
62 PREFIX="$OPTARG"
63 ;;
64 \?)
65 echo "Invalid option: -$OPTARG" >&2
66 showhelp
67 exit 1
68 ;;
69 esac
70 done
71
72 if test x$HOST = x || test x$PREFIX = x
73 then
74 showhelp
75 exit 1
76 fi
77
78
79 die()
80 {
81 echo "die:" $@
82 exit 1
83 }
84
85 DESTDIR="`pwd`/deps"
86 mkdir -p "$DESTDIR"
87 rm -f "$DESTDIR/README"
88 rm -rf "$DESTDIR/$PREFIX"
89
90
91 PACKAGE="boost_1_43_0"
92 VERSION="1.43.0"
93 cd $DESTDIR
94 test ! -f $PACKAGE.tar.bz2 && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE")
95 (md5sum -c <<"EOL"
96 dd49767bfb726b0c774f7db0cef91ed1 boost_1_43_0.tar.bz2
97 EOL
98 ) || die "verifying $PACKAGE"
99 rm -rf $PACKAGE
100 tar xjf $PACKAGE.tar.bz2 || die "unpackaging $PACKAGE"
101 (mkdir -p $DESTDIR/$PREFIX/include && \
102 rm -rf $DESTDIR/$PREFIX/include/boost && \
103 cp -r $PACKAGE/boost $DESTDIR/$PREFIX/include/boost) || die "installing $PACKAGE"
104
105
106 PACKAGE="SDL-1.2.14"
107 cd $DESTDIR
108 test ! -f $PACKAGE.tar.gz && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
109 (md5sum -c <<"EOL"
110 e52086d1b508fa0b76c52ee30b55bec4 SDL-1.2.14.tar.gz
111 EOL
112 ) || die "verifying $PACKAGE"
113 rm -rf $PACKAGE
114 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
115 cd $PACKAGE
116 ./configure --host=$HOST --prefix=$PREFIX --disable-stdio-redirect || die "configuring $PACKAGE"
117 make $MAKEOPTS || die "making $PACKAGE"
118 make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
119
120
121 PACKAGE="libogg-1.2.0"
122 cd $DESTDIR
123 test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
124 (md5sum -c <<"EOL"
125 c95b73759acfc30712beef6ce4e88efa libogg-1.2.0.tar.gz
126 EOL
127 ) || die "verifying $PACKAGE"
128 rm -rf $PACKAGE
129 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
130 cd $PACKAGE
131 ./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE"
132 make $MAKEOPTS || die "making $PACKAGE"
133 make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
134
135
136 PACKAGE="libvorbis-1.3.1"
137 cd $DESTDIR
138 test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
139 (md5sum -c <<"EOL"
140 016e523fac70bdd786258a9d15fd36e9 libvorbis-1.3.1.tar.gz
141 EOL
142 ) || die "verifying $PACKAGE"
143 rm -rf $PACKAGE
144 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
145 cd $PACKAGE
146 ./configure --host=$HOST --prefix=$PREFIX \
147 CPPFLAGS="-I$DESTDIR/$PREFIX/include" \
148 LDFLAGS="-L$DESTDIR/$PREFIX/lib" || die "configuring $PACKAGE"
149 make $MAKEOPTS || die "making $PACKAGE"
150 make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
151
152
153 PACKAGE="openal-soft-1.12.854-bin"
154 cd $DESTDIR
155 test ! -f $PACKAGE.zip && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE")
156 (md5sum -c <<"EOL"
157 a0d92a959895fa9d0981b39089897a01 openal-soft-1.12.854-bin.zip
158 EOL
159 ) || die "verifying $PACKAGE"
160 rm -rf $PACKAGE
161 unzip $PACKAGE.zip || die "unpackaging $PACKAGE"
162 cd $PACKAGE
163 (mkdir -p $DESTDIR/$PREFIX/{lib/pkgconfig,include/AL} && \
164 install -p -m 0644 include/AL/* $DESTDIR/$PREFIX/include/AL/ && \
165 install -p -m 0755 Win32/soft_oal.dll $DESTDIR/$PREFIX/bin/OpenAL32.dll && \
166 install -p -m 0755 openal-info.exe $DESTDIR/$PREFIX/bin/ && \
167 install -p -m 0755 lib/Win32/libOpenAL32.dll.a $DESTDIR/$PREFIX/lib/ && \
168 cat >$DESTDIR/$PREFIX/lib/pkgconfig/openal.pc <<EOL
169 prefix=$PREFIX
170 exec_prefix=\${prefix}
171 libdir=\${exec_prefix}/lib
172 includedir=\${prefix}/include
173
174 Name: OpenAL
175 Description: OpenAL is a cross-platform 3D audio API
176 Requires:
177 Version: 1.11.753
178 Libs: -L\${libdir} -lOpenAL32
179 Cflags: -I\${includedir}
180 EOL
181 ) || die "installing $PACKAGE"
182
183
184 PACKAGE="zlib-1.2.5"
185 cd $DESTDIR
186 test ! -f $PACKAGE.zip && (wget "http://www.zlib.net/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
187 (md5sum -c <<"EOL"
188 c735eab2d659a96e5a594c9e8541ad63 zlib-1.2.5.tar.gz
189 EOL
190 ) || die "verifying $PACKAGE"
191 rm -rf $PACKAGE
192 tar xf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
193 cd $PACKAGE
194 cp win32/Makefile.gcc Makefile && \
195 make $MAKEOPTS prefix="$PREFIX" PREFIX="$HOST-" || die "making $PACKAGE"
196 (install -p -m 0644 zconf.h $DESTDIR/$PREFIX/include/ && \
197 install -p -m 0644 zlib.h $DESTDIR/$PREFIX/include/ && \
198 install -p -m 0755 zlib1.dll $DESTDIR/$PREFIX/bin/ && \
199 install -p -m 0755 libzdll.a $DESTDIR/$PREFIX/lib/ && \
200 cd $DESTDIR/$PREFIX/lib && \
201 ln -fs libzdll.a libz.dll.a) || die "installing $PACKAGE"
202
203
204 PACKAGE="libpng-1.4.2"
205 cd $DESTDIR
206 test ! -f $PACKAGE.tar.gz && (wget "http://prdownloads.sourceforge.net/libpng/$PACKAGE.tar.gz?download" || die "downloading $PACKAGE")
207 (md5sum -c <<"EOL"
208 89fd334dc5fc84ff146b9269c4fa452f libpng-1.4.2.tar.gz
209 EOL
210 ) || die "verifying $PACKAGE"
211 rm -rf $PACKAGE
212 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
213 cd $PACKAGE
214 cp scripts/makefile.mingw Makefile && \
215 make $MAKEOPTS prefix="$PREFIX" CC="$HOST-gcc" AR="$HOST-ar" RANLIB="$HOST-ranlib" \
216 ZLIBINC="$DESTDIR/$PREFIX/include" \
217 ZLIBLIB="$DESTDIR/$PREFIX/lib" libpng.a libpng14.dll || die "making $PACKAGE"
218 make DESTDIR=$DESTDIR install prefix="$PREFIX" || die "installing $PACKAGE"
219
220
221 PACKAGE="lua-5.1.4"
222 cd $DESTDIR
223 test ! -f $PACKAGE.tar.gz && (wget "http://www.lua.org/ftp/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
224 (md5sum -c <<"EOL"
225 d0870f2de55d59c1c8419f36e8fac150 lua-5.1.4.tar.gz
226 EOL
227 ) || die "verifying $PACKAGE"
228 rm -rf $PACKAGE
229 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
230 cd $PACKAGE
231 patch -p1 <<"EOL"
232 diff -ur lua-5.1.4.orig/Makefile lua-5.1.4/Makefile
233 --- lua-5.1.4.orig/Makefile 2008-08-11 18:40:48.000000000 -0600
234 +++ lua-5.1.4/Makefile 2010-03-03 23:11:41.673472345 -0700
235 @@ -13,7 +13,8 @@
236 INSTALL_BIN= $(INSTALL_TOP)/bin
237 INSTALL_INC= $(INSTALL_TOP)/include
238 INSTALL_LIB= $(INSTALL_TOP)/lib
239 -INSTALL_MAN= $(INSTALL_TOP)/man/man1
240 +INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
241 +INSTALL_PC= $(INSTALL_LIB)/pkgconfig
242 #
243 # You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
244 # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
245 @@ -41,10 +42,11 @@
246 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
247
248 # What to install.
249 -TO_BIN= lua luac
250 +TO_BIN= lua.exe luac.exe lua51.dll
251 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
252 -TO_LIB= liblua.a
253 +TO_LIB= liblua.a liblua.dll.a
254 TO_MAN= lua.1 luac.1
255 +TO_PC= lua.pc
256
257 # Lua version and release.
258 V= 5.1
259 @@ -59,11 +61,12 @@
260 src/lua test/hello.lua
261
262 install: dummy
263 - cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
264 + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_PC) $(INSTALL_LMOD) $(INSTALL_CMOD)
265 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
266 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
267 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
268 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
269 + cd etc && $(INSTALL_DATA) $(TO_PC) $(INSTALL_PC)
270
271 ranlib:
272 cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
273 diff -ur lua-5.1.4.orig/src/Makefile lua-5.1.4/src/Makefile
274 --- lua-5.1.4.orig/src/Makefile 2008-01-19 12:37:58.000000000 -0700
275 +++ lua-5.1.4/src/Makefile 2010-03-03 22:45:47.101159854 -0700
276 @@ -105,7 +105,7 @@
277
278 mingw:
279 $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
280 - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
281 + "AR=$(CC) -shared -Wl,--out-implib,liblua.dll.a -o" "RANLIB=strip --strip-unneeded" \
282 "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe
283 $(MAKE) "LUAC_T=luac.exe" luac.exe
284
285 EOL
286 patch -p1 <<EOL
287 diff -ur lua-5.1.4.orig/etc/lua.pc lua-5.1.4/etc/lua.pc
288 --- lua-5.1.4.orig/etc/lua.pc 2008-08-08 06:46:11.000000000 -0600
289 +++ lua-5.1.4/etc/lua.pc 2010-03-03 22:46:49.160471491 -0700
290 @@ -8,7 +8,7 @@
291 R= 5.1.4
292
293 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
294 -prefix= /usr/local
295 +prefix= $PREFIX
296 INSTALL_BIN= \${prefix}/bin
297 INSTALL_INC= \${prefix}/include
298 INSTALL_LIB= \${prefix}/lib
299 EOL
300 make $MAKEOPTS CC="$HOST-gcc" RANLIB="$HOST-ranlib" mingw || die "making $PACKAGE"
301 make INSTALL_TOP=$DESTDIR/$PREFIX install || die "installing $PACKAGE"
302 chmod 755 $DESTDIR/$PREFIX/lib/liblua.dll.a
303
304
305 # libopengl32 and libglu32 pc files
306 mkdir -p $DESTDIR/$PREFIX/lib/pkgconfig
307 cat >$DESTDIR/$PREFIX/lib/pkgconfig/gl.pc <<EOL
308 prefix=$PREFIX
309 exec_prefix=\${prefix}
310 libdir=\${exec_prefix}/lib
311 includedir=\${prefix}/include
312
313 Name: gl
314 Description: OpenGL library
315 Requires:
316 Version:
317 Libs: -L\${libdir} -lopengl32
318 Cflags: -I\${includedir}
319 EOL
320 cat >$DESTDIR/$PREFIX/lib/pkgconfig/glu.pc <<EOL
321 prefix=$PREFIX
322 exec_prefix=\${prefix}
323 libdir=\${exec_prefix}/lib
324 includedir=\${prefix}/include
325
326 Name: glu
327 Description: OpenGL Utility library
328 Requires: gl
329 Version:
330 Libs: -L\${libdir} -lglu32
331 Cflags: -I\${includedir}
332 EOL
333
334
335 # wspiapi.h header file
336 install -p -m 0644 $DESTDIR/../wspiapi.h $DESTDIR/$PREFIX/include/ || die "installing wspiapi.h"
337
338
339 cd $DESTDIR/$PREFIX
340 cat >README <<EOL
341
342 Yoink Win32 Dependencies
343 Created `date +"%d %b %Y"`
344
345 These dependencies were generated automatically by makedeps.sh, a script
346 available in the Yoink repository. You should find here all the header
347 files, DLL's, implibs, and pkgconfig files required to build Yoink that are
348 not provided with the standard mingw32 toolchain. Yoink itself can be
349 built with mingw32 and these installed dependencies like this:
350
351 ./configure --host=$HOST --prefix=$PREFIX \\
352 PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
353 make installer
354
355 These files are licensed such that their general distribution under
356 reasonable conditions is allowable. The copyrights of these binaries go to
357 their various respective owners. Look up the specific library for specific
358 terms and conditions, or see the file COPYING in the Yoink package.
359
360 EOL
361 tar cjf deps.tar.bz2 * || die "archiving dependencies"
362 mv deps.tar.bz2 $DESTDIR/..
363
364 echo "Done!"
365 echo "The dependencies are packed into the archive deps.tar.bz2."
366
This page took 0.049149 seconds and 4 git commands to generate.