Statistics
| Branch: | Revision:

chunker-player / build_ul.sh @ e4ef5ca5

History | View | Annotate | Download (8.68 KB)

1
#!/bin/bash
2
SCRIPT=$(readlink -f $0)
3
BASE_UL_DIR=`dirname $SCRIPT`
4
EXTERN_DIR="external_libs"
5
MAKE="make -j 4"
6
cd "$BASE_UL_DIR"
7

    
8
LIBTOOLIZE_PATH=`whereis -b libtoolize`
9
if [ "$LIBTOOLIZE_PATH" = "libtoolize:" ]; then
10
	echo "Can't find libtoolize. Try sudo apt-get install libtool"
11
	exit
12
fi
13

    
14
YASM_PATH=`whereis -b yasm`
15
if [ "$YASM_PATH" = "yasm:" ]; then
16
	echo "Can't find yasm assembler. Try sudo apt-get install yasm"
17
	exit
18
fi
19

    
20
#try to find libbz2 in your system
21
LOCAL_BZ2_A=`locate -l 1 libbz2.a`
22
if [ $LOCAL_BZ2_A = "" ]; then
23
    if [ -f "/usr/lib/libbz2.a" ]; then
24
	echo "You have file libbz2.a in default system"
25
	echo "setting path for it to default /usr/lib/libbz2.a"
26
	LOCAL_BZ2="/usr"
27
    else
28
	echo "you seem not to have file libbz2.a. EXITING."
29
	exit
30
    fi
31
else
32
    LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
33
fi
34

    
35
#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
36
if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
37
	#remove previuos versions of external libs builds
38
	rm -r -f $EXTERN_DIR
39
fi
40

    
41
mkdir $EXTERN_DIR
42

    
43
if [ -n "$BUILD_X264" ]; then
44
	cd "$BASE_UL_DIR/$EXTERN_DIR"
45
	rm -r -f x264
46
	#get and compile latest x264 library
47
	git clone git://git.videolan.org/x264.git
48
	cd x264
49
	#make and simulate install in local folder
50
	./configure --prefix="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install"
51
	$MAKE; $MAKE install
52
fi
53

    
54
if [ -n "$BUILD_MP3LAME" ]; then
55
	cd "$BASE_UL_DIR/$EXTERN_DIR"
56
	rm -r -f mp3lame
57
	#get and compile latest mp3lame library
58
	rm -f lame-3.98.4.tar.gz
59
	wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download; tar xzf lame-3.98.4.tar.gz; mv lame-3.98.4 mp3lame;
60
	cd mp3lame
61
	#make and simulate install in local folder
62
	./configure --disable-gtktest --disable-frontend --prefix="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install"
63
	$MAKE; $MAKE install
64
fi
65

    
66
if [ -n "$BUILD_FFMPEG" ]; then
67
	cd "$BASE_UL_DIR/$EXTERN_DIR"
68
	rm -r -f ffmpeg
69
	#get and compile ffmpeg with x264 support
70
	#get latest snapshot
71
	rm -f ffmpeg-checkout-snapshot.tar.bz2
72
	wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
73
	#do not get latest snapshot
74
	#get instead a specific one because allows output video rate resampling
75
	#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
76
	cd ffmpeg
77
	./configure --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --enable-pthreads --extra-cflags="-I../x264/temp_x264_install/include -I../mp3lame/temp_mp3lame_install/include" --extra-ldflags="-L../x264/temp_x264_install/lib -L../mp3lame/temp_mp3lame_install/lib"
78
	$MAKE
79
fi
80

    
81
if [ -n "$BUILD_MHD" ]; then
82
	cd "$BASE_UL_DIR/$EXTERN_DIR"
83
	rm -r -f libmicrohttpd
84
	#get and compile libmicrohttpd lib
85
	svn --trust-server-cert --non-interactive checkout https://ng.gnunet.org/svn/libmicrohttpd
86
	cd libmicrohttpd
87
	autoreconf -fi
88
	./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install"
89
	$MAKE; $MAKE install
90
fi
91

    
92
if [ -n "$BUILD_SDL" ]; then
93
	cd "$BASE_UL_DIR/$EXTERN_DIR"
94
	rm -r -r sdl
95
	#get and compile SDL lib
96
	rm -f SDL-1.2.14.tar.gz
97
	wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz; tar xzf SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl
98
	cd sdl
99
	#make and simulate install in local folder
100
	./configure --disable-video-directfb --prefix="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install"
101
	$MAKE; $MAKE install
102
fi
103

    
104
if [ -n "$BUILD_SDLIMAGE" ]; then
105
	cd "$BASE_UL_DIR/$EXTERN_DIR"
106
	rm -r -r sdlimage
107
	#get and compile SDLIMAGE lib
108
	rm -f SDL_image-1.2.10.tar.gz
109
	wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz; tar xzf SDL_image-1.2.10.tar.gz; mv SDL_image-1.2.10 sdlimage
110
	cd sdlimage
111
	#make and simulate install in local folder
112
	./configure --prefix="$BASE_UL_DIR/$EXTERN_DIR/sdlimage/temp_sdlimage_install"
113
	$MAKE; $MAKE install
114
fi
115

    
116
if [ -n "$BUILD_SDLTTF" ]; then
117
	cd "$BASE_UL_DIR/$EXTERN_DIR"
118
	rm -r -r sdlttf
119
	#get and compile SDLTTF lib
120
	rm -f SDL_ttf-2.0.10.tar.gz
121
	wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.10.tar.gz; tar xzf SDL_ttf-2.0.10.tar.gz; mv SDL_ttf-2.0.10 sdlttf
122
	cd sdlttf
123
	#make and simulate install in local folder
124
	./configure --prefix="$BASE_UL_DIR/$EXTERN_DIR/sdlttf/temp_sdlttf_install"
125
	$MAKE; $MAKE install
126
fi
127

    
128
# SDL_ttf depends on freetype
129
if [ -n "$BUILD_SDLTTF" ]; then
130
	cd "$BASE_UL_DIR/$EXTERN_DIR"
131
	rm -r -r freetype
132
	#get and compile SDLTTF lib
133
	rm -f freetype-2.1.10.tar.gz
134
	wget http://mirror.lihnidos.org/GNU/savannah/freetype/freetype-2.1.10.tar.gz; tar xzf freetype-2.1.10.tar.gz; mv freetype-2.1.10 freetype
135
	cd freetype
136
	#make and simulate install in local folder
137
	./configure --prefix="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install"
138
	$MAKE; $MAKE install
139
fi
140

    
141
if [ -n "$BUILD_CURL" ]; then
142
	cd "$BASE_UL_DIR/$EXTERN_DIR"
143
	rm -r -r curl
144
	#get and compile CURL lib
145
	rm -f curl-7.21.0.tar.bz2
146
	wget http://curl.haxx.se/download/curl-7.21.0.tar.bz2; tar xjf curl-7.21.0.tar.bz2; mv curl-7.21.0 curl
147
	cd curl
148
	#make and simulate install in local folder
149
	./configure --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --without-libssh2 --without-ssl --without-krb4 --enable-static --disable-shared --without-zlib --without-libidn --prefix="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install"
150
	$MAKE; $MAKE install
151
fi
152

    
153
#set needed paths to external libraries
154
echo "-----"
155
LOCAL_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install"
156
echo "path for X264 dependancy set to $LOCAL_X264"
157
LOCAL_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install"
158
echo "path for MP3LAME dependancy set to $LOCAL_MP3LAME"
159
LOCAL_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg"
160
echo "path for FFMPEG dependancy set to $LOCAL_FFMPEG"
161
LOCAL_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install"
162
echo "path for LIBMICROHTTPD dependancy set to $LOCAL_MHD"
163
LOCAL_ABS_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install"
164
echo "path for SDL dependancy set to $LOCAL_ABS_SDL"
165
LOCAL_SDLIMAGE="$BASE_UL_DIR/$EXTERN_DIR/sdlimage/temp_sdlimage_install"
166
echo "path for SDLIMAGE dependancy set to $LOCAL_SDLIMAGE"
167
LOCAL_SDLTTF="$BASE_UL_DIR/$EXTERN_DIR/sdlttf/temp_sdlttf_install"
168
echo "path for SDLTTF dependancy set to $LOCAL_SDLTTF"
169
LOCAL_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install"
170
echo "path for FREETYPE dependancy set to $LOCAL_FREETYPE"
171
LOCAL_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install"
172
echo "path for CURL dependancy set to $LOCAL_CURL"
173

    
174
echo "path for BZ2 dependancy is set to $LOCAL_BZ2"
175
echo "-----"
176

    
177
#compile the UL external applications
178
#CHUNKER_STREAMER
179
echo "----------------COMPILING CHUNKER STREAMER"
180
cd "$BASE_UL_DIR"
181
cd chunker_streamer
182
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
183
    LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
184
    echo "found LIBCONFUSE in $LOCAL_CONFUSE"
185
else
186
    LOCAL_CONFUSE_A=`locate -l 1 libconfuse.a`
187
    if [ "$LOCAL_CONFUSE_A" = "" ]; then
188
        if [ -f "/usr/lib/libconfuse.a" ]; then
189
	    echo "You have file libconfuse.a in default system"
190
	    echo "setting path for it to default /usr/lib/libconfuse.a"
191
	    LOCAL_CONFUSE="/usr"
192
	else
193
	    echo "you seem not to have file libconfuse.a. EXITING."
194
	    exit
195
	fi
196
    else
197
	LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
198
    fi
199
fi
200
$MAKE clean
201
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_CURL=$LOCAL_CURL LOCAL_CONFUSE=$LOCAL_CONFUSE $MAKE
202
echo "----------------FINISHED COMPILING CHUNKER STREAMER"
203
#CHUNKER_PLAYER
204
echo "----------------COMPILING CHUNKER PLAYER"
205
cd "$BASE_UL_DIR"
206
cd chunker_player
207
$MAKE clean
208
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_MHD=$LOCAL_MHD LOCAL_ABS_SDL=$LOCAL_ABS_SDL LOCAL_SDLIMAGE=$LOCAL_SDLIMAGE LOCAL_FREETYPE=$LOCAL_FREETYPE LOCAL_SDLTTF=$LOCAL_SDLTTF LOCAL_CONFUSE=$LOCAL_CONFUSE $MAKE
209
echo "----------------FINISHED COMPILING CHUNKER PLAYER"
210

    
211
#compile a version of offerstreamer with UL enabled
212
#static needs fix??
213
cd "$BASE_UL_DIR/../OfferStreamer"
214
$MAKE clean
215
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
216
    LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
217
    echo "found LIBEVENT in $LOCAL_EVENT"
218
else
219
    LOCAL_EVENT_A=`locate -l 1 libevent.a`
220
    if [ "$LOCAL_EVENT_A" = "" ]; then
221
        if [ -f "/usr/lib/libevent.a" ]; then
222
	    echo "You have file libevent.a in default system"
223
	    echo "setting path for it to default /usr/lib/libevent.a"
224
	    LOCAL_EVENT="/usr"
225
	else
226
	    echo "you seem not to have file libevent.a. EXITING."
227
	    exit
228
	fi
229
    else
230
	LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
231
    fi
232
fi
233
ULPLAYER=$BASE_UL_DIR ULPLAYER_EXTERNAL_LIBS=$EXTERN_DIR LIBEVENT_DIR=$LOCAL_EVENT ML=1 STATIC= MONL=1 HTTPIO=1 DEBUG=1 $MAKE