]> Dogcows Code - chaz/yoink/blob - build/arch/win32/makedeps.mk
03766157694a16450710ea2c1c7c738ca7080c51
[chaz/yoink] / build / arch / win32 / makedeps.mk
1 #
2 # Yoink
3 # Use this with make to download and cross-compile dependencies for win32.
4 #
5 # boost_1_46_1
6 # libogg-1.2.2
7 # libpng-1.5.2
8 # libvorbis-1.3.2
9 # lua-5.1.4
10 # openal-soft-1.12.854-bin
11 # SDL-1.2.14
12 # zlib-1.2.5
13 #
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!
16 #
17 # Example usage:
18 # make -f deps.mk -j2 host=i486-mingw32 prefix=/usr/i486-mingw32
19 # sudo make install
20 #
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.
23 #
24
25 host = i686-mingw32
26 prefix = /usr/i686-mingw32/usr
27
28
29 ###########################################################################
30 ECONF = ./configure --host=$(host) --prefix=$(prefix)
31 MAKEINST = $(MAKE) -j1 install
32
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
40
41
42 .PHONY: all
43 all: __package__
44
45 ifneq ($(strip $(wildcard .saved)),)
46 host = $(shell sed -n 1p .saved)
47 prefix = $(shell sed -n 2p .saved)
48 endif
49
50
51 ###########################################################################
52 BOOST = boost_1_46_1
53 BOOST_CKSUM = 7375679575f4c8db605d426fc721d506
54 BOOST_EXT = .tar.bz2
55 BOOST_VERSION = 1.46.1
56
57 $(BOOST)$(BOOST_EXT):
58 $(call getdist,$@,http://sourceforge.net/projects/boost/files/boost/$(BOOST_VERSION)/$@/download)
59 $(call checkdist,$@,$(BOOST_CKSUM)) || rm -f $@
60
61 .PHONY: $(BOOST) install-$(BOOST)
62 $(BOOST): $(BOOST)$(BOOST_EXT)
63
64 install-$(BOOST): $(BOOST)$(BOOST_EXT)
65 tar -xjf $<
66 $(call mkdirinst,include)
67 $(call installdir,$(BOOST)/boost,include/boost)
68
69
70 ###########################################################################
71 SDL = SDL-1.2.14
72 SDL_CKSUM = e52086d1b508fa0b76c52ee30b55bec4
73 SDL_EXT = .tar.gz
74
75 $(SDL)$(SDL_EXT):
76 $(call getdist,$@,http://www.libsdl.org/release/$@)
77 $(call checkdist,$@,$(SDL_CKSUM)) || rm -f $@
78
79 $(SDL)/build/.libs/SDL.dll: $(SDL)$(SDL_EXT)
80 tar -xzf $<
81 cd $(SDL) && $(ECONF) --disable-stdio-redirect && $(MAKE)
82
83 .PHONY: $(SDL) install-$(SDL)
84 $(SDL): $(SDL)/build/.libs/SDL.dll
85
86 install-$(SDL): $(SDL)
87 cd $(SDL) && $(MAKEINST)
88
89
90 ###########################################################################
91 LIBOGG = libogg-1.2.2
92 LIBOGG_CKSUM = 5a9fcabc9a1b7c6f1cd75ddc78f36c56
93 LIBOGG_EXT = .tar.gz
94
95 $(LIBOGG)$(LIBOGG_EXT):
96 $(call getdist,$@,http://downloads.xiph.org/releases/ogg/$@)
97 $(call checkdist,$@,$(LIBOGG_CKSUM)) || rm -f $@
98
99 $(LIBOGG)/src/.libs/libogg-0.dll: $(LIBOGG)$(LIBOGG_EXT)
100 tar -xzf $<
101 cd $(LIBOGG) && $(ECONF) && $(MAKE) && $(MAKEINST) DESTDIR=$$PWD
102
103 .PHONY: $(LIBOGG) install-$(LIBOGG)
104 $(LIBOGG): $(LIBOGG)/src/.libs/libogg-0.dll
105
106 install-$(LIBOGG): $(LIBOGG)
107 cd $(LIBOGG) && $(MAKEINST)
108
109
110 ###########################################################################
111 LIBVORBIS = libvorbis-1.3.2
112 LIBVORBIS_CKSUM = c870b9bd5858a0ecb5275c14486d9554
113 LIBVORBIS_EXT = .tar.gz
114
115 $(LIBVORBIS)$(LIBVORBIS_EXT):
116 $(call getdist,$@,http://downloads.xiph.org/releases/vorbis/$@)
117 $(call checkdist,$@,$(LIBVORBIS_CKSUM)) || rm -f $@
118
119 $(LIBVORBIS)/lib/.libs/libvorbis-0.dll: $(LIBVORBIS)$(LIBVORBIS_EXT)
120 tar -xzf $<
121 cd $(LIBVORBIS) && $(ECONF) --with-ogg=$(PWD)/$(LIBOGG)$(prefix) && $(MAKE)
122
123 .PHONY: $(LIBVORBIS) install-$(LIBVORBIS)
124 $(LIBVORBIS): $(LIBOGG) $(LIBVORBIS)/lib/.libs/libvorbis-0.dll
125
126 install-$(LIBVORBIS): $(LIBVORBIS) install-$(LIBOGG)
127 cd $(LIBVORBIS) && $(MAKEINST)
128
129
130 ###########################################################################
131 OPENAL = openal-soft-1.13-bin
132 OPENAL_CKSUM = b545d3ebb8138cc581cd67f988638f43
133 OPENAL_EXT = .zip
134 OPENAL_VERSION = 1.13
135
136 define OPENAL_PCFILE
137 prefix=$(prefix)
138 exec_prefix=$${prefix}
139 libdir=$${exec_prefix}/lib
140 includedir=$${prefix}/include
141
142 Name: OpenAL
143 Description: OpenAL is a cross-platform 3D audio API
144 Requires:
145 Version: $(OPENAL_VERSION)
146 Libs: -L$${libdir} -lOpenAL32
147 Cflags: -I$${includedir}
148 endef
149 export OPENAL_PCFILE
150
151 $(OPENAL)$(OPENAL_EXT):
152 $(call getdist,$@,http://kcat.strangesoft.net/$@)
153 $(call checkdist,$@,$(OPENAL_CKSUM)) || rm -f $@
154
155 .PHONY: $(OPENAL) install-$(OPENAL)
156 $(OPENAL): $(OPENAL)$(OPENAL_EXT)
157
158 install-$(OPENAL): $(OPENAL)$(OPENAL_EXT)
159 $(call mkdirinst,bin include/AL lib/pkgconfig)
160 unzip -o $<
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)
166
167
168 ###########################################################################
169 ZLIB = zlib-1.2.5
170 ZLIB_CKSUM = c735eab2d659a96e5a594c9e8541ad63
171 ZLIB_EXT = .tar.gz
172 ZLIB_VERSION = 1.2.5
173
174 define ZLIB_PCFILE
175 prefix=$(prefix)
176 exec_prefix=$${prefix}
177 libdir=$${exec_prefix}/lib
178 includedir=$${prefix}/include
179
180 Name: zlib
181 Description: zlib compression library
182 Version: $(ZLIB_VERSION)
183 Requires:
184 Libs: -L$${libdir} -lz
185 Cflags: -I$${includedir}
186 endef
187 export ZLIB_PCFILE
188
189 $(ZLIB)$(ZLIB_EXT):
190 $(call getdist,$@,http://www.zlib.net/$@)
191 $(call checkdist,$@,$(ZLIB_CKSUM)) || rm -f $@
192
193 $(ZLIB)/zlib1.dll: $(ZLIB)$(ZLIB_EXT)
194 tar -xzf $<
195 cd $(ZLIB) && $(MAKE) -f win32/Makefile.gcc PREFIX="$(host)-"
196
197 .PHONY: $(ZLIB) install-$(ZLIB)
198 $(ZLIB): $(ZLIB)/zlib1.dll
199
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
207
208
209 ###########################################################################
210 LIBPNG = libpng-1.5.2
211 LIBPNG_CKSUM = 31d448eb93a1646359a23f1b23434ab3
212 LIBPNG_EXT = .tar.gz
213
214 define LIBPNG_PATCH
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
218 @@ -85,9 +85,9 @@
219 [prefix that may have been used in installed zlib]),
220 [ZPREFIX=$${withval}],
221 [ZPREFIX='z_'])
222 -AC_CHECK_LIB(z, zlibVersion, ,
223 - AC_CHECK_LIB(z, $${ZPREFIX}zlibVersion, ,
224 - AC_ERROR([zlib not installed])))
225 +LIBS="$$LIBS -lz"
226 +CPPFLAGS="$$CPPFLAGS -I../$(ZLIB)"
227 +LDFLAGS="$$LDFLAGS -L../$(ZLIB) -avoid-version"
228
229
230 LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
231 endef
232 export LIBPNG_PATCH
233
234 $(LIBPNG)$(LIBPNG_EXT):
235 $(call getdist,$@,http://prdownloads.sourceforge.net/libpng/$@?download)
236 $(call checkdist,$@,$(LIBPNG_CKSUM)) || rm -f $@
237
238 $(LIBPNG)/.libs/libpng15.dll: $(LIBPNG)$(LIBPNG_EXT)
239 tar -xzf $<
240 cd $(LIBPNG) && $(call patch,LIBPNG_PATCH) && ./autogen.sh && $(ECONF) && $(MAKE)
241
242 .PHONY: $(LIBPNG) install-$(LIBPNG)
243 $(LIBPNG): $(ZLIB) $(LIBPNG)/.libs/libpng15.dll
244
245 install-$(LIBPNG): $(LIBPNG) install-$(ZLIB)
246 cd $(LIBPNG) && $(MAKEINST)
247
248
249 ###########################################################################
250 LUA = lua-5.1.4
251 LUA_CKSUM = d0870f2de55d59c1c8419f36e8fac150
252 LUA_EXT = .tar.gz
253
254 $(LUA)$(LUA_EXT):
255 $(call getdist,$@,http://www.lua.org/ftp/$@)
256 $(call checkdist,$@,$(LUA_CKSUM)) || rm -f $@
257
258 $(LUA)/src/lua51.dll: $(LUA)$(LUA_EXT)
259 tar -xzf $<
260 cd $(LUA) && $(MAKE) CC=$(host)-gcc RANLIB=$(host)-ranlib mingw
261
262 .PHONY: $(LUA) install-$(LUA)
263 $(LUA): $(LUA)/src/lua51.dll
264
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
271
272
273 ############################################################################
274 # libopengl32 and libglu32 pkgconfig files
275 define GL_PCFILE
276 prefix=$(prefix)
277 exec_prefix=$${prefix}
278 libdir=$${exec_prefix}/lib
279 includedir=$${prefix}/include
280
281 Name: gl
282 Description: OpenGL library
283 Version:
284 Requires:
285 Libs: -L$${libdir} -lopengl32
286 Cflags: -I$${includedir}
287 endef
288 export GL_PCFILE
289
290 .PHONY: install-gl.pc
291 install-gl.pc:
292 $(call mkdirinst,lib/pkgconfig)
293 $(call installvar,GL_PCFILE,lib/pkgconfig/gl.pc)
294
295 define GLU_PCFILE
296 prefix=$(prefix)
297 exec_prefix=$${prefix}
298 libdir=$${exec_prefix}/lib
299 includedir=$${prefix}/include
300
301 Name: glu
302 Description: OpenGL Utility library
303 Version:
304 Requires: gl
305 Libs: -L$${libdir} -lglu32
306 Cflags: -I$${includedir}
307 endef
308 export GLU_PCFILE
309
310 .PHONY: install-glu.pc
311 install-glu.pc:
312 $(call mkdirinst,lib/pkgconfig)
313 $(call installvar,GLU_PCFILE,lib/pkgconfig/glu.pc)
314
315
316 ###########################################################################
317 # wspiapi.h header file
318 install-wspiapi.h:
319 $(call install,0644,wspiapi.h,include)
320
321
322 ###########################################################################
323 ALL = $(BOOST) $(SDL) $(LIBOGG) $(LIBVORBIS) $(OPENAL) $(ZLIB) $(LIBPNG) $(LUA)
324 __package__: $(ALL)
325 printf "$(host)\n$(prefix)\n" >.saved
326 @echo "All done!"
327
328 install: $(addprefix install-,$(ALL)) install-gl.pc install-glu.pc
329 @echo "All done!"
330
331 .NOTPARALLEL:
332 # For readability, the recipes in this file should not run in parallel.
333
This page took 0.049094 seconds and 4 git commands to generate.