Makefile 81.4 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 - 2009 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
48
49
50
51
ifdef HAVE_DARWIN_OS
export CC
export CXX
export LD
endif
52
53
54
55
56
57
58
59

# ***************************************************************************
# 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... ;)
# ***************************************************************************

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

79

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

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

92
FFMPEGCONF=
93
94

# cross compiling
95
96
#This should be inside the if block but some config scripts are buggy
HOSTCONF=--target=$(HOST) --host=$(HOST) --build=$(BUILD) --program-prefix=""
97
98
99
100
101
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
    #
102
    ifndef HAVE_CYGWIN
103
        # We are REALLY cross compiling
104
        FFMPEGCONF+=--cross-prefix=$(HOST)- --enable-cross-compile
105
        X264CONF=--host=$(HOST)
106
        PTHREADSCONF="CROSS=$(HOST)-"
107
108
    else
        # We are compiling for MinGW on Cygwin
109
        PTHREADSCONF=$(HOSTCC)
110
    endif
111
endif
112
113

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

ifdef HAVE_WINCE
HOSTCONF+= --without-pic --disable-shared
128
FFMPEGCONF+= --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
129
130
131
endif

ifdef HAVE_UCLIBC
132
ifdef HAVE_BIGENDIAN
133
FFMPEGCONF+= --arch=armeb --enable-armv5te --enable-iwmmxt
134
135
136
else
FFMPEGCONF+= --arch=armv4l
endif
137
FFMPEGCONF+= --enable-small --disable-mpegaudio-hp
138
FFMPEG_CFLAGS += -DHAVE_LRINTF --std=c99
gbazin's avatar
gbazin committed
139
else
140
ifndef HAVE_WINCE
141
FFMPEGCONF+= --enable-libmp3lame --enable-libgsm
142
endif
143
endif
144

145
ifdef HAVE_DARWIN_OS_ON_INTEL
146
FFMPEGCONF += --enable-memalign-hack
147
148
149
endif

ifdef HAVE_DARWIN_OS
150
X264CONF=--host=$(HOST)
151
X264CONF += --enable-pic
152
153
154
ifdef HAVE_DARWIN_32
FFMPEGCONF += --cc=gcc-4.0
else
155
FFMPEGCONF += --cc=$(CC)
156
endif
157
FFMPEGCONF += --arch=$(ARCH)
158
ifdef HAVE_DARWIN_64
159
FFMPEGCONF += --cpu=core2
160
X264CONF+=--host=x86_64-apple-darwin10
161
endif
162
ifdef HAVE_DARWIN_OS_ON_INTEL
163
164
FFMPEG_CFLAGS += -DHAVE_LRINTF
endif
165
endif
166

167
ifdef HAVE_AMR
168
FFMPEGCONF+= --enable-libamr-nb --enable-libamr-wb --enable-nonfree
169
170
endif

171
ifdef HAVE_LINUX
172
ifdef HAVE_MAEMO
173
174
175
ifneq ($(filter -m%=cortex-a8, $(EXTRA_CFLAGS)),)
FFMPEGCONF += --disable-runtime-cpudetect --enable-neon --cpu=cortex-a8
endif
176
177
178
179
# 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
180
FFMPEGCONF += --enable-pic
181
182
183
X264CONF += --enable-pic
endif

184
185
186
187
ifdef HAVE_ISA_THUMB
NOTHUMB ?= -mno-thumb
endif

188
189
X264CONF+= --disable-avs-input --disable-lavf-input --disable-ffms-input --disable-mp4-output

190
191
DATE=`date +%Y-%m-%d`

192
193
194
# ***************************************************************************
# Standard rules
# ***************************************************************************
195
# Generated by ./bootstrap from default configuration in src/Distributions
ivoire's avatar
ivoire committed
196
#
197
include ../distro.mak
198
199
200
201
202
203
204
205

FORCE:

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

define EXTRACT_GZ
206
	rm -rf $@ || true
ivoire's avatar
ivoire committed
207
	gunzip -c $< | tar xf - --exclude='[*?:<>\|]'
208
209
	mv $(patsubst %.tar.gz,%,$(patsubst %.tgz,%,$(notdir $<))) $@ || true
	touch $@
210
211
212
endef

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

219
define EXTRACT_ZIP
220
221
222
223
	rm -rf $@ || true
	unzip $<
	mv $(patsubst %.zip,%,$(notdir $<)) $@ || true
	touch $@
224
225
endef

226
227
228
229
230
231
### 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
232
233
234
235
236
#	cd $< ; ./configure --prefix=$(PREFIX)
#	$(MAKE) -C $<
#	$(MAKE) -C $< install
#	$(INSTALL_NAME)
#	touch $@
237

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# ***************************************************************************
# 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

254
255
256
257
# ***************************************************************************
# autoconf
# ***************************************************************************

258
autoconf-$(AUTOCONF_VERSION).tar.bz2:
259
	$(WGET) $(AUTOCONF_URL)
260

261
autoconf: autoconf-$(AUTOCONF_VERSION).tar.bz2
262
	$(EXTRACT_BZ2)
263
264

.autoconf: autoconf
265
266
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@
267
268
269

CLEAN_FILE += .autoconf
CLEAN_PKG += autoconf
270
DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.bz2
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# ***************************************************************************
# gnumake
# ***************************************************************************

make-$(GNUMAKE_VERSION).tar.bz2:
	$(WGET) $(GNUMAKE_URL)

gnumake: make-$(GNUMAKE_VERSION).tar.bz2
	$(EXTRACT_BZ2)

.gnumake: gnumake
ifdef HAVE_DARWIN_OS
ifndef HAVE_DARWIN_9
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
endif
endif
	touch $@

CLEAN_FILE += .gnumake
CLEAN_PKG += gnumake
DISTCLEAN_PKG += make-$(GNUMAKE_VERSION).tar.bz2

294
295
296
# ***************************************************************************
# CMake
# ***************************************************************************
Rafaël Carré's avatar
Rafaël Carré committed
297
298
299
300
301
cmake-$(CMAKE_VERSION).tar.gz:
	$(WGET) $(CMAKE_URL)

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

303
.cmake: cmake
304
305
306
307
308
309
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .cmake
CLEAN_PKG += cmake

310
311
312
313
314
# ***************************************************************************
# libtool
# ***************************************************************************

ifdef HAVE_DARWIN_OS
315
316
317
318
319
320
321
322
libtool-$(LIBTOOL_VERSION).tar.gz:
	$(WGET) $(LIBTOOL_URL)

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

.libtool: libtool
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
323
324
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
325
	touch $@
326
327
328

CLEAN_PKG += libtool
DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
329
330
CLEAN_FILE += .libtool

331
332
333
334
335
336
337
endif

# ***************************************************************************
# automake
# ***************************************************************************

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

automake: automake-$(AUTOMAKE_VERSION).tar.gz
341
	$(EXTRACT_GZ)
342
343

.automake: automake
344
345
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@
346
347
348
349
350
351
352
353
354

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

# ***************************************************************************
# pkgconfig
# ***************************************************************************

355
pkg-config-$(PKGCFG_VERSION).tar.gz:
356
	$(WGET) $(PKGCFG_URL)
357

358
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
359
	$(EXTRACT_GZ)
360
	(cd $@; autoconf)
361
362

.pkgcfg: pkgconfig
363
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
364
	touch $@
365
366
367

CLEAN_FILE += .pkgcfg
CLEAN_PKG += pkgconfig
368
DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
369
370
371
372
373
374

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

gettext-$(GETTEXT_VERSION).tar.gz:
375
	$(WGET) $(GETTEXT_URL)
376
377

gettext: gettext-$(GETTEXT_VERSION).tar.gz
378
	$(EXTRACT_GZ)
379
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
380
	patch -p0 < Patches/gettext-win32.patch
381
endif
VideoLAN's avatar
VideoLAN committed
382
383
384
ifdef HAVE_DARWIN_OS
	patch -p0 < Patches/gettext-macosx.patch
endif
385

386
.intl: gettext .iconv
387
ifdef HAVE_WIN32
388
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-relocatable --with-iconv-prefix=$(PREFIX) --disable-java --disable-native-java)
389
else
390
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-java --disable-native-java --without-emacs)
391
endif
392
ifneq ($(HOST),$(BUILD))
393
394
  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
395
	( cd $< && make -C gettext-runtime/intl && patch -p1 < ../Patches/libintl.patch && make -C gettext-runtime/intl install && make -C gettext-tools/misc install )
396
397
398
399
  else
    # We are compiling for MinGW on Cygwin -- build the full current gettext
	( cd $< && make && patch -p1 < ../Patches/libintl.patch && make install )
  endif
400
401
else
# Build and install the whole gettext
402
	( cd $< && make && patch -p1 < ../Patches/libintl.patch && make install )
403
404
405
endif
# Work around another non-sense of autoconf.
ifdef HAVE_WIN32
406
	(cd $(PREFIX)/include; sed -i.orig '311 c #if 0' libintl.h)
407
endif
408
409
	$(INSTALL_NAME)
	touch $@
410
411
412
413
414
415
416
417
418
419

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

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

libiconv-$(LIBICONV_VERSION).tar.gz:
420
	$(WGET) $(LIBICONV_URL)
421
422

libiconv: libiconv-$(LIBICONV_VERSION).tar.gz
423
	$(EXTRACT_GZ)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
424
425
ifdef HAVE_WIN64
	patch -p0 < Patches/libiconv-win64.patch
426
endif
427
428
429
430
ifdef HAVE_WINCE
	patch -p0 < Patches/libiconv-wince.patch
	patch -p0 < Patches/libiconv-wince-hack.patch
endif
431

432
433
434
435
436
libiconv-snowleopard.tar.bz2:
	$(WGET) $(LIBICONVMAC_URL)

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

438
ifdef HAVE_DARWIN_OS
439
ifdef HAVE_DARWIN_10
440
.iconv: libiconv-snowleopard
441
	(cd libiconv-snowleopard && cp libiconv.* $(PREFIX)/lib/)
442
443
	touch $@
else
444
.iconv:
445
	touch $@
446
endif
447
else
448
.iconv: libiconv
449
450
451
	(cd libiconv; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-nls && make && make install)
	$(INSTALL_NAME)
	touch $@
452
endif
453
454
455
456
457

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

458
459
460
461
462
463
464
# ***************************************************************************
# fontconfig
# ***************************************************************************

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

465
fontconfig: fontconfig-$(FONTCONFIG_VERSION).tar.gz Patches/fontconfig.patch
466
	$(EXTRACT_GZ)
467
	patch -p0 < Patches/fontconfig-march.patch
468
	patch -p0 < Patches/fontconfig-nodocs.patch
469
470
ifdef HAVE_WIN32
	patch -p0 < Patches/fontconfig.patch
471
	patch -p0 < Patches/fontconfig-noxml2.patch
472
	(cd $@; autoreconf -ivf)
473
endif
474

Rafaël Carré's avatar
Rafaël Carré committed
475
.fontconfig: fontconfig .xml .freetype
476
477
ifdef HAVE_WIN32
  ifdef HAVE_CYGWIN
478
	(cd $<; ./configure --target=$(HOST) --disable-pic --disable-shared --disable-docs --with-arch=i686 --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --enable-libxml2 && make && make install)
479
  else
480
	(cd $<; $(HOSTCC)  ./configure $(HOSTCONF) --with-arch=i686 --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --disable-libxml2 --disable-docs && make && make install)
481
482
  endif
else
bitmap's avatar
bitmap committed
483
  ifdef HAVE_DARWIN_OS
484
	(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
485
  else
486
	(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
487
  endif
488
489
490
491
492
493
494
495
endif
	$(INSTALL_NAME)
	touch $@

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

496
497
498
499
500
# ***************************************************************************
# freetype2
# ***************************************************************************

freetype-$(FREETYPE2_VERSION).tar.gz:
501
	$(WGET) $(FREETYPE2_URL)
502
503

freetype2: freetype-$(FREETYPE2_VERSION).tar.gz
504
	$(EXTRACT_GZ)
505
506

.freetype: freetype2
507
508
509
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
	$(INSTALL_NAME)
	touch $@
510
511
512
513
514
515
516
517
518

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

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

damienf's avatar
damienf committed
519
fribidi-$(FRIBIDI_VERSION).tar.gz:
520
	$(WGET) $(FRIBIDI_URL)
521

damienf's avatar
damienf committed
522
523
fribidi: fribidi-$(FRIBIDI_VERSION).tar.gz
	$(EXTRACT_GZ)
524
	patch -p0 < Patches/fribidi.patch
525
	( cd $@; rm -f configure; ./bootstrap)
526

527
.fribidi: fribidi .iconv
528
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  && make && make install)
529
530
	$(INSTALL_NAME)
	touch $@
531
532
533

CLEAN_FILE += .fribidi
CLEAN_PKG += fribidi
damienf's avatar
damienf committed
534
DISTCLEAN_PKG += fribidi-$(FRIBIDI_VERSION).tar.gz
535
536
537
538
539
540

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

a52dec-$(A52DEC_VERSION).tar.gz:
541
	$(WGET) $(A52DEC_URL)
542
543

a52dec: a52dec-$(A52DEC_VERSION).tar.gz
544
	$(EXTRACT_GZ)
545
ifeq ($(ARCH),armel)
546
547
	(cd $@ ; patch -p0 < ../Patches/liba52-fixed.diff)
endif
548
549

.a52: a52dec
550
551
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && cd liba52 && make && make install && cd ../include && make && make install)
	touch $@
552
553
554
555
556
557
558
559
560

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

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

Christophe Mutricy's avatar
Christophe Mutricy committed
561
562
libmpeg2-$(LIBMPEG2_VERSION).tar.gz:
	$(WGET) $(LIBMPEG2_URL)
563

Christophe Mutricy's avatar
Christophe Mutricy committed
564
libmpeg2: libmpeg2-$(LIBMPEG2_VERSION).tar.gz
565
	$(EXTRACT_GZ)
566
	patch -p0 < Patches/libmpeg2-arm-pld.patch
567
568
	cd libmpeg2 && patch -p0 < ../Patches/libmpeg2-mc-neon.patch
	cd libmpeg2 && ./bootstrap
569

Christophe Mutricy's avatar
Christophe Mutricy committed
570
.mpeg2: libmpeg2
571
572
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --without-x --disable-sdl && cd libmpeg2 && make && make install && cd ../include && make && make install)
	touch $@
573
574

CLEAN_FILE += .mpeg2
Christophe Mutricy's avatar
Christophe Mutricy committed
575
576
CLEAN_PKG += libmpeg2
DISTCLEAN_PKG += libmpeg2-$(LIBMPEG2_VERSION).tar.gz
577
578
579
580
581
582

# ***************************************************************************
# libid3tag
# ***************************************************************************

libid3tag-$(LIBID3TAG_VERSION).tar.gz:
583
	$(WGET) $(LIBID3TAG_URL)
584
585

libid3tag: libid3tag-$(LIBID3TAG_VERSION).tar.gz
586
	$(EXTRACT_GZ)
587
	patch -d libid3tag -p0 < Patches/libid3tag-0.15.1b-fix-CVE-2008-2109.patch
588
589
590
ifdef HAVE_DARWIN_OS
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
endif
591
592

.id3tag: libid3tag
593
594
595
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
	$(INSTALL_NAME)
	touch $@
596
597
598
599
600

CLEAN_FILE += .id3tag
CLEAN_PKG += libid3tag
DISTCLEAN_PKG += libid3tag-$(LIBID3TAG_VERSION).tar.gz

601
602
603
604
605
606
607
608
609
610
611
# ***************************************************************************
# pcre
# ***************************************************************************

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

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

.pcre: pcre
Rafaël Carré's avatar
Rafaël Carré committed
612
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-shared && make && make install )
613
614
615
616
617
618
	touch $@

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

619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# ***************************************************************************
# 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)
646
647
648
ifdef HAVE_DARWIN_OS
	(cd $@; sed -e 's%gcc%$(CC)%' -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -i.orig  src/Makefile)
endif
649
650

.lua: lua
651
ifdef HAVE_WIN32
652
	( 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 ../..)
Christophe Mutricy's avatar
Christophe Mutricy committed
653
654
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM)&& cd src&& $(HOSTCC) make liblua.a&& cd ..&&$(HOSTCC) make install INSTALL_TOP=$(PREFIX)&& $(RANLIB) $(PREFIX)/lib/liblua.a)
	(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
655
else
Christophe Mutricy's avatar
Christophe Mutricy committed
656
657
	(cd $<&& patch -p1) < Patches/lua-noreadline.patch
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM) && make install INSTALL_TOP=$(PREFIX))
658
endif
659
660
661
662
663
664
	touch $@

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

665
666
667
668
669
# ***************************************************************************
# libmad
# ***************************************************************************

libmad-$(LIBMAD_VERSION).tar.gz:
670
	$(WGET) $(LIBMAD_URL)
671
672

libmad: libmad-$(LIBMAD_VERSION).tar.gz
673
	$(EXTRACT_GZ)
674
ifdef HAVE_DARWIN_OS
675
	( cd $@; sed -e 's%-march=i486%$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
676
endif
677
678

.mad: libmad
679
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) CFLAGS="-O3 $(NOTHUMB)" && make && make install)
680
681
	$(INSTALL_NAME)
	touch $@
682
683
684
685
686
687
688
689
690
691

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

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

libogg-$(OGG_VERSION).tar.gz:
692
	$(WGET) $(OGG_URL)
693
694

libogg: libogg-$(OGG_VERSION).tar.gz
695
	$(EXTRACT_GZ)
Rafaël Carré's avatar
Rafaël Carré committed
696
697
	patch -p0 < Patches/ogg.patch
	patch -p0 < Patches/libogg-1.1.patch
gbazin's avatar
gbazin committed
698
ifdef HAVE_WINCE
Rafaël Carré's avatar
Rafaël Carré committed
699
	patch -p0 < Patches/libogg-wince.patch
gbazin's avatar
gbazin committed
700
endif
701
	(cd $@; autoconf)
702
703

.ogg: libogg
704
705
706
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make install)
	$(INSTALL_NAME)
	touch $@
707
708
709
710
711
712
713
714
715
716

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

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

libvorbis-$(VORBIS_VERSION).tar.gz:
717
	$(WGET) $(VORBIS_URL)
718
719

libvorbis: libvorbis-$(VORBIS_VERSION).tar.gz
720
	$(EXTRACT_GZ)
721
	patch -p0 < Patches/vorbis-noapps.patch
722
723

.vorbis: libvorbis .ogg
724
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
725
726
#	$(INSTALL_NAME)
	touch $@
727
728

.vorbisenc: .vorbis .ogg
729
730
#	$(INSTALL_NAME)
	touch $@
731
732
733
734
735

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

gbazin's avatar
gbazin committed
736
737
738
739
740
# ***************************************************************************
# tremor
# ***************************************************************************

ifdef SVN
ivoire's avatar
ivoire committed
741
tremor:
742
	$(SVN) co http://svn.xiph.org/trunk/Tremor tremor
743
	(cd $@ && patch -p0 < ../Patches/tremor.patch)
744
	(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
745
746
else
tremor-$(TREMOR_VERSION).tar.bz2:
747
748
	echo "tremor snapshot does not exist, you MUST use subversion !"
	exit -1
749
	$(WGET) $(TREMOR_URL)
gbazin's avatar
gbazin committed
750
751

tremor: tremor-$(TREMOR_VERSION).tar.bz2
752
	$(EXTRACT_BZ2)
gbazin's avatar
gbazin committed
753
754
755
endif

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

760
761
ifdef SVN
tremor-source: tremor
762
	tar cv --exclude=.svn tremor | bzip2 > tremor-$(DATE).tar.bz2
763
764
765
766

SOURCE += tremor-source
endif

gbazin's avatar
gbazin committed
767
768
CLEAN_FILE += .tremor
CLEAN_PKG += tremor
769
#DISTCLEAN_PKG += tremor-$(TREMOR_VERSION).tar.bz2 #no tremor snapshot
gbazin's avatar
gbazin committed
770

771
772
773
774
775
# ***************************************************************************
# theora
# ***************************************************************************

libtheora-$(THEORA_VERSION).tar.bz2:
776
	$(WGET) $(THEORA_URL)
777
778

libtheora: libtheora-$(THEORA_VERSION).tar.bz2
779
	$(EXTRACT_BZ2)
780
	patch -p0 < Patches/libtheora-includes.patch
781

782
783
THEORACONF = --disable-sdltest --disable-oggtest --disable-vorbistest --disable-examples

784
ifdef HAVE_DARWIN_64
785
786
THEORACONF += --disable-asm
endif
787
788
789
ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
790

791
.theora: libtheora .ogg
792
ifdef HAVE_DARWIN_OS
793
794
	cd $<; ($(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF) && make && make install)
else
795
796
797
798
799
800
801
802
803
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
	cd $< && make && make install
804
endif
805
806
	$(INSTALL_NAME)
	touch $@
807
808
809
810
811

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

hartman's avatar
hartman committed
812
813
814
815
816
# ***************************************************************************
# shout
# ***************************************************************************

libshout-$(SHOUT_VERSION).tar.gz:
817
	$(WGET) $(SHOUT_URL)
hartman's avatar
hartman committed
818
819

libshout: libshout-$(SHOUT_VERSION).tar.gz
820
	$(EXTRACT_GZ)
Christophe Mutricy's avatar
Christophe Mutricy committed
821
ifdef HAVE_WIN32
822
	patch -p0 < Patches/libshout-win32.patch
Christophe Mutricy's avatar
Christophe Mutricy committed
823
endif
ivoire's avatar
ivoire committed
824

825
.shout: libshout .theora .ogg .speex .vorbis
826
827
828
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) &&  make && make install )
	$(INSTALL_NAME)
	touch $@
hartman's avatar
hartman committed
829
830
831
832
833

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

834
835
836
837
838
# ***************************************************************************
# flac
# ***************************************************************************

flac-$(FLAC_VERSION).tar.gz:
839
	$(WGET) $(FLAC_URL)
840
841

flac: flac-$(FLAC_VERSION).tar.gz
842
	$(EXTRACT_GZ)
843
ifdef HAVE_WIN32
844
	patch -p0 < Patches/flac-win32.patch
845
endif
846
ifdef HAVE_DARWIN_OS
Felix Paul Kühne's avatar
Felix Paul Kühne committed
847
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
848
endif
849
850

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

ivoire's avatar
ivoire committed
852
.flac: flac .ogg
853
ifdef HAVE_WIN32
854
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(FLAC_DISABLE_FLAGS) && cd src&& make -C libFLAC&& make -C libFLAC install && cd .. && make -C include install)
855
else
856
ifdef HAVE_DARWIN_OS
857
ifdef HAVE_DARWIN_OS_ON_INTEL
858
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm-optimizations && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
859
else
860
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(FLAC_DISABLE_FLAGS) && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
861
endif
862
else
863
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  $(FLAC_DISABLE_FLAGS) && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
864
endif
865
endif
866
867
	$(INSTALL_NAME)
	touch $@
868

damienf's avatar
damienf committed
869
CLEAN_FILE += .flac
870
871
872
873
874
875
876
877
CLEAN_PKG += flac
DISTCLEAN_PKG += flac-$(FLAC_VERSION).tar.gz

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

speex-$(SPEEX_VERSION).tar.gz:
878
	$(WGET) $(SPEEX_URL)
879
880

speex: speex-$(SPEEX_VERSION).tar.gz
881
882
	$(EXTRACT_GZ)
	patch -p0 < Patches/speex.patch
883
884

.speex: speex
885
886
887
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --enable-ogg=no && make && make install)
	$(INSTALL_NAME)
	touch $@
888
889
890
891
892
893
894
895
896

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

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

897
faad2-$(FAAD2_VERSION).tar.gz:
898
	$(WGET) $(FAAD2_URL)
899

900
901
faad2: faad2-$(FAAD2_VERSION).tar.gz
	$(EXTRACT_GZ)
Rafaël Carré's avatar
Rafaël Carré committed
902
	(cd $@; echo|$(CC) -iquote . -E - || sed -i 's/-iquote /-I/' libfaad/Makefile.am; sh ./bootstrap)
903
	patch -p0 < Patches/faad-arm-fixed.patch
904

905
.faad: faad2
Rafaël Carré's avatar
Rafaël Carré committed
906
	(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)
907
	touch $@
908
909

CLEAN_FILE += .faad
910
911
CLEAN_PKG += faad2
DISTCLEAN_PKG += faad2-$(FAAD2_VERSION).tar.gz
912
913
914
915
916
917

# ***************************************************************************
# lame
# ***************************************************************************

lame-$(LAME_VERSION).tar.gz:
918
	$(WGET) $(LAME_URL)
919
920

lame: lame-$(LAME_VERSION).tar.gz
921
	$(EXTRACT_GZ)
922
923

.lame: lame
924
925
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-analyser-hooks --disable-decoder --disable-shared --disable-gtktest --disable-frontend && make && make install)
	touch $@
926
927
928
929
930
931
932
933
934
935

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

# ***************************************************************************
# libebml
# ***************************************************************************

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

libebml: libebml-$(LIBEBML_VERSION).tar.bz2
939
	$(EXTRACT_BZ2)
940
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
941
	(cd $@; patch -p0 < ../Patches/libebml-svn-win32.patch)
942
endif
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
943
ifdef HAVE_WIN64
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
944
	patch -p0 < Patches/libebml-win64.patch
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
945
endif
946
947

.ebml: libebml
948
ifdef HAVE_WIN32
949
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC2) CFLAGS="$(CFLAGS) -DWIN32" SHARED=no && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC2))
950
else
951
952
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
	$(RANLIB) $(PREFIX)/lib/libebml.a
ivoire's avatar
ivoire committed
953
endif
954
	touch $@
955

956
957
958
959
960
961
962
963
CLEAN_FILE += .ebml
CLEAN_PKG += libebml
DISTCLEAN_PKG += libebml-$(LIBEBML_VERSION).tar.bz2

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

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

967
libmatroska: libmatroska-$(LIBMATROSKA_VERSION).tar.bz2
968
	$(EXTRACT_BZ2)
hartman's avatar
hartman committed
969
	patch -p0 < ./Patches/libmatroska-kaxblock.patch
970
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
971
	(cd $@; patch -p0 < ../Patches/libmatroska-win32.patch)
972
endif
973

974
975
.matroska: libmatroska .ebml
ifdef HAVE_WIN32
976
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC2) SHARED=no EBML_DLL=no libmatroska.a && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC2))
977
else
978
979
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
	$(RANLIB) $(PREFIX)/lib/libmatroska.a
980
endif
981
	touch $@
982

983

984
985
986
987
988
CLEAN_FILE += .matroska
CLEAN_PKG += libmatroska
DISTCLEAN_PKG += libmatroska-$(LIBMATROSKA_VERSION).tar.bz2

# ***************************************************************************
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# libamrnb
# ***************************************************************************

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

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

.libamrnb: libamrnb
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
	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
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
	touch $@


CLEAN_FILE += .libamrwb
CLEAN_PKG += libamrwb
1023
DISTCLEAN_PKG += amrwb-$(LIBAMR_WB_VERSION).tar.bz2
1024
1025
1026

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

1027
1028
1029
# ffmpeg
# ***************************************************************************

1030
ifdef SVN
1031
1032
1033
1034
1035
ifdef HAVE_WIN32
ffmpeg: .dshow_headers
else
ffmpeg: 
endif
1036
	$(SVN) co $(FFMPEG_SVN) ffmpeg
1037
1038
1039
ifdef HAVE_ISA_THUMB
	patch -p0 < Patches/ffmpeg-avcodec-no-thumb.patch
endif
1040
ifdef HAVE_UCLIBC
1041
1042
	patch -p0 < Patches/ffmpeg-svn-uclibc.patch
	patch -p0 < Patches/ffmpeg-svn-internal-define.patch
1043
	patch -p0 < Patches/ffmpeg-svn-libavformat.patch
1044
endif
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
1045
	(cd $@; patch -p1 < ../Patches/eac3_spectral.patch)
Rafaël Carré's avatar