Makefile 78.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 --arch=x86 --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+= --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
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
FFMPEGCONF+= --target-os=linux
173
ifdef HAVE_MAEMO
174
175
176
ifneq ($(filter -m%=cortex-a8, $(EXTRA_CFLAGS)),)
FFMPEGCONF += --disable-runtime-cpudetect --enable-neon --cpu=cortex-a8
endif
177
178
179
180
# 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
181
FFMPEGCONF += --enable-pic
182
183
184
X264CONF += --enable-pic
endif

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

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

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

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

FORCE:

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

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

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

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

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

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

255
256
257
258
# ***************************************************************************
# autoconf
# ***************************************************************************

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

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

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

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

273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# ***************************************************************************
# 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

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

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

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

CLEAN_FILE += .cmake
CLEAN_PKG += cmake

311
312
313
314
315
# ***************************************************************************
# libtool
# ***************************************************************************

ifdef HAVE_DARWIN_OS
316
317
318
319
320
321
322
323
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)
324
325
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
326
	touch $@
327
328
329

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

332
333
334
335
336
337
338
endif

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

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

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

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

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

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

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

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

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

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

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

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

gettext: gettext-$(GETTEXT_VERSION).tar.gz
379
	$(EXTRACT_GZ)
VideoLAN's avatar
VideoLAN committed
380
381
382
ifdef HAVE_DARWIN_OS
	patch -p0 < Patches/gettext-macosx.patch
endif
383

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

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

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

libiconv-$(LIBICONV_VERSION).tar.gz:
418
	$(WGET) $(LIBICONV_URL)
419
420

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

430
431
432
433
434
libiconv-snowleopard.tar.bz2:
	$(WGET) $(LIBICONVMAC_URL)

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

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

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

456
457
458
459
460
461
462
# ***************************************************************************
# fontconfig
# ***************************************************************************

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

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

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

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

494
495
496
497
498
# ***************************************************************************
# freetype2
# ***************************************************************************

freetype-$(FREETYPE2_VERSION).tar.gz:
499
	$(WGET) $(FREETYPE2_URL)
500
501

freetype2: freetype-$(FREETYPE2_VERSION).tar.gz
502
	$(EXTRACT_GZ)
503
504

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

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

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

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

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

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

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

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

a52dec-$(A52DEC_VERSION).tar.gz:
539
	$(WGET) $(A52DEC_URL)
540
541

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

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

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

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

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

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

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

CLEAN_FILE += .mpeg2
Christophe Mutricy's avatar
Christophe Mutricy committed
573
574
CLEAN_PKG += libmpeg2
DISTCLEAN_PKG += libmpeg2-$(LIBMPEG2_VERSION).tar.gz
575

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

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

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
619
620
# ***************************************************************************
# 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)
621
622
623
ifdef HAVE_DARWIN_OS
	(cd $@; sed -e 's%gcc%$(CC)%' -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -i.orig  src/Makefile)
endif
624
625

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

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

640
641
642
643
644
# ***************************************************************************
# libmad
# ***************************************************************************

libmad-$(LIBMAD_VERSION).tar.gz:
645
	$(WGET) $(LIBMAD_URL)
646
647

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

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

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

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

libogg-$(OGG_VERSION).tar.gz:
667
	$(WGET) $(OGG_URL)
668
669

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

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

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

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

libvorbis-$(VORBIS_VERSION).tar.gz:
692
	$(WGET) $(VORBIS_URL)
693
694

libvorbis: libvorbis-$(VORBIS_VERSION).tar.gz
695
	$(EXTRACT_GZ)
696
	patch -p0 < Patches/vorbis-noapps.patch
697
698

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

.vorbisenc: .vorbis .ogg
704
705
#	$(INSTALL_NAME)
	touch $@
706
707
708
709
710

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

gbazin's avatar
gbazin committed
711
712
713
714
715
# ***************************************************************************
# tremor
# ***************************************************************************

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

tremor: tremor-$(TREMOR_VERSION).tar.bz2
727
	$(EXTRACT_BZ2)
gbazin's avatar
gbazin committed
728
729
730
endif

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

735
736
ifdef SVN
tremor-source: tremor
737
	tar cv --exclude=.svn tremor | bzip2 > tremor-$(DATE).tar.bz2
738
739
740
741

SOURCE += tremor-source
endif

gbazin's avatar
gbazin committed
742
743
CLEAN_FILE += .tremor
CLEAN_PKG += tremor
744
#DISTCLEAN_PKG += tremor-$(TREMOR_VERSION).tar.bz2 #no tremor snapshot
gbazin's avatar
gbazin committed
745

746
747
748
749
750
# ***************************************************************************
# theora
# ***************************************************************************

libtheora-$(THEORA_VERSION).tar.bz2:
751
	$(WGET) $(THEORA_URL)
752
753

libtheora: libtheora-$(THEORA_VERSION).tar.bz2
754
	$(EXTRACT_BZ2)
755
	patch -p0 < Patches/libtheora-includes.patch
756

757
758
THEORACONF = --disable-sdltest --disable-oggtest --disable-vorbistest --disable-examples

759
ifdef HAVE_DARWIN_64
760
761
THEORACONF += --disable-asm
endif
762
763
764
ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
765

766
.theora: libtheora .ogg
767
ifdef HAVE_DARWIN_OS
768
769
	cd $<; ($(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF) && make && make install)
else
770
771
772
773
774
775
776
777
778
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
779
endif
780
781
	$(INSTALL_NAME)
	touch $@
782
783
784
785
786

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

hartman's avatar
hartman committed
787
788
789
790
791
# ***************************************************************************
# shout
# ***************************************************************************

libshout-$(SHOUT_VERSION).tar.gz:
792
	$(WGET) $(SHOUT_URL)
hartman's avatar
hartman committed
793
794

libshout: libshout-$(SHOUT_VERSION).tar.gz
795
	$(EXTRACT_GZ)
Christophe Mutricy's avatar
Christophe Mutricy committed
796
ifdef HAVE_WIN32
797
	patch -p0 < Patches/libshout-win32.patch
Christophe Mutricy's avatar
Christophe Mutricy committed
798
endif
ivoire's avatar
ivoire committed
799

800
.shout: libshout .theora .ogg .speex .vorbis
801
802
803
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) &&  make && make install )
	$(INSTALL_NAME)
	touch $@
hartman's avatar
hartman committed
804
805
806
807
808

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

809
810
811
812
813
# ***************************************************************************
# flac
# ***************************************************************************

flac-$(FLAC_VERSION).tar.gz:
814
	$(WGET) $(FLAC_URL)
815
816

flac: flac-$(FLAC_VERSION).tar.gz
817
	$(EXTRACT_GZ)
818
ifdef HAVE_WIN32
819
	patch -p0 < Patches/flac-win32.patch
820
endif
821
ifdef HAVE_DARWIN_OS
Felix Paul Kühne's avatar
Felix Paul Kühne committed
822
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
823
endif
824
825

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

ivoire's avatar
ivoire committed
827
.flac: flac .ogg
828
ifdef HAVE_DARWIN_OS_ON_INTEL
829
830
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm-optimizations $(FLAC_DISABLE_FLAGS)
831
else
832
833
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  $(FLAC_DISABLE_FLAGS)
834
endif
835
	cd $</src && \
836
837
	make -C libFLAC && \
	echo 'Requires.private: ogg' >> libFLAC/flac.pc && \
838
839
	make -C libFLAC install
	cd $< && make -C include install
840
841
	$(INSTALL_NAME)
	touch $@
842

damienf's avatar
damienf committed
843
CLEAN_FILE += .flac
844
845
846
847
848
849
850
851
CLEAN_PKG += flac
DISTCLEAN_PKG += flac-$(FLAC_VERSION).tar.gz

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

speex-$(SPEEX_VERSION).tar.gz:
852
	$(WGET) $(SPEEX_URL)
853
854

speex: speex-$(SPEEX_VERSION).tar.gz
855
856
	$(EXTRACT_GZ)
	patch -p0 < Patches/speex.patch
857
858

.speex: speex
859
860
861
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --enable-ogg=no && make && make install)
	$(INSTALL_NAME)
	touch $@
862
863
864
865
866
867
868
869
870

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

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

871
faad2-$(FAAD2_VERSION).tar.gz:
872
	$(WGET) $(FAAD2_URL)
873

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

879
.faad: faad2
Rafaël Carré's avatar
Rafaël Carré committed
880
	(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)
881
	touch $@
882
883

CLEAN_FILE += .faad
884
885
CLEAN_PKG += faad2
DISTCLEAN_PKG += faad2-$(FAAD2_VERSION).tar.gz
886

887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
# ***************************************************************************
# libebml
# ***************************************************************************

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

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

.ebml: libebml
ifdef HAVE_WIN32
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC) SHARED=no && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC))
else
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
	$(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
	(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))
else
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
	$(RANLIB) $(PREFIX)/lib/libmatroska.a
endif
	touch $@


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

934
935
936
937
938

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

939
940
#ibvpx-$(VPX_VERSION).tar.bz2:
#$(WGET) $(VPX_URL)
941

942
943
libvpx: 
	$(GIT) clone git://review.webmproject.org/libvpx.git
944
945
946

ifdef HAVE_WIN32
VPX_TARGET=x86-win32-gcc
947
CROSS=
948
else
949
950
951
952
953
954
955
956
957
958
959
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
960
961
VPX_TARGET=FIXME
endif
962
endif
963

964
.libvpx: libvpx
965
	(cd $<; CROSS=$(HOST)- ./configure --target=$(VPX_TARGET) --disable-install-bins --disable-install-srcs --disable-install-libs --disable-examples && make && make install)
966
967
	(rm -rf $(PREFIX)/include/vpx/ && mkdir $(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?
	rm $(PREFIX)/include/vpx/config.h
968
	(cd $<; $(RANLIB) libvpx.a && cp libvpx.a $(PREFIX)/lib) # Of course, why the hell would one expect it to be listed or in make install?
969
970
	touch $@

971
972
973
CLEAN_FILE += .libvpx
CLEAN_PKG += libvpx
#DISTCLEAN_PKG += libvpx-$(VPX_VERSION).tar.bz2
974

975
976
977
978
979
# ***************************************************************************
# lame
# ***************************************************************************

lame-$(LAME_VERSION).tar.gz:
980
	$(WGET) $(LAME_URL)
981
982

lame: lame-$(LAME_VERSION).tar.gz
983
	$(EXTRACT_GZ)
984
985

.lame: lame
986
987
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-analyser-hooks --disable-decoder --disable-shared --disable-gtktest --disable-frontend && make && make install)
	touch $@
988
989
990
991
992
993
994

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


# ***************************************************************************
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
1023
1024
1025
1026
1027
1028
# 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
1029
DISTCLEAN_PKG += amrwb-$(LIBAMR_WB_VERSION).tar.bz2
1030
1031
1032

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

1033
1034
1035
# ffmpeg
# ***************************************************************************

1036
ifdef SVN
1037
1038
1039
ifdef HAVE_WIN32
ffmpeg: .dshow_headers
else
1040
ffmpeg:
1041
endif
1042
	$(SVN) co $(FFMPEG_SVN) ffmpeg
1043
1044
1045
ifdef HAVE_ISA_THUMB
	patch -p0 < Patches/ffmpeg-avcodec-no-thumb.patch
endif
1046
1047
1048
ifdef HAVE_WIN64
	(cd ffmpeg/libswscale; patch -p0 < ../../Patches/ffmpeg-win64.patch;)
endif
1049
ifdef HAVE_UCLIBC
1050
1051
	patch -p0 < Patches/ffmpeg-svn-uclibc.patch
	patch -p0 < Patches/ffmpeg-svn-internal-define.patch
1052
	patch -p0 < Patches/ffmpeg-svn-libavformat.patch
1053
endif
1054
1055
1056
ifdef HAVE_WIN32
	sed -i "s/std=c99/std=gnu99/" ffmpeg/configure
endif
1057
else
1058
ffmpeg-$(FFMPEG_VERSION).tar.gz: