Makefile 76.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 - 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 --cpu=i686 --arch=i686
119
ifdef HAVE_WIN64
120
FFMPEGCONF+= --cpu=athlon64 --arch=x86_64
121
122
123
else
FFMPEGCONF+= --cpu=i686 --arch=x86_32
endif
124
endif
gbazin's avatar
gbazin committed
125
126
127

ifdef HAVE_WINCE
HOSTCONF+= --without-pic --disable-shared
128
FFMPEGCONF+= --enable-mingwce --cpu=armv4l --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
FFMPEGCONF+= --enable-libmp3lame --enable-libgsm
141
142
endif

143
ifdef HAVE_DARWIN_OS_ON_INTEL
144
FFMPEGCONF += --enable-memalign-hack
145
146
147
endif

ifdef HAVE_DARWIN_OS
148
X264CONF=--host=$(HOST)
149
X264CONF += --enable-pic
150
FFMPEGCONF += --cc=$(CC)
151
FFMPEGCONF += --arch=$(ARCH)
152
ifdef HAVE_DARWIN_64
153
FFMPEGCONF += --cpu=core2
154
X264CONF+=--host=x86_64-apple-darwin10
155
endif
156
ifdef HAVE_DARWIN_OS_ON_INTEL
157
158
FFMPEG_CFLAGS += -DHAVE_LRINTF
endif
159
endif
160

161
ifdef HAVE_AMR
162
FFMPEGCONF+= --enable-libamr-nb --enable-libamr-wb --enable-nonfree
163
164
endif

165
ifdef HAVE_LINUX
166
ifdef HAVE_MAEMO
167
168
169
ifneq ($(filter -m%=cortex-a8, $(EXTRA_CFLAGS)),)
FFMPEGCONF += --disable-runtime-cpudetect --enable-neon --cpu=cortex-a8
endif
170
171
172
173
# 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
174
175
176
X264CONF += --enable-pic
endif

177
178
179
180
ifdef HAVE_ISA_THUMB
NOTHUMB ?= -mno-thumb
endif

181
182
DATE=`date +%Y-%m-%d`

183
184
185
# ***************************************************************************
# Standard rules
# ***************************************************************************
186
# Generated by ./bootstrap from default configuration in src/Distributions
ivoire's avatar
ivoire committed
187
#
188
include ../distro.mak
189
190
191
192
193
194
195
196

FORCE:

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

define EXTRACT_GZ
197
	rm -rf $@ || true
ivoire's avatar
ivoire committed
198
	gunzip -c $< | tar xf - --exclude='[*?:<>\|]'
199
200
	mv $(patsubst %.tar.gz,%,$(patsubst %.tgz,%,$(notdir $<))) $@ || true
	touch $@
201
202
203
endef

define EXTRACT_BZ2
204
	rm -rf $@ || true
ivoire's avatar
ivoire committed
205
	bunzip2 -c $< | tar xf - --exclude='[*?:<>\|]'
206
207
	mv $(patsubst %.tar.bz2,%,$(notdir $<)) $@ || true
	touch $@
208
209
endef

210
define EXTRACT_ZIP
211
212
213
214
	rm -rf $@ || true
	unzip $<
	mv $(patsubst %.zip,%,$(notdir $<)) $@ || true
	touch $@
215
216
endef

217
218
219
220
221
222
### 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
223
224
225
226
227
#	cd $< ; ./configure --prefix=$(PREFIX)
#	$(MAKE) -C $<
#	$(MAKE) -C $< install
#	$(INSTALL_NAME)
#	touch $@
228
229
230
231
232

# ***************************************************************************
# autoconf
# ***************************************************************************

233
autoconf-$(AUTOCONF_VERSION).tar.bz2:
234
	$(WGET) $(AUTOCONF_URL)
235

236
autoconf: autoconf-$(AUTOCONF_VERSION).tar.bz2
237
	$(EXTRACT_BZ2)
238
239

.autoconf: autoconf
240
241
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@
242
243
244

CLEAN_FILE += .autoconf
CLEAN_PKG += autoconf
245
DISTCLEAN_PKG += autoconf-$(AUTOCONF_VERSION).tar.bz2
246

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# ***************************************************************************
# 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

269
270
271
# ***************************************************************************
# CMake
# ***************************************************************************
Rafaël Carré's avatar
Rafaël Carré committed
272
273
274
275
276
cmake-$(CMAKE_VERSION).tar.gz:
	$(WGET) $(CMAKE_URL)

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

Rafaël Carré's avatar
Rafaël Carré committed
278
279
#cmake:
#	cvs -d :pserver:anonymous:cmake@www.cmake.org:/cvsroot/CMake co -d cmake CMake
280
281

.cmake: cmake
282
283
284
285
286
287
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@

CLEAN_FILE += .cmake
CLEAN_PKG += cmake

288
289
290
291
292
# ***************************************************************************
# libtool
# ***************************************************************************

ifdef HAVE_DARWIN_OS
293
294
295
296
297
298
299
300
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)
301
302
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
303
	touch $@
304
305
306

CLEAN_PKG += libtool
DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
307
308
CLEAN_FILE += .libtool

309
310
311
312
313
314
315
endif

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

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

automake: automake-$(AUTOMAKE_VERSION).tar.gz
319
	$(EXTRACT_GZ)
320
321

.automake: automake
322
323
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
	touch $@
324
325
326
327
328
329
330
331
332

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

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

333
pkg-config-$(PKGCFG_VERSION).tar.gz:
334
	$(WGET) $(PKGCFG_URL)
335

336
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
337
338
339
	$(EXTRACT_GZ)
	patch -d pkgconfig/glib-1.2.8 -p 1 < Patches/glib.patch
	patch -d pkgconfig -p0 < Patches/pkgcfg.patch
340
	(cd $@; autoconf)
341
342

.pkgcfg: pkgconfig
343
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
344
	touch $@
345
346
347

CLEAN_FILE += .pkgcfg
CLEAN_PKG += pkgconfig
348
DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
349
350
351
352
353
354

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

gettext-$(GETTEXT_VERSION).tar.gz:
355
	$(WGET) $(GETTEXT_URL)
356
357

gettext: gettext-$(GETTEXT_VERSION).tar.gz
358
	$(EXTRACT_GZ)
359
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
360
	patch -p0 < Patches/gettext-win32.patch
361
endif
VideoLAN's avatar
VideoLAN committed
362
363
364
ifdef HAVE_DARWIN_OS
	patch -p0 < Patches/gettext-macosx.patch
endif
365

366
.intl: gettext .iconv
367
ifdef HAVE_WIN32
368
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-relocatable --with-iconv-prefix=$(PREFIX) --disable-java --disable-native-java)
369
else
370
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-java --disable-native-java --without-emacs)
371
endif
372
ifneq ($(HOST),$(BUILD))
373
374
  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
375
	( cd $< && make -C gettext-runtime/intl && patch -p1 < ../Patches/libintl.patch && make -C gettext-runtime/intl install && make -C gettext-tools/misc install )
376
377
378
379
  else
    # We are compiling for MinGW on Cygwin -- build the full current gettext
	( cd $< && make && patch -p1 < ../Patches/libintl.patch && make install )
  endif
380
381
else
# Build and install the whole gettext
382
	( cd $< && make && patch -p1 < ../Patches/libintl.patch && make install )
383
384
385
endif
# Work around another non-sense of autoconf.
ifdef HAVE_WIN32
386
	(cd ../include; sed -i.orig '311 c #if 0' libintl.h)
387
endif
388
389
	$(INSTALL_NAME)
	touch $@
390
391
392
393
394
395
396
397
398
399

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

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

libiconv-$(LIBICONV_VERSION).tar.gz:
400
	$(WGET) $(LIBICONV_URL)
401
402

libiconv: libiconv-$(LIBICONV_VERSION).tar.gz
403
	$(EXTRACT_GZ)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
404
405
ifdef HAVE_WIN64
	patch -p0 < Patches/libiconv-win64.patch
406
endif
407

408
409
410
411
412
libiconv-snowleopard.tar.bz2:
	$(WGET) $(LIBICONVMAC_URL)

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

414
ifdef HAVE_DARWIN_OS
415
ifdef HAVE_DARWIN_10
416
417
418
419
.iconv: libiconv-snowleopard
	(cd libiconv-snowleopard && cp libiconv.* ../../lib/)
	touch $@
else
420
.iconv:
421
	touch $@
422
endif
423
else
424
.iconv: libiconv
425
426
427
	(cd libiconv; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-nls && make && make install)
	$(INSTALL_NAME)
	touch $@
428
endif
429
430
431
432
433

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

434
435
436
437
438
439
440
# ***************************************************************************
# fontconfig
# ***************************************************************************

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

441
fontconfig: fontconfig-$(FONTCONFIG_VERSION).tar.gz Patches/fontconfig.patch
442
	$(EXTRACT_GZ)
443
	patch -p0 < Patches/fontconfig-nodocs.patch
444
445
ifdef HAVE_WIN32
	patch -p0 < Patches/fontconfig.patch
446
	patch -p0 < Patches/fontconfig-noxml2.patch
447
endif
448
	(cd $@; autoreconf -ivf)
449

Rafaël Carré's avatar
Rafaël Carré committed
450
.fontconfig: fontconfig .xml .freetype
451
452
ifdef HAVE_WIN32
  ifdef HAVE_CYGWIN
453
	(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)
454
  else
455
	(cd $<; $(HOSTCC)  ./configure $(HOSTCONF) --with-arch=i686 --prefix=$(PREFIX) --with-freetype-config=$(PREFIX)/bin/freetype-config --disable-libxml2 --disable-docs && make && make install)
456
457
  endif
else
bitmap's avatar
bitmap committed
458
  ifdef HAVE_DARWIN_OS
459
	(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
460
  else
461
	(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
462
  endif
463
464
465
466
467
468
469
470
endif
	$(INSTALL_NAME)
	touch $@

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

471
472
473
474
475
# ***************************************************************************
# freetype2
# ***************************************************************************

freetype-$(FREETYPE2_VERSION).tar.gz:
476
	$(WGET) $(FREETYPE2_URL)
477
478

freetype2: freetype-$(FREETYPE2_VERSION).tar.gz
479
	$(EXTRACT_GZ)
480
481

.freetype: freetype2
482
ifdef HAVE_CYGWIN
483
	(cd $<; ./configure --target=$(HOST) --disable-pic --disable-shared --prefix=$(PREFIX) && make && make install)
484
else
485
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
486
endif
487
488
	$(INSTALL_NAME)
	touch $@
489
490
491
492
493
494
495
496
497

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

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

damienf's avatar
damienf committed
498
fribidi-$(FRIBIDI_VERSION).tar.gz:
499
	$(WGET) $(FRIBIDI_URL)
500

damienf's avatar
damienf committed
501
502
fribidi: fribidi-$(FRIBIDI_VERSION).tar.gz
	$(EXTRACT_GZ)
503
	patch -p0 < Patches/fribidi.patch
504
	( cd $@; rm -f configure; ./bootstrap)
505

506
.fribidi: fribidi .iconv
507
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  && make && make install)
508
509
	$(INSTALL_NAME)
	touch $@
510
511
512

CLEAN_FILE += .fribidi
CLEAN_PKG += fribidi
damienf's avatar
damienf committed
513
DISTCLEAN_PKG += fribidi-$(FRIBIDI_VERSION).tar.gz
514
515
516
517
518
519

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

a52dec-$(A52DEC_VERSION).tar.gz:
520
	$(WGET) $(A52DEC_URL)
521
522

a52dec: a52dec-$(A52DEC_VERSION).tar.gz
523
	$(EXTRACT_GZ)
524
525

.a52: a52dec
526
527
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && cd liba52 && make && make install && cd ../include && make && make install)
	touch $@
528
529
530
531
532
533
534
535
536

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

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

Christophe Mutricy's avatar
Christophe Mutricy committed
537
538
libmpeg2-$(LIBMPEG2_VERSION).tar.gz:
	$(WGET) $(LIBMPEG2_URL)
539

Christophe Mutricy's avatar
Christophe Mutricy committed
540
libmpeg2: libmpeg2-$(LIBMPEG2_VERSION).tar.gz
541
	$(EXTRACT_GZ)
542

Christophe Mutricy's avatar
Christophe Mutricy committed
543
.mpeg2: libmpeg2
544
545
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --without-x --disable-sdl && cd libmpeg2 && make && make install && cd ../include && make && make install)
	touch $@
546
547

CLEAN_FILE += .mpeg2
Christophe Mutricy's avatar
Christophe Mutricy committed
548
549
CLEAN_PKG += libmpeg2
DISTCLEAN_PKG += libmpeg2-$(LIBMPEG2_VERSION).tar.gz
550
551
552
553
554
555

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

libid3tag-$(LIBID3TAG_VERSION).tar.gz:
556
	$(WGET) $(LIBID3TAG_URL)
557
558

libid3tag: libid3tag-$(LIBID3TAG_VERSION).tar.gz
559
	$(EXTRACT_GZ)
560
	patch -d libid3tag -p0 < Patches/libid3tag-0.15.1b-fix-CVE-2008-2109.patch
561
562
563
ifdef HAVE_DARWIN_OS
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
endif
564
565

.id3tag: libid3tag
566
567
568
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
	$(INSTALL_NAME)
	touch $@
569
570
571
572
573

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

574
575
576
577
578
579
580
581
582
583
584
# ***************************************************************************
# 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
585
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-shared && make && make install )
586
587
588
589
590
591
	touch $@

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

592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# ***************************************************************************
# 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)
619
620
621
ifdef HAVE_DARWIN_OS
	(cd $@; sed -e 's%gcc%$(CC)%' -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -i.orig  src/Makefile)
endif
622
623

.lua: lua
624
ifdef HAVE_WIN32
625
	( 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
626
627
	(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
628
else
Christophe Mutricy's avatar
Christophe Mutricy committed
629
630
	(cd $<&& patch -p1) < Patches/lua-noreadline.patch
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM) && make install INSTALL_TOP=$(PREFIX))
631
endif
632
633
634
635
636
637
	touch $@

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

638
639
640
641
642
# ***************************************************************************
# libmad
# ***************************************************************************

libmad-$(LIBMAD_VERSION).tar.gz:
643
	$(WGET) $(LIBMAD_URL)
644
645

libmad: libmad-$(LIBMAD_VERSION).tar.gz
646
	$(EXTRACT_GZ)
647
ifdef HAVE_DARWIN_OS
648
	( cd $@; sed -e 's%-march=i486%$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
649
endif
650
651

.mad: libmad
652
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) CFLAGS="-O3 $(NOTHUMB)" && make && make install)
653
654
	$(INSTALL_NAME)
	touch $@
655
656
657
658
659
660
661
662
663
664

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

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

libogg-$(OGG_VERSION).tar.gz:
665
	$(WGET) $(OGG_URL)
666
667

libogg: libogg-$(OGG_VERSION).tar.gz
668
	$(EXTRACT_GZ)
Rafaël Carré's avatar
Rafaël Carré committed
669
670
	patch -p0 < Patches/ogg.patch
	patch -p0 < Patches/libogg-1.1.patch
gbazin's avatar
gbazin committed
671
ifdef HAVE_WINCE
Rafaël Carré's avatar
Rafaël Carré committed
672
	patch -p0 < Patches/libogg-wince.patch
gbazin's avatar
gbazin committed
673
endif
674
	(cd $@; autoconf)
675
676

.ogg: libogg
677
678
679
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make install)
	$(INSTALL_NAME)
	touch $@
680
681
682
683
684
685
686
687
688
689

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

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

libvorbis-$(VORBIS_VERSION).tar.gz:
690
	$(WGET) $(VORBIS_URL)
691
692

libvorbis: libvorbis-$(VORBIS_VERSION).tar.gz
693
	$(EXTRACT_GZ)
694
695

.vorbis: libvorbis .ogg
696
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
697
698
#	$(INSTALL_NAME)
	touch $@
699
700

.vorbisenc: .vorbis .ogg
701
702
#	$(INSTALL_NAME)
	touch $@
703
704
705
706
707

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

gbazin's avatar
gbazin committed
708
709
710
711
712
# ***************************************************************************
# tremor
# ***************************************************************************

ifdef SVN
ivoire's avatar
ivoire committed
713
tremor:
714
	$(SVN) co http://svn.xiph.org/trunk/Tremor tremor
715
	(cd $@ && patch -p0 < ../Patches/tremor.patch)
716
	(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
717
718
else
tremor-$(TREMOR_VERSION).tar.bz2:
719
720
	echo "tremor snapshot does not exist, you MUST use subversion !"
	exit -1
721
	$(WGET) $(TREMOR_URL)
gbazin's avatar
gbazin committed
722
723

tremor: tremor-$(TREMOR_VERSION).tar.bz2
724
	$(EXTRACT_BZ2)
gbazin's avatar
gbazin committed
725
726
727
endif

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

732
733
ifdef SVN
tremor-source: tremor
734
	tar cfvz tremor-$(DATE).tar.gz tremor
735
736
737
738

SOURCE += tremor-source
endif

gbazin's avatar
gbazin committed
739
740
CLEAN_FILE += .tremor
CLEAN_PKG += tremor
741
#DISTCLEAN_PKG += tremor-$(TREMOR_VERSION).tar.bz2 #no tremor snapshot
gbazin's avatar
gbazin committed
742

743
744
745
746
747
# ***************************************************************************
# theora
# ***************************************************************************

libtheora-$(THEORA_VERSION).tar.bz2:
748
	$(WGET) $(THEORA_URL)
749
750

libtheora: libtheora-$(THEORA_VERSION).tar.bz2
751
	$(EXTRACT_BZ2)
752
ifdef HAVE_DARWIN_OS
753
754
755
756
757
ifdef HAVE_DARWIN_OS_ON_INTEL
	patch -p0 < Patches/theora_mac_intel32.patch
else
	patch -p0 < Patches/theora_mac_ppc.patch
endif
758
endif
759
	patch -p0 < Patches/libtheora-includes.patch
760
761
762
ifdef HAVE_WIN32
	patch -p0 < Patches/theora-doc.patch
endif
763

764
THEORACONF = --disable-sdltest --disable-oggtest --disable-vorbistest --disable-examples
765
766
767
ifdef HAVE_WIN32
THEORACONF += --disable-docs
endif
768

769
ifdef HAVE_DARWIN_64
770
771
THEORACONF += --disable-asm
endif
772
773
774
ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
775

776
.theora: libtheora .ogg
777
778
779
780
781
782
783
784
785
786
787
788
ifdef HAVE_DARWIN_OS
	cd $<; $(HOSTCC) ./autogen.sh $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF)
endif
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
789
790
	$(INSTALL_NAME)
	touch $@
791
792
793
794
795

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

hartman's avatar
hartman committed
796
797
798
799
800
# ***************************************************************************
# shout
# ***************************************************************************

libshout-$(SHOUT_VERSION).tar.gz:
801
	$(WGET) $(SHOUT_URL)
hartman's avatar
hartman committed
802
803

libshout: libshout-$(SHOUT_VERSION).tar.gz
804
	$(EXTRACT_GZ)
Christophe Mutricy's avatar
Christophe Mutricy committed
805
ifdef HAVE_WIN32
806
	patch -p0 < Patches/libshout-win32.patch
Christophe Mutricy's avatar
Christophe Mutricy committed
807
endif
ivoire's avatar
ivoire committed
808

809
.shout: libshout .theora .ogg .speex .vorbis
810
811
812
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) &&  make && make install )
	$(INSTALL_NAME)
	touch $@
hartman's avatar
hartman committed
813
814
815
816
817

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

818
819
820
821
822
# ***************************************************************************
# flac
# ***************************************************************************

flac-$(FLAC_VERSION).tar.gz:
823
	$(WGET) $(FLAC_URL)
824
825

flac: flac-$(FLAC_VERSION).tar.gz
826
	$(EXTRACT_GZ)
827
ifdef HAVE_WIN32
828
	patch -p0 < Patches/flac-win32.patch
829
endif
830
ifdef HAVE_DARWIN_OS
Felix Paul Kühne's avatar
Felix Paul Kühne committed
831
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
832
endif
833
834

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

ivoire's avatar
ivoire committed
836
.flac: flac .ogg
837
ifdef HAVE_WIN32
838
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(FLAC_DISABLE_FLAGS) && cd src&& make -C libFLAC&& make -C libFLAC install && cd .. && make -C include install)
839
else
840
ifdef HAVE_DARWIN_OS
841
ifdef HAVE_DARWIN_OS_ON_INTEL
842
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm-optimizations && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
843
else
844
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(FLAC_DISABLE_FLAGS) && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
845
endif
846
else
847
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  $(FLAC_DISABLE_FLAGS) && cd src && make -C libFLAC && make -C libFLAC install  && cd .. && make -C include install)
848
endif
849
endif
850
851
	$(INSTALL_NAME)
	touch $@
852

damienf's avatar
damienf committed
853
CLEAN_FILE += .flac
854
855
856
857
858
859
860
861
CLEAN_PKG += flac
DISTCLEAN_PKG += flac-$(FLAC_VERSION).tar.gz

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

speex-$(SPEEX_VERSION).tar.gz:
862
	$(WGET) $(SPEEX_URL)
863
864

speex: speex-$(SPEEX_VERSION).tar.gz
865
866
	$(EXTRACT_GZ)
	patch -p0 < Patches/speex.patch
867
868

.speex: speex
869
870
871
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --enable-ogg=no && make && make install)
	$(INSTALL_NAME)
	touch $@
872
873
874
875
876
877
878
879
880

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

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

881
faad2-$(FAAD2_VERSION).tar.gz:
882
	$(WGET) $(FAAD2_URL)
883

884
885
faad2: faad2-$(FAAD2_VERSION).tar.gz
	$(EXTRACT_GZ)
886
	(cd $@; echo|$(HOSTCC) -iquote . -E - || sed -i 's/-iquote /-I/' libfaad/Makefile.am; sh ./bootstrap)
887
	patch -p0 < Patches/faad-arm-fixed.patch
888

889
.faad: faad2
890
	(cd $< && $(HOSTCC) ./configure $(HOSTCONF) --disable-shared --prefix=$(PREFIX) CFLAGS="-O3" && sed -i.orig "s/shrext_cmds/shrext/g" libtool && make -C libfaad && make -C libfaad install)
891
	touch $@
892
893

CLEAN_FILE += .faad
894
895
CLEAN_PKG += faad2
DISTCLEAN_PKG += faad2-$(FAAD2_VERSION).tar.gz
896
897
898
899
900
901

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

lame-$(LAME_VERSION).tar.gz:
902
	$(WGET) $(LAME_URL)
903
904

lame: lame-$(LAME_VERSION).tar.gz
905
	$(EXTRACT_GZ)
906
907

.lame: lame
908
909
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-analyser-hooks --disable-decoder --disable-shared --disable-gtktest --disable-frontend && make && make install)
	touch $@
910
911
912
913
914
915
916
917
918
919

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

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

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

libebml: libebml-$(LIBEBML_VERSION).tar.bz2
923
	$(EXTRACT_BZ2)
924
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
925
	(cd $@; patch -p0 < ../Patches/libebml-svn-win32.patch)
926
endif
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
927
ifdef HAVE_WIN64
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
928
	patch -p0 < Patches/libebml-win64.patch
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
929
endif
930
931

.ebml: libebml
932
ifdef HAVE_WIN32
933
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC2) CFLAGS="$(CFLAGS) -DWIN32" SHARED=no && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC2))
934
else
935
936
	(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
937
endif
938
	touch $@
939

940
941
942
943
944
945
946
947
CLEAN_FILE += .ebml
CLEAN_PKG += libebml
DISTCLEAN_PKG += libebml-$(LIBEBML_VERSION).tar.bz2

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

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

951
libmatroska: libmatroska-$(LIBMATROSKA_VERSION).tar.bz2
952
	$(EXTRACT_BZ2)
hartman's avatar
hartman committed
953
	patch -p0 < ./Patches/libmatroska-kaxblock.patch
954
ifdef HAVE_WIN32
Rafaël Carré's avatar
Rafaël Carré committed
955
	(cd $@; patch -p0 < ../Patches/libmatroska-win32.patch)
956
endif
957

958
959
.matroska: libmatroska .ebml
ifdef HAVE_WIN32
960
	(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))
961
else
962
963
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
	$(RANLIB) $(PREFIX)/lib/libmatroska.a
964
endif
965
	touch $@
966

967

968
969
970
971
972
CLEAN_FILE += .matroska
CLEAN_PKG += libmatroska
DISTCLEAN_PKG += libmatroska-$(LIBMATROSKA_VERSION).tar.bz2

# ***************************************************************************
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
# 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
1007
DISTCLEAN_PKG += amrwb-$(LIBAMR_WB_VERSION).tar.bz2
1008
1009
1010

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

1011
1012
1013
# ffmpeg
# ***************************************************************************

1014
ifdef SVN
1015
ffmpeg:
1016
	$(SVN) co $(FFMPEG_SVN) ffmpeg
1017
1018
1019
ifdef HAVE_ISA_THUMB
	patch -p0 < Patches/ffmpeg-avcodec-no-thumb.patch
endif
gbazin's avatar
gbazin committed
1020
ifdef HAVE_WINCE
Rafaël Carré's avatar
Rafaël Carré committed
1021
	patch -p1 < Patches/ffmpeg-svn-wince.patch
gbazin's avatar
gbazin committed
1022
endif
1023
ifdef HAVE_DARWIN_OS
1024
ifdef HAVE_DARWIN_OS_ON_INTEL
1025
	(cd $@; patch -p0 < ../Patches/ffmpeg-macosx-intel-mmx.patch)
1026
else
1027
	(cd $@; patch -p0 < ../Patches/ffmpeg-darwin-ppc-mdynamic.patch) 
1028
endif
Rémi Denis-Courmont's avatar