Statistics
| Branch: | Revision:

chunker-player / build_ul.sh @ 47943338

History | View | Annotate | Download (29.8 KB)

1 1538a3bd GiuseppeTropea
#!/bin/bash
2 e11386c0 CsabaKiraly
SCRIPT=$0
3
BASE_UL_DIR=`pwd`
4 1538a3bd GiuseppeTropea
EXTERN_DIR="external_libs"
5 e11386c0 CsabaKiraly
MAKE="make -j 4"
6 1538a3bd GiuseppeTropea
cd "$BASE_UL_DIR"
7
8 6579c578 ArpadBakay
REBUILD=
9
[ "$1" == "-r" ] && REBUILD=1
10
11 3db2d7e0 Csaba Kiraly
#check the architecture
12
if [ "$OSTYPE" == "linux-gnu" ]; then
13
   # do something Linux-y
14
   echo "Building on Linux"
15
elif [ "$OSTYPE" == "darwin10.0" ]; then
16
   # do something OSX-y
17
   echo "Building on OSX"
18
   MAC_OS=1
19
fi
20
21 e11386c0 CsabaKiraly
which svn >/dev/null || { echo "CANNOT build UL Applications: svn missing. Please install subversion, then retry!"; exit 1; }
22
#which libtoolize >/dev/null || { echo "CANNOT build UL Applications: libtool missing. Please install libtool, then retry!"; exit 1; }
23
which yasm >/dev/null || { echo "CANNOT build UL Applications: yasm missing. Please install yasm, then retry!"; exit 1; }
24
if [ ! -n "MAC_OS" ]; then
25
  #we don't have git on osx - so we avoid using it
26
  which git >/dev/null || { echo "CANNOT build UL Applications: git missing. Please install git, then retry!"; exit 1; }
27
fi
28
WGET_OR_CURL=`which wget`
29
[ -n "$WGET_OR_CURL" ] || { WGET_OR_CURL=`which curl` ; WGET_OR_CURLOPT="-L -O"; }
30
[ -n "$WGET_OR_CURL" ] || { echo "please install wget or curl!"; exit 1; }
31
32 09e7891d CsabaKiraly
#set some defaults
33 dddd5f37 Csaba Kiraly
IO=${IO:-"tcp"}
34 09e7891d CsabaKiraly
MONL=${MONL:-1}
35
ML=${ML:-1}
36
37 e11386c0 CsabaKiraly
if [ "$HOSTARCH" = "mingw32" ]; then
38
	MINGW=1
39
fi
40
41 920851bb GiuseppeTropea
#by default build an check
42
BUILD_ALL=1
43
44 e11386c0 CsabaKiraly
LIBTOOLIZE_PATH=`whereis libtoolize`
45 870d410a GiuseppeTropea
if [ "$LIBTOOLIZE_PATH" = "libtoolize:" ]; then
46
	echo "Can't find libtoolize. Try sudo apt-get install libtool"
47
	exit
48
fi
49
50 e11386c0 CsabaKiraly
YASM_PATH=`whereis yasm`
51 d06e13db GiuseppeTropea
if [ "$YASM_PATH" = "yasm:" ]; then
52
	echo "Can't find yasm assembler. Try sudo apt-get install yasm"
53
	exit
54
fi
55
56 e11386c0 CsabaKiraly
mkdir $EXTERN_DIR
57
58
if [ -n "$MINGW" ]; then
59
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2_mingw"
60
	if [ ! -e "$TEMP_BZ2/lib/libbz2.a" ]; then
61
		#we erase and rebuild since the installation is not there
62
		cd "$BASE_UL_DIR/$EXTERN_DIR"
63
		rm -r -f bzip2_mingw
64
		#get the latest bzip2 library
65
		$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
66
		$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
67
		rm -f bzip2-1.0.5-lib.zip; rm -f bzip2-1.0.5-bin.zip;
68
	fi
69
	LOCAL_BZ2=$TEMP_BZ2
70
else
71
	#try to find libbz2 in your system
72
	LOCAL_BZ2_A=/usr/lib/libbz2.a
73
	if [ ! -e $LOCAL_BZ2_A ]; then
74
		[ X$LOCAL_BZ2_A != X ] && LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
75
		if [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
76
			#wrong location and/or folders structure
77
			echo "you seem not to have file libbz2.a or the location is non-standard.Will be built locally."
78
			LOCAL_BZ2=""
79
			BUILD_BZ2=1
80
		fi
81
	else
82 1f5f168b TivadarSzemethy
		echo "You have file libbz2.a in default system"
83
		echo "setting path for it to default /usr/lib/libbz2.a"
84
		LOCAL_BZ2="/usr"
85 920851bb GiuseppeTropea
	fi
86
fi
87
88 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
89
	TEMP_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib_mingw"
90
	if [ ! -e "$TEMP_Z/lib/libz.a" ]; then
91
		cd "$BASE_UL_DIR/$EXTERN_DIR"
92
		rm -r -f zlib_mingw;
93
		#get the latest zlib libraries
94
		$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
95
		$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
96
		rm -f zlib-1.2.3-bin.zip; rm -f zlib-1.2.3-lib.zip;
97 920851bb GiuseppeTropea
	fi
98 e11386c0 CsabaKiraly
	LOCAL_Z=$TEMP_Z
99 b9e6f879 CsabaKiraly
else
100 e11386c0 CsabaKiraly
	LOCAL_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib/temp_zlib_install_linux"
101
	if [ -f "$LOCAL_Z/lib/libz.a" ]; then
102
		echo "libz.a found in $LOCAL_Z/lib"
103
	else
104
		#force building locally
105
		#does not exist systemwide
106
		cd "$BASE_UL_DIR/$EXTERN_DIR"
107
		rm -r -f zlib
108
		#get and compile latest zlib library
109
		$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
110
		cd zlib
111
		#make and install in local folder
112
		./configure --prefix="$LOCAL_Z"
113
		$MAKE; $MAKE install
114 12b8f562 CarmeloDaniele
	fi
115
116 e11386c0 CsabaKiraly
	#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
117
	if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
118
		#remove previuos versions of external libs builds
119
		rm -r -f $EXTERN_DIR
120
	fi
121 b9e6f879 CsabaKiraly
fi
122 e11386c0 CsabaKiraly
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_Z/include"
123
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_Z/lib"
124
125
if [ ! -n "$MINGW" ]; then
126
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2/temp_bzip2_install_linux"
127
	if [ -n "$BUILD_BZ2" ]; then
128
		#we have to build it either because of user will or because does not exist system wide
129
		if [ -z "$LOCAL_BZ2" ]; then
130
			#does not exist systemwide
131
			if [ -n "$BUILD_ALL" -a ! -e "$TEMP_BZ2" ]; then
132
				#we erase and rebuild since the installation is not there
133
				cd "$BASE_UL_DIR/$EXTERN_DIR"
134
				rm -r -f bzip2
135
				#get and compile latest bzip2 library
136
				$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
137
				cd bzip2
138
				#make and install in local folder
139
				$MAKE; $MAKE install PREFIX="$TEMP_BZ2"
140
			fi
141
			#previous local install is existing, just set pointer to it
142
			#or override location if it was set as systemwide
143
			LOCAL_BZ2=$TEMP_BZ2
144 b9e6f879 CsabaKiraly
		fi
145 12b8f562 CarmeloDaniele
	fi
146
fi
147
148 e11386c0 CsabaKiraly
149
if [ -n "$MINGW" ]; then
150
	# plibc
151
	LOCAL_PLIBC="$BASE_UL_DIR/$EXTERN_DIR/plibc"
152
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a" ]; then
153
		echo "You have file libplibc.dll.a in default system: $BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a"
154
	else
155
		cd "$BASE_UL_DIR/$EXTERN_DIR"
156
		rm -fR plibc
157
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ovh.dl.sourceforge.net/project/plibc/plibc/0.1.5/plibc-0.1.5.zip
158
		unzip plibc-0.1.5.zip -d plibc;
159
		rm -f plibc/lib/*.la
160
		rm -f plibc-0.1.5.zip
161
	fi
162
	LIBMICROHHTPD_FLAGS="-I$BASE_UL_DIR/$EXTERN_DIR/plibc/include"
163
	LIBMICROHHTPD_LDFLAGS="-L$BASE_UL_DIR/$EXTERN_DIR/plibc/lib"
164
165
	# libiconv
166
	LOCAL_LIBICONV="$BASE_UL_DIR/$EXTERN_DIR/libiconv/temp_libiconv_install_mingw"
167
	if [ -f "$LOCAL_LIBICONV/lib/libiconv.a" ]; then
168
		echo "libiconv.a found in $LOCAL_LIBICONV/lib"
169
	else
170
		cd "$BASE_UL_DIR/$EXTERN_DIR"
171
		rm -fR libiconv
172
		
173
		#download binaries
174
		#~ 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
175
		#~ mkdir -p $LOCAL_LIBICONV/lib/
176
		#~ mv libiconv/*.dll $LOCAL_LIBICONV/lib/
177
		#~ rm -f libintl-0.14.4-dep.zip
178
		
179
		#build from sources
180
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
181
		tar zxvf libiconv-1.13.tar.gz; mv libiconv-1.13 libiconv; rm -f libiconv-1.13.tar.gz; cd libiconv
182
		./configure --enable-static ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBICONV
183
		make
184
		make install
185
	fi
186
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBICONV/include"
187
	#~ LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBICONV/lib"
188
189
	LOCAL_LIBINTL="$BASE_UL_DIR/$EXTERN_DIR/libintl/temp_libintl_install_mingw"
190
	if [ -f "$LOCAL_LIBINTL/lib/libintl.dll.a" ] || [ -f "$LOCAL_LIBINTL/lib/libintl.a" ]; then
191
		echo "libintl libraries found in $LOCAL_LIBINTL/lib"
192
	else
193
		cd "$BASE_UL_DIR/$EXTERN_DIR"
194
		#download binaries
195
		rm -fR libintl
196
		$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
197
		$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
198
		rm -f libintl-0.14.4-bin.zip; rm -f libintl-0.14.4-lib.zip
199
		cd libintl
200
		mkdir -p $LOCAL_LIBINTL;
201
		mv bin $LOCAL_LIBINTL/; mv lib $LOCAL_LIBINTL/; mv include $LOCAL_LIBINTL/
202
		mv man $LOCAL_LIBINTL/; mv share $LOCAL_LIBINTL/
203
		
204
		# build from gettext sources
205
		#~ rm -fR gettext
206
		#~ rm -fR libintl
207
		#~ wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
208
		#~ tar zxvf gettext-0.18.1.1.tar.gz; mv gettext-0.18.1.1 gettext; cd gettext
209
		#~ ./configure ${HOSTARCH:+--host=$HOSTARCH} --with-libiconv-prefix=$LOCAL_LIBICONV
210
		#~ cd gettext-runtime/intl
211
		#~ make
212
		#~ mkdir -p $LOCAL_LIBINTL/bin; mkdir -p $LOCAL_LIBINTL/include; mkdir -p $LOCAL_LIBINTL/lib
213
		#~ cp ./.libs/*a $LOCAL_LIBINTL/lib
214
		#~ cp ./.libs/*.dll $LOCAL_LIBINTL/bin
215
		#~ cp *.h $LOCAL_LIBINTL/include
216
		#~ cd ../../../
217
		#~ rm -f gettext-0.18.1.1.tar.gz
218
		#~ rm -fR gettext
219 b9e6f879 CsabaKiraly
	fi
220 e11386c0 CsabaKiraly
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBINTL"
221
	LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBINTL/lib"
222
223
	# check for mingw pthread libs
224
	LOCAL_PTHREAD="$BASE_UL_DIR/$EXTERN_DIR/pthreads"
225
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a" ]; then
226
		echo "libpthread.a in $LOCAL_PTHREAD/lib/"
227
	else
228
		cd "$BASE_UL_DIR/$EXTERN_DIR"
229
		rm -fR pthreads
230
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
231
		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;
232
		cd pthreads
233
		mkdir -p ./{include,lib,bin}
234
		make CROSS=i586-mingw32msvc- GC-inlined
235
		mv libpthreadGC2.a ./lib
236
		mv *.h ./include
237
		mv pthreadGC2.dll ./bin
238
		ln -s "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthreadGC2.a" "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a"
239
	fi
240
	LIBMICROHHTPD_FLAGS="$LIBMICROHHTPD_FLAGS -I$BASE_UL_DIR/$EXTERN_DIR/pthreads/include"
241
	LIBMICROHHTPD_LDFLAGS="$LIBMICROHHTPD_LDFLAGS -L$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib"
242 920851bb GiuseppeTropea
fi
243
244 e11386c0 CsabaKiraly
245 e347580f Csaba Kiraly
echo "building libpng"
246 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
247
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_mingw"
248
else
249
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_linux"
250
fi
251
if [ -f "$LOCAL_LIBPNG/lib/libpng.a" ]; then
252
	echo "libpng.a found in $LOCAL_LIBPNG/lib"
253
else
254
	cd "$BASE_UL_DIR/$EXTERN_DIR"
255
	rm -fR libpng
256
	$WGET_OR_CURL $WGET_OR_CURLOPT http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.4/libpng-1.4.4.tar.gz
257
	tar zxvf libpng-1.4.4.tar.gz; rm -f libpng-1.4.4.tar.gz
258
	mv libpng-1.4.4 libpng; cd libpng;
259
	CFLAGS=-I$LOCAL_Z/include CPPFLAGS=-I$LOCAL_Z/include LDFLAGS=-L$LOCAL_Z/lib sh configure  ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBPNG
260
	make
261
	make install
262
fi
263
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBPNG/include"
264
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBPNG/lib"
265
266
267 e347580f Csaba Kiraly
echo "building x264"
268 2d1eea50 Csaba Kiraly
if [ -n "$LOCAL_X264" ]; then
269
	TEMP_X264=$LOCAL_X264
270
else
271 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
272 eb7e020b Csaba Kiraly
	#TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_mingw"	#would be needed only for the encoding by the chunker, so we disable it
273
	echo "mingw: libx264 not required for player"
274 e11386c0 CsabaKiraly
else
275
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_linux"
276 920851bb GiuseppeTropea
if [ -n "$BUILD_X264" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_X264" ]; then
277 1538a3bd GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
278 e11386c0 CsabaKiraly
	if [ -e "x264" ]; then
279
		cd x264
280
		make clean
281
	else
282
		#get and compile latest x264 library
283
		if [ -n "$MAC_OS" ]; then
284
		   $WGET_OR_CURL $WGET_OR_CURLOPT ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20110115-2245.tar.bz2
285
		   tar yvfx x264-snapshot-20110115-2245.tar.bz2
286
		   rm -f x264-snapshot-20110115-2245.tar.bz2
287
		   mv x264-snapshot-20110115-2245/ x264
288
		else
289
		   git clone git://git.videolan.org/x264.git
290
		fi
291
		cd x264
292
	fi	
293
294 920851bb GiuseppeTropea
	#make and install in local folder
295 e11386c0 CsabaKiraly
	./configure --prefix="$TEMP_X264" ${HOSTARCH:+--host=$HOSTARCH}
296 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
297 9f668f32 GiuseppeTropea
fi
298 2d1eea50 Csaba Kiraly
fi
299 eb7e020b Csaba Kiraly
fi
300 e11386c0 CsabaKiraly
301 e347580f Csaba Kiraly
echo "building mp3lame"
302 368fb59e Csaba Kiraly
if [ -n "$LOCAL_MP3LAME" ]; then
303 2d1eea50 Csaba Kiraly
	TEMP_MP3LAME=$LOCAL_MP3LAME
304
else
305 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
306 eb7e020b Csaba Kiraly
	#TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_mingw"	#would be needed only for the encoding by the chunker, so we disable it
307
	echo "mingw: libmp3lame not required for player"
308 e11386c0 CsabaKiraly
else
309
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_linux"
310 920851bb GiuseppeTropea
if [ -n "$BUILD_MP3LAME" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MP3LAME" ]; then
311 9f668f32 GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
312 e11386c0 CsabaKiraly
	
313
	if [ -e "mp3lame" ]; then
314
		cd mp3lame
315
		make clean
316
	else
317
		#get and compile latest mp3lame library
318
		rm -f lame-3.98.4.tar.gz
319
		$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;
320
		cd mp3lame
321
	fi	
322
323 920851bb GiuseppeTropea
	#make and install in local folder
324 e11386c0 CsabaKiraly
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME" ${HOSTARCH:+--host=$HOSTARCH}
325 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
326 1538a3bd GiuseppeTropea
fi
327 2d1eea50 Csaba Kiraly
fi
328 eb7e020b Csaba Kiraly
fi
329 e11386c0 CsabaKiraly
330 e347580f Csaba Kiraly
echo "building ffmpeg"
331 2d1eea50 Csaba Kiraly
if [ -n "$LOCAL_FFMPEG" ]; then
332
	TEMP_FFMPEG=$LOCAL_FFMPEG
333
else
334 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
335
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_mingw"
336
else
337
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_linux"
338
fi
339 920851bb GiuseppeTropea
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
340 b09066b0 Csaba Kiraly
	echo "Compilation of some ffmpeg dependancies failed. Check your internet connection and errors."
341
fi
342
if [ -e "$TEMP_X264/lib/libx264.a" ]; then
343
	FFMPEG_CONFIG+=" --enable-libx264"
344
	FFMPEG_EXTRA_CFLAGS+=" -I$TEMP_X264/include"
345
fi
346
if [ -e "$TEMP_MP3LAME/lib/libmp3lame.a" ]; then
347
	FFMPEG_CONFIG+=" --enable-libmp3lame"
348
	FFMPEG_EXTRA_CFLAGS+=" -I$TEMP_MP3LAME/include"
349 920851bb GiuseppeTropea
fi
350
if [ -n "$BUILD_FFMPEG" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FFMPEG" ]; then
351 1538a3bd GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
352 e11386c0 CsabaKiraly
	
353
	if [ -e "ffmpeg" ]; then
354
		cd ffmpeg
355
		make clean
356
	else
357
		#get and compile ffmpeg with x264 support
358
		#get latest snapshot
359
		#rm -f ffmpeg-checkout-snapshot.tar.bz2
360
		#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
361
		#do not get latest snapshot
362
		#get a release tarball instead
363
		rm -f ffmpeg-0.6.tar.bz2
364
		$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
365
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
366
		#do not get latest snapshot
367
		#get instead a specific one because allows output video rate resampling
368
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
369
		cd ffmpeg
370
	fi	
371
372
	if [ -n "$MINGW" ]; then
373
		HOSTARCH_OLDSTYLE=${HOSTARCH:+--arch=i586 --enable-cross-compile --cross-prefix=i586-mingw32msvc- --target-os=$HOSTARCH --disable-sse}
374
	
375
		#configure bugfix
376
		sed -i -e 's/^SDL_CONFIG=/[ -z "$SDL_CONFIG" ] \&\& SDL_CONFIG=/g' ./configure;
377
		sed -i -e 's/check_cflags \+-Werror=missing-prototypes/#\0/g' configure;
378
	
379 b09066b0 Csaba Kiraly
		./configure $HOSTARCH_OLDSTYLE --enable-gpl --enable-nonfree --enable-version3 --disable-pthreads $FFMPEG_CONFIG --extra-cflags="$FFMPEG_EXTRA_CFLAGS -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"
380 e11386c0 CsabaKiraly
	else
381 b09066b0 Csaba Kiraly
		./configure --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads  $FFMPEG_CONFIG --extra-cflags="$FFMPEG_EXTRA_CFLAGS -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"
382 e11386c0 CsabaKiraly
	fi
383 c3ccd8f0 GiuseppeTropea
	$MAKE; $MAKE install
384 1538a3bd GiuseppeTropea
fi
385 2d1eea50 Csaba Kiraly
fi
386 e11386c0 CsabaKiraly
387 e347580f Csaba Kiraly
echo "building libmicrohttpd"
388 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
389
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_mingw"
390
else
391
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_linux"
392
fi
393 920851bb GiuseppeTropea
if [ -n "$BUILD_MHD" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MHD" ]; then
394 1538a3bd GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
395 e11386c0 CsabaKiraly
	
396
	if [ -e "libmicrohttpd" ]; then
397
		cd libmicrohttpd
398
		make clean
399
	else
400
		#get and compile libmicrohttpd lib
401 342922ca TivadarSzemethy
		if [ X`svn --version|head -1|cut -c14-16` = X1.6 ]; then
402 b66b8eda CsabaKiraly
			svn --non-interactive --trust-server-cert checkout https://gnunet.org/svn/libmicrohttpd
403 342922ca TivadarSzemethy
		else
404 b66b8eda CsabaKiraly
			svn --non-interactive checkout https://gnunet.org/svn/libmicrohttpd
405 342922ca TivadarSzemethy
		fi
406
		cd libmicrohttpd || { echo "CANNOT download libmicrohttpd"; exit 1; }
407
 
408 e11386c0 CsabaKiraly
	fi
409
	
410 1538a3bd GiuseppeTropea
	autoreconf -fi
411 e11386c0 CsabaKiraly
	if [ -n "$MINGW" ]; then
412
		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"
413
	else
414
		./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
415
	fi
416 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
417 1538a3bd GiuseppeTropea
fi
418
419 e11386c0 CsabaKiraly
420 e347580f Csaba Kiraly
echo "building SDL"
421 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
422
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl_mingw/temp_sdl_install"
423
else
424
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install_linux"
425
fi
426 920851bb GiuseppeTropea
if [ -n "$BUILD_SDL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL" ]; then
427 1538a3bd GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
428 e11386c0 CsabaKiraly
429
	if [ -n "$MINGW" ]; then
430 a353fde9 Csaba Kiraly
#		if [ ! -e "sdl_mingw" ]; then
431
#			# use binaries
432
#			$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;
433
#			rm -f SDL-devel-1.2.14-mingw32.tar.gz;
434
#			cd sdl_mingw
435
#			mkdir temp_sdl_install
436
#			mv bin $TEMP_SDL/; mv lib $TEMP_SDL/; mv include $TEMP_SDL/; mv share $TEMP_SDL/
437
438
			# build from sources
439
			$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; rm -f SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl_mingw
440 e11386c0 CsabaKiraly
			cd sdl_mingw
441 a353fde9 Csaba Kiraly
			#make and install in local folder
442
			./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-video-directfb --disable-shared --prefix="$TEMP_SDL"
443
			$MAKE; $MAKE install
444
#		fi
445 e11386c0 CsabaKiraly
	else
446
		if [ -e "sdl" ]; then
447
			cd sdl
448
			make clean
449
		else
450
			#get and compile SDL lib
451
			$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
452
			cd sdl
453
		fi
454
		#make and install in local folder
455
		./configure --disable-video-directfb --prefix="$TEMP_SDL"
456
		$MAKE; $MAKE install
457
	fi
458 1538a3bd GiuseppeTropea
fi
459
460 e347580f Csaba Kiraly
echo "building SDLimage"
461 920851bb GiuseppeTropea
if [ -n "$BUILD_SDLIMAGE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_image.a" ]; then
462 e27711c4 GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
463 e11386c0 CsabaKiraly
	
464
	if [ -e "sdlimage" ]; then
465
		cd sdlimage
466
		make clean
467
	else
468
		#get and compile SDLIMAGE lib
469
		$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
470
		rm -f SDL_image-1.2.10.tar.gz
471
		cd sdlimage
472
	fi
473
	
474 920851bb GiuseppeTropea
	#make and install in local SDL folder
475 e11386c0 CsabaKiraly
        ./autogen.sh
476
	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"
477
478
	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"
479
480 94a3ca93 Csaba Kiraly
	./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  --disable-shared
481 e11386c0 CsabaKiraly
482 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
483 e27711c4 GiuseppeTropea
fi
484
485 e347580f Csaba Kiraly
echo "building freetype"
486 14d0fa53 GiuseppeTropea
# SDL_ttf depends on freetype
487 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
488
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_mingw"
489
else
490
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_linux"
491
fi
492 920851bb GiuseppeTropea
if [ -n "$BUILD_FREETYPE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FREETYPE" ]; then
493 fc014e26 GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
494 e11386c0 CsabaKiraly
	if [ -e "freetype" ]; then
495
		cd freetype
496
		make clean
497
	else
498
		#get and compile SDLTTF lib
499
		rm -f freetype-2.1.10.tar.gz
500
		$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
501
		cd freetype
502
	fi
503
504 920851bb GiuseppeTropea
	#make and install in local folder
505 e11386c0 CsabaKiraly
	./configure ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_FREETYPE"
506 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
507 fc014e26 GiuseppeTropea
fi
508
509 e347580f Csaba Kiraly
echo "building libSDL-ttf"
510 920851bb GiuseppeTropea
if [ -n "$BUILD_SDLTTF" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_ttf.a" ]; then
511 fc014e26 GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
512 e11386c0 CsabaKiraly
	
513
	if [ -e "sdlttf" ]; then
514
		cd sdlttf
515
		make clean
516
	else
517
		#get and compile SDLTTF lib
518
		rm -f SDL_ttf-2.0.10.tar.gz
519
		$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
520
		cd sdlttf
521
	fi
522
523 920851bb GiuseppeTropea
	#make and install in local SDL folder
524 94a3ca93 Csaba Kiraly
	./configure ${HOSTARCH:+--host=$HOSTARCH} --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL" --disable-shared
525 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
526 fc014e26 GiuseppeTropea
fi
527
528 e347580f Csaba Kiraly
echo "building curl"
529 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
530
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_mingw"
531
else
532
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_linux"
533
fi
534 920851bb GiuseppeTropea
if [ -n "$BUILD_CURL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_CURL" ]; then
535 e27711c4 GiuseppeTropea
	cd "$BASE_UL_DIR/$EXTERN_DIR"
536 e11386c0 CsabaKiraly
	if [ -e "curl" ]; then
537
		cd curl
538
		make clean
539
	else
540
		#get and compile CURL lib
541
		rm -f curl-7.21.0.tar.bz2
542
		$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
543
		cd curl
544
	fi
545
546 920851bb GiuseppeTropea
	#make and install in local folder
547 e11386c0 CsabaKiraly
	./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"
548 e4ef5ca5 CsabaKiraly
	$MAKE; $MAKE install
549 e27711c4 GiuseppeTropea
fi
550
551 e347580f Csaba Kiraly
echo "looking for libevent"
552 e11386c0 CsabaKiraly
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
553
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
554
	echo "found LIBEVENT in $LOCAL_EVENT"
555 66b73752 Csaba Kiraly
else 
556
  if [ -d "$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libevent" ]; then
557
	LOCAL_EVENT="$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libevent"
558
	echo "found LIBEVENT in $LOCAL_EVENT"
559
  else 
560
    if [ -d "$BASE_UL_DIR/external_libs/libevent" ]; then
561 3d2b3344 Csaba Kiraly
	LOCAL_EVENT="$BASE_UL_DIR/external_libs/libevent"
562
	echo "found LIBEVENT in $LOCAL_EVENT"
563
    else
564 e11386c0 CsabaKiraly
	if [ "$LOCAL_EVENT_A" = "" ]; then
565
		if [ -f "/usr/lib/libevent.a" ]; then
566
			echo "You have file libevent.a in default system"
567
			echo "setting path for it to default /usr/lib/libevent.a"
568
			LOCAL_EVENT="/usr"
569
		else
570 83dacba2 Csaba Kiraly
			echo "you seem not to have file libevent.a."
571
			echo "you will not be able to build the libevent based version"
572
			echo "(don't worry, the default version will still compile)."
573 e11386c0 CsabaKiraly
		fi
574
	else
575
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
576
	fi
577 3d2b3344 Csaba Kiraly
    fi
578 66b73752 Csaba Kiraly
  fi
579 e11386c0 CsabaKiraly
fi
580
581 e347580f Csaba Kiraly
echo "looking for libconfuse"
582 e11386c0 CsabaKiraly
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
583
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
584
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
585 66b73752 Csaba Kiraly
else 
586
  if [ -d "$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libconfuse" ]; then
587
	LOCAL_CONFUSE="$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libconfuse"
588
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
589
  else 
590
    if [ -d "$BASE_UL_DIR/external_libs/libconfuse" ]; then
591
	LOCAL_CONFUSE="$BASE_UL_DIR/external_libs/libconfuse"
592
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
593
    else
594 e11386c0 CsabaKiraly
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
595
		if [ -f "/usr/lib/libconfuse.a" ]; then
596
			echo "You have file libconfuse.a in default system"
597
			echo "setting path for it to default /usr/lib/libconfuse.a"
598
			LOCAL_CONFUSE="/usr"
599
		else
600
			echo "you seem not to have file libconfuse.a. EXITING."
601
			exit
602
		fi
603
	else
604
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
605
	fi
606 66b73752 Csaba Kiraly
    fi
607
  fi
608 e11386c0 CsabaKiraly
fi
609
610 1538a3bd GiuseppeTropea
#set needed paths to external libraries
611
echo "-----"
612 47943338 GiuseppeTropea
NAPA="$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS"
613
echo "path for NAPA base folder set to $NAPA"
614 920851bb GiuseppeTropea
LOCAL_X264=$TEMP_X264
615 1538a3bd GiuseppeTropea
echo "path for X264 dependancy set to $LOCAL_X264"
616 920851bb GiuseppeTropea
LOCAL_MP3LAME=$TEMP_MP3LAME
617 9f668f32 GiuseppeTropea
echo "path for MP3LAME dependancy set to $LOCAL_MP3LAME"
618 920851bb GiuseppeTropea
LOCAL_FFMPEG=$TEMP_FFMPEG
619 1538a3bd GiuseppeTropea
echo "path for FFMPEG dependancy set to $LOCAL_FFMPEG"
620 920851bb GiuseppeTropea
LOCAL_MHD=$TEMP_MHD
621 1538a3bd GiuseppeTropea
echo "path for LIBMICROHTTPD dependancy set to $LOCAL_MHD"
622 920851bb GiuseppeTropea
LOCAL_ABS_SDL=$TEMP_SDL
623 1538a3bd GiuseppeTropea
echo "path for SDL dependancy set to $LOCAL_ABS_SDL"
624 920851bb GiuseppeTropea
LOCAL_SDLIMAGE=$TEMP_SDL
625 e27711c4 GiuseppeTropea
echo "path for SDLIMAGE dependancy set to $LOCAL_SDLIMAGE"
626 920851bb GiuseppeTropea
LOCAL_SDLTTF=$TEMP_SDL
627 fc014e26 GiuseppeTropea
echo "path for SDLTTF dependancy set to $LOCAL_SDLTTF"
628 920851bb GiuseppeTropea
LOCAL_FREETYPE=$TEMP_FREETYPE
629 fc014e26 GiuseppeTropea
echo "path for FREETYPE dependancy set to $LOCAL_FREETYPE"
630 920851bb GiuseppeTropea
LOCAL_CURL=$TEMP_CURL
631 e27711c4 GiuseppeTropea
echo "path for CURL dependancy set to $LOCAL_CURL"
632 1538a3bd GiuseppeTropea
633
echo "path for BZ2 dependancy is set to $LOCAL_BZ2"
634 920851bb GiuseppeTropea
echo "path for ZLIB dependancy is set to $LOCAL_Z"
635 e11386c0 CsabaKiraly
636
echo "path for LIBEVENT dependancy is set to $LOCAL_EVENT"
637
echo "path for LIBCONFUSE dependancy is set to $LOCAL_CONFUSE"
638 1538a3bd GiuseppeTropea
echo "-----"
639
640
#compile the UL external applications
641 920851bb GiuseppeTropea
#chunker_streamer and chunker_player
642
643
#CHUNKER_STREAMER
644 e11386c0 CsabaKiraly
645
# streamer is not supported yet on windows
646
if [ ! -n "$MINGW" ]; then
647
	echo "----------------COMPILING CHUNKER STREAMER"
648
	cd "$BASE_UL_DIR"
649
	cd chunker_streamer
650 18c8bbeb ArpadBakay
	[ -n "$REBUILD" ] && $MAKE clean
651 e11386c0 CsabaKiraly
	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; }
652
	echo "----------------FINISHED COMPILING CHUNKER STREAMER"
653
fi
654 920851bb GiuseppeTropea
655 e27711c4 GiuseppeTropea
#CHUNKER_PLAYER
656
echo "----------------COMPILING CHUNKER PLAYER"
657 1538a3bd GiuseppeTropea
cd "$BASE_UL_DIR"
658
cd chunker_player
659 18c8bbeb ArpadBakay
[ -n "$REBUILD" ] && $MAKE clean
660 47943338 GiuseppeTropea
NAPA=$NAPA LIBEVENT_DIR=$LOCAL_EVENT 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; }
661 e27711c4 GiuseppeTropea
echo "----------------FINISHED COMPILING CHUNKER PLAYER"
662 f61f9ed3 Csaba Kiraly
exit
663 1538a3bd GiuseppeTropea
664 e11386c0 CsabaKiraly
#compile a version of winestreamer with UL enabled
665 ff3fddf2 GiuseppeTropea
#static needs fix??
666 e11386c0 CsabaKiraly
cd "$BASE_UL_DIR/../Streamer"
667
668 ffb841a5 CsabaKiraly
$MAKE IO=$IO clean
669 e11386c0 CsabaKiraly
#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; }
670
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; }
671 f5887924 GiuseppeTropea
672
#check if all is ok
673
echo "============== RESULTS ==================="
674
675 e11386c0 CsabaKiraly
if [ ! -n "$MINGW" ]; then
676
	cd "$BASE_UL_DIR/chunker_streamer"
677
	if [ -f "chunker_streamer" ]; then
678
		echo "chunker_streamer OK"
679
		C_STREAMER_EXE=`ls -la chunker_streamer`
680
		echo "$C_STREAMER_EXE"
681
		#now we want the bare name
682
		C_STREAMER_EXE=`ls chunker_streamer`
683
	else
684
		echo "chunker_streamer FAIL"
685
	fi
686 f5887924 GiuseppeTropea
fi
687
688
cd "$BASE_UL_DIR/chunker_player"
689 e11386c0 CsabaKiraly
if [ -n "$MINGW" ]; then
690
	SUFFIX=".exe"
691
	SCRIPT_SUFFIX=".bat"
692
else
693
	SUFFIX=""
694
	SCRIPT_SUFFIX=".sh"
695
fi
696
if [ -f "chunker_player$SUFFIX" ]; then
697 f5887924 GiuseppeTropea
	echo "chunker_player OK"
698 e11386c0 CsabaKiraly
	C_PLAYER_EXE=`ls -la chunker_player$SUFFIX`
699 f5887924 GiuseppeTropea
	echo "$C_PLAYER_EXE"
700
	#now we want the bare name
701 e11386c0 CsabaKiraly
	C_PLAYER_EXE=`ls chunker_player$SUFFIX`
702 f5887924 GiuseppeTropea
else
703
	echo "chunker_player FAIL"
704
fi
705
706 e11386c0 CsabaKiraly
cd "$BASE_UL_DIR/../Streamer"
707
echo "Check if the http binary is among these winestreamers:"
708
ls -la winestreamer* | grep -v ".o$"
709
echo "Your UL-enabled winestreamer has these flags:"
710
if [ -n "$ALTO" ]; then
711
	GREP_ALTO_EXPR="-alto"
712
	GREP_ALTO_FLAGS=""
713
	echo "ALTO: enabled"
714
else
715
	GREP_ALTO_EXPR="-alto"
716
	GREP_ALTO_FLAGS="-v"
717
	echo "ALTO: disabled"
718
fi
719
if [ "$STATIC" = "1" ]; then
720
	GREP_STATIC_EXPR="-halfstatic"
721
	GREP_STATIC_FLAGS=""
722
	echo "STATIC: halfstatic"
723
elif [ "$STATIC" = "2" ]; then
724
	GREP_STATIC_EXPR="-static"
725
	GREP_STATIC_FLAGS=""
726
	echo "STATIC: static"
727
else
728
	GREP_STATIC_EXPR="static"
729
	GREP_STATIC_FLAGS="-v"
730
	echo "STATIC: dynamic"
731
fi
732
echo "IO: $IO"
733
IO="-"$IO
734
echo "Hence your UL-enabled winestreamer should be..."
735
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"`
736
#O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep -e "$IO"`
737 f5887924 GiuseppeTropea
echo "$O_TARGET_EXE"
738
if [ -f "$O_TARGET_EXE" ]; then
739
	echo "...and i found it."
740
else
741
	echo "...but sadly it appears build FAILED!."
742
fi
743
744 e11386c0 CsabaKiraly
#creating conf file with executable name inside
745
cd "$BASE_UL_DIR/chunker_player"
746
echo "$O_TARGET_EXE" > peer_exec_name.conf
747
748 f5887924 GiuseppeTropea
#packaging for distribution
749
cd "$BASE_UL_DIR/chunker_player"
750 e11386c0 CsabaKiraly
if [ -f "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
751 f5887924 GiuseppeTropea
	echo "============== PACKAGING NAPAPLAYER ==================="
752
	rm -f -r napaplayer
753
	mkdir napaplayer
754
	mkdir napaplayer/icons
755
	cp icons/* napaplayer/icons/
756
	cp channels.conf napaplayer/
757 e11386c0 CsabaKiraly
	cp peer_exec_name.conf napaplayer/
758
	cp runme$SCRIPT_SUFFIX napaplayer/
759 4344fb25 GiuseppeTropea
	cp README napaplayer/
760 f5887924 GiuseppeTropea
	cp napalogo*.bmp napaplayer/
761
	cp *.ttf napaplayer/
762
	cp "$C_PLAYER_EXE" napaplayer/
763 e11386c0 CsabaKiraly
	if [ -n "$MINGW" ]; then
764
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
765
	else
766
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
767
	fi
768
	if [ -n "$MINGW" ]; then
769
		cp "$LOCAL_LIBICONV/bin/libiconv-2.dll" napaplayer/libiconv2.dll
770
		if [ -f "$LOCAL_LIBINTL/bin/libintl-8.dll" ]; then
771
			cp "$LOCAL_LIBINTL/bin/libintl-8.dll" napaplayer/
772
		else
773
			cp "$LOCAL_LIBINTL/bin/libintl3.dll" napaplayer/libintl-8.dll
774
		fi
775
		cp "$LOCAL_PLIBC/bin/libplibc-1.dll" napaplayer/
776
		cp "$LOCAL_PTHREAD/bin/pthreadGC2.dll" napaplayer/
777
		cp "$LOCAL_ABS_SDL/bin/SDL.dll" napaplayer/
778
		rm -f -r napaplayer.zip
779
		zip -r napaplayer napaplayer
780
		if [ -s "napaplayer.zip" ]; then
781
			#it has size>0. OK!
782
			echo "Here it is your napaplayer package. Enjoy!"
783
			ls -la napaplayer.zip
784
		else
785
			echo "Sorry something went wrong during packaging napaplayer."
786
		fi
787 add73b22 CarmeloDaniele
	else
788 e11386c0 CsabaKiraly
		rm -f -r napaplayer.tar.gz
789
		tar cvfz napaplayer.tar.gz napaplayer
790
		if [ -s "napaplayer.tar.gz" ]; then
791
			#it has size>0. OK!
792
			echo "Here it is your napaplayer tarball. Enjoy!"
793
			ls -la napaplayer.tar.gz
794
		else
795
			echo "Sorry something went wrong during packaging napaplayer."
796
		fi
797 f5887924 GiuseppeTropea
	fi
798
else
799
	echo ""
800
	echo "Not packaging napaplayer since build failed."
801
fi
802
803
echo "Finished build UL script"