contrib-src.mak 78.7 KB
Newer Older
Christophe Mutricy's avatar
Christophe Mutricy committed
1
#***************************************************************************
2
3
# src/Makefile : Dearchive and compile all files necessary
# ***************************************************************************
4
# Copyright (C) 2003 - 2010 the VideoLAN team
5
6
7
8
# $Id$
#
# Authors: Christophe Massiot <massiot@via.ecp.fr>
#          Derk-Jan Hartman <hartman at videolan dot org>
9
#          Eric Petit <titer@m0k.org>
10
#          Felix Paul Kühne <fkuehne at videolan dot org>
Christophe Mutricy's avatar
Christophe Mutricy committed
11
#          Christophe Mutricy <xtophe AT xtelevision.com>
12
#          Gildas Bazin <gbazin at videolan dot org>
13
#          Damien Fouilleul <damienf at videolan dot org>
14
#          Jean-Baptiste Kempf <jb at videolan dot org>
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
dionoea's avatar
dionoea committed
28
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
29
30
31
32
33
34
35
36
37
# ***************************************************************************

include ../config.mak
include ./packages.mak

# ***************************************************************************
# Set a clean environment
# ***************************************************************************

38
39
export PATH := $(PREFIX)/bin:$(EXTRA_PATH):$(PATH)
export PKG_CONFIG_PATH
40
export PKG_CONFIG_LIBDIR = $(PREFIX)/lib/pkgconfig
41
export MACOSX_DEPLOYMENT_TARGET = $(SDK_TARGET)
42
export LIBRARY_PATH := $(PREFIX)/lib:$(LIBRARY_PATH)
43
44
45
export CFLAGS = -I$(PREFIX)/include $(EXTRA_CFLAGS) $(EXTRA_CPPFLAGS)
export CPPFLAGS = -I$(PREFIX)/include $(EXTRA_CFLAGS) $(EXTRA_CPPFLAGS)
export CXXFLAGS = -I$(PREFIX)/include $(EXTRA_CFLAGS) $(EXTRA_CPPFLAGS)
46
export LDFLAGS = -L$(PREFIX)/lib $(EXTRA_LDFLAGS)
47
export ACLOCAL = aclocal -I$(PREFIX)/share/aclocal
48
49
50
51
52
ifdef HAVE_DARWIN_OS
export CC
export CXX
export LD
endif
53
54
55
56
57
58
59
60

# ***************************************************************************
# Cross compilation variables
# We'll usually use --host=<platform>, except for a few libraries which
# don't handle it (gotta set CC/CXX/etc), and obviously FFmpeg has its own
# way of doing it... ;)
# ***************************************************************************

61
62
63
64
65
66
ifneq ($(CC),)
HOSTCC+= CC="$(CC)"
endif
ifneq ($(CXX),)
HOSTCC+= CXX="$(CXX)"
endif
67
68
69
ifneq ($(LD),)
HOSTCC+= LD="$(LD)"
endif
70
71
72
73
74
75
ifneq ($(RANLIB),)
HOSTCC+= RANLIB="$(RANLIB)"
endif
ifneq ($(AR),)
HOSTCC+= AR="$(AR)"
endif
76
77
78
79
ifneq ($(STRIP),)
HOSTCC+= STRIP="$(STRIP)"
endif

80

81
82
83
84
85
# Define ranlib on non-cross compilation setups
ifeq ($(RANLIB),)
RANLIB=ranlib
endif

86
87
88
# For libebml/libmatroska. Grrr.
ifneq ($(AR),)
HOSTCC2=$(HOSTCC) AR="$(AR) rcvu"
89
90
else
HOSTCC2=$(HOSTCC)
91
92
endif

93
FFMPEGCONF=--disable-doc --disable-decoder=libvpx
94
95

# cross compiling
96
97
#This should be inside the if block but some config scripts are buggy
HOSTCONF=--target=$(HOST) --host=$(HOST) --build=$(BUILD) --program-prefix=""
98
99
100
101
102
ifneq ($(BUILD),$(HOST))
    #
    # Compiling for MinGW under Cygwin could be deemed as cross compiling
    # unfortunately there isn't a complete separate GCC toolchain for MinGW under Cygwin
    #
103
    ifndef HAVE_CYGWIN
104
        # We are REALLY cross compiling
Pierre's avatar
Pierre committed
105
106
107
108
109
        ifdef HAVE_IOS
            FFMPEGCONF+=--enable-cross-compile
        else
            FFMPEGCONF+=--cross-prefix=$(HOST)- --enable-cross-compile
        endif
110
        X264CONF=--host=$(HOST)
111
        PTHREADSCONF=CROSS="$(HOST)-"
112
113
    else
        # We are compiling for MinGW on Cygwin
114
    endif
115
endif
116
117

#
118
# Special target-dependant options
119
#
120
ifdef HAVE_WIN32
121
HOSTCONF+= --without-pic --disable-shared --disable-dependency-tracking
122
FFMPEGCONF+= --target-os=mingw32 --arch=x86 --enable-memalign-hack
123
ifdef HAVE_WIN64
124
FFMPEGCONF+= --cpu=athlon64 --arch=x86_64
125
else
126
FFMPEGCONF+= --cpu=i686
127
endif
128
endif
gbazin's avatar
gbazin committed
129
130
131

ifdef HAVE_WINCE
HOSTCONF+= --without-pic --disable-shared
132
FFMPEGCONF+= --target-os=mingw32ce --arch=armv4l --cpu=armv4t --disable-encoders --disable-muxers --disable-mpegaudio-hp --disable-decoder=snow --disable-decoder=vc9 --disable-decoder=wmv3 --disable-decoder=vorbis --disable-decoder=dvdsub --disable-decoder=dvbsub --disable-protocols
133
134
135
endif

ifdef HAVE_UCLIBC
136
ifdef HAVE_BIGENDIAN
137
FFMPEGCONF+= --arch=armeb --enable-armv5te --enable-iwmmxt
138
139
140
else
FFMPEGCONF+= --arch=armv4l
endif
141
FFMPEGCONF+= --enable-small --disable-mpegaudio-hp
142
FFMPEG_CFLAGS += -DHAVE_LRINTF --std=c99
gbazin's avatar
gbazin committed
143
else
144
ifndef HAVE_WINCE
Pierre's avatar
Pierre committed
145
ifndef HAVE_IOS
146
FFMPEGCONF+= --enable-libmp3lame --enable-libgsm
147
endif
148
endif
Pierre's avatar
Pierre committed
149
endif
150

151
ifdef HAVE_DARWIN_OS_ON_INTEL
152
FFMPEGCONF += --enable-memalign-hack
153
154
155
endif

ifdef HAVE_DARWIN_OS
156
X264CONF=--host=$(HOST)
157
X264CONF += --enable-pic
158
FFMPEGCONF += --enable-libvpx
159
160
161
ifdef HAVE_DARWIN_32
FFMPEGCONF += --cc=gcc-4.0
else
162
FFMPEGCONF += --cc=$(CC)
163
endif
164
FFMPEGCONF += --arch=$(ARCH)
165
ifdef HAVE_DARWIN_64
166
FFMPEGCONF += --cpu=core2
167
X264CONF+=--host=x86_64-apple-darwin10
168
endif
169
ifdef HAVE_DARWIN_OS_ON_INTEL
170
171
FFMPEG_CFLAGS += -DHAVE_LRINTF
endif
172
endif
173

174
ifdef HAVE_AMR
175
FFMPEGCONF+= --enable-libamr-nb --enable-libamr-wb --enable-nonfree
176
177
endif

178
ifdef HAVE_LINUX
179
FFMPEGCONF+= --target-os=linux
180
ifdef HAVE_MAEMO
181
182
183
ifneq ($(filter -m%=cortex-a8, $(EXTRA_CFLAGS)),)
FFMPEGCONF += --disable-runtime-cpudetect --enable-neon --cpu=cortex-a8
endif
184
185
186
187
# Really, this could be done on all Linux platforms, not just Maemo.
# Installing statically-linked VLC plugins is so much simpler.
HOSTCONF += --with-pic --disable-shared
endif
188
FFMPEGCONF += --enable-pic
189
190
191
X264CONF += --enable-pic
endif

192
193
194
195
ifdef HAVE_ISA_THUMB
NOTHUMB ?= -mno-thumb
endif

Rafaël Carré's avatar
Rafaël Carré committed
196
X264CONF+= --disable-avs --disable-lavf --disable-ffms --disable-mp4-output
197

198
199
DATE=`date +%Y-%m-%d`

200
201
202
# ***************************************************************************
# Standard rules
# ***************************************************************************
203
# Generated by ./bootstrap from default configuration in src/Distributions
ivoire's avatar
ivoire committed
204
#
205
include ../distro.mak
206
207
208
209
210
211
212
213

FORCE:

# ***************************************************************************
# Useful macros
# ***************************************************************************

define EXTRACT_GZ
214
	rm -rf $@ || true
ivoire's avatar
ivoire committed
215
	gunzip -c $< | tar xf - --exclude='[*?:<>\|]'
216
217
	mv $(patsubst %.tar.gz,%,$(patsubst %.tgz,%,$(notdir $<))) $@ || true
	touch $@
218
219
220
endef

define EXTRACT_BZ2
221
	rm -rf $@ || true
ivoire's avatar
ivoire committed
222
	bunzip2 -c $< | tar xf - --exclude='[*?:<>\|]'
223
224
	mv $(patsubst %.tar.bz2,%,$(notdir $<)) $@ || true
	touch $@
225
226
endef

227
define EXTRACT_ZIP
228
229
230
231
	rm -rf $@ || true
	unzip $<
	mv $(patsubst %.zip,%,$(notdir $<)) $@ || true
	touch $@
232
233
endef

234
235
236
237
238
239
### Darwin-specific ###
# These macros prepare the dynamic libraries for inclusion in the Mac OS X
# bundle. For instance if you're building a library named libtoto.dylib,
# which depends on the contrib library libtata.dylib, you should have the
# following entry :
# .toto: toto_directory .tata
240
241
242
243
244
#	cd $< ; ./configure --prefix=$(PREFIX)
#	$(MAKE) -C $<
#	$(MAKE) -C $< install
#	$(INSTALL_NAME)
#	touch $@
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# ***************************************************************************
# errno
# ***************************************************************************

errno:
	mkdir -p $@
	$(WGET) $(ERRNO_URL)/errno.h -O $@/errno.h

.errno: errno
	mkdir -p $(PREFIX)/include
	cp $</errno.h $(PREFIX)/include
	touch $@

CLEAN_FILE += .errno
CLEAN_PKG += errno

262
263
264
# ***************************************************************************
# CMake
# ***************************************************************************
Rafaël Carré's avatar
Rafaël Carré committed
265
266
267
268
269
cmake-$(CMAKE_VERSION).tar.gz:
	$(WGET) $(CMAKE_URL)

cmake: cmake-$(CMAKE_VERSION).tar.gz
	$(EXTRACT_GZ)
ivoire's avatar
ivoire committed
270

271
.cmake: cmake
272
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
273
274
275
276
277
	touch $@

CLEAN_FILE += .cmake
CLEAN_PKG += cmake

278
279
280
281
282
# ***************************************************************************
# libtool
# ***************************************************************************

ifdef HAVE_DARWIN_OS
283
284
285
286
287
288
289
libtool-$(LIBTOOL_VERSION).tar.gz:
	$(WGET) $(LIBTOOL_URL)

libtool: libtool-$(LIBTOOL_VERSION).tar.gz
	$(EXTRACT_GZ)

.libtool: libtool
290
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
291
292
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
293
	touch $@
294
295
296

CLEAN_PKG += libtool
DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
297
298
CLEAN_FILE += .libtool

299
300
endif

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# ***************************************************************************
# automake
# ***************************************************************************

automake-$(AUTOMAKE_VERSION).tar.gz:
	$(WGET) $(AUTOMAKE_URL)

automake: automake-$(AUTOMAKE_VERSION).tar.gz
	$(EXTRACT_GZ)

.automake: automake
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .automake
CLEAN_PKG += automake
DISTCLEAN_PKG += automake-$(AUTOMAKE_VERSION).tar.gz

319
320
321
322
# ***************************************************************************
# pkgconfig
# ***************************************************************************

323
pkg-config-$(PKGCFG_VERSION).tar.gz:
324
	$(WGET) $(PKGCFG_URL)
325

326
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
327
	$(EXTRACT_GZ)
328
	(cd $@; autoconf)
329
330

.pkgcfg: pkgconfig
331
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
332
	touch $@
333
334
335

CLEAN_FILE += .pkgcfg
CLEAN_PKG += pkgconfig
336
DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
337
338
339
340
341
342

# ***************************************************************************
# gettext
# ***************************************************************************

gettext-$(GETTEXT_VERSION).tar.gz:
343
	$(WGET) $(GETTEXT_URL)
344
345

gettext: gettext-$(GETTEXT_VERSION).tar.gz
346
	$(EXTRACT_GZ)
VideoLAN's avatar
VideoLAN committed
347
348
349
ifdef HAVE_DARWIN_OS
	patch -p0 < Patches/gettext-macosx.patch
endif
350

351
.intl: gettext
352
ifdef HAVE_WIN32
353
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-relocatable --disable-java --disable-native-java)
354
else
355
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-java --disable-native-java --without-emacs)
356
endif
357
ifneq ($(HOST),$(BUILD))
358
359
  ifndef HAVE_CYGWIN
    # We'll use the installed gettext and only need to cross-compile libintl, also build autopoint and gettextsize tools need for VLC bootstrap
360
	( cd $< && make -C gettext-runtime/intl && make -C gettext-runtime/intl install && make -C gettext-tools/misc install )
361
362
  else
    # We are compiling for MinGW on Cygwin -- build the full current gettext
363
	( cd $< && make && make install )
364
  endif
365
366
else
# Build and install the whole gettext
367
	( cd $< && make && make install )
368
369
370
endif
# Work around another non-sense of autoconf.
ifdef HAVE_WIN32
371
	(cd $(PREFIX)/include; sed -i.orig '314 c #if 0' libintl.h)
372
endif
373
374
	$(INSTALL_NAME)
	touch $@
375
376
377
378
379
380
381
382
383
384

CLEAN_FILE += .intl
CLEAN_PKG += gettext
DISTCLEAN_PKG += gettext-$(GETTEXT_VERSION).tar.gz

# ***************************************************************************
# libiconv
# ***************************************************************************

libiconv-$(LIBICONV_VERSION).tar.gz:
385
	$(WGET) $(LIBICONV_URL)
386
387

libiconv: libiconv-$(LIBICONV_VERSION).tar.gz
388
	$(EXTRACT_GZ)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
389
390
ifdef HAVE_WIN64
	patch -p0 < Patches/libiconv-win64.patch
391
endif
392
393
394
395
ifdef HAVE_WINCE
	patch -p0 < Patches/libiconv-wince.patch
	patch -p0 < Patches/libiconv-wince-hack.patch
endif
396

397
398
399
400
401
libiconv-snowleopard.tar.bz2:
	$(WGET) $(LIBICONVMAC_URL)

libiconv-snowleopard: libiconv-snowleopard.tar.bz2
	$(EXTRACT_BZ2)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
402

403
ifdef HAVE_DARWIN_OS
404
ifdef HAVE_DARWIN_10
405
.iconv: libiconv-snowleopard
406
	(cd libiconv-snowleopard && cp libiconv.* $(PREFIX)/lib/)
407
408
	touch $@
else
409
.iconv:
410
	touch $@
411
endif
412
else
413
.iconv: libiconv
414
	(cd libiconv; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-nls && make && make install)
415
416
	$(INSTALL_NAME)
	touch $@
417
endif
418
419
420
421
422

CLEAN_FILE += .iconv
CLEAN_PKG += libiconv
DISTCLEAN_PKG += libiconv-$(LIBICONV_VERSION).tar.gz

423
424
425
426
427
428
429
# ***************************************************************************
# fontconfig
# ***************************************************************************

fontconfig-$(FONTCONFIG_VERSION).tar.gz:
	$(WGET) $(FONTCONFIG_URL)

430
fontconfig: fontconfig-$(FONTCONFIG_VERSION).tar.gz Patches/fontconfig.patch
431
	$(EXTRACT_GZ)
432
	patch -p0 < Patches/fontconfig-march.patch
433
	patch -p0 < Patches/fontconfig-nodocs.patch
434
435
ifdef HAVE_WIN32
	patch -p0 < Patches/fontconfig.patch
436
	patch -p0 < Patches/fontconfig-noxml2.patch
437
	(cd $@; autoreconf -ivf)
438
endif
439

Rafaël Carré's avatar
Rafaël Carré committed
440
.fontconfig: fontconfig .xml .freetype
441
442
ifdef HAVE_WIN32
  ifdef HAVE_CYGWIN
443
	(cd $<; ./configure --target=$(HOST) --disable-pic --disable-shared --disable-docs --with-arch=i686 --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --disable-libxml2 && make && make install)
444
  else
445
	(cd $<; $(HOSTCC)  ./configure $(HOSTCONF) --with-arch=i686 --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --disable-libxml2 --disable-docs && make && make install)
446
447
  endif
else
bitmap's avatar
bitmap committed
448
  ifdef HAVE_DARWIN_OS
449
	(cd $<; $(HOSTCC) LIBXML2_CFLAGS=`xml2-config --cflags` LIBXML2_LIBS=`xml2-config --libs` ./configure $(HOSTCONF) --with-cache-dir=/usr/X11/var/cache/fontconfig --with-confdir=/usr/X11/lib/X11/fonts --with-default-fonts=/System/Library/Fonts --with-add-fonts=/Library/Fonts,~/Library/Fonts --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --with-arch=$(ARCH) --enable-libxml2 --disable-docs && make && make install-exec && (cd fontconfig ; make install-data) && cp fontconfig.pc $(PKG_CONFIG_LIBDIR))
bitmap's avatar
bitmap committed
450
  else
451
	(cd $<; $(HOSTCC) LIBXML2_CFLAGS=`$(PREFIX)/bin/xml2-config --cflags` ./configure $(HOSTCONF) --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --enable-libxml2 --disable-docs && make && make install)
bitmap's avatar
bitmap committed
452
  endif
453
454
455
456
457
458
459
460
endif
	$(INSTALL_NAME)
	touch $@

CLEAN_FILE += .fontconfig
CLEAN_PKG += fontconfig
DISTCLEAN_PKG += fontconfig-$(FONTCONFIG_VERSION).tar.gz

461
462
463
464
465
# ***************************************************************************
# freetype2
# ***************************************************************************

freetype-$(FREETYPE2_VERSION).tar.gz:
466
	$(WGET) $(FREETYPE2_URL)
467
468

freetype2: freetype-$(FREETYPE2_VERSION).tar.gz
469
	$(EXTRACT_GZ)
470
471

.freetype: freetype2
472
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
473
474
	$(INSTALL_NAME)
	touch $@
475
476
477
478
479
480
481
482
483

CLEAN_FILE += .freetype
CLEAN_PKG += freetype2
DISTCLEAN_PKG += freetype-$(FREETYPE2_VERSION).tar.gz

# ***************************************************************************
# fribidi
# ***************************************************************************

damienf's avatar
damienf committed
484
fribidi-$(FRIBIDI_VERSION).tar.gz:
485
	$(WGET) $(FRIBIDI_URL)
486

damienf's avatar
damienf committed
487
488
fribidi: fribidi-$(FRIBIDI_VERSION).tar.gz
	$(EXTRACT_GZ)
489
	patch -p0 < Patches/fribidi.patch
490
	( cd $@; rm -f configure; ./bootstrap)
491

492
.fribidi: fribidi .iconv
493
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  && make && make install)
494
495
	$(INSTALL_NAME)
	touch $@
496
497
498

CLEAN_FILE += .fribidi
CLEAN_PKG += fribidi
damienf's avatar
damienf committed
499
DISTCLEAN_PKG += fribidi-$(FRIBIDI_VERSION).tar.gz
500
501
502
503
504
505

# ***************************************************************************
# liba52
# ***************************************************************************

a52dec-$(A52DEC_VERSION).tar.gz:
506
	$(WGET) $(A52DEC_URL)
507
508

a52dec: a52dec-$(A52DEC_VERSION).tar.gz
509
	$(EXTRACT_GZ)
510
ifeq ($(ARCH),armel)
511
512
	(cd $@ ; patch -p0 < ../Patches/liba52-fixed.diff)
endif
513
514
515
ifdef HAVE_WIN64
	(cd $@ ; autoreconf -if)
endif
516
517

.a52: a52dec
518
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && cd liba52 && make && make install && cd ../include && make && make install)
519
	touch $@
520
521
522
523
524
525
526
527
528

CLEAN_FILE += .a52
CLEAN_PKG += a52dec
DISTCLEAN_PKG += a52dec-$(A52DEC_VERSION).tar.gz

# ***************************************************************************
# mpeg2dec
# ***************************************************************************

Christophe Mutricy's avatar
Christophe Mutricy committed
529
530
libmpeg2-$(LIBMPEG2_VERSION).tar.gz:
	$(WGET) $(LIBMPEG2_URL)
531

Christophe Mutricy's avatar
Christophe Mutricy committed
532
libmpeg2: libmpeg2-$(LIBMPEG2_VERSION).tar.gz
533
	$(EXTRACT_GZ)
534
	patch -p0 < Patches/libmpeg2-arm-pld.patch
535
536
	cd libmpeg2 && patch -p0 < ../Patches/libmpeg2-mc-neon.patch
	cd libmpeg2 && ./bootstrap
537

Christophe Mutricy's avatar
Christophe Mutricy committed
538
.mpeg2: libmpeg2
539
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --without-x --disable-sdl && cd libmpeg2 && make && make install && cd ../include && make && make install)
540
	touch $@
541
542

CLEAN_FILE += .mpeg2
Christophe Mutricy's avatar
Christophe Mutricy committed
543
544
CLEAN_PKG += libmpeg2
DISTCLEAN_PKG += libmpeg2-$(LIBMPEG2_VERSION).tar.gz
545

546
547
548
549
550
551
552
553
554
555
556
# ***************************************************************************
# pcre
# ***************************************************************************

pcre-$(PCRE_VERSION).tar.bz2:
	$(WGET) $(PCRE_URL)

pcre: pcre-$(PCRE_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.pcre: pcre
557
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-shared && make && make install )
558
559
560
561
562
563
	touch $@

CLEAN_FILE += .pcre
CLEAN_PKG += pcre
DISTCLEAN_PKG += pcre-$(PCRE_VERSION).tar.bz2

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# ***************************************************************************
# lua
# ***************************************************************************

ifdef HAVE_WIN32
LUA_MAKEPLATEFORM=mingw
else
ifdef HAVE_DARWIN_OS
LUA_MAKEPLATEFORM=macosx
else
ifdef HAVE_LINUX
LUA_MAKEPLATEFORM=linux
else
ifdef HAVE_BSD
LUA_MAKEPLATEFORM=bsd
else
LUA_MAKEPLATEFORM=generic
endif
endif
endif
endif

lua-$(LUA_VERSION).tar.gz:
	$(WGET) $(LUA_URL)

lua: lua-$(LUA_VERSION).tar.gz
	$(EXTRACT_GZ)
591
592
593
ifdef HAVE_DARWIN_OS
	(cd $@; sed -e 's%gcc%$(CC)%' -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -i.orig  src/Makefile)
endif
594
595

.lua: lua
596
ifdef HAVE_WIN32
597
	( cd $< && sed -i.orig 's/lua luac/lua.exe/' Makefile && cd src && sed -i.orig 's/CC=/#CC=/' Makefile && sed -i 's/strip/$(STRIP)/' Makefile && cd ../..)
598
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM)&& cd src&& $(HOSTCC) make liblua.a&& cd ..&&$(HOSTCC) make install INSTALL_TOP=$(PREFIX)&& $(RANLIB) $(PREFIX)/lib/liblua.a)
Christophe Mutricy's avatar
Christophe Mutricy committed
599
	(cd $<&& sed -i.orig 's@prefix= /usr/local@prefix= $(PREFIX)@' etc/lua.pc&& mkdir -p $(PREFIX)/lib/pkgconfig&& cp etc/lua.pc $(PREFIX)/lib/pkgconfig)
ivoire's avatar
ivoire committed
600
else
Christophe Mutricy's avatar
Christophe Mutricy committed
601
	(cd $<&& patch -p1) < Patches/lua-noreadline.patch
602
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM) && make install INSTALL_TOP=$(PREFIX))
603
endif
604
605
606
607
608
609
	touch $@

CLEAN_FILE += .lua
CLEAN_PKG += lua
DISTCLEAN_PKG += lua-$(LUA_VERSION).tar.gz

610
611
612
613
614
# ***************************************************************************
# libmad
# ***************************************************************************

libmad-$(LIBMAD_VERSION).tar.gz:
615
	$(WGET) $(LIBMAD_URL)
616
617

libmad: libmad-$(LIBMAD_VERSION).tar.gz
618
	$(EXTRACT_GZ)
619
ifdef HAVE_DARWIN_OS
620
	( cd $@; sed -e 's%-march=i486%$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
621
endif
622
623

.mad: libmad
624
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) CFLAGS="-O3 $(NOTHUMB)" && make && make install)
625
626
	$(INSTALL_NAME)
	touch $@
627
628
629
630
631
632
633
634
635
636

CLEAN_FILE += .mad
CLEAN_PKG += libmad
DISTCLEAN_PKG += libmad-$(LIBMAD_VERSION).tar.gz

# ***************************************************************************
# ogg
# ***************************************************************************

libogg-$(OGG_VERSION).tar.gz:
637
	$(WGET) $(OGG_URL)
638
639

libogg: libogg-$(OGG_VERSION).tar.gz
640
	$(EXTRACT_GZ)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
641
	patch -p0 < Patches/libogg-inttypes.patch
Rafaël Carré's avatar
Rafaël Carré committed
642
	patch -p0 < Patches/libogg-1.1.patch
gbazin's avatar
gbazin committed
643
ifdef HAVE_WINCE
Rafaël Carré's avatar
Rafaël Carré committed
644
	patch -p0 < Patches/libogg-wince.patch
gbazin's avatar
gbazin committed
645
endif
646
	(cd $@; autoconf)
647
648

.ogg: libogg
649
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make install)
650
651
	$(INSTALL_NAME)
	touch $@
652
653
654
655
656
657
658
659
660
661

CLEAN_FILE += .ogg
CLEAN_PKG += libogg
DISTCLEAN_PKG += libogg-$(OGG_VERSION).tar.gz

# ***************************************************************************
# vorbis
# ***************************************************************************

libvorbis-$(VORBIS_VERSION).tar.gz:
662
	$(WGET) $(VORBIS_URL)
663
664

libvorbis: libvorbis-$(VORBIS_VERSION).tar.gz
665
	$(EXTRACT_GZ)
666
	patch -p0 < Patches/vorbis-noapps.patch
667
668

.vorbis: libvorbis .ogg
669
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
670
671
#	$(INSTALL_NAME)
	touch $@
672
673

.vorbisenc: .vorbis .ogg
674
675
#	$(INSTALL_NAME)
	touch $@
676
677
678
679
680

CLEAN_FILE += .vorbis .vorbisenc
CLEAN_PKG += libvorbis
DISTCLEAN_PKG += libvorbis-$(VORBIS_VERSION).tar.gz

gbazin's avatar
gbazin committed
681
682
683
684
685
# ***************************************************************************
# tremor
# ***************************************************************************

ifdef SVN
ivoire's avatar
ivoire committed
686
tremor:
687
	$(SVN) co http://svn.xiph.org/trunk/Tremor tremor
688
	(cd $@ && patch -p0 < ../Patches/tremor.patch)
689
	(cd $@; rm -f ogg.h && echo "#include <ogg/ogg.h>" > ogg.h && rm -f os_types.h && echo "#include <ogg/os_types.h>" > os_types.h)
gbazin's avatar
gbazin committed
690
691
else
tremor-$(TREMOR_VERSION).tar.bz2:
692
693
	echo "tremor snapshot does not exist, you MUST use subversion !"
	exit -1
694
	$(WGET) $(TREMOR_URL)
gbazin's avatar
gbazin committed
695
696

tremor: tremor-$(TREMOR_VERSION).tar.bz2
697
	$(EXTRACT_BZ2)
gbazin's avatar
gbazin committed
698
699
700
endif

.tremor: tremor .ogg
701
	(cd $<; $(HOSTCC) ./autogen.sh $(HOSTCONF) --prefix=$(PREFIX) --disable-shared CFLAGS="$(NOTHUMB)" && make && make install)
702
703
	$(INSTALL_NAME)
	touch $@
gbazin's avatar
gbazin committed
704

705
706
ifdef SVN
tremor-source: tremor
707
	tar cv --exclude=.svn tremor | bzip2 > tremor-$(DATE).tar.bz2
708
709
710
711

SOURCE += tremor-source
endif

gbazin's avatar
gbazin committed
712
713
CLEAN_FILE += .tremor
CLEAN_PKG += tremor
714
#DISTCLEAN_PKG += tremor-$(TREMOR_VERSION).tar.bz2 #no tremor snapshot
gbazin's avatar
gbazin committed
715

716
717
718
719
720
# ***************************************************************************
# theora
# ***************************************************************************

libtheora-$(THEORA_VERSION).tar.bz2:
721
	$(WGET) $(THEORA_URL)
722
723

libtheora: libtheora-$(THEORA_VERSION).tar.bz2
724
	$(EXTRACT_BZ2)
725
	patch -p0 < Patches/libtheora-includes.patch
726
727
728
ifdef HAVE_WIN64
	(cd $@ ; autoreconf -if -I m4)
endif
729

730
731
THEORACONF = --disable-sdltest --disable-oggtest --disable-vorbistest --disable-examples

732
ifdef HAVE_DARWIN_64
733
734
THEORACONF += --disable-asm
endif
735
736
737
ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
738

739
.theora: libtheora .ogg
740
ifdef HAVE_DARWIN_OS
741
	cd $<; ($(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF) && make && make install)
742
else
743
744
745
746
747
748
749
750
ifdef HAVE_WIN32
	cd $<; $(HOSTCC) ./autogen.sh $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF)
endif
	if test ! -f $</config.status; then \
		cd $< ; \
		$(HOSTCC) ./configure $(HOSTCONF) \
			--prefix=$(PREFIX) $(THEORACONF) ; \
	fi
751
	cd $< && make && make install
752
endif
753
754
	$(INSTALL_NAME)
	touch $@
755
756
757
758
759

CLEAN_FILE += .theora
CLEAN_PKG += libtheora
DISTCLEAN_PKG += libtheora-$(THEORA_VERSION).tar.bz2

hartman's avatar
hartman committed
760
761
762
763
764
# ***************************************************************************
# shout
# ***************************************************************************

libshout-$(SHOUT_VERSION).tar.gz:
765
	$(WGET) $(SHOUT_URL)
hartman's avatar
hartman committed
766
767

libshout: libshout-$(SHOUT_VERSION).tar.gz
768
	$(EXTRACT_GZ)
Christophe Mutricy's avatar
Christophe Mutricy committed
769
ifdef HAVE_WIN32
770
	patch -p0 < Patches/libshout-win32.patch
Christophe Mutricy's avatar
Christophe Mutricy committed
771
endif
ivoire's avatar
ivoire committed
772

773
.shout: libshout .theora .ogg .speex .vorbis
774
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) &&  make && make install )
775
776
	$(INSTALL_NAME)
	touch $@
hartman's avatar
hartman committed
777
778
779
780
781

CLEAN_FILE += .shout
CLEAN_PKG += libshout
DISTCLEAN_PKG += libshout-$(SHOUT_VERSION).tar.gz

782
783
784
785
786
# ***************************************************************************
# flac
# ***************************************************************************

flac-$(FLAC_VERSION).tar.gz:
787
	$(WGET) $(FLAC_URL)
788
789

flac: flac-$(FLAC_VERSION).tar.gz
790
	$(EXTRACT_GZ)
791
ifdef HAVE_WIN32
792
	patch -p0 < Patches/flac-win32.patch
793
endif
794
ifdef HAVE_DARWIN_OS
Felix Paul Kühne's avatar
Felix Paul Kühne committed
795
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
796
endif
797
798

FLAC_DISABLE_FLAGS = --disable-oggtest --disable-xmms-plugin --disable-cpplibs
799

ivoire's avatar
ivoire committed
800
.flac: flac .ogg
801
ifdef HAVE_DARWIN_OS_ON_INTEL
802
803
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm-optimizations $(FLAC_DISABLE_FLAGS)
804
else
805
806
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  $(FLAC_DISABLE_FLAGS)
807
endif
808
	cd $</src && \
809
	make -C libFLAC && \
810
	echo 'Requires.private: ogg' >> libFLAC/flac.pc && \
811
812
	make -C libFLAC install
	cd $< && make -C include install
813
814
	$(INSTALL_NAME)
	touch $@
815

damienf's avatar
damienf committed
816
CLEAN_FILE += .flac
817
818
819
820
821
822
823
824
CLEAN_PKG += flac
DISTCLEAN_PKG += flac-$(FLAC_VERSION).tar.gz

# ***************************************************************************
# speex
# ***************************************************************************

speex-$(SPEEX_VERSION).tar.gz:
825
	$(WGET) $(SPEEX_URL)
826
827

speex: speex-$(SPEEX_VERSION).tar.gz
828
829
	$(EXTRACT_GZ)
	patch -p0 < Patches/speex.patch
830
831

.speex: speex
832
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --enable-ogg=no && make && make install)
833
834
	$(INSTALL_NAME)
	touch $@
835
836
837
838
839
840
841
842
843

CLEAN_FILE += .speex
CLEAN_PKG += speex
DISTCLEAN_PKG += speex-$(SPEEX_VERSION).tar.gz

# ***************************************************************************
# faad2
# ***************************************************************************

844
faad2-$(FAAD2_VERSION).tar.gz:
845
	$(WGET) $(FAAD2_URL)
846

847
848
faad2: faad2-$(FAAD2_VERSION).tar.gz
	$(EXTRACT_GZ)
849
	(cd $@; echo|$(CC) -iquote . -E - || sed -i 's/-iquote /-I/' libfaad/Makefile.am; autoreconf -ivf)
850
	patch -p0 < Patches/faad-arm-fixed.patch
851

852
.faad: faad2
853
	(cd $< && $(HOSTCC) ./configure $(HOSTCONF) --disable-shared --prefix=$(PREFIX) CFLAGS="-O3 $(NOTHUMB)" && sed -i.orig "s/shrext_cmds/shrext/g" libtool && make -C libfaad && make -C libfaad install)
854
	touch $@
855
856

CLEAN_FILE += .faad
857
858
CLEAN_PKG += faad2
DISTCLEAN_PKG += faad2-$(FAAD2_VERSION).tar.gz
859

860
861
862
863
864
865
866
867
868
869
870
871
# ***************************************************************************
# libebml
# ***************************************************************************

libebml-$(LIBEBML_VERSION).tar.bz2:
	$(WGET) $(LIBEBML_URL)

libebml: libebml-$(LIBEBML_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.ebml: libebml
ifdef HAVE_WIN32
872
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC) SHARED=no && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC))
873
else
874
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
	$(RANLIB) $(PREFIX)/lib/libebml.a
endif
	touch $@

CLEAN_FILE += .ebml
CLEAN_PKG += libebml
DISTCLEAN_PKG += libebml-$(LIBEBML_VERSION).tar.bz2

# ***************************************************************************
# libmatroska
# ***************************************************************************

libmatroska-$(LIBMATROSKA_VERSION).tar.bz2:
	$(WGET) $(LIBMATROSKA_URL)

libmatroska: libmatroska-$(LIBMATROSKA_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.matroska: libmatroska .ebml
ifdef HAVE_WIN32
895
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC) SHARED=no EBML_DLL=no libmatroska.a && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC))
896
else
897
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
898
899
900
901
902
903
904
905
906
	$(RANLIB) $(PREFIX)/lib/libmatroska.a
endif
	touch $@


CLEAN_FILE += .matroska
CLEAN_PKG += libmatroska
DISTCLEAN_PKG += libmatroska-$(LIBMATROSKA_VERSION).tar.bz2

907
908
909
910
911

# ***************************************************************************
# libvp8
# ***************************************************************************

912
913
#ibvpx-$(VPX_VERSION).tar.bz2:
#$(WGET) $(VPX_URL)
914

915
916
libvpx: 
	$(GIT) clone git://review.webmproject.org/libvpx.git
917
918
919

ifdef HAVE_WIN32
VPX_TARGET=x86-win32-gcc
920
CROSS=$(HOST)-
921
else
922
923
924
925
926
927
928
929
930
931
932
ifdef HAVE_DARWIN_OS
ifdef HAVE_DARWIN_64
VPX_TARGET=x86_64-darwin9-gcc
else
ifdef HAVE_DARWIN_OS_ON_INTEL
VPX_TARGET=x86-darwin9-gcc
else
VPX_TARGET=ppc32-darwin9-gcc
endif
endif
else
933
934
VPX_TARGET=FIXME
endif
935
endif
936

Rafaël Carré's avatar
Rafaël Carré committed
937
938
939
ifdef HAVE_DARWIN_OS_ON_INTEL
.libvpx: libvpx .yasm
else
940
.libvpx: libvpx
Rafaël Carré's avatar
Rafaël Carré committed
941
endif
942
	(cd $<; CROSS=$(CROSS) ./configure --target=$(VPX_TARGET) --disable-install-bins --disable-install-srcs --disable-install-libs --disable-install-docs --disable-examples --disable-vp8-decoder && make && make install)
943
	(rm -rf $(PREFIX)/include/vpx/ && mkdir -p $(PREFIX)/include/vpx/; cd $< && cp vpx/*.h vpx_ports/*.h $(PREFIX)/include/vpx/) # Of course, why the hell would one expect it to be listed or in make install?
944
	rm $(PREFIX)/include/vpx/config.h
945
	(cd $<; $(RANLIB) libvpx.a && mkdir -p $(PREFIX)/lib && cp libvpx.a $(PREFIX)/lib/) # Of course, why the hell would one expect it to be listed or in make install?
946
947
	touch $@

948
949
950
CLEAN_FILE += .libvpx
CLEAN_PKG += libvpx
#DISTCLEAN_PKG += libvpx-$(VPX_VERSION).tar.bz2
951

952
953
954
955
956
# ***************************************************************************
# lame
# ***************************************************************************

lame-$(LAME_VERSION).tar.gz:
957
	$(WGET) $(LAME_URL)
958
959

lame: lame-$(LAME_VERSION).tar.gz
960
	$(EXTRACT_GZ)
961
962

.lame: lame
963
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-analyser-hooks --disable-decoder --disable-shared --disable-gtktest --disable-frontend && make && make install)
964
	touch $@
965
966
967
968
969
970
971

CLEAN_FILE += .lame
CLEAN_PKG += lame
DISTCLEAN_PKG += lame-$(LAME_VERSION).tar.gz


# ***************************************************************************
972
973
974
975
976
977
978
979
980
981
# libamrnb
# ***************************************************************************

amrnb-$(LIBAMR_NB_VERSION).tar.bz2:
	$(WGET) $(LIBAMR_NB)

libamrnb: amrnb-$(LIBAMR_NB_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.libamrnb: libamrnb
982
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
	touch $@

CLEAN_FILE += .libamrnb
CLEAN_PKG += libamrnb
DISTCLEAN_PKG += amrnb-$(LIBAMR_NB_VERSION).tar.bz2

# ***************************************************************************
# libamrwb
# ***************************************************************************

amrwb-$(LIBAMR_WB_VERSION).tar.bz2:
	$(WGET) $(LIBAMR_WB)

libamrwb: amrwb-$(LIBAMR_WB_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.libamrwb: libamrwb
1000
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
1001
1002
1003
1004
1005
	touch $@


CLEAN_FILE += .libamrwb
CLEAN_PKG += libamrwb
1006
DISTCLEAN_PKG += amrwb-$(LIBAMR_WB_VERSION).tar.bz2
1007
1008
1009

# ***************************************************************************

1010
1011
1012
# ffmpeg
# ***************************************************************************

1013
ifdef SVN