Statistics
| Branch: | Tag: | Revision:

streamers-build / Makefile @ 7e677ddc

History | View | Annotate | Download (5.21 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 ) || ( [ -d .git ] && git describe --tags --always ) || ( [ -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
34

    
35
all: pack
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 update --init -- $(shell dirname $@)
58

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

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

    
67
ChunkerPlayer/chunker_player/chunker_player$(EXE): ChunkerPlayer/.git
68
endif
69

    
70
Streamers/streamer-grapes: $(THIRDPARTYLIBS)
71
	GRAPES=$(THIRDPARTYLIBS)/GRAPES FFMPEG_DIR=$(THIRDPARTYLIBS)/ffmpeg X264_DIR=$(THIRDPARTYLIBS)/x264 $(MAKE) -C Streamers  || { echo "Error compiling the Streamer" && exit 1; }
72

    
73
#version with NAPA-libs
74
Streamers/streamer-ml-monl-grapes$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
75
	GRAPES=$(THIRDPARTYLIBS)/GRAPES FFMPEG_DIR=$(THIRDPARTYLIBS)/ffmpeg X264_DIR=$(THIRDPARTYLIBS)/x264 STATIC=$(STATIC) NAPA=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ LIBEVENT_DIR=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent ML=1 MONL=1 $(MAKE) -C Streamers || { echo "Error compiling the ML+MONL version of the Streamer" && exit 1; }
76

    
77
Streamers/streamer-chunkstream$(EXE): $(THIRDPARTYLIBS)
78
	IO=chunkstream GRAPES=$(THIRDPARTYLIBS)/GRAPES FFMPEG_DIR=$(THIRDPARTYLIBS)/ffmpeg X264_DIR=$(THIRDPARTYLIBS)/x264 $(MAKE) -C Streamers  || { echo "Error compiling the Streamer" && exit 1; }
79

    
80
Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE): $(THIRDPARTYLIBS)
81
	IO=chunkstream GRAPES=$(THIRDPARTYLIBS)/GRAPES FFMPEG_DIR=$(THIRDPARTYLIBS)/ffmpeg X264_DIR=$(THIRDPARTYLIBS)/x264 STATIC=$(STATIC) NAPA=$(THIRDPARTYLIBS)/NAPA-BASELIBS/ LIBEVENT_DIR=$(THIRDPARTYLIBS)/NAPA-BASELIBS/3RDPARTY-LIBS/libevent ML=1 MONL=1 $(MAKE) -C Streamers || { echo "Error compiling the ML+MONL version of the Streamer" && exit 1; }
82

    
83
ChunkerPlayer/chunker_player/chunker_player$(EXE): $(THIRDPARTYLIBS)
84
	cd ChunkerPlayer && $(FLAGS_CHUNKER) ./build_ul.sh
85

    
86
prepare:
87
ifndef NOGIT
88
	git submodule update --init
89
else
90
	git clone http://halo.disi.unitn.it/~cskiraly/PublicGits/ffmpeg.git THIRDPARTY-LIBS/ffmpeg
91
	cd THIRDPARTY-LIBS/ffmpeg && git checkout -b streamer 210091b0e31832342322b8461bd053a0314e63bc
92
	git clone git://git.videolan.org/x264.git THIRDPARTY-LIBS/x264
93
	cd THIRDPARTY-LIBS/x264 && git checkout -b streamer 08d04a4d30b452faed3b763528611737d994b30b
94
endif
95

    
96
clean:
97
	$(MAKE) -C $(THIRDPARTYLIBS) clean
98
	$(MAKE) -C Streamers clean
99
	$(MAKE) -C ChunkerPlayer/chunker_player clean
100
	$(MAKE) -C ChunkerPlayer/chunk_transcoding clean
101
	$(MAKE) -C ChunkerPlayer/chunker_streamer clean
102

    
103
pack:  $(DIR)-stripped.tgz
104

    
105
$(DIR)-stripped.tgz:  Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) ChunkerPlayer/chunker_player/chunker_player$(EXE)
106
	rm -rf $(DIR) $(DIR).tgz $(DIR)-stripped.tgz
107
	mkdir $(DIR)
108
	cp Streamers/streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)
109
	cp ChunkerPlayer/chunker_player/chunker_player$(EXE) $(DIR)
110
	mkdir $(DIR)/icons
111
	cp ChunkerPlayer/chunker_player/icons/* $(DIR)/icons
112
	cp ChunkerPlayer/chunker_player/stats_font.ttf ChunkerPlayer/chunker_player/mainfont.ttf ChunkerPlayer/chunker_player/napalogo_small.bmp $(DIR)
113
	echo streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) > $(DIR)/peer_exec_name.conf
114
ifneq ($(HOSTARCH),mingw32)
115
	ln -s streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) $(DIR)/streamer
116
	cp ChunkerPlayer/chunker_streamer/chunker_streamer ChunkerPlayer/chunker_streamer/chunker.conf $(DIR)
117
	cp scripts/source.sh $(DIR)
118
	cp scripts/player.sh $(DIR)
119
endif
120
	cp channels.conf $(DIR)
121
	cp README $(DIR)
122
ifneq ($(HOSTARCH),mingw32)
123
	tar czf $(DIR).tgz $(DIR)
124
	cd $(DIR) && strip chunker_streamer$(EXE)
125
endif
126
	cd $(DIR) && strip streamer-ml-monl-chunkstream$(XSTATIC)$(EXE) chunker_player$(EXE)
127
ifneq ($(HOSTARCH),mingw32)
128
	tar czf $(DIR)-stripped.tgz $(DIR)
129
else
130
	zip -r $(DIR).zip $(DIR)
131
endif