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