Statistics
| Branch: | Tag: | Revision:

streamers-build / THIRDPARTY-LIBS / Makefile @ 56b651d6

History | View | Annotate | Download (6.01 KB)

1
UNAME := $(shell uname)
2

    
3
THIRDPARTYLIBS = $(shell pwd)
4
#NAPA-LIBS = NAPA-BASELIBS/monl/libmon.a NAPA-BASELIBS/ml/libml.a
5
#GRAPES-LIBS = GRAPES/src/libgrapes.a
6
#LIBS = $(GRAPES-LIBS) $(NAPA-LIBS)
7

    
8
NOGIT := $(shell [ -d ../.git ] || echo 1)
9
GITREPOCHECK = .git/HEAD
10

    
11
#configure FFMPEG
12
CONFIG_FFMPEG += --disable-sse #required because of an error in recent ffmpeg version in case of -bf > 0
13
CONFIG_FFMPEG += --disable-vaapi #there seems to be no static version of vaapi, so it creates problems in distributed binaries
14
CONFIG_FFMPEG += --enable-gpl
15
CONFIG_FFMPEG += --disable-doc #for less build dependecies and faster build
16
ifeq ($(HOSTARCH),mingw32)
17
CONFIG_FFMPEG += --arch=i586 --enable-cross-compile --cross-prefix=$(CROSSPREFIX) --target-os=mingw32 --enable-memalign-hack --disable-pthreads
18
else
19
ifeq ($(UNAME), Darwin)
20
CONFIG_FFMPEG += --disable-avfilter # current libav fails to build on OSX Lion
21
CONFIG_FFMPEG += --disable-vda # seems to create some linking problems in ffmpeg 0.10.2
22
CONFIG_LIBVORBIS += --build=x86_64 # OSX 10.7.2 needs this
23
endif
24

    
25
CONFIG_FFMPEG += --enable-pthreads
26
CONFIG_FFMPEG += --enable-libvorbis
27
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/libvorbis-install/include
28
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/libvorbis-install/lib
29
CONFIG_FFMPEG_LDLIBS += -lvorbis
30
CONFIG_FFMPEG_LDLIBS += -lvorbisenc
31
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/libogg-install/include
32
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/libogg-install/lib
33
CONFIG_FFMPEG_LDLIBS += -logg
34
CONFIG_FFMPEG += --enable-libmp3lame
35
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/mp3lame-install/include
36
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/mp3lame-install/lib
37
CONFIG_FFMPEG_LDLIBS += -lmp3lame
38
endif
39
CONFIG_FFMPEG += --enable-libx264
40
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/x264-install/include
41
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/x264-install/lib
42
CONFIG_FFMPEG_LDLIBS += -lx264
43

    
44
CONFIG_FFMPEG += --extra-cflags='$(CONFIG_FFMPEG_CFLAGS)'
45
CONFIG_FFMPEG += --extra-ldflags='$(CONFIG_FFMPEG_LDFLAGS)'
46

    
47
ifeq ($(HOSTARCH),mingw32)
48
FLAGS_GRAPES += ARCH=win32
49
ALTO_OPTION = ALTO=0
50
CONFIG_X264 += --host=$(HOSTARCH)
51
endif
52

    
53
WGET_OR_CURL = $(shell which wget || echo "curl -O -L")
54

    
55
.PHONY: GRAPES-build NAPA-build all
56

    
57
all: GRAPES-build NAPA-build
58

    
59
ifndef NOGIT
60
x264/$(GITREPOCHECK) ffmpeg/$(GITREPOCHECK) GRAPES/$(GITREPOCHECK) NAPA-BASELIBS/$(GITREPOCHECK):
61
	cd .. && git submodule init $(THIRDPARTYLIBS)/$(@:/$(GITREPOCHECK)=)
62
	cd .. && git submodule update $(THIRDPARTYLIBS)/$(@:/$(GITREPOCHECK)=)
63

    
64
x264/config.mak: x264/$(GITREPOCHECK)
65

    
66
ffmpeg/config.mak: ffmpeg/$(GITREPOCHECK)
67

    
68
GRAPES-build: GRAPES/$(GITREPOCHECK)
69

    
70
NAPA-build: NAPA-BASELIBS/$(GITREPOCHECK)
71
endif
72

    
73
x264/config.mak:
74
	cd x264 && ./configure --disable-lavf --prefix=$(THIRDPARTYLIBS)/x264-install/ --libdir=$(THIRDPARTYLIBS)/x264-install/lib $(CONFIG_X264) || { echo "Error configuring x264" && exit 1; }
75

    
76
x264-install: x264/config.mak
77
	$(MAKE) -C x264 || { echo "Error compiling x264" && exit 1; }
78
	$(MAKE) -C x264 install-lib-static  || { echo "Error installing x264" && exit 1; }
79
	touch x264-install
80

    
81
libogg:
82
	$(WGET_OR_CURL) http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz && tar xzf libogg-1.2.2.tar.gz && mv libogg-1.2.2 libogg && rm libogg-1.2.2.tar.gz
83

    
84
libogg-install: libogg
85
	cd libogg && ./configure --disable-oggtest --disable-shared --prefix=$(THIRDPARTYLIBS)/libogg-install/ --libdir=$(THIRDPARTYLIBS)/libogg-install/lib && make && make install
86

    
87
libvorbis:
88
	$(WGET_OR_CURL) http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz && tar xzf libvorbis-1.3.2.tar.gz && mv libvorbis-1.3.2 libvorbis && rm libvorbis-1.3.2.tar.gz
89

    
90
libvorbis-install: libvorbis libogg-install
91
	cd libvorbis && ./configure --disable-oggtest --disable-shared --prefix=$(THIRDPARTYLIBS)/libvorbis-install/ --libdir=$(THIRDPARTYLIBS)/libvorbis-install/lib --with-ogg=$(THIRDPARTYLIBS)/libogg-install/ $(CONFIG_LIBVORBIS) && make && make install
92

    
93
mp3lame: VERSION_LAME_DIR = 3.98.4
94
mp3lame: VERSION_LAME = 3.98.4
95
mp3lame:
96
	$(WGET_OR_CURL) http://sourceforge.net/projects/lame/files/lame/$(VERSION_LAME_DIR)/lame-$(VERSION_LAME).tar.gz && tar xzf lame-$(VERSION_LAME).tar.gz && rm -f lame-$(VERSION_LAME).tar.gz && mv lame-$(VERSION_LAME) mp3lame;
97

    
98
mp3lame-install: mp3lame
99
	cd mp3lame && ./configure --disable-gtktest --disable-frontend --disable-shared --prefix=$(THIRDPARTYLIBS)/mp3lame-install/ --libdir=$(THIRDPARTYLIBS)/mp3lame-install/lib ${HOSTARCH:+--host=$HOSTARCH} && make && make install
100

    
101
ifneq ($(HOSTARCH),mingw32)
102
ffmpeg/config.mak: libvorbis-install libogg-install mp3lame-install
103
endif
104
ffmpeg/config.mak: x264-install
105
ffmpeg/config.mak:
106
	cd ffmpeg && ./configure --prefix=$(THIRDPARTYLIBS)/ffmpeg-install --libdir=$(THIRDPARTYLIBS)/ffmpeg-install/lib $(CONFIG_FFMPEG) || { echo "Error configuring ffmpeg" && exit 1; }
107
	#in case x264 is not reqired (do we need the encoding?): ./configure --enable-gpl --enable-pthreads --prefix=$BASEDIR/ffmpeg-install --libdir=$BASEDIR/ffmpeg-install/lib
108
	echo $(CONFIG_FFMPEG_CFLAGS) >ffmpeg.cflags
109
	echo $(CONFIG_FFMPEG_LDFLAGS) >ffmpeg.ldflags
110
	echo $(CONFIG_FFMPEG_LDLIBS) >ffmpeg.ldlibs
111

    
112
ffmpeg-install: ffmpeg/config.mak
113
	$(MAKE) -C ffmpeg || { echo "Error compiling ffmpeg" && exit 1; }
114
	$(MAKE) -C ffmpeg install || { echo "Error installing ffmpeg" && exit 1; }
115
	touch ffmpeg-install
116

    
117
GRAPES-build: ffmpeg-install
118
	$(FLAGS_GRAPES) FFDIR=$(THIRDPARTYLIBS)/ffmpeg $(MAKE) -C GRAPES || { echo "Error compiling GRAPES" && exit 1; }
119

    
120
NAPA-build:
121
	cd NAPA-BASELIBS && $(ALTO_OPTION) ./build_all.sh -q
122

    
123
clean:
124
	$(MAKE) -C GRAPES clean
125
	$(MAKE) -C NAPA-BASELIBS clean
126

    
127
distclean:
128
	[ ! -d GRAPES ] || $(MAKE) -C GRAPES clean
129
	[ ! -d NAPA-BASELIBS ] || $(MAKE) -C NAPA-BASELIBS clean
130
	rm -rf libx264-install
131
	[ ! -d x264 ] || $(MAKE) -C x264 distclean || true
132
	rm -rf ffmpeg-install
133
	rm -rf ffmpeg.{ldflags,cflags,ldlibs}
134
	[ ! -d ffmpeg ] || $(MAKE) -C ffmpeg distclean || true
135
	rm -rf mp3lame-install
136
	[ ! -d mp3lame ] || $(MAKE) -C mp3lame distclean || true
137
	rm -rf libvorbis-install
138
	[ ! -d libvorbis ] || $(MAKE) -C libvorbis distclean || true
139
	rm -rf libogg-install
140
	[ ! -d libogg ] || $(MAKE) -C libogg distclean || true