tar -zxf libmikmod-3.2.0-beta2.tar.gz cd libmikmod-3.2.0-beta2 gunzip -cd ../iphone-drv-mikmod-3.2.0-beta2.patch.gz | patch -p1Among other things, the patch modifies various Makefiles and the configure script, so we have to cleanly regenerate all the autotool-related files:
aclocal automake autoconfNow let's set up the necessary environment variables to configure and build libmikmod. First, where to find the AudioQueue header and where to install libmikmod:
export AQDIR=$HOME/local/audioqueue export MMDIR=$HOME/local/mikmod-iphoneMake sure you are using absolute paths for the variables above. Then, let's set up some compilation flags and name the tools we'll use from the iPhone toolchain:
export CFLAGS="-I$AQDIR -DAVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER=" export CPPFLAGS="$CFLAGS" export LDFLAGS="-framework AudioToolbox" export CC=arm-apple-darwin-gcc export RANLIB=arm-apple-darwin-ranlibOkay, now it's time to let configure do its job:
./configure --enable-iphone --host=arm-apple-darwin --disable-oss --disable-esd --prefix=$MMDIRWe're almost done! But there's still a little quirk that must be addressed. The project is configured to build shared libraries, which for some reason refuse to link with the version of the open-source iPhone toolchain I use. To overcome this problem, you just need to patch the generated libtool configuration. Knowing no clever means to do so, I propose something like:
sed -r -i 's/^(allow_undefined_flag.*)"/\1 -Wl,-read_only_relocs,suppress"/' libtoolPhew, now we're done! Just type:
make CFLAGS="$CFLAGS" make installAnd voila! a fresh libmikmod with support for your beloved iPhone or iPod Touch! Oh, by the way: the library comes in both static and dynamic flavor, so it should be pretty usable. Of course, the obligatory example will follow soon :P EDIT: the link to the patch was pointing to a plain file instead of a gzip one, fixed!