# # Yoink # Use this with make to download and cross-compile dependencies for win32. # # boost_1_46_1 # libogg-1.2.2 # libpng-1.5.2 # libvorbis-1.3.2 # lua-5.1.4 # openal-soft-1.12.854-bin # SDL-1.2.14 # zlib-1.2.5 # # This requires GNU make, curl, openssl, tar, unzip, patch, and a working # mingw32 toolchain. Just set host and prefix and away you go! # # Example usage: # make -f deps.mk -j2 host=i486-mingw32 prefix=/usr/i486-mingw32 # sudo make install # # A lot of temporary files and directories are downloaded or extracted to the # current directory, so you may want to make from a clean directory. # host = i686-mingw32 prefix = /usr/i686-mingw32/usr ########################################################################### ECONF = ./configure --host=$(host) --prefix=$(prefix) MAKEINST = $(MAKE) -j1 install getdist = curl -L -o $1 "$2" checkdist = test "MD5($1)= $2" = "$$(openssl md5 $1)" patch = echo "$$$1" | patch -p1 mkdirinst = mkdir -p $(addprefix $(DESTDIR)$(prefix)/,$1) installdir = cp -pR $1 $(DESTDIR)$(prefix)/$2 install = install -p -m $1 $2 $(DESTDIR)$(prefix)/$3 installvar = echo "$$$1" >$(DESTDIR)$(prefix)/$2 .PHONY: all all: __package__ ifneq ($(strip $(wildcard .saved)),) host = $(shell sed -n 1p .saved) prefix = $(shell sed -n 2p .saved) endif ########################################################################### BOOST = boost_1_46_1 BOOST_CKSUM = 7375679575f4c8db605d426fc721d506 BOOST_EXT = .tar.bz2 BOOST_VERSION = 1.46.1 $(BOOST)$(BOOST_EXT): $(call getdist,$@,http://sourceforge.net/projects/boost/files/boost/$(BOOST_VERSION)/$@/download) $(call checkdist,$@,$(BOOST_CKSUM)) || rm -f $@ .PHONY: $(BOOST) install-$(BOOST) $(BOOST): $(BOOST)$(BOOST_EXT) install-$(BOOST): $(BOOST)$(BOOST_EXT) tar -xjf $< $(call mkdirinst,include) $(call installdir,$(BOOST)/boost,include/boost) ########################################################################### SDL = SDL-1.2.14 SDL_CKSUM = e52086d1b508fa0b76c52ee30b55bec4 SDL_EXT = .tar.gz $(SDL)$(SDL_EXT): $(call getdist,$@,http://www.libsdl.org/release/$@) $(call checkdist,$@,$(SDL_CKSUM)) || rm -f $@ $(SDL)/build/.libs/SDL.dll: $(SDL)$(SDL_EXT) tar -xzf $< cd $(SDL) && $(ECONF) --disable-stdio-redirect && $(MAKE) .PHONY: $(SDL) install-$(SDL) $(SDL): $(SDL)/build/.libs/SDL.dll install-$(SDL): $(SDL) cd $(SDL) && $(MAKEINST) ########################################################################### LIBOGG = libogg-1.2.2 LIBOGG_CKSUM = 5a9fcabc9a1b7c6f1cd75ddc78f36c56 LIBOGG_EXT = .tar.gz $(LIBOGG)$(LIBOGG_EXT): $(call getdist,$@,http://downloads.xiph.org/releases/ogg/$@) $(call checkdist,$@,$(LIBOGG_CKSUM)) || rm -f $@ $(LIBOGG)/src/.libs/libogg-0.dll: $(LIBOGG)$(LIBOGG_EXT) tar -xzf $< cd $(LIBOGG) && $(ECONF) && $(MAKE) && $(MAKEINST) DESTDIR=$$PWD .PHONY: $(LIBOGG) install-$(LIBOGG) $(LIBOGG): $(LIBOGG)/src/.libs/libogg-0.dll install-$(LIBOGG): $(LIBOGG) cd $(LIBOGG) && $(MAKEINST) ########################################################################### LIBVORBIS = libvorbis-1.3.2 LIBVORBIS_CKSUM = c870b9bd5858a0ecb5275c14486d9554 LIBVORBIS_EXT = .tar.gz $(LIBVORBIS)$(LIBVORBIS_EXT): $(call getdist,$@,http://downloads.xiph.org/releases/vorbis/$@) $(call checkdist,$@,$(LIBVORBIS_CKSUM)) || rm -f $@ $(LIBVORBIS)/lib/.libs/libvorbis-0.dll: $(LIBVORBIS)$(LIBVORBIS_EXT) tar -xzf $< cd $(LIBVORBIS) && $(ECONF) --with-ogg=$(PWD)/$(LIBOGG)$(prefix) && $(MAKE) .PHONY: $(LIBVORBIS) install-$(LIBVORBIS) $(LIBVORBIS): $(LIBOGG) $(LIBVORBIS)/lib/.libs/libvorbis-0.dll install-$(LIBVORBIS): $(LIBVORBIS) install-$(LIBOGG) cd $(LIBVORBIS) && $(MAKEINST) ########################################################################### OPENAL = openal-soft-1.13-bin OPENAL_CKSUM = b545d3ebb8138cc581cd67f988638f43 OPENAL_EXT = .zip OPENAL_VERSION = 1.13 define OPENAL_PCFILE prefix=$(prefix) exec_prefix=$${prefix} libdir=$${exec_prefix}/lib includedir=$${prefix}/include Name: OpenAL Description: OpenAL is a cross-platform 3D audio API Requires: Version: $(OPENAL_VERSION) Libs: -L$${libdir} -lOpenAL32 Cflags: -I$${includedir} endef export OPENAL_PCFILE $(OPENAL)$(OPENAL_EXT): $(call getdist,$@,http://kcat.strangesoft.net/$@) $(call checkdist,$@,$(OPENAL_CKSUM)) || rm -f $@ .PHONY: $(OPENAL) install-$(OPENAL) $(OPENAL): $(OPENAL)$(OPENAL_EXT) install-$(OPENAL): $(OPENAL)$(OPENAL_EXT) $(call mkdirinst,bin include/AL lib/pkgconfig) unzip -o $< $(call install,0644,$(OPENAL)/include/AL/*,include/AL) $(call install,0755,$(OPENAL)/Win32/soft_oal.dll,bin/OpenAL32.dll) $(call install,0755,$(OPENAL)/openal-info.exe,bin) $(call install,0755,$(OPENAL)/lib/Win32/libOpenAL32.dll.a,lib) $(call installvar,OPENAL_PCFILE,lib/pkgconfig/openal.pc) ########################################################################### ZLIB = zlib-1.2.5 ZLIB_CKSUM = c735eab2d659a96e5a594c9e8541ad63 ZLIB_EXT = .tar.gz ZLIB_VERSION = 1.2.5 define ZLIB_PCFILE prefix=$(prefix) exec_prefix=$${prefix} libdir=$${exec_prefix}/lib includedir=$${prefix}/include Name: zlib Description: zlib compression library Version: $(ZLIB_VERSION) Requires: Libs: -L$${libdir} -lz Cflags: -I$${includedir} endef export ZLIB_PCFILE $(ZLIB)$(ZLIB_EXT): $(call getdist,$@,http://www.zlib.net/$@) $(call checkdist,$@,$(ZLIB_CKSUM)) || rm -f $@ $(ZLIB)/zlib1.dll: $(ZLIB)$(ZLIB_EXT) tar -xzf $< cd $(ZLIB) && $(MAKE) -f win32/Makefile.gcc PREFIX="$(host)-" .PHONY: $(ZLIB) install-$(ZLIB) $(ZLIB): $(ZLIB)/zlib1.dll install-$(ZLIB): $(ZLIB) $(call mkdirinst,bin include lib/pkgconfig) $(call install,0644,$(ZLIB)/zconf.h $(ZLIB)/zlib.h,include) $(call install,0755,$(ZLIB)/zlib1.dll,bin) $(call install,0755,$(ZLIB)/libzdll.a,lib) $(call installvar,ZLIB_PCFILE,lib/pkgconfig/zlib.pc) cd $(DESTDIR)$(prefix)/lib && ln -fs libzdll.a libz.dll.a ########################################################################### LIBPNG = libpng-1.5.2 LIBPNG_CKSUM = 31d448eb93a1646359a23f1b23434ab3 LIBPNG_EXT = .tar.gz define LIBPNG_PATCH diff -ur libpng-1.5.2.orig/configure.pc libpng-1.5.2/configure.pc --- libpng-1.5.2.orig/configure.ac 2011-06-03 14:01:39.174626747 -0600 +++ libpng-1.5.2/configure.ac 2011-06-03 14:02:05.427642561 -0600 @@ -85,9 +85,9 @@ [prefix that may have been used in installed zlib]), [ZPREFIX=$${withval}], [ZPREFIX='z_']) -AC_CHECK_LIB(z, zlibVersion, , - AC_CHECK_LIB(z, $${ZPREFIX}zlibVersion, , - AC_ERROR([zlib not installed]))) +LIBS="$$LIBS -lz" +CPPFLAGS="$$CPPFLAGS -I../$(ZLIB)" +LDFLAGS="$$LDFLAGS -L../$(ZLIB) -avoid-version" LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG endef export LIBPNG_PATCH $(LIBPNG)$(LIBPNG_EXT): $(call getdist,$@,http://prdownloads.sourceforge.net/libpng/$@?download) $(call checkdist,$@,$(LIBPNG_CKSUM)) || rm -f $@ $(LIBPNG)/.libs/libpng15.dll: $(LIBPNG)$(LIBPNG_EXT) tar -xzf $< cd $(LIBPNG) && $(call patch,LIBPNG_PATCH) && ./autogen.sh && $(ECONF) && $(MAKE) .PHONY: $(LIBPNG) install-$(LIBPNG) $(LIBPNG): $(ZLIB) $(LIBPNG)/.libs/libpng15.dll install-$(LIBPNG): $(LIBPNG) install-$(ZLIB) cd $(LIBPNG) && $(MAKEINST) ########################################################################### LUA = lua-5.1.4 LUA_CKSUM = d0870f2de55d59c1c8419f36e8fac150 LUA_EXT = .tar.gz $(LUA)$(LUA_EXT): $(call getdist,$@,http://www.lua.org/ftp/$@) $(call checkdist,$@,$(LUA_CKSUM)) || rm -f $@ $(LUA)/src/lua51.dll: $(LUA)$(LUA_EXT) tar -xzf $< cd $(LUA) && $(MAKE) CC=$(host)-gcc RANLIB=$(host)-ranlib mingw .PHONY: $(LUA) install-$(LUA) $(LUA): $(LUA)/src/lua51.dll install-$(LUA): $(LUA) $(call mkdirinst,bin include lib/pkgconfig) $(call install,0644,$(addprefix $(LUA)/src/,lua.h lualib.h luaconf.h lauxlib.h) $(LUA)/etc/lua.hpp,include) $(call install,0755,$(LUA)/src/liblua.a,lib/liblua.dll.a) $(call install,0755,$(LUA)/src/*.exe $(LUA)/src/lua51.dll,bin) sed 's!/usr/local!$(prefix)!' $(LUA)/etc/lua.pc >$(DESTDIR)$(prefix)/lib/pkgconfig/lua.pc ############################################################################ # libopengl32 and libglu32 pkgconfig files define GL_PCFILE prefix=$(prefix) exec_prefix=$${prefix} libdir=$${exec_prefix}/lib includedir=$${prefix}/include Name: gl Description: OpenGL library Version: Requires: Libs: -L$${libdir} -lopengl32 Cflags: -I$${includedir} endef export GL_PCFILE .PHONY: install-gl.pc install-gl.pc: $(call mkdirinst,lib/pkgconfig) $(call installvar,GL_PCFILE,lib/pkgconfig/gl.pc) define GLU_PCFILE prefix=$(prefix) exec_prefix=$${prefix} libdir=$${exec_prefix}/lib includedir=$${prefix}/include Name: glu Description: OpenGL Utility library Version: Requires: gl Libs: -L$${libdir} -lglu32 Cflags: -I$${includedir} endef export GLU_PCFILE .PHONY: install-glu.pc install-glu.pc: $(call mkdirinst,lib/pkgconfig) $(call installvar,GLU_PCFILE,lib/pkgconfig/glu.pc) ########################################################################### # wspiapi.h header file install-wspiapi.h: $(call install,0644,wspiapi.h,include) ########################################################################### ALL = $(BOOST) $(SDL) $(LIBOGG) $(LIBVORBIS) $(OPENAL) $(ZLIB) $(LIBPNG) $(LUA) __package__: $(ALL) printf "$(host)\n$(prefix)\n" >.saved @echo "All done!" install: $(addprefix install-,$(ALL)) install-gl.pc install-glu.pc @echo "All done!" .NOTPARALLEL: # For readability, the recipes in this file should not run in parallel.