Statistics
| Branch: | Revision:

chunker-player / build_ul.sh @ 8647f8a0

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