Statistics
| Branch: | Tag: | Revision:

streamers-build / Makefile @ af7a9c24

History | View | Annotate | Download (7.94 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
UNAME := $(shell uname)
9
ifeq ($(UNAME), Linux)
10
  # do something Linux-y
11
  STATIC ?= 2
12
  XSTATIC = -static
13
  LINUX_OS = 1
14
endif
15
ifeq ($(UNAME), Darwin)
16
  # do something OSX-y
17
  STATIC = 0
18
  XSTATIC =
19
  MAC_OS = 1
20
endif
21
STATIC ?= 2
22
XSTATIC ?= -static
23

    
24
FLAGS_CHUNKER += LOCAL_FFMPEG=$(THIRDPARTYLIBS)/ffmpeg-install
25
ifneq ($(HOSTARCH),mingw32)
26
FLAGS_CHUNKER += LOCAL_X264=$(THIRDPARTYLIBS)/x264-install 
27
FLAGS_CHUNKER += LOCAL_LIBOGG=$(THIRDPARTYLIBS)/libogg-install
28
FLAGS_CHUNKER += LOCAL_LIBVORBIS=$(THIRDPARTYLIBS)/libvorbis-install
29
FLAGS_CHUNKER += LOCAL_MP3LAME=$(THIRDPARTYLIBS)/mp3lame-install
30
else
31
EXE =.exe
32
endif
33

    
34
.PHONY: $(THIRDPARTYLIBS) update clean ml-chunkstream $(DIR)
35

    
36
all: $(DIR)
37

    
38
simple: Streamers/streamer-udp-grapes$(EXE)
39
ml: Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE)
40
chunkstream: Streamers/streamer-udp-chunkstream$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
41
ml-chunkstream: Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
42

    
43
$(THIRDPARTYLIBS):
44
	$(MAKE) -C $(THIRDPARTYLIBS) || { echo "Error preparing third party libs" && exit 1; }
45

    
46
ifndef NOGIT
47
update:
48
	git pull
49
	git submodule sync
50
	git submodule update
51

    
52
forceupdate:
53
	git stash
54
	git pull
55
	git submodule foreach git stash
56
	git submodule sync
57
	git submodule update
58

    
59
Streamers/.git:
60
	git submodule init -- $(shell dirname $@)
61
	git submodule update -- $(shell dirname $@)
62

    
63
Streamers/streamer-grapes: Streamers/.git
64
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): Streamers/.git
65
Streamers/streamer-chunkstream$(EXE): Streamers/.git
66
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): Streamers/.git
67

    
68
ChunkerPlayer/.git:
69
	git submodule init -- $(shell dirname $@)
70
	git submodule update -- $(shell dirname $@)
71

    
72
ChunkerPlayer/chunker_player/chunker_player$(EXE): ChunkerPlayer/.git
73
endif
74

    
75
#.PHONY: Streamers/streamer-grapes Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE) Streamers/streamer-chunkstream$(EXE) Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE)
76
Streamers/streamer-udp-grapes: $(THIRDPARTYLIBS)
77
	cd Streamers && ./configure \
78
	--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags`" --with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs`" \
79
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
80
	--with-net-helper=udp \
81
	--with-static=$(STATIC)
82
	$(MAKE) -C Streamers
83

    
84
#version with NAPA-libs
85
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
86
	cd Streamers && ./configure \
87
	--with-ldflags="`cat $(THIRDPARTYLIBS)/ffmpeg.ldflags`" --with-ldlibs="`cat $(THIRDPARTYLIBS)/ffmpeg.ldlibs`" \
88
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
89
	--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \
90
	--with-net-helper=ml --with-monl \
91
	--with-static=$(STATIC)
92
	$(MAKE) -C Streamers
93

    
94
Streamers/streamer-udp-chunkstream$(EXE): $(THIRDPARTYLIBS)
95
	cd Streamers && ./configure \
96
	--with-io=chunkstream \
97
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
98
	--with-net-helper=udp \
99
	--with-static=$(STATIC)
100
	$(MAKE) -C Streamers
101

    
102
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
103
	cd Streamers && ./configure \
104
	--with-io=chunkstream \
105
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
106
	--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \
107
	--with-net-helper=ml --with-monl \
108
	--with-static=$(STATIC)
109
	$(MAKE) -C Streamers
110

    
111
ChunkerPlayer/chunker_player/chunker_player$(EXE): $(THIRDPARTYLIBS)
112
	cd ChunkerPlayer && $(FLAGS_CHUNKER) ./build_ul.sh
113

    
114
prepare:
115
ifndef NOGIT
116
	git submodule init
117
	git submodule update
118
else
119
	git clone http://halo.disi.unitn.it/~cskiraly/PublicGits/ffmpeg.git THIRDPARTY-LIBS/ffmpeg
120
	cd THIRDPARTY-LIBS/ffmpeg && git checkout -b streamer 210091b0e31832342322b8461bd053a0314e63bc
121
	git clone git://git.videolan.org/x264.git THIRDPARTY-LIBS/x264
122
	cd THIRDPARTY-LIBS/x264 && git checkout -b streamer 08d04a4d30b452faed3b763528611737d994b30b
123
endif
124

    
125
clean:
126
	$(MAKE) -C $(THIRDPARTYLIBS) clean
127
	$(MAKE) -C Streamers clean
128
	$(MAKE) -C ChunkerPlayer/chunker_player clean
129
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
130
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
131
ifdef MAC_OS
132
	rm -rf *.app *.dmg
133
endif
134

    
135
distclean:
136
	$(MAKE) -C $(THIRDPARTYLIBS) distclean
137
	$(MAKE) -C Streamers clean
138
	$(MAKE) -C ChunkerPlayer/chunker_player clean
139
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
140
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
141

    
142
pack:  $(DIR)-stripped.tgz
143

    
144
$(DIR):  Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
145
	rm -rf $(DIR) $(DIR).tgz $(DIR)-stripped.tgz
146
	mkdir $(DIR)
147
	cp Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)
148
	cp ChunkerPlayer/chunker_player/chunker_player$(EXE) $(DIR)
149
	mkdir $(DIR)/icons
150
	cp ChunkerPlayer/chunker_player/icons/* $(DIR)/icons
151
	cp ChunkerPlayer/chunker_player/stats_font.ttf ChunkerPlayer/chunker_player/mainfont.ttf ChunkerPlayer/chunker_player/napalogo_small.bmp $(DIR)
152
	echo streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) > $(DIR)/peer_exec_name.conf
153
ifneq ($(HOSTARCH),mingw32)
154
	ln -s streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)/streamer
155
	cp ChunkerPlayer/chunker_streamer/chunker_streamer ChunkerPlayer/chunker_streamer/chunker.conf $(DIR)
156
	cp scripts/source.sh $(DIR)
157
	cp scripts/player.sh $(DIR)
158
endif
159
	cp channels.conf $(DIR)
160
	cp README $(DIR)
161

    
162
$(DIR).tgz: $(DIR)
163
	tar czf $(DIR).tgz $(DIR)
164

    
165
$(DIR)-stripped.tgz: $(DIR).tgz
166
ifneq ($(HOSTARCH),mingw32)
167
	cd $(DIR) && strip chunker_streamer$(EXE)
168
endif
169
	cd $(DIR) && strip streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) chunker_player$(EXE)
170
ifneq ($(HOSTARCH),mingw32)
171
	tar czf $(DIR)-stripped.tgz $(DIR)
172
else
173
	zip -r $(DIR).zip $(DIR)
174
endif
175

    
176
install: $(DIR)
177
	mkdir -p /opt/peerstreamer
178
	cp -r $(DIR)/* /opt/peerstreamer
179
	ln -f -s /opt/peerstreamer/player.sh /usr/local/bin/peerstreamer
180
	cp -r Installer/Lin/usr/share /usr
181

    
182
uninstall:
183
	rm -rf /opt/peerstreamer
184
	rm -f /usr/local/bin/peerstreamer
185
	rm -rf /usr/share/applications/peerstreamer.desktop
186
	rm -rf /usr/share/menu/peerstreamer
187
	rm -rf /usr/share/pixmaps/peerstreamer.xpm
188

    
189
ifdef LINUX_OS
190
debian:
191
	fakeroot checkinstall -D --fstrans --install=no --pkgname="peerstreamer" --pkgversion="$(subst PeerStreamer-,,$(REV))" --pkglicense="GPLv3" --maintainer='"Csaba Kiraly <info@peerstreamer.org>"' --nodoc --strip=yes --showinstall=no --default --backup=no
192

    
193
debian-amd64:
194
	fakeroot checkinstall --requires=ia32-libs -D --fstrans --install=no --pkgname="peerstreamer" --pkgversion="$(subst PeerStreamer-,,$(REV))" --pkgarch=amd64 --pkglicense="GPLv3" --maintainer='"Csaba Kiraly <info@peerstreamer.org>"' --nodoc --strip=yes --showinstall=no --default --backup=no
195

    
196
rpm: TMPDIR:=$(shell mktemp -d)
197
rpm: debian
198
	cp $(subst PeerStreamer-,peerstreamer_,$(DIR))-1_i386.deb $(TMPDIR)
199
	cd $(TMPDIR) && alien -r $(subst PeerStreamer-,peerstreamer_,$(DIR))-1_i386.deb -v --fixperms -k
200
	mv $(TMPDIR)/$(subst PeerStreamer_,peerstreamer-,$(subst -,_,$(DIR)))-1.i386.rpm .
201
	rm -rf $(TMPDIR)
202
endif
203

    
204
ifeq ($(HOSTARCH),mingw32)
205
installer-win: $(DIR)
206
	ln -s $(DIR) PeerStreamer
207
	makensis -DPRODUCT_VERSION="$(subst PeerStreamer-,,$(REV))" Installer/Win/peerstreamer.nsi
208
	rm PeerStreamer
209
	mv Installer/Win/PeerStreamerInstaller*.exe .
210
endif
211

    
212
ifdef MAC_OS
213
installer-OSX: $(DIR)
214
	cd Installer/OSX/ && tar zfx OSX_template.tgz && ./makeApp.sh $(DIR) && rm -rf napa-template.app && make VERSION=$(REV) && mv $(REV).dmg ../../
215
endif