Statistics
| Branch: | Tag: | Revision:

streamers-build / Makefile @ da7b5d65

History | View | Annotate | Download (6.29 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
endif
14
ifeq ($(UNAME), Darwin)
15
  # do something OSX-y
16
  STATIC = 0
17
  XSTATIC =
18
  MAC_OS = 1
19
endif
20
STATIC ?= 2
21
XSTATIC ?= -static
22

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

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

    
35
all: $(DIR)
36

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

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

    
45
ifndef NOGIT
46
update:
47
	git pull
48
	git submodule update
49

    
50
forceupdate:
51
	git stash
52
	git pull
53
	git submodule foreach git stash
54
	git submodule update
55

    
56
Streamers/.git:
57
	git submodule init -- $(shell dirname $@)
58
	git submodule update -- $(shell dirname $@)
59

    
60
Streamers/streamer-grapes: Streamers/.git
61
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): Streamers/.git
62
Streamers/streamer-chunkstream$(EXE): Streamers/.git
63
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): Streamers/.git
64

    
65
ChunkerPlayer/.git:
66
	git submodule init -- $(shell dirname $@)
67
	git submodule update -- $(shell dirname $@)
68

    
69
ChunkerPlayer/chunker_player/chunker_player$(EXE): ChunkerPlayer/.git
70
endif
71

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

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

    
90
Streamers/streamer-chunkstream$(EXE): $(THIRDPARTYLIBS)
91
	cd Streamers && ./configure \
92
	--with-io=chunkstream \
93
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
94
	--with-static=$(STATIC)
95
	$(MAKE) -C Streamers
96

    
97
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
98
	cd Streamers && ./configure \
99
	--with-io=chunkstream \
100
	--with-grapes=$(THIRDPARTYLIBS)/GRAPES --with-ffmpeg=$(THIRDPARTYLIBS)/ffmpeg --with-x264=$(THIRDPARTYLIBS)/x264 \
101
	--with-napa=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ --with-libevent=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent \
102
	--with-ml --with-monl \
103
	--with-static=$(STATIC)
104
	$(MAKE) -C Streamers
105

    
106
ChunkerPlayer/chunker_player/chunker_player$(EXE): $(THIRDPARTYLIBS)
107
	cd ChunkerPlayer && $(FLAGS_CHUNKER) ./build_ul.sh
108

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

    
120
clean:
121
	$(MAKE) -C $(THIRDPARTYLIBS) clean
122
	$(MAKE) -C Streamers clean
123
	$(MAKE) -C ChunkerPlayer/chunker_player clean
124
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
125
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
126

    
127
distclean:
128
	$(MAKE) -C $(THIRDPARTYLIBS) distclean
129
	$(MAKE) -C Streamers clean
130
	$(MAKE) -C ChunkerPlayer/chunker_player clean
131
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
132
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
133

    
134
pack:  $(DIR)-stripped.tgz
135

    
136
$(DIR):  Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
137
	rm -rf $(DIR) $(DIR).tgz $(DIR)-stripped.tgz
138
	mkdir $(DIR)
139
	cp Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)
140
	cp ChunkerPlayer/chunker_player/chunker_player$(EXE) $(DIR)
141
	mkdir $(DIR)/icons
142
	cp ChunkerPlayer/chunker_player/icons/* $(DIR)/icons
143
	cp ChunkerPlayer/chunker_player/stats_font.ttf ChunkerPlayer/chunker_player/mainfont.ttf ChunkerPlayer/chunker_player/napalogo_small.bmp $(DIR)
144
	echo streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) > $(DIR)/peer_exec_name.conf
145
ifneq ($(HOSTARCH),mingw32)
146
	ln -s streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)/streamer
147
	cp ChunkerPlayer/chunker_streamer/chunker_streamer ChunkerPlayer/chunker_streamer/chunker.conf $(DIR)
148
	cp scripts/source.sh $(DIR)
149
	cp scripts/player.sh $(DIR)
150
endif
151
	cp channels.conf $(DIR)
152
	cp README $(DIR)
153

    
154
$(DIR).tgz: $(DIR)
155
	tar czf $(DIR).tgz $(DIR)
156

    
157
$(DIR)-stripped.tgz: $(DIR).tgz
158
ifneq ($(HOSTARCH),mingw32)
159
	cd $(DIR) && strip chunker_streamer$(EXE)
160
endif
161
	cd $(DIR) && strip streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) chunker_player$(EXE)
162
ifneq ($(HOSTARCH),mingw32)
163
	tar czf $(DIR)-stripped.tgz $(DIR)
164
else
165
	zip -r $(DIR).zip $(DIR)
166
endif
167

    
168
ifeq ($(HOSTARCH),mingw32)
169
installer-win: $(DIR)
170
	ln -s $(DIR) PeerStreamer
171
	PEERSTREAMER_VERSION=$(REV) makensis Installer/Win/NAPA-installer.nsi
172
	rm PeerStreamer
173
	mv Installer/Win/PeerStreamerInstaller*.exe .
174
endif