Statistics
| Branch: | Revision:

chunker-player / build_ul.sh @ f61f9ed3

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