Statistics
| Branch: | Tag: | Revision:

streamers-build / THIRDPARTY-LIBS / Makefile @ b54320b3

History | View | Annotate | Download (7.25 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
GITREPOCHECK = .git
11

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

    
29
CONFIG_FFMPEG += --enable-pthreads
30
CONFIG_FFMPEG += --enable-libvorbis
31
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/libvorbis-install/include
32
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/libvorbis-install/lib
33
CONFIG_FFMPEG_LDLIBS += -lvorbis
34
CONFIG_FFMPEG_LDLIBS += -lvorbisenc
35
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/libogg-install/include
36
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/libogg-install/lib
37
CONFIG_FFMPEG_LDLIBS += -logg
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
CONFIG_FFMPEG += --enable-libmp3lame
44
CONFIG_FFMPEG_CFLAGS += -I$(THIRDPARTYLIBS)/mp3lame-install/include
45
CONFIG_FFMPEG_LDFLAGS += -L$(THIRDPARTYLIBS)/mp3lame-install/lib
46
CONFIG_FFMPEG_LDLIBS += -lmp3lame
47

    
48
CONFIG_FFMPEG += --extra-cflags='$(CONFIG_FFMPEG_CFLAGS)'
49
CONFIG_FFMPEG += --extra-ldflags='$(CONFIG_FFMPEG_LDFLAGS)'
50

    
51
ifneq (,$(findstring mingw32,$(HOSTARCH)))
52
FLAGS_GRAPES += ARCH=win32
53
ALTO_OPTION = ALTO=0
54
CONFIG_X264 += --host=$(HOSTARCH)
55
CONFIG_MP3LAME += --host=$(HOSTARCH)
56
endif
57

    
58
WGET_OR_CURL = $(shell which wget || echo "curl -O -L")
59

    
60
.PHONY: GRAPES-build NAPA-build all
61

    
62
all: GRAPES-build NAPA-build
63

    
64
ifndef NOGIT
65
x264/$(GITREPOCHECK) ffmpeg/$(GITREPOCHECK) GRAPES/$(GITREPOCHECK) NAPA-BASELIBS/$(GITREPOCHECK):
66
	cd .. && git submodule init $(THIRDPARTYLIBS)/$(@:/$(GITREPOCHECK)=)
67
	cd .. && git submodule update $(THIRDPARTYLIBS)/$(@:/$(GITREPOCHECK)=)
68

    
69
x264/config.mak: x264/$(GITREPOCHECK)
70

    
71
ffmpeg/config.mak: ffmpeg/$(GITREPOCHECK)
72

    
73
GRAPES-build: GRAPES/$(GITREPOCHECK)
74

    
75
NAPA-build: NAPA-BASELIBS/$(GITREPOCHECK)
76
endif
77

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

    
86
x264-install: x264/config.mak
87
	$(MAKE) -C x264 || { echo "Error compiling x264" && exit 1; }
88
	$(MAKE) -C x264 install-lib-static  || { echo "Error installing x264" && exit 1; }
89
	touch x264-install
90

    
91
libogg:
92
	$(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
93

    
94
libogg-install: libogg
95
	cd libogg && ./configure --disable-oggtest --disable-shared --prefix=$(THIRDPARTYLIBS)/libogg-install/ --libdir=$(THIRDPARTYLIBS)/libogg-install/lib && make && make install
96

    
97
libvorbis:
98
	$(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
99

    
100
libvorbis-install: libvorbis libogg-install
101
	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
102

    
103
mp3lame: VERSION_LAME_DIR = 3.99
104
mp3lame: VERSION_LAME = 3.99.5
105
mp3lame:
106
	$(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;
107

    
108
mp3lame-install: mp3lame
109
	cd mp3lame && ./configure --disable-gtktest --disable-frontend --disable-shared --prefix=$(THIRDPARTYLIBS)/mp3lame-install/ --libdir=$(THIRDPARTYLIBS)/mp3lame-install/lib $(CONFIG_MP3LAME) && make && make install
110

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

    
123
ffmpeg-install: ffmpeg/config.mak
124
	$(MAKE) -C ffmpeg || { echo "Error compiling ffmpeg" && exit 1; }
125
	$(MAKE) -C ffmpeg install || { echo "Error installing ffmpeg" && exit 1; }
126
	touch ffmpeg-install
127

    
128
pjproject-src:
129
	$(WGET_OR_CURL) http://www.pjsip.org/release/2.1/pjproject-2.1.tar.bz2
130
	tar -C pjproject-src xjf pjproject-2.1.tar.bz2
131

    
132
pjproject: pjproject-src
133
	cd pjproject-src
134
	./configure --disable-sound --disable-oss --disable-video --disable-small-filter --disable-large-filter --disable-speex-aec --disable-g711-codec --disable-l16-codec --disable-gsm-codec --disable-g722-codec --disable-g7221-codec --disable-speex-codec --disable-ilbc-codec --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-ssl --disable-opencore-amr --disable-silk --prefix=$(THIRDPARTYLIBS)/pjproject"
135
	make dep
136
	make
137
	make install
138

    
139
GRAPES-build: ffmpeg-install pjproject
140
	$(FLAGS_GRAPES) FFDIR=$(THIRDPARTYLIBS)/ffmpeg $(MAKE) PJDIR=$(THIRDPARTYLIBS)/pjproject -C GRAPES || { echo "Error compiling GRAPES" && exit 1; }
141

    
142
NAPA-build:
143
	cd NAPA-BASELIBS && $(ALTO_OPTION) ./build_all.sh -q
144

    
145
clean:
146
	$(MAKE) -C GRAPES clean
147
	$(MAKE) -C NAPA-BASELIBS clean
148

    
149
distclean: clean
150
	[ ! -d GRAPES ] || $(MAKE) -C GRAPES clean
151
	[ ! -d NAPA-BASELIBS ] || $(MAKE) -C NAPA-BASELIBS clean
152
	rm -rf libx264-install
153
	[ ! -d x264 ] || $(MAKE) -C x264 distclean || true
154
	rm -rf ffmpeg-install
155
	rm -rf ffmpeg.{ldflags,cflags,ldlibs}
156
	[ ! -d ffmpeg ] || $(MAKE) -C ffmpeg distclean || true
157
	rm -rf mp3lame-install
158
	[ ! -d mp3lame ] || $(MAKE) -C mp3lame distclean || true
159
	rm -rf libvorbis-install
160
	[ ! -d libvorbis ] || $(MAKE) -C libvorbis distclean || true
161
	rm -rf libogg-install
162
	[ ! -d libogg ] || $(MAKE) -C libogg distclean || true
163
	rm -rf pjproject 
164
	[ ! -d pjproject-src ] || $(MAKE) -C pjproject-src distclean || true