3 # Use this with make to download and cross-compile dependencies for win32.
10 # openal-soft-1.12.854-bin
14 # This requires GNU make, curl, openssl, tar, unzip, patch, and a working
15 # mingw32 toolchain. Just set host and prefix and away you go!
18 # make -f deps.mk -j2 host=i486-mingw32 prefix=/usr/i486-mingw32
21 # A lot of temporary files and directories are downloaded or extracted to the
22 # current directory, so you may want to make from a clean directory.
26 prefix = /usr/i686-mingw32/usr
29 ###########################################################################
30 ECONF = ./configure --host=$(host) --prefix=$(prefix)
31 MAKEINST = $(MAKE) -j1 install
33 getdist = curl -L -o $1 "$2"
34 checkdist = test "MD5($1)= $2" = "$$(openssl md5 $1)"
35 patch = echo "$$$1" | patch -p1
36 mkdirinst = mkdir -p $(addprefix $(DESTDIR)$(prefix)/,$1)
37 installdir = cp -pR $1 $(DESTDIR)$(prefix)/$2
38 install = install -p -m $1 $2 $(DESTDIR)$(prefix)/$3
39 installvar = echo "$$$1" >$(DESTDIR)$(prefix)/$2
45 ifneq ($(strip $(wildcard .saved)),)
46 host = $(shell sed -n 1p .saved)
47 prefix = $(shell sed -n 2p .saved)
51 ###########################################################################
53 BOOST_CKSUM = 7375679575f4c8db605d426fc721d506
55 BOOST_VERSION = 1.46.1
58 $(call getdist,$@,http://sourceforge.net/projects/boost/files/boost/$(BOOST_VERSION)/$@/download)
59 $(call checkdist,$@,$(BOOST_CKSUM)) || rm -f $@
61 .PHONY: $(BOOST) install-$(BOOST)
62 $(BOOST): $(BOOST)$(BOOST_EXT)
64 install-$(BOOST): $(BOOST)$(BOOST_EXT)
66 $(call mkdirinst,include)
67 $(call installdir,$(BOOST)/boost,include/boost)
70 ###########################################################################
72 SDL_CKSUM = e52086d1b508fa0b76c52ee30b55bec4
76 $(call getdist,$@,http://www.libsdl.org/release/$@)
77 $(call checkdist,$@,$(SDL_CKSUM)) || rm -f $@
79 $(SDL)/build/.libs/SDL.dll: $(SDL)$(SDL_EXT)
81 cd $(SDL) && $(ECONF) --disable-stdio-redirect && $(MAKE)
83 .PHONY: $(SDL) install-$(SDL)
84 $(SDL): $(SDL)/build/.libs/SDL.dll
86 install-$(SDL): $(SDL)
87 cd $(SDL) && $(MAKEINST)
90 ###########################################################################
92 LIBOGG_CKSUM = 5a9fcabc9a1b7c6f1cd75ddc78f36c56
95 $(LIBOGG)$(LIBOGG_EXT):
96 $(call getdist,$@,http://downloads.xiph.org/releases/ogg/$@)
97 $(call checkdist,$@,$(LIBOGG_CKSUM)) || rm -f $@
99 $(LIBOGG)/src/.libs/libogg-0.dll: $(LIBOGG)$(LIBOGG_EXT)
101 cd $(LIBOGG) && $(ECONF) && $(MAKE) && $(MAKEINST) DESTDIR=$$PWD
103 .PHONY: $(LIBOGG) install-$(LIBOGG)
104 $(LIBOGG): $(LIBOGG)/src/.libs/libogg-0.dll
106 install-$(LIBOGG): $(LIBOGG)
107 cd $(LIBOGG) && $(MAKEINST)
110 ###########################################################################
111 LIBVORBIS = libvorbis-1.3.2
112 LIBVORBIS_CKSUM = c870b9bd5858a0ecb5275c14486d9554
113 LIBVORBIS_EXT = .tar.gz
115 $(LIBVORBIS)$(LIBVORBIS_EXT):
116 $(call getdist,$@,http://downloads.xiph.org/releases/vorbis/$@)
117 $(call checkdist,$@,$(LIBVORBIS_CKSUM)) || rm -f $@
119 $(LIBVORBIS)/lib/.libs/libvorbis-0.dll: $(LIBVORBIS)$(LIBVORBIS_EXT)
121 cd $(LIBVORBIS) && $(ECONF) --with-ogg=$(PWD)/$(LIBOGG)$(prefix) && $(MAKE)
123 .PHONY: $(LIBVORBIS) install-$(LIBVORBIS)
124 $(LIBVORBIS): $(LIBOGG) $(LIBVORBIS)/lib/.libs/libvorbis-0.dll
126 install-$(LIBVORBIS): $(LIBVORBIS) install-$(LIBOGG)
127 cd $(LIBVORBIS) && $(MAKEINST)
130 ###########################################################################
131 OPENAL = openal-soft-1.13-bin
132 OPENAL_CKSUM = b545d3ebb8138cc581cd67f988638f43
134 OPENAL_VERSION = 1.13
138 exec_prefix=$${prefix}
139 libdir=$${exec_prefix}/lib
140 includedir=$${prefix}/include
143 Description: OpenAL is a cross-platform 3D audio API
145 Version: $(OPENAL_VERSION)
146 Libs: -L$${libdir} -lOpenAL32
147 Cflags: -I$${includedir}
151 $(OPENAL)$(OPENAL_EXT):
152 $(call getdist,$@,http://kcat.strangesoft.net/$@)
153 $(call checkdist,$@,$(OPENAL_CKSUM)) || rm -f $@
155 .PHONY: $(OPENAL) install-$(OPENAL)
156 $(OPENAL): $(OPENAL)$(OPENAL_EXT)
158 install-$(OPENAL): $(OPENAL)$(OPENAL_EXT)
159 $(call mkdirinst,bin include/AL lib/pkgconfig)
161 $(call install,0644,$(OPENAL)/include/AL/*,include/AL)
162 $(call install,0755,$(OPENAL)/Win32/soft_oal.dll,bin/OpenAL32.dll)
163 $(call install,0755,$(OPENAL)/openal-info.exe,bin)
164 $(call install,0755,$(OPENAL)/lib/Win32/libOpenAL32.dll.a,lib)
165 $(call installvar,OPENAL_PCFILE,lib/pkgconfig/openal.pc)
168 ###########################################################################
170 ZLIB_CKSUM = c735eab2d659a96e5a594c9e8541ad63
176 exec_prefix=$${prefix}
177 libdir=$${exec_prefix}/lib
178 includedir=$${prefix}/include
181 Description: zlib compression library
182 Version: $(ZLIB_VERSION)
184 Libs: -L$${libdir} -lz
185 Cflags: -I$${includedir}
190 $(call getdist,$@,http://www.zlib.net/$@)
191 $(call checkdist,$@,$(ZLIB_CKSUM)) || rm -f $@
193 $(ZLIB)/zlib1.dll: $(ZLIB)$(ZLIB_EXT)
195 cd $(ZLIB) && $(MAKE) -f win32/Makefile.gcc PREFIX="$(host)-"
197 .PHONY: $(ZLIB) install-$(ZLIB)
198 $(ZLIB): $(ZLIB)/zlib1.dll
200 install-$(ZLIB): $(ZLIB)
201 $(call mkdirinst,bin include lib/pkgconfig)
202 $(call install,0644,$(ZLIB)/zconf.h $(ZLIB)/zlib.h,include)
203 $(call install,0755,$(ZLIB)/zlib1.dll,bin)
204 $(call install,0755,$(ZLIB)/libzdll.a,lib)
205 $(call installvar,ZLIB_PCFILE,lib/pkgconfig/zlib.pc)
206 cd $(DESTDIR)$(prefix)/lib && ln -fs libzdll.a libz.dll.a
209 ###########################################################################
210 LIBPNG = libpng-1.5.2
211 LIBPNG_CKSUM = 31d448eb93a1646359a23f1b23434ab3
215 diff -ur libpng-1.5.2.orig/configure.pc libpng-1.5.2/configure.pc
216 --- libpng-1.5.2.orig/configure.ac 2011-06-03 14:01:39.174626747 -0600
217 +++ libpng-1.5.2/configure.ac 2011-06-03 14:02:05.427642561 -0600
219 [prefix that may have been used in installed zlib]),
220 [ZPREFIX=$${withval}],
222 -AC_CHECK_LIB(z, zlibVersion, ,
223 - AC_CHECK_LIB(z, $${ZPREFIX}zlibVersion, ,
224 - AC_ERROR([zlib not installed])))
226 +CPPFLAGS="$$CPPFLAGS -I../$(ZLIB)"
227 +LDFLAGS="$$LDFLAGS -L../$(ZLIB) -avoid-version"
230 LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
234 $(LIBPNG)$(LIBPNG_EXT):
235 $(call getdist,$@,http://prdownloads.sourceforge.net/libpng/$@?download)
236 $(call checkdist,$@,$(LIBPNG_CKSUM)) || rm -f $@
238 $(LIBPNG)/.libs/libpng15.dll: $(LIBPNG)$(LIBPNG_EXT)
240 cd $(LIBPNG) && $(call patch,LIBPNG_PATCH) && ./autogen.sh && $(ECONF) && $(MAKE)
242 .PHONY: $(LIBPNG) install-$(LIBPNG)
243 $(LIBPNG): $(ZLIB) $(LIBPNG)/.libs/libpng15.dll
245 install-$(LIBPNG): $(LIBPNG) install-$(ZLIB)
246 cd $(LIBPNG) && $(MAKEINST)
249 ###########################################################################
251 LUA_CKSUM = d0870f2de55d59c1c8419f36e8fac150
255 $(call getdist,$@,http://www.lua.org/ftp/$@)
256 $(call checkdist,$@,$(LUA_CKSUM)) || rm -f $@
258 $(LUA)/src/lua51.dll: $(LUA)$(LUA_EXT)
260 cd $(LUA) && $(MAKE) CC=$(host)-gcc RANLIB=$(host)-ranlib mingw
262 .PHONY: $(LUA) install-$(LUA)
263 $(LUA): $(LUA)/src/lua51.dll
265 install-$(LUA): $(LUA)
266 $(call mkdirinst,bin include lib/pkgconfig)
267 $(call install,0644,$(addprefix $(LUA)/src/,lua.h lualib.h luaconf.h lauxlib.h) $(LUA)/etc/lua.hpp,include)
268 $(call install,0755,$(LUA)/src/liblua.a,lib/liblua.dll.a)
269 $(call install,0755,$(LUA)/src/*.exe $(LUA)/src/lua51.dll,bin)
270 sed 's!/usr/local!$(prefix)!' $(LUA)/etc/lua.pc >$(DESTDIR)$(prefix)/lib/pkgconfig/lua.pc
273 ############################################################################
274 # libopengl32 and libglu32 pkgconfig files
277 exec_prefix=$${prefix}
278 libdir=$${exec_prefix}/lib
279 includedir=$${prefix}/include
282 Description: OpenGL library
285 Libs: -L$${libdir} -lopengl32
286 Cflags: -I$${includedir}
290 .PHONY: install-gl.pc
292 $(call mkdirinst,lib/pkgconfig)
293 $(call installvar,GL_PCFILE,lib/pkgconfig/gl.pc)
297 exec_prefix=$${prefix}
298 libdir=$${exec_prefix}/lib
299 includedir=$${prefix}/include
302 Description: OpenGL Utility library
305 Libs: -L$${libdir} -lglu32
306 Cflags: -I$${includedir}
310 .PHONY: install-glu.pc
312 $(call mkdirinst,lib/pkgconfig)
313 $(call installvar,GLU_PCFILE,lib/pkgconfig/glu.pc)
316 ###########################################################################
317 # wspiapi.h header file
319 $(call install,0644,wspiapi.h,include)
322 ###########################################################################
323 ALL = $(BOOST) $(SDL) $(LIBOGG) $(LIBVORBIS) $(OPENAL) $(ZLIB) $(LIBPNG) $(LUA)
325 printf "$(host)\n$(prefix)\n" >.saved
328 install: $(addprefix install-,$(ALL)) install-gl.pc install-glu.pc
332 # For readability, the recipes in this file should not run in parallel.