contrib-src.mak 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 - 2011 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
#ifdef HAVE_DARWIN_OS
export PATH := $(PREFIX)/bin:$(EXTRA_PATH):/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:
Felix Paul Kühne's avatar
Felix Paul Kühne committed
40
#else
41
export PATH := $(PREFIX)/bin:$(EXTRA_PATH):$(PATH)
Felix Paul Kühne's avatar
Felix Paul Kühne committed
42
#endif
43
export PKG_CONFIG_PATH
44
export PKG_CONFIG_LIBDIR = $(PREFIX)/lib/pkgconfig
45
export MACOSX_DEPLOYMENT_TARGET = $(SDK_TARGET)
46
export LIBRARY_PATH := $(PREFIX)/lib:$(LIBRARY_PATH)
47
export LD_LIBRARY_PATH := $(PREFIX)/lib:$(LD_LIBRARY_PATH)
48
49
50
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)
51
export LDFLAGS = -L$(PREFIX)/lib $(EXTRA_LDFLAGS)
52
export ACLOCAL = aclocal -I$(PREFIX)/share/aclocal
Pierre's avatar
Pierre committed
53
ifdef HAVE_MACOSX
54
55
56
57
export CC
export CXX
export LD
endif
58
59
60
61
62
63
64
65

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

66
67
68
69
70
71
ifneq ($(CC),)
HOSTCC+= CC="$(CC)"
endif
ifneq ($(CXX),)
HOSTCC+= CXX="$(CXX)"
endif
72
73
74
ifneq ($(LD),)
HOSTCC+= LD="$(LD)"
endif
75
76
77
78
79
80
ifneq ($(RANLIB),)
HOSTCC+= RANLIB="$(RANLIB)"
endif
ifneq ($(AR),)
HOSTCC+= AR="$(AR)"
endif
81
82
83
84
ifneq ($(STRIP),)
HOSTCC+= STRIP="$(STRIP)"
endif

85

86
87
88
89
90
# Define ranlib on non-cross compilation setups
ifeq ($(RANLIB),)
RANLIB=ranlib
endif

91
92
93
# For libebml/libmatroska. Grrr.
ifneq ($(AR),)
HOSTCC2=$(HOSTCC) AR="$(AR) rcvu"
94
95
else
HOSTCC2=$(HOSTCC)
96
97
endif

Rafaël Carré's avatar
Rafaël Carré committed
98
99
# Just a shortcut for readability
ENABLED=1
100

101
# cross compiling
102
103
#This should be inside the if block but some config scripts are buggy
HOSTCONF=--target=$(HOST) --host=$(HOST) --build=$(BUILD) --program-prefix=""
104
105
106
107
108
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
    #
109
    ifndef HAVE_CYGWIN
110
111
112
113
		# We are REALLY cross compiling
		HAVE_CROSS_COMPILE=y
        ifndef HAVE_IOS
			HAVE_CROSS_COMPILE_NEEDS_CROSS_PREFIX=y
Pierre's avatar
Pierre committed
114
        endif
115
116
    else
        # We are compiling for MinGW on Cygwin
117
    endif
118
endif
119
120

#
121
# Special target-dependant options
122
#
123
ifdef HAVE_WIN32
124
HOSTCONF+= --without-pic --disable-shared --disable-dependency-tracking
125
endif
gbazin's avatar
gbazin committed
126
127
128

ifdef HAVE_WINCE
HOSTCONF+= --without-pic --disable-shared
129
130
endif

131

132
ifdef HAVE_LINUX
133
134
135
136
137
ifdef HAVE_MAEMO
# 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
138
139
endif

140

141
142
143
144
ifdef HAVE_ISA_THUMB
NOTHUMB ?= -mno-thumb
endif

145
146
DATE=`date +%Y-%m-%d`

147
148
149
# ***************************************************************************
# Standard rules
# ***************************************************************************
150
# Generated by ./bootstrap from default configuration in src/Distributions
ivoire's avatar
ivoire committed
151
#
152
include ../distro.mak
153
154
155
156
157
158
159
160

FORCE:

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

define EXTRACT_GZ
161
	rm -rf $@ || true
ivoire's avatar
ivoire committed
162
	gunzip -c $< | tar xf - --exclude='[*?:<>\|]'
163
164
	mv $(patsubst %.tar.gz,%,$(patsubst %.tgz,%,$(notdir $<))) $@ || true
	touch $@
165
166
167
endef

define EXTRACT_BZ2
168
	rm -rf $@ || true
ivoire's avatar
ivoire committed
169
	bunzip2 -c $< | tar xf - --exclude='[*?:<>\|]'
170
171
	mv $(patsubst %.tar.bz2,%,$(notdir $<)) $@ || true
	touch $@
172
173
endef

174
define EXTRACT_ZIP
175
176
177
178
	rm -rf $@ || true
	unzip $<
	mv $(patsubst %.zip,%,$(notdir $<)) $@ || true
	touch $@
179
180
endef

181
182
183
184
185
### 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 :
186
# .toto: toto_.tata
187
188
189
190
191
#	cd $< ; ./configure --prefix=$(PREFIX)
#	$(MAKE) -C $<
#	$(MAKE) -C $< install
#	$(INSTALL_NAME)
#	touch $@
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# ***************************************************************************
# 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

209
210
211
# ***************************************************************************
# CMake
# ***************************************************************************
Rafaël Carré's avatar
Rafaël Carré committed
212
213
214
215
216
cmake-$(CMAKE_VERSION).tar.gz:
	$(WGET) $(CMAKE_URL)

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

218
.cmake: cmake
219
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
220
221
222
223
224
	touch $@

CLEAN_FILE += .cmake
CLEAN_PKG += cmake

225
226
227
228
# ***************************************************************************
# libtool
# ***************************************************************************

Pierre's avatar
Pierre committed
229
ifdef HAVE_MACOSX
230
231
232
233
234
235
236
libtool-$(LIBTOOL_VERSION).tar.gz:
	$(WGET) $(LIBTOOL_URL)

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

.libtool: libtool
237
	(cd $<; ./configure --prefix=$(PREFIX) && make && make install)
238
239
	ln -sf libtool $(PREFIX)/bin/glibtool
	ln -sf libtoolize $(PREFIX)/bin/glibtoolize
240
	touch $@
241
242
243

CLEAN_PKG += libtool
DISTCLEAN_PKG += libtool-$(LIBTOOL_VERSION).tar.gz
244
245
CLEAN_FILE += .libtool

246
247
endif

248
# ***************************************************************************
249
# autotools
250
251
# ***************************************************************************

252
253
254
255
256
257
258
259
260
261
262
263
264
265
autoconf-$(AUTOCONF_VERSION).tar.bz2:
	$(WGET) $(AUTOCONF_URL)

autoconf: autoconf-$(AUTOCONF_VERSION).tar.bz2
	$(EXTRACT_BZ2)

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

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

266
267
268
269
270
271
automake-$(AUTOMAKE_VERSION).tar.gz:
	$(WGET) $(AUTOMAKE_URL)

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

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

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

280
281
282
283
# ***************************************************************************
# pkgconfig
# ***************************************************************************

284
pkg-config-$(PKGCFG_VERSION).tar.gz:
285
	$(WGET) $(PKGCFG_URL)
286

287
pkgconfig: pkg-config-$(PKGCFG_VERSION).tar.gz
288
	$(EXTRACT_GZ)
289
	(cd $@; autoconf)
290
291

.pkgcfg: pkgconfig
292
	(cd pkgconfig; ./configure --prefix=$(PREFIX) --disable-shared --enable-static && make && make install)
293
	touch $@
294
295
296

CLEAN_FILE += .pkgcfg
CLEAN_PKG += pkgconfig
297
DISTCLEAN_PKG += pkg-config-$(PKGCFG_VERSION).tar.gz
298
299
300
301
302
303

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

gettext-$(GETTEXT_VERSION).tar.gz:
304
	$(WGET) $(GETTEXT_URL)
305
306

gettext: gettext-$(GETTEXT_VERSION).tar.gz
307
	$(EXTRACT_GZ)
Pierre's avatar
Pierre committed
308
ifdef HAVE_MACOSX
VideoLAN's avatar
VideoLAN committed
309
310
	patch -p0 < Patches/gettext-macosx.patch
endif
311

312
.intl: gettext
313
ifdef HAVE_WIN32
314
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-relocatable --disable-java --disable-native-java)
315
else
316
	( cd $< && $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-java --disable-native-java --without-emacs)
317
endif
318
ifneq ($(HOST),$(BUILD))
319
320
  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
321
	( cd $< && make -C gettext-runtime/intl && make -C gettext-runtime/intl install && make -C gettext-tools/misc install )
322
323
  else
    # We are compiling for MinGW on Cygwin -- build the full current gettext
324
	( cd $< && make && make install )
325
  endif
326
327
else
# Build and install the whole gettext
328
	( cd $< && make && make install )
329
330
331
endif
# Work around another non-sense of autoconf.
ifdef HAVE_WIN32
332
	(cd $(PREFIX)/include; sed -i.orig '314 c #if 0' libintl.h)
333
endif
334
335
	$(INSTALL_NAME)
	touch $@
336
337
338
339
340
341
342
343
344
345

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

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

libiconv-$(LIBICONV_VERSION).tar.gz:
346
	$(WGET) $(LIBICONV_URL)
347
348

libiconv: libiconv-$(LIBICONV_VERSION).tar.gz
349
	$(EXTRACT_GZ)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
350
351
ifdef HAVE_WIN64
	patch -p0 < Patches/libiconv-win64.patch
352
endif
353
354
355
356
ifdef HAVE_WINCE
	patch -p0 < Patches/libiconv-wince.patch
	patch -p0 < Patches/libiconv-wince-hack.patch
endif
357

358
359
360
361
362
libiconv-snowleopard.tar.bz2:
	$(WGET) $(LIBICONVMAC_URL)

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

Pierre's avatar
Pierre committed
364
365
ifdef HAVE_MACOSX
ifdef HAVE_MACOSX_DARWIN_10
366
.iconv-from-os: libiconv-snowleopard
367
	(cd libiconv-snowleopard && cp libiconv.* $(PREFIX)/lib/)
368
369
	touch $@
else
370
.iconv-from-os:
371
	touch $@
372
endif
373
374
endif

375
.iconv: libiconv
376
	(cd libiconv; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-nls && make && make install)
377
378
	$(INSTALL_NAME)
	touch $@
379

380
CLEAN_FILE += .iconv .iconv-from-os
381
382
383
CLEAN_PKG += libiconv
DISTCLEAN_PKG += libiconv-$(LIBICONV_VERSION).tar.gz

384
385
386
387
388
389
390
# ***************************************************************************
# fontconfig
# ***************************************************************************

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

391
fontconfig: fontconfig-$(FONTCONFIG_VERSION).tar.gz Patches/fontconfig.patch
392
	$(EXTRACT_GZ)
393
	patch -p0 < Patches/fontconfig-march.patch
394
	patch -p0 < Patches/fontconfig-nodocs.patch
395
396
ifdef HAVE_WIN32
	patch -p0 < Patches/fontconfig.patch
397
	patch -p0 < Patches/fontconfig-noxml2.patch
398
	(cd $@; autoreconf -ivf)
399
endif
400

401
402
403
404
405
406
407
FONTCONFIG_BASE_CONF = --prefix=$(PREFIX) \
					   --with-freetype-config=$(PREFIX)/bin/freetype-config \
					   --enable-libxml2 \
					   --disable-docs

FONTCONFIG_CONF-$(ENABLED)      = $(HOSTCONF) $(FONTCONFIG_BASE_CONF)
FONTCONFIG_CONF-$(HAVE_MACOSX) += $(HOSTCONF) \
408
	--with-cache-dir=~/Library/Caches/fontconfig \
409
410
411
412
413
414
415
416
	--with-confdir=/usr/X11/lib/X11/fonts \
	--with-default-fonts=/System/Library/Fonts \
	--with-add-fonts=/Library/Fonts,~/Library/Fonts  \
	--with-arch=$(ARCH)

FONTCONFIG_CONF-$(HAVE_WIN32)   = --with-arch=i686 $(FONTCONFIG_BASE_CONF)
ifndef HAVE_CYGWIN
FONTCONFIG_CONF-$(HAVE_WIN32)  += $(HOSTCONF)
417
endif
418
419
420
421
422
423
424
425
FONTCONFIG_CONF-$(HAVE_CYGWIN) += --target=$(HOST) --disable-pic --disable-shared

FONTCONFIG_ENV-$(ENABLED)         = $(HOSTCC) LIBXML2_CFLAGS=`$(PREFIX)/bin/xml2-config --cflags`
FONTCONFIG_ENV-$(HAVE_MACOSX)     = $(HOSTCC) LIBXML2_CFLAGS=`xml2-config --cflags` LIBXML2_LIBS=`xml2-config --libs`
FONTCONFIG_ENV-$(HAVE_WIN32)      = $(HOSTCC)
FONTCONFIG_ENV-$(HAVE_CYGWIN)     =

FONTCONFIG_INSTALL-$(ENABLED)     = make install
426
FONTCONFIG_INSTALL-$(HAVE_MACOSX) = make install-exec && (cd fontconfig ; make install-data) && cp fontconfig.pc $(PKG_CONFIG_LIBDIR) && sed -e 's%/usr/lib/libiconv.la%%' -i.orig $(PREFIX)/lib/libfontconfig.la
427
428
429

.fontconfig: fontconfig .xml .freetype
	(cd $<; $(FONTCONFIG_ENV-1) ./configure $(FONTCONFIG_CONF-1) && make && $(FONTCONFIG_INSTALL-1))
430
431
432
433
434
435
436
	$(INSTALL_NAME)
	touch $@

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

437
438
439
440
441
# ***************************************************************************
# freetype2
# ***************************************************************************

freetype-$(FREETYPE2_VERSION).tar.gz:
442
	$(WGET) $(FREETYPE2_URL)
443
444

freetype2: freetype-$(FREETYPE2_VERSION).tar.gz
445
	$(EXTRACT_GZ)
446
447

.freetype: freetype2
448
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
449
450
	$(INSTALL_NAME)
	touch $@
451
452
453
454
455
456
457
458
459

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

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

damienf's avatar
damienf committed
460
fribidi-$(FRIBIDI_VERSION).tar.gz:
461
	$(WGET) $(FRIBIDI_URL)
462

damienf's avatar
damienf committed
463
464
fribidi: fribidi-$(FRIBIDI_VERSION).tar.gz
	$(EXTRACT_GZ)
465
	patch -p0 < Patches/fribidi.patch
466
	( cd $@; rm -f configure; ./bootstrap)
467

468
469
470
ifdef HAVE_MACOSX
.fribidi: fribidi .iconv-from-os
else
471
.fribidi: fribidi .iconv
472
endif
473
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  && make && make install)
474
475
	$(INSTALL_NAME)
	touch $@
476
477
478

CLEAN_FILE += .fribidi
CLEAN_PKG += fribidi
damienf's avatar
damienf committed
479
DISTCLEAN_PKG += fribidi-$(FRIBIDI_VERSION).tar.gz
480
481
482
483
484
485

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

a52dec-$(A52DEC_VERSION).tar.gz:
486
	$(WGET) $(A52DEC_URL)
487
488

a52dec: a52dec-$(A52DEC_VERSION).tar.gz
489
	$(EXTRACT_GZ)
490
ifeq ($(ARCH),armel)
491
492
	(cd $@ ; patch -p0 < ../Patches/liba52-fixed.diff)
endif
493
494
495
ifdef HAVE_WIN64
	(cd $@ ; autoreconf -if)
endif
496
497

.a52: a52dec
498
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && cd liba52 && make && make install && cd ../include && make && make install)
499
	touch $@
500
501
502
503
504
505
506
507
508

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

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

Christophe Mutricy's avatar
Christophe Mutricy committed
509
510
libmpeg2-$(LIBMPEG2_VERSION).tar.gz:
	$(WGET) $(LIBMPEG2_URL)
511

Christophe Mutricy's avatar
Christophe Mutricy committed
512
libmpeg2: libmpeg2-$(LIBMPEG2_VERSION).tar.gz
513
	$(EXTRACT_GZ)
514
	patch -p0 < Patches/libmpeg2-arm-pld.patch
515
516
	cd libmpeg2 && patch -p0 < ../Patches/libmpeg2-mc-neon.patch
	cd libmpeg2 && ./bootstrap
517

Christophe Mutricy's avatar
Christophe Mutricy committed
518
.mpeg2: libmpeg2
519
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --without-x --disable-sdl && cd libmpeg2 && make && make install && cd ../include && make && make install)
520
	touch $@
521
522

CLEAN_FILE += .mpeg2
Christophe Mutricy's avatar
Christophe Mutricy committed
523
524
CLEAN_PKG += libmpeg2
DISTCLEAN_PKG += libmpeg2-$(LIBMPEG2_VERSION).tar.gz
525

526
527
528
529
530
531
532
533
534
535
536
# ***************************************************************************
# pcre
# ***************************************************************************

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

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

.pcre: pcre
537
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-shared && make && make install )
538
539
540
541
542
543
	touch $@

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

544
545
546
547
# ***************************************************************************
# lua
# ***************************************************************************

548
549
550
551
552
LUA_MAKEPLATEFORM-$(ENABLED)=generic
LUA_MAKEPLATEFORM-$(HAVE_BSD)=bsd
LUA_MAKEPLATEFORM-$(HAVE_LINUX)=linux
LUA_MAKEPLATEFORM-$(HAVE_MACOSX)=macosx
LUA_MAKEPLATEFORM-$(HAVE_WIN32)=mingw
553
554
555
556
557
558

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

lua: lua-$(LUA_VERSION).tar.gz
	$(EXTRACT_GZ)
Pierre's avatar
Pierre committed
559
ifdef HAVE_MACOSX
560
561
	(cd $@; sed -e 's%gcc%$(CC)%' -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -i.orig  src/Makefile)
endif
562
563

.lua: lua
564
ifdef HAVE_WIN32
565
	( cd $< && sed -i.orig 's/lua luac/lua.exe/' Makefile && cd src && sed -i.orig 's/CC=/#CC=/' Makefile && sed -i 's/=strip/=$(STRIP)/;s/= ranlib/= $(RANLIB)/' Makefile && cd ../..)
566
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM-1)&& cd src&& $(HOSTCC) make liblua.a&& cd ..&&$(HOSTCC) make install INSTALL_TOP=$(PREFIX)&& $(RANLIB) $(PREFIX)/lib/liblua.a)
Christophe Mutricy's avatar
Christophe Mutricy committed
567
	(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
568
else
Christophe Mutricy's avatar
Christophe Mutricy committed
569
	(cd $<&& patch -p1) < Patches/lua-noreadline.patch
570
	(cd $<&& $(HOSTCC) make $(LUA_MAKEPLATEFORM-1) && make install INSTALL_TOP=$(PREFIX))
571
endif
572
573
574
575
576
577
	touch $@

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

578
579
580
581
582
# ***************************************************************************
# libmad
# ***************************************************************************

libmad-$(LIBMAD_VERSION).tar.gz:
583
	$(WGET) $(LIBMAD_URL)
584
585

libmad: libmad-$(LIBMAD_VERSION).tar.gz
586
	$(EXTRACT_GZ)
Pierre's avatar
Pierre committed
587
ifdef HAVE_MACOSX
588
	( cd $@; sed -e 's%-march=i486%$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
589
endif
590
591

.mad: libmad
592
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) CFLAGS="-O3 $(NOTHUMB)" && make && make install)
593
594
	$(INSTALL_NAME)
	touch $@
595
596
597
598
599
600
601
602
603
604

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

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

libogg-$(OGG_VERSION).tar.gz:
605
	$(WGET) $(OGG_URL)
606
607

libogg: libogg-$(OGG_VERSION).tar.gz
608
	$(EXTRACT_GZ)
Rafaël Carré's avatar
Rafaël Carré committed
609
	patch -p0 < Patches/libogg-1.1.patch
gbazin's avatar
gbazin committed
610
ifdef HAVE_WINCE
Rafaël Carré's avatar
Rafaël Carré committed
611
	patch -p0 < Patches/libogg-wince.patch
gbazin's avatar
gbazin committed
612
endif
613
	(cd $@; autoconf)
614
615

.ogg: libogg
616
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make install)
617
618
	$(INSTALL_NAME)
	touch $@
619
620
621
622
623
624
625
626
627
628

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

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

libvorbis-$(VORBIS_VERSION).tar.gz:
629
	$(WGET) $(VORBIS_URL)
630
631

libvorbis: libvorbis-$(VORBIS_VERSION).tar.gz
632
	$(EXTRACT_GZ)
633
	patch -p0 < Patches/vorbis-noapps.patch
634
635

.vorbis: libvorbis .ogg
636
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) && make && make install)
637
638
#	$(INSTALL_NAME)
	touch $@
639
640

.vorbisenc: .vorbis .ogg
641
642
#	$(INSTALL_NAME)
	touch $@
643
644
645
646
647

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

gbazin's avatar
gbazin committed
648
649
650
651
652
# ***************************************************************************
# tremor
# ***************************************************************************

ifdef SVN
ivoire's avatar
ivoire committed
653
tremor:
654
	$(SVN) co http://svn.xiph.org/trunk/Tremor tremor
655
	(cd $@ && patch -p0 < ../Patches/tremor.patch)
656
	(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
657
658
else
tremor-$(TREMOR_VERSION).tar.bz2:
659
660
	echo "tremor snapshot does not exist, you MUST use subversion !"
	exit -1
661
	$(WGET) $(TREMOR_URL)
gbazin's avatar
gbazin committed
662
663

tremor: tremor-$(TREMOR_VERSION).tar.bz2
664
	$(EXTRACT_BZ2)
gbazin's avatar
gbazin committed
665
666
667
endif

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

672
673
ifdef SVN
tremor-source: tremor
674
	tar cv --exclude=.svn tremor | bzip2 > tremor-$(DATE).tar.bz2
675
676
677
678

SOURCE += tremor-source
endif

gbazin's avatar
gbazin committed
679
680
CLEAN_FILE += .tremor
CLEAN_PKG += tremor
681
#DISTCLEAN_PKG += tremor-$(TREMOR_VERSION).tar.bz2 #no tremor snapshot
gbazin's avatar
gbazin committed
682

683
684
685
686
687
# ***************************************************************************
# theora
# ***************************************************************************

libtheora-$(THEORA_VERSION).tar.bz2:
688
	$(WGET) $(THEORA_URL)
689
690

libtheora: libtheora-$(THEORA_VERSION).tar.bz2
691
	$(EXTRACT_BZ2)
692
	patch -p0 < Patches/libtheora-includes.patch
693
694
695
ifdef HAVE_WIN64
	(cd $@ ; autoreconf -if -I m4)
endif
696

697
698
THEORACONF = --disable-sdltest --disable-oggtest --disable-vorbistest --disable-examples

Pierre's avatar
Pierre committed
699
ifdef HAVE_MACOSX64
700
701
THEORACONF += --disable-asm
endif
702
703
704
ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
705

706
.theora: libtheora .ogg
Pierre's avatar
Pierre committed
707
ifdef HAVE_MACOSX
708
	cd $<; ($(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) $(THEORACONF) && make && make install)
709
else
710
711
712
713
714
715
716
717
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
718
	cd $< && make && make install
719
endif
720
721
	$(INSTALL_NAME)
	touch $@
722
723
724
725
726

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

hartman's avatar
hartman committed
727
728
729
730
731
# ***************************************************************************
# shout
# ***************************************************************************

libshout-$(SHOUT_VERSION).tar.gz:
732
	$(WGET) $(SHOUT_URL)
hartman's avatar
hartman committed
733
734

libshout: libshout-$(SHOUT_VERSION).tar.gz
735
	$(EXTRACT_GZ)
Christophe Mutricy's avatar
Christophe Mutricy committed
736
ifdef HAVE_WIN32
737
	patch -p0 < Patches/libshout-win32.patch
Christophe Mutricy's avatar
Christophe Mutricy committed
738
endif
ivoire's avatar
ivoire committed
739

740
.shout: libshout .theora .ogg .speex .vorbis
741
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) &&  make && make install )
742
743
	$(INSTALL_NAME)
	touch $@
hartman's avatar
hartman committed
744
745
746
747
748

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

749
750
751
752
753
# ***************************************************************************
# flac
# ***************************************************************************

flac-$(FLAC_VERSION).tar.gz:
754
	$(WGET) $(FLAC_URL)
755
756

flac: flac-$(FLAC_VERSION).tar.gz
757
	$(EXTRACT_GZ)
758
ifdef HAVE_WIN32
759
	patch -p0 < Patches/flac-win32.patch
760
endif
Pierre's avatar
Pierre committed
761
ifdef HAVE_MACOSX
Felix Paul Kühne's avatar
Felix Paul Kühne committed
762
	( cd $@; sed -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' -i.orig  configure )
763
endif
764
765

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

ivoire's avatar
ivoire committed
767
.flac: flac .ogg
Pierre's avatar
Pierre committed
768
ifdef HAVE_MACOSX_ON_INTEL
769
770
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm-optimizations $(FLAC_DISABLE_FLAGS)
771
else
772
773
	cd $< && \
	$(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX)  $(FLAC_DISABLE_FLAGS)
774
endif
775
	cd $</src && \
776
	make -C libFLAC && \
777
	echo 'Requires.private: ogg' >> libFLAC/flac.pc && \
778
779
	make -C libFLAC install
	cd $< && make -C include install
780
781
	$(INSTALL_NAME)
	touch $@
782

damienf's avatar
damienf committed
783
CLEAN_FILE += .flac
784
785
786
787
788
789
790
791
CLEAN_PKG += flac
DISTCLEAN_PKG += flac-$(FLAC_VERSION).tar.gz

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

speex-$(SPEEX_VERSION).tar.gz:
792
	$(WGET) $(SPEEX_URL)
793
794

speex: speex-$(SPEEX_VERSION).tar.gz
795
796
	$(EXTRACT_GZ)
	patch -p0 < Patches/speex.patch
797
798

.speex: speex
799
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --enable-ogg=no && make && make install)
800
801
	$(INSTALL_NAME)
	touch $@
802
803
804
805
806
807
808
809
810

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

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

811
faad2-$(FAAD2_VERSION).tar.gz:
812
	$(WGET) $(FAAD2_URL)
813

814
815
faad2: faad2-$(FAAD2_VERSION).tar.gz
	$(EXTRACT_GZ)
816
	(cd $@; echo|$(CC) -iquote . -E - || sed -i 's/-iquote /-I/' libfaad/Makefile.am; autoreconf -ivf)
817
	patch -p0 < Patches/faad-arm-fixed.patch
818

819
.faad: faad2
820
	(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)
821
	touch $@
822
823

CLEAN_FILE += .faad
824
825
CLEAN_PKG += faad2
DISTCLEAN_PKG += faad2-$(FAAD2_VERSION).tar.gz
826

827
828
829
830
831
832
833
834
835
836
837
838
# ***************************************************************************
# libebml
# ***************************************************************************

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

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

.ebml: libebml
ifdef HAVE_WIN32
839
	(cd $<; make -C make/mingw32 prefix=$(PREFIX) $(HOSTCC) SHARED=no && make -C make/linux install_staticlib install_headers prefix=$(PREFIX) $(HOSTCC))
840
else
841
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC2) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
	$(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
862
	(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))
863
else
864
	(cd $<; make -C make/linux prefix=$(PREFIX) $(HOSTCC) staticlib && make -C make/linux install_staticlib install_headers prefix=$(PREFIX))
865
866
867
868
869
870
871
872
873
	$(RANLIB) $(PREFIX)/lib/libmatroska.a
endif
	touch $@


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

874
875
876
877
878

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

879
880
libvpx-$(VPX_VERSION).tar.bz2:
	$(WGET) $(VPX_URL)
881

882
883
libvpx: libvpx-$(VPX_VERSION).tar.bz2
	$(EXTRACT_BZ2)
884
885

ifdef HAVE_WIN32
886
CROSS=$(HOST)-
887
endif
888

889
890
891
892
893
894
VPX_TARGET-$(ENABLED)              = --target=FIXME
VPX_TARGET-$(HAVE_LINUX)           =
VPX_TARGET-$(HAVE_WIN32)           = --target=x86-win32-gcc
VPX_TARGET-$(HAVE_DARWIN_OS)       = --target=ppc32-darwin9-gcc
VPX_TARGET-$(HAVE_MACOSX_ON_INTEL) = --target=x86-darwin9-gcc
VPX_TARGET-$(HAVE_MACOSX64)        = --target=x86_64-darwin9-gcc
Rafaël Carré's avatar
Rafaël Carré committed
895
VPX_DEPS-$(ENABLED)                =
Pierre's avatar
Pierre committed
896
VPX_DEPS-$(HAVE_MACOSX_ON_INTEL) += .yasm
897
898

.libvpx: libvpx $(VPX_DEPS-1)
899
	(cd $<; CROSS=$(CROSS) ./configure $(VPX_TARGET-1) --disable-install-bins --disable-install-srcs --disable-install-libs --disable-install-docs --disable-examples --disable-vp8-decoder && make && make install)
900
	(rm -rf $(PREFIX)/include/vpx/ && mkdir -p $(PREFIX)/include/vpx/; cd $< && cp vpx/*.h vpx_ports/*.h $(PREFIX)/include/vpx/) # Of course, why the hell would one expect it to be listed or in make install?
901
	rm $(PREFIX)/include/vpx/config.h
902
	(cd $<; $(RANLIB) libvpx.a && mkdir -p $(PREFIX)/lib && cp libvpx.a $(PREFIX)/lib/) # Of course, why the hell would one expect it to be listed or in make install?
903
904
	touch $@

905
906
CLEAN_FILE += .libvpx
CLEAN_PKG += libvpx
907
DISTCLEAN_PKG += libvpx-$(VPX_VERSION).tar.bz2
908

909
910
911
912
913
# ***************************************************************************
# lame
# ***************************************************************************

lame-$(LAME_VERSION).tar.gz:
914
	$(WGET) $(LAME_URL)
915
916

lame: lame-$(LAME_VERSION).tar.gz
917
	$(EXTRACT_GZ)
918
919

.lame: lame
920
	(cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-analyser-hooks --disable-decoder --disable-shared --disable-gtktest --disable-frontend && make && make install)
921
	touch $@
922
923
924
925
926
927
928

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


# ***************************************************************************
929
930
931
932
933
934
935
936
937
938
# libamrnb
# ***************************************************************************

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

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

.libamrnb: libamrnb
939
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
	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
957
	(cd $<; $(HOSTCC) ./configure --prefix=$(PREFIX) --enable-shared && make && make install)
958
959
960
961
962
	touch $@


CLEAN_FILE += .libamrwb
CLEAN_PKG += libamrwb
963
DISTCLEAN_PKG += amrwb-$(LIBAMR_WB_VERSION).tar.bz2
964
965
966

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

967
968
969
# ffmpeg
# ***************************************************************************

970
971
972
FFMPEGCONF=--disable-doc --disable-decoder=libvpx

ifdef HAVE_CROSS_COMPILE
973
FFMPEGCONF += --enable-cross-compile
974
975
endif
ifdef HAVE_CROSS_COMPILE_NEEDS_CROSS_PREFIX
ivoire's avatar
ivoire committed
976
ifndef HAVE_ANDROID
Pankaj Yadav's avatar
Pankaj Yadav committed
977
ifndef HAVE_SYMBIAN
978
FFMPEGCONF += --cross-prefix=$(HOST)-
ivoire's avatar
ivoire committed
979
else
Pankaj Yadav's avatar
Pankaj Yadav committed
980
981
982
FFMPEGCONF += --cross-prefix=arm-none-symbianelf- --arch=armv6 --disable-asm
endif
else
ivoire's avatar
ivoire committed
983
984
FFMPEGCONF += --cross-prefix=arm-linux-androideabi- --arch=armv4l
endif
985
986
987
988
989
990
991
endif

#
# Special target-dependant options
#

ifdef HAVE_WINCE
992
993
994
995
996
997
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
998
999
1000
1001
1002
1003
1004
1005
1006
1007
endif

ifdef HAVE_UCLIBC
ifdef HAVE_BIGENDIAN
FFMPEGCONF+= --arch=armeb --enable-armv5te --enable-iwmmxt
else
FFMPEGCONF+= --arch=armv4l
endif
FFMPEGCONF+= --enable-small --disable-mpegaudio-hp
FFMPEG_CFLAGS += -DHAVE_LRINTF --std=c99
1008
1009
1010
endif

ifndef HAVE_UCLIBC
1011
1012
ifndef HAVE_WINCE
ifndef HAVE_IOS
ivoire's avatar
ivoire committed
1013
ifndef HAVE_ANDROID
1014
1015
1016
1017
FFMPEGCONF+= --enable-libmp3lame --enable-libgsm
endif
endif
endif
ivoire's avatar
ivoire committed
1018
endif
1019

1020
ifdef CC
ivoire's avatar
ivoire committed
1021
FFMPEGCONF += --cc="$(CC)"