demux: mkv: ProcessNavAction: negate if to prevent nesting
[vlc.git] / extras / tools / tools.mak
blob8a86c32de4f5f190e132d269012225b9f16e1e48
1 # Copyright (C) 2003-2011 the VideoLAN team
3 # This file is under the same license as the vlc package.
5 include packages.mak
8 # common rules
11 ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
12 download = curl -f -L -- "$(1)" > "$@.tmp" && touch $@.tmp && mv $@.tmp $@
13 else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
14 download = rm -f $@.tmp && \
15 wget --passive -c -p -O $@.tmp "$(1)" && \
16 touch $@.tmp && \
17 mv $@.tmp $@
18 else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),)
19 download = rm -f $@.tmp && \
20 fetch -p -o $@.tmp "$(1)" && \
21 touch $@.tmp && \
22 mv $@.tmp $@
23 else
24 download = $(error Neither curl nor wget found!)
25 endif
27 download_pkg = $(call download,$(VIDEOLAN)/$(2)/$(lastword $(subst /, ,$(@)))) || \
28 ( $(call download,$(1)) && echo "Please upload package $(lastword $(subst /, ,$(@))) to our FTP" ) \
29 && grep $(@) SHA512SUMS| shasum -a 512 -c
31 UNPACK = $(RM) -R $@ \
32 $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzf $(f)) \
33 $(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
34 $(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
35 $(foreach f,$(filter %.zip,$^), && unzip $(f))
37 UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
38 APPLY = (cd $(UNPACK_DIR) && patch -p1) <
39 MOVE = mv $(UNPACK_DIR) $@ && touch $@
42 # package rules
45 # yasm
47 yasm-$(YASM_VERSION).tar.gz:
48 $(call download_pkg,$(YASM_URL),yasm)
50 yasm: yasm-$(YASM_VERSION).tar.gz
51 $(UNPACK)
52 $(MOVE)
54 .buildyasm: yasm
55 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
56 touch $@
58 CLEAN_FILE += .buildyasm
59 CLEAN_PKG += yasm
60 DISTCLEAN_PKG += yasm-$(YASM_VERSION).tar.gz
62 nasm-$(NASM_VERSION).tar.gz:
63 $(call download_pkg,$(NASM_URL),nasm)
65 nasm: nasm-$(NASM_VERSION).tar.gz
66 $(UNPACK)
67 $(MOVE)
69 .buildnasm: nasm
70 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
71 touch $@
73 CLEAN_FILE += .buildnasm
74 CLEAN_PKG += nasm
75 DISTCLEAN_PKG += nasm-$(NASM_VERSION).tar.gz
77 # cmake
79 cmake-$(CMAKE_VERSION).tar.gz:
80 $(call download_pkg,$(CMAKE_URL),cmake)
82 cmake: cmake-$(CMAKE_VERSION).tar.gz
83 $(UNPACK)
84 $(APPLY) cmake-winstore.patch
85 $(MOVE)
87 .buildcmake: cmake
88 (cd $<; ./configure --prefix=$(PREFIX) $(CMAKEFLAGS) && $(MAKE) && $(MAKE) install)
89 touch $@
91 CLEAN_FILE += .buildcmake
92 CLEAN_PKG += cmake
93 DISTCLEAN_PKG += cmake-$(CMAKE_VERSION).tar.gz
95 # help2man
96 help2man-$(HELP2MAN_VERSION).tar.xz:
97 $(call download_pkg,$(HELP2MAN_URL),help2man)
99 help2man: help2man-$(HELP2MAN_VERSION).tar.xz
100 $(UNPACK)
101 $(MOVE)
103 .buildhelp2man: help2man
104 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
105 touch $@
107 CLEAN_FILE += .buildhelp2man
108 CLEAN_PKG += help2man
109 DISTCLEAN_PKG += help2man-$(HELP2MAN_VERSION).tar.xz
111 # libtool
113 libtool-$(LIBTOOL_VERSION).tar.gz:
114 $(call download_pkg,$(LIBTOOL_URL),libtool)
116 libtool: libtool-$(LIBTOOL_VERSION).tar.gz
117 $(UNPACK)
118 $(APPLY) libtool-2.4.2-bitcode.patch
119 $(APPLY) libtool-2.4.2-san.patch
120 $(APPLY) libtool-2.4.6-clang-libs.patch
121 $(MOVE)
123 .buildlibtool: libtool .automake .help2man
124 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
125 ln -sf libtool $(PREFIX)/bin/glibtool
126 ln -sf libtoolize $(PREFIX)/bin/glibtoolize
127 touch $@
129 CLEAN_PKG += libtool
130 DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
131 CLEAN_FILE += .buildlibtool
133 # GNU tar (with xz support)
135 tar-$(TAR_VERSION).tar.bz2:
136 $(call download_pkg,$(TAR_URL),tar)
138 tar: tar-$(TAR_VERSION).tar.bz2
139 $(UNPACK)
140 $(MOVE)
142 .buildtar: tar
143 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
144 touch $@
146 CLEAN_PKG += tar
147 DISTCLEAN_PKG += tar-$(TAR_VERSION).tar.bz2
148 CLEAN_FILE += .buildtar
150 # xz
152 xz-$(XZ_VERSION).tar.bz2:
153 $(call download_pkg,$(XZ_URL),xz)
155 xz: xz-$(XZ_VERSION).tar.bz2
156 $(UNPACK)
157 $(MOVE)
159 .buildxz: xz
160 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install && rm $(PREFIX)/lib/pkgconfig/liblzma.pc)
161 touch $@
163 CLEAN_PKG += xz
164 DISTCLEAN_PKG += xz-$(XZ_VERSION).tar.bz2
165 CLEAN_FILE += .buildxz
167 # autoconf
169 autoconf-$(AUTOCONF_VERSION).tar.gz:
170 $(call download_pkg,$(AUTOCONF_URL),autoconf)
172 autoconf: autoconf-$(AUTOCONF_VERSION).tar.gz
173 $(UNPACK)
174 $(MOVE)
176 .buildautoconf: autoconf .pkg-config
177 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
178 touch $@
180 CLEAN_FILE += .buildautoconf
181 CLEAN_PKG += autoconf
182 DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.gz
184 # automake
186 automake-$(AUTOMAKE_VERSION).tar.gz:
187 $(call download_pkg,$(AUTOMAKE_URL),automake)
189 automake: automake-$(AUTOMAKE_VERSION).tar.gz
190 $(UNPACK)
191 $(MOVE)
193 .buildautomake: automake .autoconf
194 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
195 touch $@
197 CLEAN_FILE += .buildautomake
198 CLEAN_PKG += automake
199 DISTCLEAN_PKG += automake-$(AUTOMAKE_VERSION).tar.gz
201 # m4
203 m4-$(M4_VERSION).tar.gz:
204 $(call download_pkg,$(M4_URL),m4)
206 m4: m4-$(M4_VERSION).tar.gz
207 $(UNPACK)
208 $(APPLY) bison-macOS-c41f233c.patch
209 $(APPLY) bison-macOS-7df04f9.patch
210 $(MOVE)
212 .buildm4: m4
213 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
214 touch $@
216 CLEAN_FILE += .buildm4
217 CLEAN_PKG += m4
218 DISTCLEAN_PKG += m4-$(M4_VERSION).tar.gz
220 # pkg-config
222 pkg-config-$(PKGCFG_VERSION).tar.gz:
223 $(call download_pkg,$(PKGCFG_URL),pkgconfiglite)
225 pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
226 $(UNPACK)
227 mv pkg-config-lite-$(PKGCFG_VERSION) pkg-config-$(PKGCFG_VERSION)
228 $(MOVE)
230 .buildpkg-config: pkgconfig
231 (cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
232 touch $@
234 CLEAN_FILE += .buildpkg-config
235 CLEAN_PKG += pkgconfig
236 DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
238 # gas-preprocessor
239 gas-preprocessor-$(GAS_VERSION).tar.gz:
240 $(call download_pkg,$(GAS_URL),gas-preprocessor)
242 gas: gas-preprocessor-$(GAS_VERSION).tar.gz
243 $(UNPACK)
244 $(MOVE)
246 .buildgas: gas
247 mkdir -p $(PREFIX)/bin
248 cp gas/gas-preprocessor.pl $(PREFIX)/bin/
249 touch $@
251 CLEAN_FILE += .buildgas
252 CLEAN_PKG += gas
253 DISTCLEAN_PKG += gas-preprocessor-$(GAS_VERSION).tar.gz
255 # Ragel State Machine Compiler
256 ragel-$(RAGEL_VERSION).tar.gz:
257 $(call download_pkg,$(RAGEL_URL),ragel)
259 ragel: ragel-$(RAGEL_VERSION).tar.gz
260 $(UNPACK)
261 $(APPLY) ragel-6.8-javacodegen.patch
262 $(MOVE)
265 .buildragel: ragel
266 (cd ragel; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
267 touch $@
269 CLEAN_FILE += .buildragel
270 CLEAN_PKG += ragel
271 DISTCLEAN_PKG += ragel-$(RAGEL_VERSION).tar.gz
273 # GNU sed
275 sed-$(SED_VERSION).tar.bz2:
276 $(call download_pkg,$(SED_URL),sed)
278 sed: sed-$(SED_VERSION).tar.bz2
279 $(UNPACK)
280 $(MOVE)
282 .buildsed: sed
283 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
284 touch $@
286 CLEAN_PKG += sed
287 DISTCLEAN_PKG += sed-$(SED_VERSION).tar.bz2
288 CLEAN_FILE += .buildsed
290 # Apache ANT
292 apache-ant-$(ANT_VERSION).tar.bz2:
293 $(call download_pkg,$(ANT_URL),ant)
295 ant: apache-ant-$(ANT_VERSION).tar.bz2
296 $(UNPACK)
297 $(MOVE)
299 .buildant: ant
300 (mkdir -p $(PREFIX)/bin && cp $</bin/* $(PREFIX)/bin/)
301 (mkdir -p $(PREFIX)/lib && cp $</lib/* $(PREFIX)/lib/)
302 touch $@
304 CLEAN_PKG += ant
305 DISTCLEAN_PKG += apache-ant-$(ANT_VERSION).tar.bz2
306 CLEAN_FILE += .buildant
309 # Protobuf Protoc
311 protobuf-$(PROTOBUF_VERSION).tar.gz:
312 $(call download_pkg,$(PROTOBUF_URL),protobuf)
314 protobuf: protobuf-$(PROTOBUF_VERSION).tar.gz
315 $(UNPACK)
316 $(MOVE)
318 .buildprotoc: protobuf
319 (cd $< && ./configure --prefix="$(PREFIX)" --disable-shared --enable-static && $(MAKE) && $(MAKE) install)
320 (find $(PREFIX) -name 'protobuf*.pc' -exec rm -f {} \;)
321 touch $@
323 CLEAN_PKG += protobuf
324 DISTCLEAN_PKG += protobuf-$(PROTOBUF_VERSION).tar.gz
325 CLEAN_FILE += .buildprotoc
328 # GNU bison
331 bison-$(BISON_VERSION).tar.xz:
332 $(call download_pkg,$(BISON_URL),bison)
334 bison: bison-$(BISON_VERSION).tar.xz
335 $(UNPACK)
336 $(APPLY) bison-macOS-c41f233c.patch
337 $(APPLY) bison-macOS-7df04f9.patch
338 $(MOVE)
340 .buildbison: bison
341 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
342 touch $@
344 CLEAN_PKG += bison
345 DISTCLEAN_PKG += bison-$(BISON_VERSION).tar.xz
346 CLEAN_FILE += .buildbison
349 # GNU flex
352 flex-$(FLEX_VERSION).tar.gz:
353 $(call download_pkg,$(FLEX_URL),flex)
355 flex: flex-$(FLEX_VERSION).tar.gz
356 $(UNPACK)
357 $(MOVE)
359 .buildflex: flex
360 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
361 touch $@
363 CLEAN_PKG += flex
364 DISTCLEAN_PKG += flex-$(FLEX_VERSION).tar.gz
365 CLEAN_FILE += .buildflex
370 # GNU gettext
373 gettext-$(GETTEXT_VERSION).tar.gz:
374 $(call download_pkg,$(GETTEXT_URL),gettext)
376 gettext: gettext-$(GETTEXT_VERSION).tar.gz
377 $(UNPACK)
378 $(MOVE)
380 .buildgettext: gettext
381 (cd $<; ./configure --prefix=$(PREFIX) && $(MAKE) && $(MAKE) install)
382 touch $@
384 CLEAN_PKG += gettext
385 DISTCLEAN_PKG += gettext-$(GETTEXT_VERSION).tar.gz
386 CLEAN_FILE += .buildgettext
393 fetch-all: $(DISTCLEAN_PKG)
395 clean:
396 rm -fr $(CLEAN_FILE) $(CLEAN_PKG) build/
398 distclean: clean
399 rm -fr $(DISTCLEAN_PKG)
401 .PHONY: all clean distclean
403 .DELETE_ON_ERROR: