Revision e11386c0 build_ul.sh

View differences:

build_ul.sh
1 1
#!/bin/bash
2
SCRIPT=$(readlink -f $0)
3
BASE_UL_DIR=`dirname $SCRIPT`
2
SCRIPT=$0
3
BASE_UL_DIR=`pwd`
4 4
EXTERN_DIR="external_libs"
5
MAKE="make -j `grep processor /proc/cpuinfo | wc -l`"
5
MAKE="make -j 4"
6 6
cd "$BASE_UL_DIR"
7 7

  
8
which svn >/dev/null || { echo "CANNOT build UL Applications: svn missing. Please install subversion, then retry!"; exit 1; }
9
#which libtoolize >/dev/null || { echo "CANNOT build UL Applications: libtool missing. Please install libtool, then retry!"; exit 1; }
10
which yasm >/dev/null || { echo "CANNOT build UL Applications: yasm missing. Please install yasm, then retry!"; exit 1; }
11
if [ ! -n "MAC_OS" ]; then
12
  #we don't have git on osx - so we avoid using it
13
  which git >/dev/null || { echo "CANNOT build UL Applications: git missing. Please install git, then retry!"; exit 1; }
14
fi
15
WGET_OR_CURL=`which wget`
16
[ -n "$WGET_OR_CURL" ] || { WGET_OR_CURL=`which curl` ; WGET_OR_CURLOPT="-L -O"; }
17
[ -n "$WGET_OR_CURL" ] || { echo "please install wget or curl!"; exit 1; }
18

  
8 19
#set some defaults
9 20
IO=${IO:-"httpevent"}
10 21
MONL=${MONL:-1}
11 22
ML=${ML:-1}
12 23

  
24
if [ "$HOSTARCH" = "mingw32" ]; then
25
	MINGW=1
26
fi
27

  
13 28
#by default build an check
14 29
BUILD_ALL=1
15 30

  
16
LIBTOOLIZE_PATH=`whereis -b libtoolize`
31
LIBTOOLIZE_PATH=`whereis libtoolize`
17 32
if [ "$LIBTOOLIZE_PATH" = "libtoolize:" ]; then
18 33
	echo "Can't find libtoolize. Try sudo apt-get install libtool"
19 34
	exit
20 35
fi
21 36

  
22
YASM_PATH=`whereis -b yasm`
37
YASM_PATH=`whereis yasm`
23 38
if [ "$YASM_PATH" = "yasm:" ]; then
24 39
	echo "Can't find yasm assembler. Try sudo apt-get install yasm"
25 40
	exit
26 41
fi
27 42

  
28
#try to find libbz2 in your system
29
LOCAL_BZ2_A=`locate -l 1 libbz2.a`
30
if [ "$LOCAL_BZ2_A" = "" ]; then
31
	if [ -f "/usr/lib/libbz2.a" ]; then
43
mkdir $EXTERN_DIR
44

  
45
if [ -n "$MINGW" ]; then
46
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2_mingw"
47
	if [ ! -e "$TEMP_BZ2/lib/libbz2.a" ]; then
48
		#we erase and rebuild since the installation is not there
49
		cd "$BASE_UL_DIR/$EXTERN_DIR"
50
		rm -r -f bzip2_mingw
51
		#get the latest bzip2 library
52
		$WGET_OR_CURL $WGET_OR_CURLOPT http://switch.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-bin.zip; unzip bzip2-1.0.5-bin.zip -d bzip2_mingw
53
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sunet.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-lib.zip; unzip -o bzip2-1.0.5-lib.zip -d bzip2_mingw
54
		rm -f bzip2-1.0.5-lib.zip; rm -f bzip2-1.0.5-bin.zip;
55
	fi
56
	LOCAL_BZ2=$TEMP_BZ2
57
else
58
	#try to find libbz2 in your system
59
	LOCAL_BZ2_A=/usr/lib/libbz2.a
60
	if [ ! -e $LOCAL_BZ2_A ]; then
61
		LOCAL_BZ2_A=`locate -l 1 libbz2.a`
62
		[ X$LOCAL_BZ2_A != X ] && LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
63
		if [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
64
			#wrong location and/or folders structure
65
			echo "you seem not to have file libbz2.a or the location is non-standard.Will be built locally."
66
			LOCAL_BZ2=""
67
			BUILD_BZ2=1
68
		fi
69
	else
32 70
		echo "You have file libbz2.a in default system"
33 71
		echo "setting path for it to default /usr/lib/libbz2.a"
34 72
		LOCAL_BZ2="/usr"
35
	else
36
		echo "you seem not to have file libbz2.a. Will be built locally."
37
		BUILD_BZ2=1
38
	fi
39
else
40
	LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
41
	if [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
42
		#wrong location and/or folders structure
43
		LOCAL_BZ2=""
44
		BUILD_BZ2=1
45 73
	fi
46 74
fi
47 75

  
48
#try to find libz in your system
49
LOCAL_Z_A=`locate -l 1 libz.a`
50
if [ "$LOCAL_Z_A" = "" ]; then
51
	if [ -f "/usr/lib/libz.a" ]; then
52
		echo "You have file libz.a in default system"
53
		echo "setting path for it to default /usr/lib/libz.a"
54
		LOCAL_Z="/usr"
55
	else
56
		echo "you seem not to have file libz.a. Will be built locally."
57
		BUILD_Z=1
76
if [ -n "$MINGW" ]; then
77
	TEMP_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib_mingw"
78
	if [ ! -e "$TEMP_Z/lib/libz.a" ]; then
79
		cd "$BASE_UL_DIR/$EXTERN_DIR"
80
		rm -r -f zlib_mingw;
81
		#get the latest zlib libraries
82
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sunet.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3-bin.zip; unzip zlib-1.2.3-bin.zip -d zlib_mingw
83
		$WGET_OR_CURL $WGET_OR_CURLOPT http://kent.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3-lib.zip; unzip -o zlib-1.2.3-lib.zip -d zlib_mingw
84
		rm -f zlib-1.2.3-bin.zip; rm -f zlib-1.2.3-lib.zip;
58 85
	fi
86
	LOCAL_Z=$TEMP_Z
59 87
else
60
	LOCAL_Z=`dirname $LOCAL_Z_A`/..
61
	if [ ! -e "$LOCAL_Z/lib/libz.a" ]; then
62
		#wrong location and/or folders structure
63
		LOCAL_Z=""
64
		BUILD_Z=1
88
	LOCAL_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib/temp_zlib_install_linux"
89
	if [ -f "$LOCAL_Z/lib/libz.a" ]; then
90
		echo "libz.a found in $LOCAL_Z/lib"
91
	else
92
		#force building locally
93
		#does not exist systemwide
94
		cd "$BASE_UL_DIR/$EXTERN_DIR"
95
		rm -r -f zlib
96
		#get and compile latest zlib library
97
		$WGET_OR_CURL $WGET_OR_CURLOPT http://zlib.net/zlib-1.2.5.tar.gz; tar xzf zlib-1.2.5.tar.gz; mv zlib-1.2.5 zlib; rm -f zlib-1.2.5.tar.gz
98
		cd zlib
99
		#make and install in local folder
100
		./configure --prefix="$LOCAL_Z"
101
		$MAKE; $MAKE install
65 102
	fi
66
fi
67 103

  
68
#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
69
if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
70
	#remove previuos versions of external libs builds
71
	rm -r -f $EXTERN_DIR
104
	#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
105
	if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
106
		#remove previuos versions of external libs builds
107
		rm -r -f $EXTERN_DIR
108
	fi
72 109
fi
73

  
74
mkdir $EXTERN_DIR
75

  
76
TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2/temp_bzip2_install"
77
if [ -n "$BUILD_BZ2" ]; then
78
	#we have to build it either because of user will or because does not exist system wide
79
	if [ -z "$LOCAL_BZ2" ]; then
80
		#does not exist systemwide
81
		if [ -n "$BUILD_ALL" -a ! -e "$TEMP_BZ2" ]; then
82
			#we erase and rebuild since the installation is not there
83
			cd "$BASE_UL_DIR/$EXTERN_DIR"
84
			rm -r -f bzip2
85
			rm -f bzip2-1.0.5.tar.gz
86
			#get and compile latest bzip2 library
87
			wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz; tar xzf bzip2-1.0.5.tar.gz; mv bzip2-1.0.5 bzip2
88
			cd bzip2
89
			#make and install in local folder
90
			$MAKE; $MAKE install PREFIX="$TEMP_BZ2"
110
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_Z/include"
111
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_Z/lib"
112

  
113
if [ ! -n "$MINGW" ]; then
114
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2/temp_bzip2_install_linux"
115
	if [ -n "$BUILD_BZ2" ]; then
116
		#we have to build it either because of user will or because does not exist system wide
117
		if [ -z "$LOCAL_BZ2" ]; then
118
			#does not exist systemwide
119
			if [ -n "$BUILD_ALL" -a ! -e "$TEMP_BZ2" ]; then
120
				#we erase and rebuild since the installation is not there
121
				cd "$BASE_UL_DIR/$EXTERN_DIR"
122
				rm -r -f bzip2
123
				#get and compile latest bzip2 library
124
				$WGET_OR_CURL $WGET_OR_CURLOPT http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz; tar xzf bzip2-1.0.5.tar.gz; mv bzip2-1.0.5 bzip2; rm -f bzip2-1.0.5.tar.gz
125
				cd bzip2
126
				#make and install in local folder
127
				$MAKE; $MAKE install PREFIX="$TEMP_BZ2"
128
			fi
129
			#previous local install is existing, just set pointer to it
130
			#or override location if it was set as systemwide
131
			LOCAL_BZ2=$TEMP_BZ2
91 132
		fi
92
		#previous local install is existing, just set pointer to it
93
		#or override location if it was set as systemwide
94
		LOCAL_BZ2=$TEMP_BZ2
95 133
	fi
96 134
fi
97 135

  
98
TEMP_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib/temp_zlib_install"
99
if [ -n "$BUILD_Z" ]; then
100
	#we have to build it either because of user will or because does not exist system wide
101
	if [ -z "$LOCAL_Z" ]; then
102
		#does not exist systemwide
103
		if [ -n "$BUILD_ALL" -a ! -e "$TEMP_Z" ]; then
104
			cd "$BASE_UL_DIR/$EXTERN_DIR"
105
			rm -r -f zlib
106
			rm -f zlib-1.2.5.tar.gz
107
			#get and compile latest zlib library
108
			wget http://zlib.net/zlib-1.2.5.tar.gz; tar xzf zlib-1.2.5.tar.gz; mv zlib-1.2.5 zlib
109
			cd zlib
110
			#make and install in local folder
111
			./configure --prefix="$TEMP_Z"
112
			$MAKE; $MAKE install
113
		fi
114
		#previous local install is existing, just set pointer to it
115
		#or override location if it was set as systemwide
116
		LOCAL_Z=$TEMP_Z
136

  
137
if [ -n "$MINGW" ]; then
138
	# plibc
139
	LOCAL_PLIBC="$BASE_UL_DIR/$EXTERN_DIR/plibc"
140
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a" ]; then
141
		echo "You have file libplibc.dll.a in default system: $BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a"
142
	else
143
		cd "$BASE_UL_DIR/$EXTERN_DIR"
144
		rm -fR plibc
145
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ovh.dl.sourceforge.net/project/plibc/plibc/0.1.5/plibc-0.1.5.zip
146
		unzip plibc-0.1.5.zip -d plibc;
147
		rm -f plibc/lib/*.la
148
		rm -f plibc-0.1.5.zip
149
	fi
150
	LIBMICROHHTPD_FLAGS="-I$BASE_UL_DIR/$EXTERN_DIR/plibc/include"
151
	LIBMICROHHTPD_LDFLAGS="-L$BASE_UL_DIR/$EXTERN_DIR/plibc/lib"
152

  
153
	# libiconv
154
	LOCAL_LIBICONV="$BASE_UL_DIR/$EXTERN_DIR/libiconv/temp_libiconv_install_mingw"
155
	if [ -f "$LOCAL_LIBICONV/lib/libiconv.a" ]; then
156
		echo "libiconv.a found in $LOCAL_LIBICONV/lib"
157
	else
158
		cd "$BASE_UL_DIR/$EXTERN_DIR"
159
		rm -fR libiconv
160
		
161
		#download binaries
162
		#~ wget http://kent.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-dep.zip; unzip libintl-0.14.4-dep.zip -d libiconv
163
		#~ mkdir -p $LOCAL_LIBICONV/lib/
164
		#~ mv libiconv/*.dll $LOCAL_LIBICONV/lib/
165
		#~ rm -f libintl-0.14.4-dep.zip
166
		
167
		#build from sources
168
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
169
		tar zxvf libiconv-1.13.tar.gz; mv libiconv-1.13 libiconv; rm -f libiconv-1.13.tar.gz; cd libiconv
170
		./configure --enable-static ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBICONV
171
		make
172
		make install
173
	fi
174
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBICONV/include"
175
	#~ LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBICONV/lib"
176

  
177
	LOCAL_LIBINTL="$BASE_UL_DIR/$EXTERN_DIR/libintl/temp_libintl_install_mingw"
178
	if [ -f "$LOCAL_LIBINTL/lib/libintl.dll.a" ] || [ -f "$LOCAL_LIBINTL/lib/libintl.a" ]; then
179
		echo "libintl libraries found in $LOCAL_LIBINTL/lib"
180
	else
181
		cd "$BASE_UL_DIR/$EXTERN_DIR"
182
		#download binaries
183
		rm -fR libintl
184
		$WGET_OR_CURL $WGET_OR_CURLOPT http://garr.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-lib.zip; unzip -o libintl-0.14.4-lib.zip -d libintl
185
		$WGET_OR_CURL $WGET_OR_CURLOPT http://switch.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-bin.zip; unzip -o libintl-0.14.4-bin.zip -d libintl
186
		rm -f libintl-0.14.4-bin.zip; rm -f libintl-0.14.4-lib.zip
187
		cd libintl
188
		mkdir -p $LOCAL_LIBINTL;
189
		mv bin $LOCAL_LIBINTL/; mv lib $LOCAL_LIBINTL/; mv include $LOCAL_LIBINTL/
190
		mv man $LOCAL_LIBINTL/; mv share $LOCAL_LIBINTL/
191
		
192
		# build from gettext sources
193
		#~ rm -fR gettext
194
		#~ rm -fR libintl
195
		#~ wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
196
		#~ tar zxvf gettext-0.18.1.1.tar.gz; mv gettext-0.18.1.1 gettext; cd gettext
197
		#~ ./configure ${HOSTARCH:+--host=$HOSTARCH} --with-libiconv-prefix=$LOCAL_LIBICONV
198
		#~ cd gettext-runtime/intl
199
		#~ make
200
		#~ mkdir -p $LOCAL_LIBINTL/bin; mkdir -p $LOCAL_LIBINTL/include; mkdir -p $LOCAL_LIBINTL/lib
201
		#~ cp ./.libs/*a $LOCAL_LIBINTL/lib
202
		#~ cp ./.libs/*.dll $LOCAL_LIBINTL/bin
203
		#~ cp *.h $LOCAL_LIBINTL/include
204
		#~ cd ../../../
205
		#~ rm -f gettext-0.18.1.1.tar.gz
206
		#~ rm -fR gettext
117 207
	fi
208
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBINTL"
209
	LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBINTL/lib"
210

  
211
	# check for mingw pthread libs
212
	LOCAL_PTHREAD="$BASE_UL_DIR/$EXTERN_DIR/pthreads"
213
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a" ]; then
214
		echo "libpthread.a in $LOCAL_PTHREAD/lib/"
215
	else
216
		cd "$BASE_UL_DIR/$EXTERN_DIR"
217
		rm -fR pthreads
218
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
219
		tar zxvf pthreads-w32-2-8-0-release.tar.gz; mv pthreads-w32-2-8-0-release pthreads; rm -f pthreads-w32-2-8-0-release.tar.gz;
220
		cd pthreads
221
		mkdir -p ./{include,lib,bin}
222
		make CROSS=i586-mingw32msvc- GC-inlined
223
		mv libpthreadGC2.a ./lib
224
		mv *.h ./include
225
		mv pthreadGC2.dll ./bin
226
		ln -s "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthreadGC2.a" "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a"
227
	fi
228
	LIBMICROHHTPD_FLAGS="$LIBMICROHHTPD_FLAGS -I$BASE_UL_DIR/$EXTERN_DIR/pthreads/include"
229
	LIBMICROHHTPD_LDFLAGS="$LIBMICROHHTPD_LDFLAGS -L$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib"
118 230
fi
119 231

  
120
TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install"
232

  
233
#libpng
234
if [ -n "$MINGW" ]; then
235
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_mingw"
236
else
237
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_linux"
238
fi
239
if [ -f "$LOCAL_LIBPNG/lib/libpng.a" ]; then
240
	echo "libpng.a found in $LOCAL_LIBPNG/lib"
241
else
242
	cd "$BASE_UL_DIR/$EXTERN_DIR"
243
	rm -fR libpng
244
	$WGET_OR_CURL $WGET_OR_CURLOPT http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.4/libpng-1.4.4.tar.gz
245
	tar zxvf libpng-1.4.4.tar.gz; rm -f libpng-1.4.4.tar.gz
246
	mv libpng-1.4.4 libpng; cd libpng;
247
	CFLAGS=-I$LOCAL_Z/include CPPFLAGS=-I$LOCAL_Z/include LDFLAGS=-L$LOCAL_Z/lib sh configure  ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBPNG
248
	make
249
	make install
250
fi
251
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBPNG/include"
252
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBPNG/lib"
253

  
254

  
255
if [ -n "$MINGW" ]; then
256
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_mingw"
257
else
258
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_linux"
259
fi
121 260
if [ -n "$BUILD_X264" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_X264" ]; then
122 261
	cd "$BASE_UL_DIR/$EXTERN_DIR"
123
	rm -r -f x264
124
	#get and compile latest x264 library
125
	git clone git://git.videolan.org/x264.git
126
	cd x264
262
	if [ -e "x264" ]; then
263
		cd x264
264
		make clean
265
	else
266
		#get and compile latest x264 library
267
		if [ -n "$MAC_OS" ]; then
268
		   $WGET_OR_CURL $WGET_OR_CURLOPT ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20110115-2245.tar.bz2
269
		   tar yvfx x264-snapshot-20110115-2245.tar.bz2
270
		   rm -f x264-snapshot-20110115-2245.tar.bz2
271
		   mv x264-snapshot-20110115-2245/ x264
272
		else
273
		   git clone git://git.videolan.org/x264.git
274
		fi
275
		cd x264
276
	fi	
277

  
127 278
	#make and install in local folder
128
	./configure --prefix="$TEMP_X264"
279
	./configure --prefix="$TEMP_X264" ${HOSTARCH:+--host=$HOSTARCH}
129 280
	$MAKE; $MAKE install
130 281
fi
131 282

  
132
TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install"
283

  
284
if [ -n "$MINGW" ]; then
285
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_mingw"
286
else
287
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_linux"
288
fi
133 289
if [ -n "$BUILD_MP3LAME" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MP3LAME" ]; then
134 290
	cd "$BASE_UL_DIR/$EXTERN_DIR"
135
	rm -r -f mp3lame
136
	#get and compile latest mp3lame library
137
	rm -f lame-3.98.4.tar.gz
138
	wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download -O lame-3.98.4.tar.gz; tar xzf lame-3.98.4.tar.gz; mv lame-3.98.4 mp3lame;
139
	cd mp3lame
291
	
292
	if [ -e "mp3lame" ]; then
293
		cd mp3lame
294
		make clean
295
	else
296
		#get and compile latest mp3lame library
297
		rm -f lame-3.98.4.tar.gz
298
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download; tar xzf download; rm -f download; mv lame-3.98.4 mp3lame;
299
		cd mp3lame
300
	fi	
301

  
140 302
	#make and install in local folder
141
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME"
303
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME" ${HOSTARCH:+--host=$HOSTARCH}
142 304
	$MAKE; $MAKE install
143 305
fi
144 306

  
145
TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install"
307

  
308
if [ -n "$MINGW" ]; then
309
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_mingw"
310
else
311
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_linux"
312
fi
146 313
if [ ! -e "$TEMP_X264/lib/libx264.a" ] || [ ! -e "$TEMP_MP3LAME/lib/libmp3lame.a" ] || [ ! -e "$LOCAL_Z/lib/libz.a" ] || [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
147 314
	echo "Compilation of ffmpeg dependancies failed. Check your internet connection and errors. Exiting."
148 315
fi
149 316
if [ -n "$BUILD_FFMPEG" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FFMPEG" ]; then
150 317
	cd "$BASE_UL_DIR/$EXTERN_DIR"
151
	rm -r -f ffmpeg
152
	#get and compile ffmpeg with x264 support
153
	#get latest snapshot
154
	#rm -f ffmpeg-checkout-snapshot.tar.bz2
155
	#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
156
	#do not get latest snapshot
157
	#get a release tarball instead
158
	rm -f ffmpeg-0.6.tar.bz2
159
	wget http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2; tar xjf ffmpeg-0.6.tar.bz2; mv ffmpeg-0.6 ffmpeg
160
	#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
161
	#do not get latest snapshot
162
	#get instead a specific one because allows output video rate resampling
163
	#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
164
	cd ffmpeg
165
	./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 -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L../x264/temp_x264_install/lib -L../mp3lame/temp_mp3lame_install/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
318
	
319
	if [ -e "ffmpeg" ]; then
320
		cd ffmpeg
321
		make clean
322
	else
323
		#get and compile ffmpeg with x264 support
324
		#get latest snapshot
325
		#rm -f ffmpeg-checkout-snapshot.tar.bz2
326
		#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
327
		#do not get latest snapshot
328
		#get a release tarball instead
329
		rm -f ffmpeg-0.6.tar.bz2
330
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2; tar xjf ffmpeg-0.6.tar.bz2; rm -f ffmpeg-0.6.tar.bz2; mv ffmpeg-0.6 ffmpeg
331
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
332
		#do not get latest snapshot
333
		#get instead a specific one because allows output video rate resampling
334
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
335
		cd ffmpeg
336
	fi	
337

  
338
	if [ -n "$MINGW" ]; then
339
		HOSTARCH_OLDSTYLE=${HOSTARCH:+--arch=i586 --enable-cross-compile --cross-prefix=i586-mingw32msvc- --target-os=$HOSTARCH --disable-sse}
340
	
341
		#configure bugfix
342
		sed -i -e 's/^SDL_CONFIG=/[ -z "$SDL_CONFIG" ] \&\& SDL_CONFIG=/g' ./configure;
343
		sed -i -e 's/check_cflags \+-Werror=missing-prototypes/#\0/g' configure;
344
	
345
		./configure $HOSTARCH_OLDSTYLE --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --disable-pthreads --extra-cflags="-I$TEMP_X264/include -I$TEMP_MP3LAME/include -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L$TEMP_X264/lib -L$TEMP_MP3LAME/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
346
	else
347
		./configure --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --enable-pthreads --extra-cflags="-I$TEMP_X264/include -I$TEMP_MP3LAME/include -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L$TEMP_X264/lib -L$TEMP_MP3LAME/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
348
	fi
166 349
	$MAKE; $MAKE install
167 350
fi
168 351

  
169
TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install"
352

  
353
if [ -n "$MINGW" ]; then
354
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_mingw"
355
else
356
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_linux"
357
fi
170 358
if [ -n "$BUILD_MHD" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MHD" ]; then
171 359
	cd "$BASE_UL_DIR/$EXTERN_DIR"
172
	rm -r -f libmicrohttpd
173
	#get and compile libmicrohttpd lib
174
	svn --non-interactive checkout https://ng.gnunet.org/svn/libmicrohttpd
175
	cd libmicrohttpd
360
	
361
	if [ -e "libmicrohttpd" ]; then
362
		cd libmicrohttpd
363
		make clean
364
	else
365
		#get and compile libmicrohttpd lib
366
		svn --non-interactive --trust-server-cert checkout https://ng.gnunet.org/svn/libmicrohttpd
367
		cd libmicrohttpd
368
	fi
369
	
176 370
	autoreconf -fi
177
	./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
371
	if [ -n "$MINGW" ]; then
372
		CFLAGS="$CFLAGS $LIBMICROHHTPD_FLAGS" CPPFLAGS="$CPPFLAGS $LIBMICROHHTPD_FLAGS" LDFLAGS="$LDFLAGS $LIBMICROHHTPD_LDFLAGS" ./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
373
	else
374
		./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
375
	fi
178 376
	$MAKE; $MAKE install
179 377
fi
180 378

  
181
TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install"
379

  
380
if [ -n "$MINGW" ]; then
381
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl_mingw/temp_sdl_install"
382
else
383
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install_linux"
384
fi
182 385
if [ -n "$BUILD_SDL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL" ]; then
183 386
	cd "$BASE_UL_DIR/$EXTERN_DIR"
184
	rm -r -r sdl
185
	#get and compile SDL lib
186
	rm -f SDL-1.2.14.tar.gz
187
	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
188
	cd sdl
189
	#make and install in local folder
190
	./configure --disable-video-directfb --prefix="$TEMP_SDL"
191
	$MAKE; $MAKE install
387

  
388
	if [ -n "$MINGW" ]; then
389
		if [ ! -e "sdl_mingw" ]; then
390
			# use binaries
391
			$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz; tar zxvf SDL-devel-1.2.14-mingw32.tar.gz; mv SDL-1.2.14 sdl_mingw;
392
			rm -f SDL-devel-1.2.14-mingw32.tar.gz;
393
			cd sdl_mingw
394
			mkdir temp_sdl_install
395
			mv bin $TEMP_SDL/; mv lib $TEMP_SDL/; mv include $TEMP_SDL/; mv share $TEMP_SDL/
396
		fi
397

  
398
		# build from sources
399
		#~ wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz; tar xzf SDL-1.2.14.tar.gz; rm -f SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl
400
		#make and install in local folder
401
		#~ ./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-video-directfb --prefix="$TEMP_SDL"
402
		#~ $MAKE; $MAKE install
403
	else
404
		if [ -e "sdl" ]; then
405
			cd sdl
406
			make clean
407
		else
408
			#get and compile SDL lib
409
			$WGET_OR_CURL $WGET_OR_CURLOPT 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; rm -f SDL-1.2.14.tar.gz
410
			cd sdl
411
		fi
412
		#make and install in local folder
413
		./configure --disable-video-directfb --prefix="$TEMP_SDL"
414
		$MAKE; $MAKE install
415
	fi
192 416
fi
193 417

  
194 418
if [ -n "$BUILD_SDLIMAGE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_image.a" ]; then
195 419
	cd "$BASE_UL_DIR/$EXTERN_DIR"
196
	rm -r -r sdlimage
197
	#get and compile SDLIMAGE lib
198
	rm -f SDL_image-1.2.10.tar.gz
199
	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
200
	cd sdlimage
420
	
421
	if [ -e "sdlimage" ]; then
422
		cd sdlimage
423
		make clean
424
	else
425
		#get and compile SDLIMAGE lib
426
		$WGET_OR_CURL $WGET_OR_CURLOPT 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
427
		rm -f SDL_image-1.2.10.tar.gz
428
		cd sdlimage
429
	fi
430
	
201 431
	#make and install in local SDL folder
202
	./configure --prefix="$TEMP_SDL"
432
        ./autogen.sh
433
	echo "./configure LIBPNG_CFLAGS=\"-I$LOCAL_LIBPNG/include\" LIBPNG_LIBS=\"-L$LOCAL_LIBPNG/lib\" CFLAGS=\"$CFLAGS $LIBSDLIMAGE_FLAGS -static\" CPPFLAGS=\"$CPPFLAGS $LIBSDLIMAGE_FLAGS -static\" LDFLAGS=\"$LDFLAGS $LIBSDLIMAGE_LDFLAGS -static\" ${HOSTARCH:+--host=$HOSTARCH} --prefix=\"$TEMP_SDL\" --with-sdl-prefix=\"$TEMP_SDL\" --disable-png-shared"
434

  
435
	echo "./configure CFLAGS=\"$CFLAGS -I$LOCAL_LIBPNG/include\" CPPFLAGS=\"$CPPFLAGS -I$LOCAL_LIBPNG/include\" LDFLAGS=\"$LDFLAGS -L$LOCAL_LIBPNG/lib\" ${HOSTARCH:+--host=$HOSTARCH} --prefix=\"$TEMP_SDL\" --with-sdl-prefix=\"$TEMP_SDL\" --disable-png-shared"
436

  
437
	./configure CFLAGS="$CFLAGS $LIBSDLIMAGE_FLAGS -I$LOCAL_LIBPNG/include" CPPFLAGS="$CPPFLAGS -I$LOCAL_LIBPNG/include" LDFLAGS="$LDFLAGS $LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBPNG/lib" ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_SDL" --with-sdl-prefix="$TEMP_SDL" --disable-png-shared
438

  
203 439
	$MAKE; $MAKE install
204 440
fi
205 441

  
206 442
# SDL_ttf depends on freetype
207
TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install"
443
if [ -n "$MINGW" ]; then
444
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_mingw"
445
else
446
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_linux"
447
fi
208 448
if [ -n "$BUILD_FREETYPE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FREETYPE" ]; then
209 449
	cd "$BASE_UL_DIR/$EXTERN_DIR"
210
	rm -r -r freetype
211
	#get and compile SDLTTF lib
212
	rm -f freetype-2.1.10.tar.gz
213
	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
214
	cd freetype
450
	if [ -e "freetype" ]; then
451
		cd freetype
452
		make clean
453
	else
454
		#get and compile SDLTTF lib
455
		rm -f freetype-2.1.10.tar.gz
456
		$WGET_OR_CURL $WGET_OR_CURLOPT http://mirror.lihnidos.org/GNU/savannah/freetype/freetype-2.1.10.tar.gz; tar xzf freetype-2.1.10.tar.gz; rm -f freetype-2.1.10.tar.gz; mv freetype-2.1.10 freetype
457
		cd freetype
458
	fi
459

  
215 460
	#make and install in local folder
216
	./configure --prefix="$TEMP_FREETYPE"
461
	./configure ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_FREETYPE"
217 462
	$MAKE; $MAKE install
218 463
fi
219 464

  
220 465
if [ -n "$BUILD_SDLTTF" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_ttf.a" ]; then
221 466
	cd "$BASE_UL_DIR/$EXTERN_DIR"
222
	rm -r -r sdlttf
223
	#get and compile SDLTTF lib
224
	rm -f SDL_ttf-2.0.10.tar.gz
225
	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
226
	cd sdlttf
467
	
468
	if [ -e "sdlttf" ]; then
469
		cd sdlttf
470
		make clean
471
	else
472
		#get and compile SDLTTF lib
473
		rm -f SDL_ttf-2.0.10.tar.gz
474
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.10.tar.gz; tar xzf SDL_ttf-2.0.10.tar.gz; rm -f SDL_ttf-2.0.10.tar.gz; mv SDL_ttf-2.0.10 sdlttf
475
		cd sdlttf
476
	fi
477

  
227 478
	#make and install in local SDL folder
228
	./configure --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL"
479
	./configure ${HOSTARCH:+--host=$HOSTARCH} --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL"
229 480
	$MAKE; $MAKE install
230 481
fi
231 482

  
232
TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install"
483
if [ -n "$MINGW" ]; then
484
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_mingw"
485
else
486
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_linux"
487
fi
233 488
if [ -n "$BUILD_CURL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_CURL" ]; then
234 489
	cd "$BASE_UL_DIR/$EXTERN_DIR"
235
	rm -r -r curl
236
	#get and compile CURL lib
237
	rm -f curl-7.21.0.tar.bz2
238
	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
239
	cd curl
490
	if [ -e "curl" ]; then
491
		cd curl
492
		make clean
493
	else
494
		#get and compile CURL lib
495
		rm -f curl-7.21.0.tar.bz2
496
		$WGET_OR_CURL $WGET_OR_CURLOPT http://curl.haxx.se/download/curl-7.21.0.tar.bz2; tar xjf curl-7.21.0.tar.bz2; rm -f curl-7.21.0.tar.bz2; mv curl-7.21.0 curl
497
		cd curl
498
	fi
499

  
240 500
	#make and install in local folder
241
	./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="$TEMP_CURL"
501
	./configure ${HOSTARCH:+--host=$HOSTARCH} --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="$TEMP_CURL"
242 502
	$MAKE; $MAKE install
243 503
fi
244 504

  
505
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
506
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
507
	echo "found LIBEVENT in $LOCAL_EVENT"
508
else
509
	LOCAL_EVENT_A=`locate -l 1 libevent.a`
510
	if [ "$LOCAL_EVENT_A" = "" ]; then
511
		if [ -f "/usr/lib/libevent.a" ]; then
512
			echo "You have file libevent.a in default system"
513
			echo "setting path for it to default /usr/lib/libevent.a"
514
			LOCAL_EVENT="/usr"
515
		else
516
			echo "you seem not to have file libevent.a. EXITING."
517
			exit
518
		fi
519
	else
520
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
521
	fi
522
fi
523

  
524
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
525
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
526
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
527
else
528
	LOCAL_CONFUSE_A=`locate -l 1 libconfuse.a`
529
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
530
		if [ -f "/usr/lib/libconfuse.a" ]; then
531
			echo "You have file libconfuse.a in default system"
532
			echo "setting path for it to default /usr/lib/libconfuse.a"
533
			LOCAL_CONFUSE="/usr"
534
		else
535
			echo "you seem not to have file libconfuse.a. EXITING."
536
			exit
537
		fi
538
	else
539
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
540
	fi
541
fi
542

  
245 543
#set needed paths to external libraries
246 544
echo "-----"
247 545
LOCAL_X264=$TEMP_X264
......
265 563

  
266 564
echo "path for BZ2 dependancy is set to $LOCAL_BZ2"
267 565
echo "path for ZLIB dependancy is set to $LOCAL_Z"
566

  
567
echo "path for LIBEVENT dependancy is set to $LOCAL_EVENT"
568
echo "path for LIBCONFUSE dependancy is set to $LOCAL_CONFUSE"
268 569
echo "-----"
269 570

  
270 571
#compile the UL external applications
271 572
#chunker_streamer and chunker_player
272
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
273
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
274
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
275
else
276
	LOCAL_CONFUSE_A=`locate -l 1 libconfuse.a`
277
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
278
		if [ -f "/usr/lib/libconfuse.a" ]; then
279
			echo "You have file libconfuse.a in default system"
280
			echo "setting path for it to default /usr/lib/libconfuse.a"
281
			LOCAL_CONFUSE="/usr"
282
		else
283
			echo "you seem not to have file libconfuse.a. EXITING."
284
			exit
285
		fi
286
	else
287
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
288
	fi
289
fi
290 573

  
291 574
#CHUNKER_STREAMER
292
echo "----------------COMPILING CHUNKER STREAMER"
293
cd "$BASE_UL_DIR"
294
cd chunker_streamer
295
$MAKE clean
296
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_CURL=$LOCAL_CURL $MAKE
297
echo "----------------FINISHED COMPILING CHUNKER STREAMER"
575

  
576
# streamer is not supported yet on windows
577
if [ ! -n "$MINGW" ]; then
578
	echo "----------------COMPILING CHUNKER STREAMER"
579
	cd "$BASE_UL_DIR"
580
	cd chunker_streamer
581
	$MAKE clean
582
	LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_CURL=$LOCAL_CURL IO=$IO MAC_OS=$MAC_OS $MAKE || { echo "Failed to build CHUNKER STREAMER"; exit 1; }
583
	echo "----------------FINISHED COMPILING CHUNKER STREAMER"
584
fi
298 585

  
299 586
#CHUNKER_PLAYER
300 587
echo "----------------COMPILING CHUNKER PLAYER"
301 588
cd "$BASE_UL_DIR"
302 589
cd chunker_player
303 590
$MAKE clean
304
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_MHD=$LOCAL_MHD LOCAL_ABS_SDL=$LOCAL_ABS_SDL LOCAL_SDLIMAGE=$LOCAL_SDLIMAGE LOCAL_FREETYPE=$LOCAL_FREETYPE LOCAL_SDLTTF=$LOCAL_SDLTTF $MAKE
591
LOCAL_PTHREAD=$LOCAL_PTHREAD LOCAL_LIBPNG=$LOCAL_LIBPNG LOCAL_LIBICONV=$LOCAL_LIBICONV LOCAL_LIBINTL=$LOCAL_LIBINTL LOCAL_PLIBC=$LOCAL_PLIBC LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_MHD=$LOCAL_MHD LOCAL_ABS_SDL=$LOCAL_ABS_SDL LOCAL_SDLIMAGE=$LOCAL_SDLIMAGE LOCAL_FREETYPE=$LOCAL_FREETYPE LOCAL_SDLTTF=$LOCAL_SDLTTF IO=$IO MAC_OS=$MAC_OS  $MAKE || { echo "Failed to build CHUNKER PLAYER" ; exit 1; }
305 592
echo "----------------FINISHED COMPILING CHUNKER PLAYER"
306 593

  
307
#compile a version of offerstreamer with UL enabled
594
#compile a version of winestreamer with UL enabled
308 595
#static needs fix??
309
cd "$BASE_UL_DIR/../OfferStreamer"
310
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
311
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
312
	echo "found LIBEVENT in $LOCAL_EVENT"
313
else
314
	LOCAL_EVENT_A=`locate -l 1 libevent.a`
315
	if [ "$LOCAL_EVENT_A" = "" ]; then
316
		if [ -f "/usr/lib/libevent.a" ]; then
317
			echo "You have file libevent.a in default system"
318
			echo "setting path for it to default /usr/lib/libevent.a"
319
			LOCAL_EVENT="/usr"
320
		else
321
			echo "you seem not to have file libevent.a. EXITING."
322
			exit
323
		fi
324
	else
325
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
326
	fi
327
fi
596
cd "$BASE_UL_DIR/../Streamer"
597

  
328 598
$MAKE IO=$IO clean
329
ULPLAYER=$BASE_UL_DIR ULPLAYER_EXTERNAL_LIBS=$EXTERN_DIR LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL IO=$IO DEBUG=$DEBUG THREADS=$THREADS $MAKE
599
#LOCAL_MHD=$LOCAL_MHD LOCAL_CURL=$LOCAL_CURL ULPLAYER=$BASE_UL_DIR ULPLAYER_EXTERNAL_LIBS=$EXTERN_DIR LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL IO=$IO DEBUG=$DEBUG THREADS=$THREADS MAC_OS=$MAC_OS SVNVERSION=$SVNVERSION $MAKE || { echo "Failed to build WineStreamer" ; exit 1; }
600
LOCAL_CURL=$LOCAL_CURL LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL ALTO=$ALTO IO=$IO DEBUG=$DEBUG THREADS=$THREADS MAC_OS=$MAC_OS SVNVERSION=$SVNVERSION $MAKE || { echo "Failed to build WineStreamer" ; exit 1; }
330 601

  
331 602
#check if all is ok
332 603
echo "============== RESULTS ==================="
333 604

  
334
cd "$BASE_UL_DIR/chunker_streamer"
335
if [ -f "chunker_streamer" ]; then
336
	echo "chunker_streamer OK"
337
	C_STREAMER_EXE=`ls -la chunker_streamer`
338
	echo "$C_STREAMER_EXE"
339
	#now we want the bare name
340
	C_STREAMER_EXE=`ls chunker_streamer`
341
else
342
	echo "chunker_streamer FAIL"
605
if [ ! -n "$MINGW" ]; then
606
	cd "$BASE_UL_DIR/chunker_streamer"
607
	if [ -f "chunker_streamer" ]; then
608
		echo "chunker_streamer OK"
609
		C_STREAMER_EXE=`ls -la chunker_streamer`
610
		echo "$C_STREAMER_EXE"
611
		#now we want the bare name
612
		C_STREAMER_EXE=`ls chunker_streamer`
613
	else
614
		echo "chunker_streamer FAIL"
615
	fi
343 616
fi
344 617

  
345 618
cd "$BASE_UL_DIR/chunker_player"
346
if [ -f "chunker_player" ]; then
619
if [ -n "$MINGW" ]; then
620
	SUFFIX=".exe"
621
	SCRIPT_SUFFIX=".bat"
622
else
623
	SUFFIX=""
624
	SCRIPT_SUFFIX=".sh"
625
fi
626
if [ -f "chunker_player$SUFFIX" ]; then
347 627
	echo "chunker_player OK"
348
	C_PLAYER_EXE=`ls -la chunker_player`
628
	C_PLAYER_EXE=`ls -la chunker_player$SUFFIX`
349 629
	echo "$C_PLAYER_EXE"
350 630
	#now we want the bare name
351
	C_PLAYER_EXE=`ls chunker_player`
631
	C_PLAYER_EXE=`ls chunker_player$SUFFIX`
352 632
else
353 633
	echo "chunker_player FAIL"
354 634
fi
355 635

  
356
cd "$BASE_UL_DIR/../OfferStreamer"
357
echo "Check if the http binary is among these offerstreamers:"
358
ls -la offerstreamer* | grep -v ".o$"
359
echo "Your UL-enabled offerstreamer should be..."
360
O_TARGET_EXE=`ls offerstreamer* | grep -v ".o$" | grep $IO`
636
cd "$BASE_UL_DIR/../Streamer"
637
echo "Check if the http binary is among these winestreamers:"
638
ls -la winestreamer* | grep -v ".o$"
639
echo "Your UL-enabled winestreamer has these flags:"
640
if [ -n "$ALTO" ]; then
641
	GREP_ALTO_EXPR="-alto"
642
	GREP_ALTO_FLAGS=""
643
	echo "ALTO: enabled"
644
else
645
	GREP_ALTO_EXPR="-alto"
646
	GREP_ALTO_FLAGS="-v"
647
	echo "ALTO: disabled"
648
fi
649
if [ "$STATIC" = "1" ]; then
650
	GREP_STATIC_EXPR="-halfstatic"
651
	GREP_STATIC_FLAGS=""
652
	echo "STATIC: halfstatic"
653
elif [ "$STATIC" = "2" ]; then
654
	GREP_STATIC_EXPR="-static"
655
	GREP_STATIC_FLAGS=""
656
	echo "STATIC: static"
657
else
658
	GREP_STATIC_EXPR="static"
659
	GREP_STATIC_FLAGS="-v"
660
	echo "STATIC: dynamic"
661
fi
662
echo "IO: $IO"
663
IO="-"$IO
664
echo "Hence your UL-enabled winestreamer should be..."
665
O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep $GREP_STATIC_FLAGS -e "$GREP_STATIC_EXPR" | grep $GREP_ALTO_FLAGS -e "$GREP_ALTO_EXPR" | grep -e "$IO"`
666
#O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep -e "$IO"`
361 667
echo "$O_TARGET_EXE"
362 668
if [ -f "$O_TARGET_EXE" ]; then
363 669
	echo "...and i found it."
......
365 671
	echo "...but sadly it appears build FAILED!."
366 672
fi
367 673

  
674
#creating conf file with executable name inside
675
cd "$BASE_UL_DIR/chunker_player"
676
echo "$O_TARGET_EXE" > peer_exec_name.conf
677

  
368 678
#packaging for distribution
369 679
cd "$BASE_UL_DIR/chunker_player"
370
if [ -f "$BASE_UL_DIR/../OfferStreamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
680
if [ -f "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
371 681
	echo "============== PACKAGING NAPAPLAYER ==================="
372 682
	rm -f -r napaplayer
373
	rm -f -r napaplayer.tar.gz
374 683
	mkdir napaplayer
375 684
	mkdir napaplayer/icons
376 685
	cp icons/* napaplayer/icons/
377 686
	cp channels.conf napaplayer/
687
	cp peer_exec_name.conf napaplayer/
688
	cp runme$SCRIPT_SUFFIX napaplayer/
378 689
	cp README napaplayer/
379 690
	cp napalogo*.bmp napaplayer/
380 691
	cp *.ttf napaplayer/
381 692
	cp "$C_PLAYER_EXE" napaplayer/
382
	cp "$BASE_UL_DIR/../OfferStreamer/$O_TARGET_EXE" napaplayer/
383
	cd napaplayer/
384
	ln -s "$O_TARGET_EXE" ./offerstreamer
385
	cd ..
386
	tar cvfz napaplayer.tar.gz napaplayer
387
	if [ -s "napaplayer.tar.gz" ]; then
388
		#it has size>0. OK!
389
		echo "Here is your napaplayer tarball. Enjoy!"
390
		ls -la napaplayer.tar.gz
693
	if [ -n "$MINGW" ]; then
694
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
695
	else
696
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
697
	fi
698
	if [ -n "$MINGW" ]; then
699
		cp "$LOCAL_LIBICONV/bin/libiconv-2.dll" napaplayer/libiconv2.dll
700
		if [ -f "$LOCAL_LIBINTL/bin/libintl-8.dll" ]; then
701
			cp "$LOCAL_LIBINTL/bin/libintl-8.dll" napaplayer/
702
		else
703
			cp "$LOCAL_LIBINTL/bin/libintl3.dll" napaplayer/libintl-8.dll
704
		fi
705
		cp "$LOCAL_PLIBC/bin/libplibc-1.dll" napaplayer/
706
		cp "$LOCAL_PTHREAD/bin/pthreadGC2.dll" napaplayer/
707
		cp "$LOCAL_ABS_SDL/bin/SDL.dll" napaplayer/
708
		rm -f -r napaplayer.zip
709
		zip -r napaplayer napaplayer
710
		if [ -s "napaplayer.zip" ]; then
711
			#it has size>0. OK!
712
			echo "Here it is your napaplayer package. Enjoy!"
713
			ls -la napaplayer.zip
714
		else
715
			echo "Sorry something went wrong during packaging napaplayer."
716
		fi
391 717
	else
392
		echo "Sorry something went wrong during packaging napaplayer."
718
		rm -f -r napaplayer.tar.gz
719
		tar cvfz napaplayer.tar.gz napaplayer
720
		if [ -s "napaplayer.tar.gz" ]; then
721
			#it has size>0. OK!
722
			echo "Here it is your napaplayer tarball. Enjoy!"
723
			ls -la napaplayer.tar.gz
724
		else
725
			echo "Sorry something went wrong during packaging napaplayer."
726
		fi
393 727
	fi
394 728
else
395 729
	echo ""

Also available in: Unified diff