Statistics
| Branch: | Tag: | Revision:

streamers-build / Makefile @ 3eb0db69

History | View | Annotate | Download (9.08 KB)

1 0ea9997c Csaba Kiraly
BASEDIR := $(shell pwd)
2
THIRDPARTYLIBS := $(BASEDIR)/THIRDPARTY-LIBS
3 e58e6412 Csaba Kiraly
4 3f254acb Csaba Kiraly
NOGIT := $(shell [ -d .git ] || echo 1)
5 5e8561de Csaba Kiraly
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 7e677ddc Csaba Kiraly
DIR := PeerStreamer-$(subst PeerStreamer-,,$(REV))
7 3f254acb Csaba Kiraly
8 78b68894 Alessandro Russo
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 25f045ec Csaba Kiraly
UNAME := $(shell uname)
20
ifeq ($(UNAME), Linux)
21
  # do something Linux-y
22
  STATIC ?= 2
23 6cf2467e Csaba Kiraly
  XSTATIC = -static
24 06979630 Csaba Kiraly
  LINUX_OS = 1
25 25f045ec Csaba Kiraly
endif
26
ifeq ($(UNAME), Darwin)
27
  # do something OSX-y
28
  STATIC = 0
29 6cf2467e Csaba Kiraly
  XSTATIC =
30 25f045ec Csaba Kiraly
  MAC_OS = 1
31
endif
32
STATIC ?= 2
33 6cf2467e Csaba Kiraly
XSTATIC ?= -static
34 25f045ec Csaba Kiraly
35 c6def51f Csaba Kiraly
FLAGS_CHUNKER += LOCAL_FFMPEG=$(THIRDPARTYLIBS)/ffmpeg-install
36
FLAGS_CHUNKER += LOCAL_X264=$(THIRDPARTYLIBS)/x264-install 
37 bc99d9d4 Csaba Kiraly
FLAGS_CHUNKER += LOCAL_MP3LAME=$(THIRDPARTYLIBS)/mp3lame-install
38 759754a2 Csaba Kiraly
ifeq (,$(findstring mingw32,$(HOSTARCH)))
39 c6def51f Csaba Kiraly
FLAGS_CHUNKER += LOCAL_LIBOGG=$(THIRDPARTYLIBS)/libogg-install
40
FLAGS_CHUNKER += LOCAL_LIBVORBIS=$(THIRDPARTYLIBS)/libvorbis-install
41 eb18831f Csaba Kiraly
else
42
EXE =.exe
43 c6def51f Csaba Kiraly
endif
44
45 b83ebeb0 Csaba Kiraly
.PHONY: $(THIRDPARTYLIBS) update clean ml-chunkstream $(DIR)
46 e58e6412 Csaba Kiraly
47 8441e956 Csaba Kiraly
all: $(DIR)
48 6a2bf561 Csaba Kiraly
49 af7a9c24 Csaba Kiraly
simple: Streamers/streamer-udp-grapes$(EXE)
50 6cf2467e Csaba Kiraly
ml: Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE)
51 af7a9c24 Csaba Kiraly
chunkstream: Streamers/streamer-udp-chunkstream$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
52 adbfe569 Csaba Kiraly
ml-chunkstream: Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
53 e58e6412 Csaba Kiraly
54
$(THIRDPARTYLIBS):
55
	$(MAKE) -C $(THIRDPARTYLIBS) || { echo "Error preparing third party libs" && exit 1; }
56
57 3f254acb Csaba Kiraly
ifndef NOGIT
58 7c525c3e Csaba Kiraly
update:
59
	git pull
60 0b0ecf08 Csaba Kiraly
	git submodule sync
61 7c525c3e Csaba Kiraly
	git submodule update
62
63 f3393d6d Csaba Kiraly
forceupdate:
64
	git stash
65
	git pull
66
	git submodule foreach git stash
67 0b0ecf08 Csaba Kiraly
	git submodule sync
68 f3393d6d Csaba Kiraly
	git submodule update
69
70 0882652d Csaba Kiraly
Streamers/.git:
71 d1bd85e3 Csaba Kiraly
	git submodule init -- $(shell dirname $@)
72
	git submodule update -- $(shell dirname $@)
73 e58e6412 Csaba Kiraly
74 3f254acb Csaba Kiraly
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 d1bd85e3 Csaba Kiraly
	git submodule init -- $(shell dirname $@)
81
	git submodule update -- $(shell dirname $@)
82 3f254acb Csaba Kiraly
83
ChunkerPlayer/chunker_player/chunker_player$(EXE): ChunkerPlayer/.git
84
endif
85
86 8441e956 Csaba Kiraly
#.PHONY: Streamers/streamer-grapes Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE) Streamers/streamer-chunkstream$(EXE) Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE)
87 269c2f50 Csaba Kiraly
Streamers/streamer-udp-grapes$(EXE): $(THIRDPARTYLIBS)
88 da7b5d65 Csaba Kiraly
	cd Streamers && ./configure \
89 3eb0db69 Davide Kirchner
	--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags` -L$(THIRDPARTYLIBS)/pjproject/lib" \
90
 	--with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs` `cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \
91 24c93d9f Csaba Kiraly
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \
92 af7a9c24 Csaba Kiraly
	--with-net-helper=udp \
93 39ca126e Luca Baldesi
	--with-static=$(STATIC) 
94 da7b5d65 Csaba Kiraly
	$(MAKE) -C Streamers
95 e58e6412 Csaba Kiraly
96
#version with NAPA-libs
97 3f254acb Csaba Kiraly
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
98 da7b5d65 Csaba Kiraly
	cd Streamers && ./configure \
99 3eb0db69 Davide Kirchner
	--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags` -L$(THIRDPARTYLIBS)/pjproject/lib" \
100
 	--with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs` `cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \
101 24c93d9f Csaba Kiraly
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \
102 da7b5d65 Csaba Kiraly
	--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \
103 af7a9c24 Csaba Kiraly
	--with-net-helper=ml --with-monl \
104 da7b5d65 Csaba Kiraly
	--with-static=$(STATIC)
105
	$(MAKE) -C Streamers
106 e58e6412 Csaba Kiraly
107 af7a9c24 Csaba Kiraly
Streamers/streamer-udp-chunkstream$(EXE): $(THIRDPARTYLIBS)
108 da7b5d65 Csaba Kiraly
	cd Streamers && ./configure \
109 3eb0db69 Davide Kirchner
	--with-ldflags=" -L$(THIRDPARTYLIBS)/pjproject/lib" \
110
 	--with-ldlibs="`cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \
111 da7b5d65 Csaba Kiraly
	--with-io=chunkstream \
112 24c93d9f Csaba Kiraly
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \
113 af7a9c24 Csaba Kiraly
	--with-net-helper=udp \
114 da7b5d65 Csaba Kiraly
	--with-static=$(STATIC)
115
	$(MAKE) -C Streamers
116 6164ac21 Csaba Kiraly
117 3f254acb Csaba Kiraly
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
118 da7b5d65 Csaba Kiraly
	cd Streamers && ./configure \
119 3eb0db69 Davide Kirchner
	--with-ldflags=" -L$(THIRDPARTYLIBS)/pjproject/lib" \
120
 	--with-ldlibs="`cat $(THIRDPARTYLIBS)/pjproject.ldlibs` -lpjproject " \
121 da7b5d65 Csaba Kiraly
	--with-io=chunkstream \
122 24c93d9f Csaba Kiraly
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg \
123 da7b5d65 Csaba Kiraly
	--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \
124 af7a9c24 Csaba Kiraly
	--with-net-helper=ml --with-monl \
125 da7b5d65 Csaba Kiraly
	--with-static=$(STATIC)
126
	$(MAKE) -C Streamers
127 cc4971e1 Csaba Kiraly
128 3f254acb Csaba Kiraly
ChunkerPlayer/chunker_player/chunker_player$(EXE): $(THIRDPARTYLIBS)
129 c6def51f Csaba Kiraly
	cd ChunkerPlayer && $(FLAGS_CHUNKER) ./build_ul.sh
130 57fb780f Csaba Kiraly
131 28507821 Csaba Kiraly
prepare:
132 3f254acb Csaba Kiraly
ifndef NOGIT
133 d1bd85e3 Csaba Kiraly
	git submodule init
134
	git submodule update
135 3f254acb Csaba Kiraly
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 28507821 Csaba Kiraly
142 e58e6412 Csaba Kiraly
clean:
143
	$(MAKE) -C $(THIRDPARTYLIBS) clean
144 55c79d1a Csaba Kiraly
	$(MAKE) -C Streamers clean
145 c3b077f0 ArpadBakay
	$(MAKE) -C ChunkerPlayer/chunker_player clean
146
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
147
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
148 ebfd2a11 Csaba Kiraly
ifdef MAC_OS
149
	rm -rf *.app *.dmg
150
endif
151 55c79d1a Csaba Kiraly
152 319c97ef Csaba Kiraly
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 8216fa9a ArpadBakay
pack:  $(DIR)-stripped.tgz
160
161 b83ebeb0 Csaba Kiraly
$(DIR):  Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
162 7bc67c3e Csaba Kiraly
	rm -rf $(DIR) $(DIR).tgz $(DIR)-stripped.tgz
163 55c79d1a Csaba Kiraly
	mkdir $(DIR)
164 6cf2467e Csaba Kiraly
	cp Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)
165 99bda36e MarcoMellia
	cp ChunkerPlayer/chunker_player/chunker_player$(EXE) $(DIR)
166
	mkdir $(DIR)/icons
167
	cp ChunkerPlayer/chunker_player/icons/* $(DIR)/icons
168 da1a3f12 Csaba Kiraly
	cp ChunkerPlayer/chunker_player/stats_font.ttf ChunkerPlayer/chunker_player/mainfont.ttf ChunkerPlayer/chunker_player/napalogo_small.bmp $(DIR)
169 6cf2467e Csaba Kiraly
	echo streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) > $(DIR)/peer_exec_name.conf
170 833d969b Csaba Kiraly
	cp ChunkerPlayer/chunker_streamer/chunker_streamer$(EXE) ChunkerPlayer/chunker_streamer/chunker.conf $(DIR)
171 8b829935 Csaba Kiraly
ifeq (,$(findstring mingw32,$(HOSTARCH)))
172 6cf2467e Csaba Kiraly
	ln -s streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)/streamer
173 4586b299 Csaba Kiraly
	cp scripts/source.sh $(DIR)
174 09277f7d Csaba Kiraly
	cp scripts/player.sh $(DIR)
175 3fd0b87a Luca
else
176
	cp scripts/peerstreamer.bat $(DIR)
177
	cp scripts/runQuietly.vbs $(DIR)
178 eb18831f Csaba Kiraly
endif
179 b1bb0c3c Csaba Kiraly
	cp channels.conf $(DIR)
180 38047925 Csaba Kiraly
	cp README $(DIR)
181 b83ebeb0 Csaba Kiraly
182
$(DIR).tgz: $(DIR)
183 55c79d1a Csaba Kiraly
	tar czf $(DIR).tgz $(DIR)
184 b83ebeb0 Csaba Kiraly
185
$(DIR)-stripped.tgz: $(DIR).tgz
186 8b829935 Csaba Kiraly
ifeq (,$(findstring mingw32,$(HOSTARCH)))
187 eb18831f Csaba Kiraly
	cd $(DIR) && strip chunker_streamer$(EXE)
188 24129ef7 MarcoMellia
endif
189
	cd $(DIR) && strip streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) chunker_player$(EXE)
190 8b829935 Csaba Kiraly
ifeq (,$(findstring mingw32,$(HOSTARCH)))
191 eb18831f Csaba Kiraly
	tar czf $(DIR)-stripped.tgz $(DIR)
192 99bda36e MarcoMellia
else
193
	zip -r $(DIR).zip $(DIR)
194
endif
195 2cf155bf Csaba Kiraly
196 06979630 Csaba Kiraly
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 8fda1c21 Csaba Kiraly
	cp -r Installer/Lin/usr/share /usr
201 06979630 Csaba Kiraly
202
uninstall:
203
	rm -rf /opt/peerstreamer
204
	rm -f /usr/local/bin/peerstreamer
205 8fda1c21 Csaba Kiraly
	rm -rf /usr/share/applications/peerstreamer.desktop
206
	rm -rf /usr/share/menu/peerstreamer
207
	rm -rf /usr/share/pixmaps/peerstreamer.xpm
208 06979630 Csaba Kiraly
209
ifdef LINUX_OS
210
debian:
211 90058e01 Alessandro Russo
	@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 06979630 Csaba Kiraly
225
rpm: TMPDIR:=$(shell mktemp -d)
226
rpm: debian
227 92235696 Alessandro Russo
	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 06979630 Csaba Kiraly
	rm -rf $(TMPDIR)
235
endif
236
237 8b829935 Csaba Kiraly
ifneq (,$(findstring mingw32,$(HOSTARCH)))
238 2cf155bf Csaba Kiraly
installer-win: $(DIR)
239
	ln -s $(DIR) PeerStreamer
240 b3227ee1 Csaba Kiraly
	makensis -DPRODUCT_VERSION="$(subst PeerStreamer-,,$(REV))" Installer/Win/peerstreamer.nsi
241 2cf155bf Csaba Kiraly
	rm PeerStreamer
242
	mv Installer/Win/PeerStreamerInstaller*.exe .
243
endif
244 a452b5e5 Csaba Kiraly
245
ifdef MAC_OS
246
installer-OSX: $(DIR)
247 ebfd2a11 Csaba Kiraly
	cd Installer/OSX/ && tar zfx OSX_template.tgz && ./makeApp.sh $(DIR) && rm -rf napa-template.app && make VERSION=$(REV) && mv $(REV).dmg ../../
248 a452b5e5 Csaba Kiraly
endif