tar_em_up.sh 13.8 KB
Newer Older
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
# super-simplistic installer for l2ork things by Ivica Ico Bukvic <ico@vt.edu>
# for info on L2Ork visit http://l2ork.music.vt.edu

if [ $# -eq 0 ] # should check for no arguments
then
	echo
	echo "   Usage: ./tar_em_up.sh -option1 -option2 ..."
	echo "   Options:"
	echo "     -a    l2ork addon to the dev package"
Ivica Bukvic's avatar
Ivica Bukvic committed
11
12
	echo "     -b    build a deb (incremental, all platforms)"
	echo "     -B    build a deb (complete recompile)"
13
14
	echo "     -c    core Pd source tarball"
	echo "     -d    whole dev folder tarball"
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
15
16
17
	echo "     -e    everything"
	echo "     -f    full installer (incremental)"
	echo "     -F    full installer (complete recompile)"
18
	echo "     -n    skip package creation (-bB, -fF)"
Ivica Bukvic's avatar
Ivica Bukvic committed
19
20
21
	echo "     -R    build a Raspberry Pi deb (complete recompile)"
	echo "     -r    build a Raspberry Pi deb (incremental)"
	echo "     -w    install custom version of cwiid system-wide"
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
22
	echo
23
24
25
26
27
	echo "   For custom install locations do the following before"
	echo "   running this script:"
	echo
	echo "           export inst_dir=/some/custom/location"
	echo
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
28
29
30
31
32
33
34
35
	exit 1
fi

addon=0
deb=0
core=0
dev=0
full=0
Ivica Bukvic's avatar
Ivica Bukvic committed
36
sys_cwiid=0
Ivica Bukvic's avatar
Ivica Bukvic committed
37
rpi=0
38
pkg=1
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
39

40
inst_dir=${inst_dir:-/usr/local}
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
41

42
while getopts ":abBcdefFnRruw" Option
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
do case $Option in
		a)		addon=1;;

		b)		deb=1
				inst_dir=/usr;;

		B)		deb=2
				inst_dir=/usr;;

		c)		core=1;;

		d)		dev=1;;

		e)		addon=1
				core=1
				dev=1
				full=1;;

		f)		full=1;;

		F)		full=2;;

65
66
		n)		pkg=0;;

67
68
69
70
71
72
73
74
		R)		deb=2
				inst_dir=/usr
				rpi=1;;

		r)		deb=1
				inst_dir=/usr
				rpi=1;;

Ivica Bukvic's avatar
Ivica Bukvic committed
75
		w)		sys_cwiid=1
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
76
77
78
79
80
81
				;;

		*)		echo "Error: unknown option";;
	esac
done

82
83
export TAR_EM_UP_PREFIX=$inst_dir

Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cd ../

if [ $core -eq 1 ]
then
	echo "core Pd..."
	rm -f ../Pd-l2ork-`date +%Y%m%d`.tar.bz2 2> /dev/null
	cd pd/src/
	make clean
	cd ../../
	tar -jcf ../Pd-l2ork-`date +%Y%m%d`.tar.bz2 pd
fi

if [ $dev -eq 1 ]
then
	echo "Pd dev package..."
Ivica Bukvic's avatar
Ivica Bukvic committed
99
	#cd doc/
100
	#svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/doc .
Ivica Bukvic's avatar
Ivica Bukvic committed
101
102
	#cp -f ../l2ork_addons/doc/Makefile .
	#cd ..
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	cd externals/miXed
	make clean
	cd ../
	make distclean
	cd ../pd/src
	make distclean
	cd ../../Gem/src/
	make distclean
	rm -rf ./.libs
	rm -rf ./*/.libs
	cd ../
	make distclean
	rm gemglutwindow.pd_linux
	rm Gem.pd_linux
	cd ../packages/linux_make
	make distclean
119
120
121
	cd ../../
	gitfolder=`basename $PWD`
	cd ../
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
122
123
	rm -f pd-l2ork-dev-`date +%Y%m%d`.tar.bz2 2> /dev/null
	echo "tar dev installer..."
124
125
	tar -jcf pd-l2ork-dev-`date +%Y%m%d`.tar.bz2 $gitfolder
	cd $gitfolder
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
126
127
128
129
fi

if [ $full -gt 0 -o $deb -gt 0 ]
then
130
131
	echo "Pd-L2Ork full installer... IMPORTANT! To ensure you have the most up-to-date submodules, this process requires internet connection to pull sources from various repositories..."

132
133
134
	if [ -d .git ]; then
		# check if Gem submodule is empty, and if so do first init
		if [ "$(ls -A Gem)" ]; then
135
136
			#git submodule update
			git submodule foreach git pull origin master
137
		else
138
			# init all submodules (only necessary the first time)
139
			git submodule init
140
			#git submodule update
141
			git submodule foreach git pull origin master
142
		fi
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
143
144
	fi

145
146
147
148
149
	# update the include files to be safe
	#if [ ! -d "/usr/local/include/pdl2ork" ]; then
	#	sudo mkdir /usr/local/include/pdl2ork
	#fi

Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	#if [ $full -eq 3 ]
	#then
	#	echo "IMPORTANT! If you are already running vanilla Pd or Pd-extended, or have a custom installation of Pd-l2ork at a location other than /usr/local/lib/pd-l2ork, you will want to EITHER uninstall all older versions of Pd-l2ork and/or other versions of pd OR manually pre-install Pd-l2ork includes in order to ensure that any third-party externals that rely on the global Pd-l2ork includes reference the right versions of the said files. Failing to do so may result in incorrectly compiled externals that will definitely crash Pd-l2ork. You can install the includes into their default dir /usr/local/include by typing following commands:"
	#	echo
	#	echo "sudo cp -f -v pd/src/g_all_guis.h /usr/local/include/pdl2ork/"
	#	echo "sudo cp -f -v pd/src/g_canvas.h /usr/local/include/pdl2ork/"
	#	echo "sudo cp -f -v pd/src/m_imp.h /usr/local/include/pdl2ork/"
	#	echo "sudo cp -f -v pd/src/m_pd.h /usr/local/include/pdl2ork/"
	#	echo "sudo cp -f -v pd/src/s_stuff.h /usr/local/include/pdl2ork/"
	#	echo
	#	echo "If you don't have sudo enabled, replace sudo commands with the appropraite alternative before pasting aforesaid lines in the terminal.
#
#PLEASE NOTE that because both Pd and Pd-l2ork use the includes with the same name, depending on your system's setup, skipping this step may result in a failed build. Press any key to continue or CTRL+C to cancel install and manually copy the said files first (or use -f or -F options to have these steps performed automatically)..."
	#	read dummy
	#else
	#	echo "First we will copy updated includes... You may have to enter your sudo password..."
	#	sudo mkdir $inst_dir/include/pdl2ork/
	#	sudo cp -f -v pd/src/g_all_guis.h $inst_dir/include/pdl2ork/
	#	sudo cp -f -v pd/src/g_canvas.h $inst_dir/include/pdl2ork/
	#	sudo cp -f -v pd/src/m_imp.h $inst_dir/include/pdl2ork/
	#	sudo cp -f -v pd/src/m_pd.h $inst_dir/include/pdl2ork/
	#	sudo cp -f -v pd/src/s_stuff.h $inst_dir/include/pdl2ork/
	#fi

	# update docs
Ivica Bukvic's avatar
Ivica Bukvic committed
175
	#cd doc/
176
	#svn checkout https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/doc .
Ivica Bukvic's avatar
Ivica Bukvic committed
177
178
	#cp -f ../l2ork_addons/doc/Makefile .
	#cd ..
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
179

Ivica Bukvic's avatar
Ivica Bukvic committed
180
	if [ $full -eq 2 -o $deb -eq 2 ]
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
181
182
183
	then
	#	echo "Since we are doing a complete recompile we are assuming we will need to install l2ork version of the cwiid library. You will need to remove any existing cwiid libraries manually as they will clash with this one. L2Ork version is fully backwards compatible while also offering unique features like full extension support including the passthrough mode. YOU SHOULD REMOVE EXISTING CWIID LIBRARIES PRIOR TO RUNNING THIS INSTALL... You will also have to enter sudo password to install these... Press any key to continue or CTRL+C to cancel install..."
	#	read dummy
184
185
	#	if [ $no_cwiid -eq 0 ]
	#	then
186
187
		cd l2ork_addons/cwiid/
		# install cwiid
188
		# git submodule update
189
190
191
192
193
194
195
196
197
198
199
200
		aclocal
		autoconf
		./configure --with-python=python2
		make
		# we have disabled system-wide install because as of 23-03-2013
		# we now statically link disis_wiimote against custom L2Ork version
		# of the cwiid library
		if [ $sys_cwiid -eq 1 ]
		then
			sudo make install
		fi
		cd ../../
201
	#	fi
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
202
203
204
		# clean files that may remain stuck even after doing global make clean (if any)
		cd externals/miXed
		make clean
205
206
207
		cd ../
		make gem_clean
		cd ../Gem/src/
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
208
209
210
211
212
213
214
215
216
		make distclean
		rm -rf ./.libs
		rm -rf ./*/.libs
		cd ../
		make distclean
		rm gemglutwindow.pd_linux
		rm Gem.pd_linux
		aclocal
		./autogen.sh
217
		export INCREMENTAL=""
218
219
220
221
222
223
224
225
226
227
	#elif [ $full -eq 3 ]
	#then
	#	echo "Since pd-l2ork relies on a unique version of cwiid library, we will need to install it to make disis_wiimote external work properly. YOU SHOULD REMOVE EXISTING CWIID LIBRARIES PRIOR TO RUNNING THIS INSTALL... No worries though, L2Ork version is fully backwards compatible while also offering unique features like full extension support including the passthrough mode. To install cwiid library go to <pd-l2ork-root-git-folder>/l2ork-addons/cwiid/ folder and install it using the usual:"
	#	echo
	#	echo "./configure"
	#	echo "make"
	#	echo "sudo make install"
	#	echo
	#	echo "As an alternative, you can also use the -f or -F options instead of an -u option to have this performed automatically. Please note that options -f and -F require that your system has sudo enabled. Press any key to continue or CTRL+C to cancel install..."
	#	read dummy
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
228
		# clean files that may remain stuck even after doing global make clean (if any)
229
230
231
232
233
234
235
236
237
238
239
240
	#	cd externals/miXed
	#	make clean
	#	cd ../../Gem/src/
	#	make distclean
	#	rm -rf ./.libs
	#	rm -rf ./*/.libs
	#	cd ../
	#	make distclean
	#	rm gemglutwindow.pd_linux
	#	rm Gem.pd_linux
	#	aclocal
	#	./autogen.sh
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
241
242
	else
		cd Gem/
243
		export INCREMENTAL="yes"
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
244
	fi
245
246
	cd ../pd/src && aclocal && autoconf
	cd ../../packages/linux_make
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
247
248
249
	if [ $full -gt 1 -o $deb -eq 2 ]
	then
		make distclean
250
251
252
253
254
255
256
		cp ../../pd/src/g_all_guis.h ../../externals/build/include
		cp ../../pd/src/g_canvas.h ../../externals/build/include
		cp ../../pd/src/m_imp.h ../../externals/build/include
		cp ../../pd/src/m_pd.h ../../externals/build/include
		cp ../../pd/src/s_stuff.h ../../externals/build/include
		cp ../../pd/src/t_tk.h ../../externals/build/include
		cp ../../pd/src/g_all_guis.h ../../externals/build/include								
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
257
258
		rm -rf build/
	fi
Ivica Bukvic's avatar
Ivica Bukvic committed
259
260
261
262
	if [ $rpi -eq 0 ]
	then
		echo "installing desktop version..."
		cp -f debian/control.desktop debian/control
263
		cp -f ../../l2ork_addons/flext/config-lnx-pd-gcc.txt.intel ../../externals/grill/trunk/flext/buildsys/config-lnx-pd-gcc.txt
Ivica Bukvic's avatar
Ivica Bukvic committed
264
265
266
	else
		echo "installing raspbian version..."
		cp -f debian/control.raspbian debian/control
267
		cp -f ../../l2ork_addons/flext/config-lnx-pd-gcc.txt.rpi ../../externals/grill/trunk/flext/buildsys/config-lnx-pd-gcc.txt
Ivica Bukvic's avatar
Ivica Bukvic committed
268
269
		cat ../../externals/OSCx/src/Makefile | sed -e s/-lpd//g > ../../externals/OSCx/src/Makefile
	fi
270
	echo "FOOOOOOOOOOOOOOOOOOOOOOOOOOOO"
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
271
	make install prefix=$inst_dir
272
	echo "copying pd-l2ork-specific externals..."
273
274
	# create images folder
	mkdir -p ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/images
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
	# patch_name
	cd ../../l2ork_addons/patch_name
	make clean
	make
	cp -f patch_name.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f patch_name-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	# disis_wiimote
	cd ../disis_wiimote
	make clean
	make
	cp -f disis_wiimote.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_wiimote-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	# disis_netsend
	cd ../disis_netsend
	make clean
	make
	cp -f disis_netsend.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_netsend-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	# disis_netreceive
	cd ../disis_netreceive
	make clean
	make
	cp -f disis_netreceive.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_netreceive-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	# disis_phasor
	cd ../disis_phasor
	make clean
	make
	cp -f disis_phasor~.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_phasor~-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	# spectdelay
	cd ../spectdelay/spectdelay~
	./linux-install.sh
	cp -f spectdelay~.pd_linux ../../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f spectdelay~-help.pd ../../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f array* ../../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
Ivica Bukvic's avatar
Ivica Bukvic committed
311
312
	# return to l2ork_addons folder
	cd ../../
313
	# copy rjlib into the extra folder
314
	cp -rf rjlib ../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
Ivica Bukvic's avatar
Ivica Bukvic committed
315
	# install raspberry pi externals (if applicable)
316
317
318
319
320
321
322
323
324
325
	#if [ $rpi -eq 1 ]
	#then
	cd raspberry_pi
	./makeall.sh
	cp -f disis_gpio/disis_gpio.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_gpio/disis_gpio-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_spi/disis_spi.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f disis_spi/disis_spi-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cd ../
	#fi
326
327
	# install rtcmix~ external
	cd rtcmix-in-pd/
328
	#git submodule update
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
	cd RTcmix*
	./configure
	#make clean
	make
	cd ../
	make clean
	make
	cp -f rtcmix~.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f rtcmix~-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -rf lib ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -rf scores ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cd ../
	# install autotune~ plugin
	cd autotune/
	make
	cp -f autotune~.pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f autotune~-help.pd ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra
	cp -f autotune_scale_warp.png ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/images
	cd ../
	# install lyonpotpourri
	cd lyonpotpourri/
350
	#git submodule update
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	make
	mkdir -p ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon
	# do not include cartopol and poltocar since cyclone library already has those
	cp `ls *.pd_linux | egrep -v '^cartopol*' | egrep -v '^poltocar*'` ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cp `ls *.pd | egrep -v '^cartopol*' | egrep -v '^poltocar*'` ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cp -rf sound ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cp -rf lib*.so ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cd ../
	# install fftease
	cd fftease*
	make
	cp *pd_linux ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cp -rf lib*.so ../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cd fftease32-helpfiles/
	cp *pd ../../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/
	cp -rf sound/* ../../../packages/linux_make/build$inst_dir/lib/pd-l2ork/extra/lyon/sound/
	cd ../../
	echo "done with l2ork addons."
369
370
	cd ../
	if [ $pkg -gt 0 ]; then
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
371
	# finish install
372
	cd packages/linux_make
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
	echo "tar full installer..."
	rm -f build/usr/local/lib/pd
	if [ $deb -gt 0 ]
	then
		cd build/
		rm -rf DEBIAN/ etc/
		cd ../
		make deb prefix=$inst_dir
	else
		make tarbz2 prefix=$inst_dir
	fi
	echo "move full installer..."
	if [ $deb -gt 0 ]
	then
		mv *.deb ../../../
	else
389
390
		#rm -f ../../../Pd-l2ork-full-`uname -m`-`date +%Y%m%d`.tar.bz2 2> /dev/null
		#mv build/Pd*bz2 ../../../Pd-l2ork-full-`uname -m`-`date +%Y%m%d`.tar.bz2
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
391
392
393
		mv -f build/pd*bz2 ../../..
	fi
	cd ../../
394
	fi
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
395
396
397
398
399
fi

if [ $addon -eq 1 ]
then
	echo "l2ork addons..."
400
	rm -f ../l2ork_addons-`uname -m`-`date +%Y%m%d`.tar.bz2 2> /dev/null
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
401
	#cp -rf /usr/local/lib/pd/* l2ork_addons/externals/
402
	tar -jcf ../l2ork_addons-`uname -m`-`date +%Y%m%d`.tar.bz2 l2ork_addons
Ivica Ico Bukvic's avatar
Ivica Ico Bukvic committed
403
404
405
406
407
408
409
fi

cd l2ork_addons/

echo "done."

exit 0