5 # Run this script to download and cross-compile dependencies for win32.
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:
12 # tar xjf deps.tar.bz2 -C $PREFIX
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:
20 # boost 1.43.0 (headers only)
25 # openal-soft 1.12.854
28 # This script requires a working mingw32 toolchain and other basic tools.
31 # ./makedeps.sh -H i486-mingw32 -p /usr/i486-mingw32 -m "-j8"
33 # Bugs: Each time the script is run, all of the dependencies will be
34 # rebuilt, even the ones which were already built successfully.
39 echo "Usage: $0 [-h] [-m makeopts] -H host -p prefix"
40 echo " Downloads and cross-compiles dependencies for win32."
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."
48 while getopts ":H:hm:p:" opt
65 echo "Invalid option: -$OPTARG" >&2
72 if test x
$HOST = x
|| test x
$PREFIX = x
87 rm -f "$DESTDIR/README"
88 rm -rf "$DESTDIR/$PREFIX"
91 PACKAGE
="boost_1_43_0"
94 test ! -f $PACKAGE.
tar.bz2
&& (wget
"http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die
"downloading $PACKAGE")
96 dd49767bfb726b0c774f7db0cef91ed1 boost_1_43_0.tar.bz2
98 ) || die "verifying $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"
108 test ! -f $PACKAGE.tar.gz && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
110 e52086d1b508fa0b76c52ee30b55bec4 SDL
-1.2
.14.
tar.gz
112 ) || die
"verifying $PACKAGE"
114 tar xzf
$PACKAGE.
tar.gz
|| die
"unpackaging $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"
121 PACKAGE
="libogg-1.2.0"
123 test ! -f $PACKAGE.
tar.gz
&& (wget
"http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die
"downloading $PACKAGE")
125 c95b73759acfc30712beef6ce4e88efa libogg-1.2.0.tar.gz
127 ) || die "verifying $PACKAGE"
129 tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
131 ./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE"
132 make $MAKEOPTS || die "making $PACKAGE"
133 make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
136 PACKAGE="libvorbis-1.3.1"
138 test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
140 016e523fac70bdd786258a9d15fd36e9 libvorbis
-1.3
.1.
tar.gz
142 ) || die
"verifying $PACKAGE"
144 tar xzf
$PACKAGE.
tar.gz
|| die
"unpackaging $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"
153 PACKAGE
="openal-soft-1.12.854-bin"
155 test ! -f $PACKAGE.
zip && (wget
"http://kcat.strangesoft.net/$PACKAGE.zip" || die
"downloading $PACKAGE")
157 a0d92a959895fa9d0981b39089897a01 openal-soft-1.12.854-bin.zip
159 ) || die "verifying $PACKAGE"
161 unzip $PACKAGE.zip || die "unpackaging $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
170 exec_prefix=\${prefix}
171 libdir=\${exec_prefix}/lib
172 includedir=\${prefix}/include
175 Description: OpenAL is a cross-platform 3D audio API
178 Libs: -L\${libdir} -lOpenAL32
179 Cflags: -I\${includedir}
181 ) || die "installing $PACKAGE"
186 test ! -f $PACKAGE.zip && (wget "http://www.zlib.net/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
188 c735eab2d659a96e5a594c9e8541ad63 zlib
-1.2
.5.
tar.gz
190 ) || die
"verifying $PACKAGE"
192 tar xf
$PACKAGE.
tar.gz
|| die
"unpackaging $PACKAGE"
194 cp win
32/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"
204 PACKAGE
="libpng-1.4.2"
206 test ! -f $PACKAGE.
tar.gz
&& (wget
"http://prdownloads.sourceforge.net/libpng/$PACKAGE.tar.gz?download" || die
"downloading $PACKAGE")
208 89fd334dc5fc84ff146b9269c4fa452f libpng-1.4.2.tar.gz
210 ) || die "verifying $PACKAGE"
212 tar xzf $PACKAGE.tar.gz || die "unpackaging $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"
223 test ! -f $PACKAGE.tar.gz && (wget "http://www.lua.org/ftp/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
225 d0870f2de55d59c1c8419f36e8fac150 lua
-5.1
.4.
tar.gz
227 ) || die
"verifying $PACKAGE"
229 tar xzf
$PACKAGE.
tar.gz
|| die
"unpackaging $PACKAGE"
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
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
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).
246 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
250 +TO_BIN= lua.exe luac.exe lua51.dll
251 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
253 +TO_LIB= liblua.a liblua.dll.a
257 # Lua version and release.
260 src/lua test/hello.lua
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)
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
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
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
293 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
296 INSTALL_BIN= \${prefix}/bin
297 INSTALL_INC= \${prefix}/include
298 INSTALL_LIB= \${prefix}/lib
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
305 # libopengl32 and libglu32 pc files
306 mkdir -p $DESTDIR/$PREFIX/lib/pkgconfig
307 cat >$DESTDIR/$PREFIX/lib/pkgconfig/gl.pc <<EOL
309 exec_prefix=\${prefix}
310 libdir=\${exec_prefix}/lib
311 includedir=\${prefix}/include
314 Description: OpenGL library
317 Libs: -L\${libdir} -lopengl32
318 Cflags: -I\${includedir}
320 cat >$DESTDIR/$PREFIX/lib/pkgconfig/glu.pc <<EOL
322 exec_prefix=\${prefix}
323 libdir=\${exec_prefix}/lib
324 includedir=\${prefix}/include
327 Description: OpenGL Utility library
330 Libs: -L\${libdir} -lglu32
331 Cflags: -I\${includedir}
335 # wspiapi.h header file
336 install -p -m 0644 $DESTDIR/../wspiapi.h $DESTDIR/$PREFIX/include/ || die "installing wspiapi.h"
342 Yoink Win32 Dependencies
343 Created `date +"%d %b %Y"`
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:
351 ./configure --host=$HOST --prefix=$PREFIX \\
352 PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
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.
361 tar cjf deps.tar.bz2 * || die "archiving dependencies"
362 mv deps.tar.bz2 $DESTDIR/..
365 echo "The dependencies are packed into the archive deps.tar.bz2."