streamers-build / Makefile @ 3eb0db69
History | View | Annotate | Download (9.08 KB)
1 |
BASEDIR := $(shell pwd) |
---|---|
2 |
THIRDPARTYLIBS := $(BASEDIR)/THIRDPARTY-LIBS |
3 |
|
4 |
NOGIT := $(shell [ -d .git ] || echo 1) |
5 |
REV := $(shell ( [ -d .git ] && git describe --tags --always --dirty 2>/dev/null ) || ( [ -d .git ] && git describe --tags --always 2>/dev/null ) || ( [ -d .git ] && git describe --tags ) || ( [ -d .svn ] && svnversion ) || echo exported) |
6 |
DIR := PeerStreamer-$(subst PeerStreamer-,,$(REV)) |
7 |
|
8 |
ARCH:=$(shell uname -m) |
9 |
ifeq ($(ARCH),x86_64) |
10 |
ARCH=amd64 |
11 |
endif |
12 |
ifeq ($(ARCH),i386) |
13 |
ARCH=i386 |
14 |
endif |
15 |
ifeq ($(ARCH),i686) |
16 |
ARCH=i386 |
17 |
endif |
18 |
|
19 |
UNAME := $(shell uname) |
20 |
ifeq ($(UNAME), Linux) |
21 |
# do something Linux-y |
22 |
STATIC ?= 2 |
23 |
XSTATIC = -static |
24 |
LINUX_OS = 1 |
25 |
endif |
26 |
ifeq ($(UNAME), Darwin) |
27 |
# do something OSX-y |
28 |
STATIC = 0 |
29 |
XSTATIC = |
30 |
MAC_OS = 1 |
31 |
endif |
32 |
STATIC ?= 2 |
33 |
XSTATIC ?= -static |
34 |
|
35 |
FLAGS_CHUNKER += LOCAL_FFMPEG=$(THIRDPARTYLIBS)/ffmpeg-install |
36 |
FLAGS_CHUNKER += LOCAL_X264=$(THIRDPARTYLIBS)/x264-install |
37 |
FLAGS_CHUNKER += LOCAL_MP3LAME=$(THIRDPARTYLIBS)/mp3lame-install |
38 |
ifeq (,$(findstring mingw32,$(HOSTARCH))) |
39 |
FLAGS_CHUNKER += LOCAL_LIBOGG=$(THIRDPARTYLIBS)/libogg-install |
40 |
FLAGS_CHUNKER += LOCAL_LIBVORBIS=$(THIRDPARTYLIBS)/libvorbis-install |
41 |
else |
42 |
EXE =.exe |
43 |
endif |
44 |
|
45 |
.PHONY: $(THIRDPARTYLIBS) update clean ml-chunkstream $(DIR) |
46 |
|
47 |
all: $(DIR) |
48 |
|
49 |
simple: Streamers/streamer-udp-grapes$(EXE) |
50 |
ml: Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE) |
51 |
chunkstream: Streamers/streamer-udp-chunkstream$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE) |
52 |
ml-chunkstream: Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE) |
53 |
|
54 |
$(THIRDPARTYLIBS): |
55 |
$(MAKE) -C $(THIRDPARTYLIBS) || { echo "Error preparing third party libs" && exit 1; } |
56 |
|
57 |
ifndef NOGIT |
58 |
update: |
59 |
git pull |
60 |
git submodule sync |
61 |
git submodule update |
62 |
|
63 |
forceupdate: |
64 |
git stash |
65 |
git pull |
66 |
git submodule foreach git stash |
67 |
git submodule sync |
68 |
git submodule update |
69 |
|
70 |
Streamers/.git: |
71 |
git submodule init -- $(shell dirname $@) |
72 |
git submodule update -- $(shell dirname $@) |
73 |
|
74 |
Streamers/streamer-grapes: Streamers/.git |
75 |
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): Streamers/.git |
76 |
Streamers/streamer-chunkstream$(EXE): Streamers/.git |
77 |
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): Streamers/.git |
78 |
|
79 |
ChunkerPlayer/.git: |
80 |
git submodule init -- $(shell dirname $@) |
81 |
git submodule update -- $(shell dirname $@) |
82 |
|
83 |
ChunkerPlayer/chunker_player/chunker_player$(EXE): ChunkerPlayer/.git |
84 |
endif |
85 |
|
86 |
#.PHONY: Streamers/streamer-grapes Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE) Streamers/streamer-chunkstream$(EXE) Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) |
87 |
Streamers/streamer-udp-grapes$(EXE): $(THIRDPARTYLIBS) |
88 |
cd Streamers && ./configure \ |
89 |
--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags` -L$(THIRDPARTYLIBS)/pjproject/lib" \ |
90 |
--with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs` `cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \ |
91 |
--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \ |
92 |
--with-net-helper=udp \ |
93 |
--with-static=$(STATIC) |
94 |
$(MAKE) -C Streamers |
95 |
|
96 |
#version with NAPA-libs |
97 |
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): $(THIRDPARTYLIBS) |
98 |
cd Streamers && ./configure \ |
99 |
--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags` -L$(THIRDPARTYLIBS)/pjproject/lib" \ |
100 |
--with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs` `cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \ |
101 |
--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \ |
102 |
--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \ |
103 |
--with-net-helper=ml --with-monl \ |
104 |
--with-static=$(STATIC) |
105 |
$(MAKE) -C Streamers |
106 |
|
107 |
Streamers/streamer-udp-chunkstream$(EXE): $(THIRDPARTYLIBS) |
108 |
cd Streamers && ./configure \ |
109 |
--with-ldflags=" -L$(THIRDPARTYLIBS)/pjproject/lib" \ |
110 |
--with-ldlibs="`cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \ |
111 |
--with-io=chunkstream \ |
112 |
--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \ |
113 |
--with-net-helper=udp \ |
114 |
--with-static=$(STATIC) |
115 |
$(MAKE) -C Streamers |
116 |
|
117 |
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): $(THIRDPARTYLIBS) |
118 |
cd Streamers && ./configure \ |
119 |
--with-ldflags=" -L$(THIRDPARTYLIBS)/pjproject/lib" \ |
120 |
--with-ldlibs="`cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \ |
121 |
--with-io=chunkstream \ |
122 |
--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \ |
123 |
--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \ |
124 |
--with-net-helper=ml --with-monl \ |
125 |
--with-static=$(STATIC) |
126 |
$(MAKE) -C Streamers |
127 |
|
128 |
ChunkerPlayer/chunker_player/chunker_player$(EXE): $(THIRDPARTYLIBS) |
129 |
cd ChunkerPlayer && $(FLAGS_CHUNKER) ./build_ul.sh |
130 |
|
131 |
prepare: |
132 |
ifndef NOGIT |
133 |
git submodule init |
134 |
git submodule update |
135 |
else |
136 |
git clone http://halo.disi.unitn.it/~cskiraly/PublicGits/ffmpeg.git THIRDPARTY-LIBS/ffmpeg |
137 |
cd THIRDPARTY-LIBS/ffmpeg && git checkout -b streamer 210091b0e31832342322b8461bd053a0314e63bc |
138 |
git clone git://git.videolan.org/x264.git THIRDPARTY-LIBS/x264 |
139 |
cd THIRDPARTY-LIBS/x264 && git checkout -b streamer 08d04a4d30b452faed3b763528611737d994b30b |
140 |
endif |
141 |
|
142 |
clean: |
143 |
$(MAKE) -C $(THIRDPARTYLIBS) clean |
144 |
$(MAKE) -C Streamers clean |
145 |
$(MAKE) -C ChunkerPlayer/chunker_player clean |
146 |
$(MAKE) -C ChunkerPlayer/chunk_transcoding clean |
147 |
$(MAKE) -C ChunkerPlayer/chunker_streamer clean |
148 |
ifdef MAC_OS |
149 |
rm -rf *.app *.dmg |
150 |
endif |
151 |
|
152 |
distclean: |
153 |
$(MAKE) -C $(THIRDPARTYLIBS) distclean |
154 |
$(MAKE) -C Streamers clean |
155 |
$(MAKE) -C ChunkerPlayer/chunker_player clean |
156 |
$(MAKE) -C ChunkerPlayer/chunk_transcoding clean |
157 |
$(MAKE) -C ChunkerPlayer/chunker_streamer clean |
158 |
|
159 |
pack: $(DIR)-stripped.tgz |
160 |
|
161 |
$(DIR): Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE) |
162 |
rm -rf $(DIR) $(DIR).tgz $(DIR)-stripped.tgz |
163 |
mkdir $(DIR) |
164 |
cp Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR) |
165 |
cp ChunkerPlayer/chunker_player/chunker_player$(EXE) $(DIR) |
166 |
mkdir $(DIR)/icons |
167 |
cp ChunkerPlayer/chunker_player/icons/* $(DIR)/icons |
168 |
cp ChunkerPlayer/chunker_player/stats_font.ttf ChunkerPlayer/chunker_player/mainfont.ttf ChunkerPlayer/chunker_player/napalogo_small.bmp $(DIR) |
169 |
echo streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) > $(DIR)/peer_exec_name.conf |
170 |
cp ChunkerPlayer/chunker_streamer/chunker_streamer$(EXE) ChunkerPlayer/chunker_streamer/chunker.conf $(DIR) |
171 |
ifeq (,$(findstring mingw32,$(HOSTARCH))) |
172 |
ln -s streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)/streamer |
173 |
cp scripts/source.sh $(DIR) |
174 |
cp scripts/player.sh $(DIR) |
175 |
else |
176 |
cp scripts/peerstreamer.bat $(DIR) |
177 |
cp scripts/runQuietly.vbs $(DIR) |
178 |
endif |
179 |
cp channels.conf $(DIR) |
180 |
cp README $(DIR) |
181 |
|
182 |
$(DIR).tgz: $(DIR) |
183 |
tar czf $(DIR).tgz $(DIR) |
184 |
|
185 |
$(DIR)-stripped.tgz: $(DIR).tgz |
186 |
ifeq (,$(findstring mingw32,$(HOSTARCH))) |
187 |
cd $(DIR) && strip chunker_streamer$(EXE) |
188 |
endif |
189 |
cd $(DIR) && strip streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) chunker_player$(EXE) |
190 |
ifeq (,$(findstring mingw32,$(HOSTARCH))) |
191 |
tar czf $(DIR)-stripped.tgz $(DIR) |
192 |
else |
193 |
zip -r $(DIR).zip $(DIR) |
194 |
endif |
195 |
|
196 |
install: $(DIR) |
197 |
mkdir -p /opt/peerstreamer |
198 |
cp -r $(DIR)/* /opt/peerstreamer |
199 |
ln -f -s /opt/peerstreamer/player.sh /usr/local/bin/peerstreamer |
200 |
cp -r Installer/Lin/usr/share /usr |
201 |
|
202 |
uninstall: |
203 |
rm -rf /opt/peerstreamer |
204 |
rm -f /usr/local/bin/peerstreamer |
205 |
rm -rf /usr/share/applications/peerstreamer.desktop |
206 |
rm -rf /usr/share/menu/peerstreamer |
207 |
rm -rf /usr/share/pixmaps/peerstreamer.xpm |
208 |
|
209 |
ifdef LINUX_OS |
210 |
debian: |
211 |
@echo Debian packaging for $(ARCH) |
212 |
ifneq (, $(filter $(ARCH),amd64 $(ARCH) i686)) |
213 |
rm -rf package && mkdir package |
214 |
cd package && mkdir -p peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH) && curl http://peerstreamer.org/files/release/barepackage.tgz| tar xz -C peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH) |
215 |
cd package && sed -i "s/ARCHITECTURE/$(ARCH)/g" peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH)/DEBIAN/control |
216 |
cd package && sed -i "s/VERSION/$(subst PeerStreamer-,,$(REV))/g" peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH)/DEBIAN/control |
217 |
cp -r $(DIR)/* package/peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH)/opt/peerstreamer |
218 |
cp Installer/Lin/usr/share/pixmaps/eit-napa.svg package/peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH)/opt/peerstreamer |
219 |
cd package && fakeroot dpkg --build peerstreamer_$(subst PeerStreamer-,,$(REV))-1_$(ARCH) |
220 |
tar -czvf package/$(DIR).tgz $(DIR) |
221 |
else |
222 |
$(error Architecture not found $(ARCH)) |
223 |
endif |
224 |
|
225 |
rpm: TMPDIR:=$(shell mktemp -d) |
226 |
rpm: debian |
227 |
cp package/$(subst PeerStreamer-,peerstreamer_,$(DIR))-1_$(ARCH).deb $(TMPDIR) |
228 |
cd $(TMPDIR) && alien -r $(subst PeerStreamer-,peerstreamer_,$(DIR))-1_$(ARCH).deb -v --fixperms -k |
229 |
ifeq ($(ARCH),i386) |
230 |
mv $(TMPDIR)/$(subst PeerStreamer_,peerstreamer-,$(subst -,_,$(DIR)))-1.i386.rpm package/ |
231 |
else |
232 |
mv $(TMPDIR)/$(subst PeerStreamer_,peerstreamer-,$(subst -,_,$(DIR)))-1.x86_64.rpm package/ |
233 |
endif |
234 |
rm -rf $(TMPDIR) |
235 |
endif |
236 |
|
237 |
ifneq (,$(findstring mingw32,$(HOSTARCH))) |
238 |
installer-win: $(DIR) |
239 |
ln -s $(DIR) PeerStreamer |
240 |
makensis -DPRODUCT_VERSION="$(subst PeerStreamer-,,$(REV))" Installer/Win/peerstreamer.nsi |
241 |
rm PeerStreamer |
242 |
mv Installer/Win/PeerStreamerInstaller*.exe . |
243 |
endif |
244 |
|
245 |
ifdef MAC_OS |
246 |
installer-OSX: $(DIR) |
247 |
cd Installer/OSX/ && tar zfx OSX_template.tgz && ./makeApp.sh $(DIR) && rm -rf napa-template.app && make VERSION=$(REV) && mv $(REV).dmg ../../ |
248 |
endif |