Statistics
| Branch: | Tag: | Revision:

streamers-build / THIRDPARTY-LIBS / Makefile @ f1abd72b

History | View | Annotate | Download (6.37 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
ifneq (,$(findstring mingw32,$(HOSTARCH)))
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
endif
35
CONFIG_FFMPEG += --enable-libx264
36
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/x264-install/include
37
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/x264-install/lib
38
CONFIG_FFMPEG_LDLIBS += -lx264
39
CONFIG_FFMPEG += --enable-libmp3lame
40
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/mp3lame-install/include
41
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/mp3lame-install/lib
42
CONFIG_FFMPEG_LDLIBS += -lmp3lame
43

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

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

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

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

    
58
all: GRAPES-build NAPA-build
59

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

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

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

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

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

    
74
ifneq (,$(findstring mingw32,$(HOSTARCH)))
75
x264/config.mak:
76
	cd x264 && ./configure --disable-lavf --prefix=$(THIRDPARTYLIBS)/x264-install/ --libdir=$(THIRDPARTYLIBS)/x264-install/lib $(CONFIG_X264) --enable-win32thread || { echo "Error configuring x264" && exit 1; }
77
else
78
x264/config.mak:
79
	cd x264 && ./configure --disable-lavf --prefix=$(THIRDPARTYLIBS)/x264-install/ --libdir=$(THIRDPARTYLIBS)/x264-install/lib $(CONFIG_X264) || { echo "Error configuring x264" && exit 1; }
80
endif
81

    
82
x264-install: x264/config.mak
83
	$(MAKE) -C x264 || { echo "Error compiling x264" && exit 1; }
84
	$(MAKE) -C x264 install-lib-static  || { echo "Error installing x264" && exit 1; }
85
	touch x264-install
86

    
87
libogg:
88
	$(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
89

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

    
93
libvorbis:
94
	$(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
95

    
96
libvorbis-install: libvorbis libogg-install
97
	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
98

    
99
mp3lame: VERSION_LAME_DIR = 3.99
100
mp3lame: VERSION_LAME = 3.99.5
101
mp3lame:
102
	$(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;
103

    
104
mp3lame-install: mp3lame
105
	cd mp3lame && ./configure --disable-gtktest --disable-frontend --disable-shared --prefix=$(THIRDPARTYLIBS)/mp3lame-install/ --libdir=$(THIRDPARTYLIBS)/mp3lame-install/lib $(CONFIG_MP3LAME) && make && make install
106

    
107
ifeq (,$(findstring mingw32,$(HOSTARCH)))
108
ffmpeg/config.mak: libvorbis-install libogg-install
109
endif
110
ffmpeg/config.mak: x264-install
111
ffmpeg/config.mak: mp3lame-install
112
ffmpeg/config.mak:
113
	cd ffmpeg && ./configure --prefix=$(THIRDPARTYLIBS)/ffmpeg-install --libdir=$(THIRDPARTYLIBS)/ffmpeg-install/lib $(CONFIG_FFMPEG) || { echo "Error configuring ffmpeg" && exit 1; }
114
	#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
115
	echo $(CONFIG_FFMPEG_CFLAGS) >ffmpeg.cflags
116
	echo $(CONFIG_FFMPEG_LDFLAGS) >ffmpeg.ldflags
117
	echo $(CONFIG_FFMPEG_LDLIBS) >ffmpeg.ldlibs
118

    
119
ffmpeg-install: ffmpeg/config.mak
120
	$(MAKE) -C ffmpeg || { echo "Error compiling ffmpeg" && exit 1; }
121
	$(MAKE) -C ffmpeg install || { echo "Error installing ffmpeg" && exit 1; }
122
	touch ffmpeg-install
123

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

    
127
NAPA-build:
128
	cd NAPA-BASELIBS && $(ALTO_OPTION) ./build_all.sh -q
129

    
130
clean:
131
	$(MAKE) -C GRAPES clean
132
	$(MAKE) -C NAPA-BASELIBS clean
133

    
134
distclean:
135
	[ ! -d GRAPES ] || $(MAKE) -C GRAPES clean
136
	[ ! -d NAPA-BASELIBS ] || $(MAKE) -C NAPA-BASELIBS clean
137
	rm -rf libx264-install
138
	[ ! -d x264 ] || $(MAKE) -C x264 distclean || true
139
	rm -rf ffmpeg-install
140
	rm -rf ffmpeg.{ldflags,cflags,ldlibs}
141
	[ ! -d ffmpeg ] || $(MAKE) -C ffmpeg distclean || true
142
	rm -rf mp3lame-install
143
	[ ! -d mp3lame ] || $(MAKE) -C mp3lame distclean || true
144
	rm -rf libvorbis-install
145
	[ ! -d libvorbis ] || $(MAKE) -C libvorbis distclean || true
146
	rm -rf libogg-install
147
	[ ! -d libogg ] || $(MAKE) -C libogg distclean || true