#!/bin/sh # # Yoink # Run this script to download and cross-compile dependencies for win32. # # A directory named deps will be created and/or populated in the current # directory. Upon successful completion (be patient), the compiled # dependencies will be packaged into an archive named deps.tar.bz2 in the # current directory. To install the dependencies, execute this command: # # tar xjf deps.tar.bz2 -C $PREFIX # # where $PREFIX is the path to your mingw32 toolchain. If problems occur, # check stdout and stderr for clues. You may be able to easily determine # the problem and make the necessary corrections. These packages will be # downloaded and built: # # SDL 1.2.14 # boost 1.43.0 (headers only) # libogg 1.2.0 # libpng 1.4.2 # libvorbis 1.3.1 # lua 5.1.4 # openal-soft 1.12.854 # zlib 1.2.5 # # This script requires a working mingw32 toolchain and other basic tools. # # Example usage: # ./makedeps.sh -H i486-mingw32 -p /usr/i486-mingw32 -m "-j8" # # Bugs: Each time the script is run, all of the dependencies will be # rebuilt, even the ones which were already built successfully. # showhelp() { echo "Usage: $0 [-h] [-m makeopts] -H host -p prefix" echo " Downloads and cross-compiles dependencies for win32." echo "" echo " -H Specify the name of your toolchain, like i486-mingw32." echo " -h Show this help an exit." echo " -m Specify options to be passed to make." echo " -p Specify the path to your toolchain installation." } while getopts ":H:hm:p:" opt do case $opt in H) HOST="$OPTARG" ;; h) showhelp exit 0 ;; m) MAKEOPTS="$OPTARG" ;; p) PREFIX="$OPTARG" ;; \?) echo "Invalid option: -$OPTARG" >&2 showhelp exit 1 ;; esac done if test x$HOST = x || test x$PREFIX = x then showhelp exit 1 fi die() { echo "die:" $@ exit 1 } DESTDIR="`pwd`/deps" mkdir -p "$DESTDIR" rm -f "$DESTDIR/README" rm -rf "$DESTDIR/$PREFIX" PACKAGE="boost_1_43_0" VERSION="1.43.0" cd $DESTDIR test ! -f $PACKAGE.tar.bz2 && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE") (md5sum -c <<"EOL" dd49767bfb726b0c774f7db0cef91ed1 boost_1_43_0.tar.bz2 EOL ) || die "verifying $PACKAGE" rm -rf $PACKAGE tar xjf $PACKAGE.tar.bz2 || die "unpackaging $PACKAGE" (mkdir -p $DESTDIR/$PREFIX/include && \ rm -rf $DESTDIR/$PREFIX/include/boost && \ cp -r $PACKAGE/boost $DESTDIR/$PREFIX/include/boost) || die "installing $PACKAGE" PACKAGE="SDL-1.2.14" cd $DESTDIR test ! -f $PACKAGE.tar.gz && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE") (md5sum -c <<"EOL" e52086d1b508fa0b76c52ee30b55bec4 SDL-1.2.14.tar.gz EOL ) || die "verifying $PACKAGE" rm -rf $PACKAGE tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" cd $PACKAGE ./configure --host=$HOST --prefix=$PREFIX --disable-stdio-redirect || die "configuring $PACKAGE" make $MAKEOPTS || die "making $PACKAGE" make DESTDIR=$DESTDIR install || die "installing $PACKAGE" PACKAGE="libogg-1.2.0" cd $DESTDIR test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE") (md5sum -c <<"EOL" c95b73759acfc30712beef6ce4e88efa libogg-1.2.0.tar.gz EOL ) || die "verifying $PACKAGE" rm -rf $PACKAGE tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" cd $PACKAGE ./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE" make $MAKEOPTS || die "making $PACKAGE" make DESTDIR=$DESTDIR install || die "installing $PACKAGE" PACKAGE="libvorbis-1.3.1" cd $DESTDIR test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE") (md5sum -c <<"EOL" 016e523fac70bdd786258a9d15fd36e9 libvorbis-1.3.1.tar.gz EOL ) || die "verifying $PACKAGE" rm -rf $PACKAGE tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE" cd $PACKAGE ./configure --host=$HOST --prefix=$PREFIX \ CPPFLAGS="-I$DESTDIR/$PREFIX/include" \ LDFLAGS="-L$DESTDIR/$PREFIX/lib" || die "configuring $PACKAGE" make $MAKEOPTS || die "making $PACKAGE" make DESTDIR=$DESTDIR install || die "installing $PACKAGE" PACKAGE="openal-soft-1.12.854-bin" cd $DESTDIR test ! -f $PACKAGE.zip && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE") (md5sum -c <<"EOL" a0d92a959895fa9d0981b39089897a01 openal-soft-1.12.854-bin.zip EOL ) || die "verifying $PACKAGE" rm -rf $PACKAGE unzip $PACKAGE.zip || die "unpackaging $PACKAGE" cd $PACKAGE (mkdir -p $DESTDIR/$PREFIX/{lib/pkgconfig,include/AL} && \ install -p -m 0644 include/AL/* $DESTDIR/$PREFIX/include/AL/ && \ install -p -m 0755 Win32/soft_oal.dll $DESTDIR/$PREFIX/bin/OpenAL32.dll && \ install -p -m 0755 openal-info.exe $DESTDIR/$PREFIX/bin/ && \ install -p -m 0755 lib/Win32/libOpenAL32.dll.a $DESTDIR/$PREFIX/lib/ && \ cat >$DESTDIR/$PREFIX/lib/pkgconfig/openal.pc <$DESTDIR/$PREFIX/lib/pkgconfig/gl.pc <$DESTDIR/$PREFIX/lib/pkgconfig/glu.pc <README <