Statistics
| Branch: | Revision:

chunker-player / build_ul.sh @ eb7e020b

History | View | Annotate | Download (29.4 KB)

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

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

    
19
#set some defaults
20
IO=${IO:-"tcp"}
21
MONL=${MONL:-1}
22
ML=${ML:-1}
23

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

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

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

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

    
43
mkdir $EXTERN_DIR
44

    
45
if [ -n "$MINGW" ]; then
46
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2_mingw"
47
	if [ ! -e "$TEMP_BZ2/lib/libbz2.a" ]; then
48
		#we erase and rebuild since the installation is not there
49
		cd "$BASE_UL_DIR/$EXTERN_DIR"
50
		rm -r -f bzip2_mingw
51
		#get the latest bzip2 library
52
		$WGET_OR_CURL $WGET_OR_CURLOPT http://switch.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-bin.zip; unzip bzip2-1.0.5-bin.zip -d bzip2_mingw
53
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sunet.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-lib.zip; unzip -o bzip2-1.0.5-lib.zip -d bzip2_mingw
54
		rm -f bzip2-1.0.5-lib.zip; rm -f bzip2-1.0.5-bin.zip;
55
	fi
56
	LOCAL_BZ2=$TEMP_BZ2
57
else
58
	#try to find libbz2 in your system
59
	LOCAL_BZ2_A=/usr/lib/libbz2.a
60
	if [ ! -e $LOCAL_BZ2_A ]; then
61
		[ 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
		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
	fi
73
fi
74

    
75
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
	fi
85
	LOCAL_Z=$TEMP_Z
86
else
87
	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
	fi
102

    
103
	#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
fi
109
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
		fi
132
	fi
133
fi
134

    
135

    
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
	fi
207
	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
fi
230

    
231

    
232
echo "building 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
echo "building x264"
255
if [ -n "$LOCAL_X264" ]; then
256
	TEMP_X264=$LOCAL_X264
257
else
258
if [ -n "$MINGW" ]; then
259
	#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
260
	echo "mingw: libx264 not required for player"
261
else
262
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_linux"
263
if [ -n "$BUILD_X264" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_X264" ]; then
264
	cd "$BASE_UL_DIR/$EXTERN_DIR"
265
	if [ -e "x264" ]; then
266
		cd x264
267
		make clean
268
	else
269
		#get and compile latest x264 library
270
		if [ -n "$MAC_OS" ]; then
271
		   $WGET_OR_CURL $WGET_OR_CURLOPT ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20110115-2245.tar.bz2
272
		   tar yvfx x264-snapshot-20110115-2245.tar.bz2
273
		   rm -f x264-snapshot-20110115-2245.tar.bz2
274
		   mv x264-snapshot-20110115-2245/ x264
275
		else
276
		   git clone git://git.videolan.org/x264.git
277
		fi
278
		cd x264
279
	fi	
280

    
281
	#make and install in local folder
282
	./configure --prefix="$TEMP_X264" ${HOSTARCH:+--host=$HOSTARCH}
283
	$MAKE; $MAKE install
284
fi
285
fi
286
fi
287

    
288
echo "building mp3lame"
289
if [ -n "$LOCAL_MP3LAME" ]; then
290
	TEMP_MP3LAME=$LOCAL_MP3LAME
291
else
292
if [ -n "$MINGW" ]; then
293
	#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
294
	echo "mingw: libmp3lame not required for player"
295
else
296
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_linux"
297
if [ -n "$BUILD_MP3LAME" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MP3LAME" ]; then
298
	cd "$BASE_UL_DIR/$EXTERN_DIR"
299
	
300
	if [ -e "mp3lame" ]; then
301
		cd mp3lame
302
		make clean
303
	else
304
		#get and compile latest mp3lame library
305
		rm -f lame-3.98.4.tar.gz
306
		$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;
307
		cd mp3lame
308
	fi	
309

    
310
	#make and install in local folder
311
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME" ${HOSTARCH:+--host=$HOSTARCH}
312
	$MAKE; $MAKE install
313
fi
314
fi
315
fi
316

    
317
echo "building ffmpeg"
318
if [ -n "$LOCAL_FFMPEG" ]; then
319
	TEMP_FFMPEG=$LOCAL_FFMPEG
320
else
321
if [ -n "$MINGW" ]; then
322
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_mingw"
323
else
324
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_linux"
325
fi
326
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
327
	echo "Compilation of some ffmpeg dependancies failed. Check your internet connection and errors."
328
fi
329
if [ -e "$TEMP_X264/lib/libx264.a" ]; then
330
	FFMPEG_CONFIG+=" --enable-libx264"
331
	FFMPEG_EXTRA_CFLAGS+=" -I$TEMP_X264/include"
332
fi
333
if [ -e "$TEMP_MP3LAME/lib/libmp3lame.a" ]; then
334
	FFMPEG_CONFIG+=" --enable-libmp3lame"
335
	FFMPEG_EXTRA_CFLAGS+=" -I$TEMP_MP3LAME/include"
336
fi
337
if [ -n "$BUILD_FFMPEG" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FFMPEG" ]; then
338
	cd "$BASE_UL_DIR/$EXTERN_DIR"
339
	
340
	if [ -e "ffmpeg" ]; then
341
		cd ffmpeg
342
		make clean
343
	else
344
		#get and compile ffmpeg with x264 support
345
		#get latest snapshot
346
		#rm -f ffmpeg-checkout-snapshot.tar.bz2
347
		#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
348
		#do not get latest snapshot
349
		#get a release tarball instead
350
		rm -f ffmpeg-0.6.tar.bz2
351
		$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
352
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
353
		#do not get latest snapshot
354
		#get instead a specific one because allows output video rate resampling
355
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
356
		cd ffmpeg
357
	fi	
358

    
359
	if [ -n "$MINGW" ]; then
360
		HOSTARCH_OLDSTYLE=${HOSTARCH:+--arch=i586 --enable-cross-compile --cross-prefix=i586-mingw32msvc- --target-os=$HOSTARCH --disable-sse}
361
	
362
		#configure bugfix
363
		sed -i -e 's/^SDL_CONFIG=/[ -z "$SDL_CONFIG" ] \&\& SDL_CONFIG=/g' ./configure;
364
		sed -i -e 's/check_cflags \+-Werror=missing-prototypes/#\0/g' configure;
365
	
366
		./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"
367
	else
368
		./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"
369
	fi
370
	$MAKE; $MAKE install
371
fi
372
fi
373

    
374
echo "building libmicrohttpd"
375
if [ -n "$MINGW" ]; then
376
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_mingw"
377
else
378
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_linux"
379
fi
380
if [ -n "$BUILD_MHD" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MHD" ]; then
381
	cd "$BASE_UL_DIR/$EXTERN_DIR"
382
	
383
	if [ -e "libmicrohttpd" ]; then
384
		cd libmicrohttpd
385
		make clean
386
	else
387
		#get and compile libmicrohttpd lib
388
		if [ X`svn --version|head -1|cut -c14-16` = X1.6 ]; then
389
			svn --non-interactive --trust-server-cert checkout https://gnunet.org/svn/libmicrohttpd
390
		else
391
			svn --non-interactive checkout https://gnunet.org/svn/libmicrohttpd
392
		fi
393
		cd libmicrohttpd || { echo "CANNOT download libmicrohttpd"; exit 1; }
394
 
395
	fi
396
	
397
	autoreconf -fi
398
	if [ -n "$MINGW" ]; then
399
		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"
400
	else
401
		./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
402
	fi
403
	$MAKE; $MAKE install
404
fi
405

    
406

    
407
echo "building SDL"
408
if [ -n "$MINGW" ]; then
409
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl_mingw/temp_sdl_install"
410
else
411
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install_linux"
412
fi
413
if [ -n "$BUILD_SDL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL" ]; then
414
	cd "$BASE_UL_DIR/$EXTERN_DIR"
415

    
416
	if [ -n "$MINGW" ]; then
417
#		if [ ! -e "sdl_mingw" ]; then
418
#			# use binaries
419
#			$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;
420
#			rm -f SDL-devel-1.2.14-mingw32.tar.gz;
421
#			cd sdl_mingw
422
#			mkdir temp_sdl_install
423
#			mv bin $TEMP_SDL/; mv lib $TEMP_SDL/; mv include $TEMP_SDL/; mv share $TEMP_SDL/
424

    
425
			# build from sources
426
			$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
427
			cd sdl_mingw
428
			#make and install in local folder
429
			./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-video-directfb --disable-shared --prefix="$TEMP_SDL"
430
			$MAKE; $MAKE install
431
#		fi
432
	else
433
		if [ -e "sdl" ]; then
434
			cd sdl
435
			make clean
436
		else
437
			#get and compile SDL lib
438
			$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
439
			cd sdl
440
		fi
441
		#make and install in local folder
442
		./configure --disable-video-directfb --prefix="$TEMP_SDL"
443
		$MAKE; $MAKE install
444
	fi
445
fi
446

    
447
echo "building SDLimage"
448
if [ -n "$BUILD_SDLIMAGE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_image.a" ]; then
449
	cd "$BASE_UL_DIR/$EXTERN_DIR"
450
	
451
	if [ -e "sdlimage" ]; then
452
		cd sdlimage
453
		make clean
454
	else
455
		#get and compile SDLIMAGE lib
456
		$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
457
		rm -f SDL_image-1.2.10.tar.gz
458
		cd sdlimage
459
	fi
460
	
461
	#make and install in local SDL folder
462
        ./autogen.sh
463
	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"
464

    
465
	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"
466

    
467
	./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
468

    
469
	$MAKE; $MAKE install
470
fi
471

    
472
echo "building freetype"
473
# SDL_ttf depends on freetype
474
if [ -n "$MINGW" ]; then
475
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_mingw"
476
else
477
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_linux"
478
fi
479
if [ -n "$BUILD_FREETYPE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FREETYPE" ]; then
480
	cd "$BASE_UL_DIR/$EXTERN_DIR"
481
	if [ -e "freetype" ]; then
482
		cd freetype
483
		make clean
484
	else
485
		#get and compile SDLTTF lib
486
		rm -f freetype-2.1.10.tar.gz
487
		$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
488
		cd freetype
489
	fi
490

    
491
	#make and install in local folder
492
	./configure ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_FREETYPE"
493
	$MAKE; $MAKE install
494
fi
495

    
496
echo "building libSDL-ttf"
497
if [ -n "$BUILD_SDLTTF" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_ttf.a" ]; then
498
	cd "$BASE_UL_DIR/$EXTERN_DIR"
499
	
500
	if [ -e "sdlttf" ]; then
501
		cd sdlttf
502
		make clean
503
	else
504
		#get and compile SDLTTF lib
505
		rm -f SDL_ttf-2.0.10.tar.gz
506
		$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
507
		cd sdlttf
508
	fi
509

    
510
	#make and install in local SDL folder
511
	./configure ${HOSTARCH:+--host=$HOSTARCH} --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL" --disable-shared
512
	$MAKE; $MAKE install
513
fi
514

    
515
echo "building curl"
516
if [ -n "$MINGW" ]; then
517
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_mingw"
518
else
519
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_linux"
520
fi
521
if [ -n "$BUILD_CURL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_CURL" ]; then
522
	cd "$BASE_UL_DIR/$EXTERN_DIR"
523
	if [ -e "curl" ]; then
524
		cd curl
525
		make clean
526
	else
527
		#get and compile CURL lib
528
		rm -f curl-7.21.0.tar.bz2
529
		$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
530
		cd curl
531
	fi
532

    
533
	#make and install in local folder
534
	./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"
535
	$MAKE; $MAKE install
536
fi
537

    
538
echo "looking for libevent"
539
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
540
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
541
	echo "found LIBEVENT in $LOCAL_EVENT"
542
else 
543
  if [ -d "$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libevent" ]; then
544
	LOCAL_EVENT="$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libevent"
545
	echo "found LIBEVENT in $LOCAL_EVENT"
546
  else 
547
    if [ -d "$BASE_UL_DIR/external_libs/libevent" ]; then
548
	LOCAL_EVENT="$BASE_UL_DIR/external_libs/libevent"
549
	echo "found LIBEVENT in $LOCAL_EVENT"
550
    else
551
	if [ "$LOCAL_EVENT_A" = "" ]; then
552
		if [ -f "/usr/lib/libevent.a" ]; then
553
			echo "You have file libevent.a in default system"
554
			echo "setting path for it to default /usr/lib/libevent.a"
555
			LOCAL_EVENT="/usr"
556
		else
557
			echo "you seem not to have file libevent.a."
558
			echo "you will not be able to build the libevent based version"
559
			echo "(don't worry, the default version will still compile)."
560
		fi
561
	else
562
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
563
	fi
564
    fi
565
  fi
566
fi
567

    
568
echo "looking for libconfuse"
569
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
570
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
571
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
572
else 
573
  if [ -d "$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libconfuse" ]; then
574
	LOCAL_CONFUSE="$BASE_UL_DIR/../THIRDPARTY-LIBS/NAPA-BASELIBS/3RDPARTY-LIBS/libconfuse"
575
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
576
  else 
577
    if [ -d "$BASE_UL_DIR/external_libs/libconfuse" ]; then
578
	LOCAL_CONFUSE="$BASE_UL_DIR/external_libs/libconfuse"
579
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
580
    else
581
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
582
		if [ -f "/usr/lib/libconfuse.a" ]; then
583
			echo "You have file libconfuse.a in default system"
584
			echo "setting path for it to default /usr/lib/libconfuse.a"
585
			LOCAL_CONFUSE="/usr"
586
		else
587
			echo "you seem not to have file libconfuse.a. EXITING."
588
			exit
589
		fi
590
	else
591
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
592
	fi
593
    fi
594
  fi
595
fi
596

    
597
#set needed paths to external libraries
598
echo "-----"
599
LOCAL_X264=$TEMP_X264
600
echo "path for X264 dependancy set to $LOCAL_X264"
601
LOCAL_MP3LAME=$TEMP_MP3LAME
602
echo "path for MP3LAME dependancy set to $LOCAL_MP3LAME"
603
LOCAL_FFMPEG=$TEMP_FFMPEG
604
echo "path for FFMPEG dependancy set to $LOCAL_FFMPEG"
605
LOCAL_MHD=$TEMP_MHD
606
echo "path for LIBMICROHTTPD dependancy set to $LOCAL_MHD"
607
LOCAL_ABS_SDL=$TEMP_SDL
608
echo "path for SDL dependancy set to $LOCAL_ABS_SDL"
609
LOCAL_SDLIMAGE=$TEMP_SDL
610
echo "path for SDLIMAGE dependancy set to $LOCAL_SDLIMAGE"
611
LOCAL_SDLTTF=$TEMP_SDL
612
echo "path for SDLTTF dependancy set to $LOCAL_SDLTTF"
613
LOCAL_FREETYPE=$TEMP_FREETYPE
614
echo "path for FREETYPE dependancy set to $LOCAL_FREETYPE"
615
LOCAL_CURL=$TEMP_CURL
616
echo "path for CURL dependancy set to $LOCAL_CURL"
617

    
618
echo "path for BZ2 dependancy is set to $LOCAL_BZ2"
619
echo "path for ZLIB dependancy is set to $LOCAL_Z"
620

    
621
echo "path for LIBEVENT dependancy is set to $LOCAL_EVENT"
622
echo "path for LIBCONFUSE dependancy is set to $LOCAL_CONFUSE"
623
echo "-----"
624

    
625
#compile the UL external applications
626
#chunker_streamer and chunker_player
627

    
628
#CHUNKER_STREAMER
629

    
630
# streamer is not supported yet on windows
631
if [ ! -n "$MINGW" ]; then
632
	echo "----------------COMPILING CHUNKER STREAMER"
633
	cd "$BASE_UL_DIR"
634
	cd chunker_streamer
635
	$MAKE clean
636
	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; }
637
	echo "----------------FINISHED COMPILING CHUNKER STREAMER"
638
fi
639

    
640
#CHUNKER_PLAYER
641
echo "----------------COMPILING CHUNKER PLAYER"
642
cd "$BASE_UL_DIR"
643
cd chunker_player
644
$MAKE clean
645
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; }
646
echo "----------------FINISHED COMPILING CHUNKER PLAYER"
647
exit
648

    
649
#compile a version of winestreamer with UL enabled
650
#static needs fix??
651
cd "$BASE_UL_DIR/../Streamer"
652

    
653
$MAKE IO=$IO clean
654
#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; }
655
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; }
656

    
657
#check if all is ok
658
echo "============== RESULTS ==================="
659

    
660
if [ ! -n "$MINGW" ]; then
661
	cd "$BASE_UL_DIR/chunker_streamer"
662
	if [ -f "chunker_streamer" ]; then
663
		echo "chunker_streamer OK"
664
		C_STREAMER_EXE=`ls -la chunker_streamer`
665
		echo "$C_STREAMER_EXE"
666
		#now we want the bare name
667
		C_STREAMER_EXE=`ls chunker_streamer`
668
	else
669
		echo "chunker_streamer FAIL"
670
	fi
671
fi
672

    
673
cd "$BASE_UL_DIR/chunker_player"
674
if [ -n "$MINGW" ]; then
675
	SUFFIX=".exe"
676
	SCRIPT_SUFFIX=".bat"
677
else
678
	SUFFIX=""
679
	SCRIPT_SUFFIX=".sh"
680
fi
681
if [ -f "chunker_player$SUFFIX" ]; then
682
	echo "chunker_player OK"
683
	C_PLAYER_EXE=`ls -la chunker_player$SUFFIX`
684
	echo "$C_PLAYER_EXE"
685
	#now we want the bare name
686
	C_PLAYER_EXE=`ls chunker_player$SUFFIX`
687
else
688
	echo "chunker_player FAIL"
689
fi
690

    
691
cd "$BASE_UL_DIR/../Streamer"
692
echo "Check if the http binary is among these winestreamers:"
693
ls -la winestreamer* | grep -v ".o$"
694
echo "Your UL-enabled winestreamer has these flags:"
695
if [ -n "$ALTO" ]; then
696
	GREP_ALTO_EXPR="-alto"
697
	GREP_ALTO_FLAGS=""
698
	echo "ALTO: enabled"
699
else
700
	GREP_ALTO_EXPR="-alto"
701
	GREP_ALTO_FLAGS="-v"
702
	echo "ALTO: disabled"
703
fi
704
if [ "$STATIC" = "1" ]; then
705
	GREP_STATIC_EXPR="-halfstatic"
706
	GREP_STATIC_FLAGS=""
707
	echo "STATIC: halfstatic"
708
elif [ "$STATIC" = "2" ]; then
709
	GREP_STATIC_EXPR="-static"
710
	GREP_STATIC_FLAGS=""
711
	echo "STATIC: static"
712
else
713
	GREP_STATIC_EXPR="static"
714
	GREP_STATIC_FLAGS="-v"
715
	echo "STATIC: dynamic"
716
fi
717
echo "IO: $IO"
718
IO="-"$IO
719
echo "Hence your UL-enabled winestreamer should be..."
720
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"`
721
#O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep -e "$IO"`
722
echo "$O_TARGET_EXE"
723
if [ -f "$O_TARGET_EXE" ]; then
724
	echo "...and i found it."
725
else
726
	echo "...but sadly it appears build FAILED!."
727
fi
728

    
729
#creating conf file with executable name inside
730
cd "$BASE_UL_DIR/chunker_player"
731
echo "$O_TARGET_EXE" > peer_exec_name.conf
732

    
733
#packaging for distribution
734
cd "$BASE_UL_DIR/chunker_player"
735
if [ -f "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
736
	echo "============== PACKAGING NAPAPLAYER ==================="
737
	rm -f -r napaplayer
738
	mkdir napaplayer
739
	mkdir napaplayer/icons
740
	cp icons/* napaplayer/icons/
741
	cp channels.conf napaplayer/
742
	cp peer_exec_name.conf napaplayer/
743
	cp runme$SCRIPT_SUFFIX napaplayer/
744
	cp README napaplayer/
745
	cp napalogo*.bmp napaplayer/
746
	cp *.ttf napaplayer/
747
	cp "$C_PLAYER_EXE" napaplayer/
748
	if [ -n "$MINGW" ]; then
749
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
750
	else
751
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
752
	fi
753
	if [ -n "$MINGW" ]; then
754
		cp "$LOCAL_LIBICONV/bin/libiconv-2.dll" napaplayer/libiconv2.dll
755
		if [ -f "$LOCAL_LIBINTL/bin/libintl-8.dll" ]; then
756
			cp "$LOCAL_LIBINTL/bin/libintl-8.dll" napaplayer/
757
		else
758
			cp "$LOCAL_LIBINTL/bin/libintl3.dll" napaplayer/libintl-8.dll
759
		fi
760
		cp "$LOCAL_PLIBC/bin/libplibc-1.dll" napaplayer/
761
		cp "$LOCAL_PTHREAD/bin/pthreadGC2.dll" napaplayer/
762
		cp "$LOCAL_ABS_SDL/bin/SDL.dll" napaplayer/
763
		rm -f -r napaplayer.zip
764
		zip -r napaplayer napaplayer
765
		if [ -s "napaplayer.zip" ]; then
766
			#it has size>0. OK!
767
			echo "Here it is your napaplayer package. Enjoy!"
768
			ls -la napaplayer.zip
769
		else
770
			echo "Sorry something went wrong during packaging napaplayer."
771
		fi
772
	else
773
		rm -f -r napaplayer.tar.gz
774
		tar cvfz napaplayer.tar.gz napaplayer
775
		if [ -s "napaplayer.tar.gz" ]; then
776
			#it has size>0. OK!
777
			echo "Here it is your napaplayer tarball. Enjoy!"
778
			ls -la napaplayer.tar.gz
779
		else
780
			echo "Sorry something went wrong during packaging napaplayer."
781
		fi
782
	fi
783
else
784
	echo ""
785
	echo "Not packaging napaplayer since build failed."
786
fi
787

    
788
echo "Finished build UL script"
789