~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.4.0-0beta2

1.1.10 by Matthieu Baerts (matttbe)
Import upstream version 2.2.0~0beta4
1
#!/bin/sh
2
3
export CAIRO_DOCK_DIR=`pwd`/..
4
export CAIRO_DOCK_PREFIX=/usr
5
export CAIRO_DOCK_AUTORECONF="0"
6
export CAIRO_DOCK_CLEAN="0"
7
export CAIRO_DOCK_COMPIL="0"
8
export CAIRO_DOCK_UNSTABLE="0"
9
export CAIRO_DOCK_INSTALL="0"
10
export CAIRO_DOCK_DOC="0"
11
export CAIRO_DOCK_EXCLUDE="template stacks"
12
export CAIRO_DOCK_GLITZ_OPTION=""
13
export CAIRO_DOCK_PLUG_INS_OPTION=""
14
export SUDO=sudo
15
export TIME=time
16
17
echo "this script will process : "
18
while getopts "acCituhd:Dgm" flag
19
do
20
	echo " option $flag $OPTIND $OPTARG"
21
	case "$flag" in
22
	a)
23
		echo " => re-generation of files"
24
		export CAIRO_DOCK_AUTORECONF="1"
25
		;;
26
	c)
27
		echo " => cleaning"
28
		export CAIRO_DOCK_CLEAN="1"
29
		;;
30
	C)
31
		echo " => compilation"
32
		export CAIRO_DOCK_COMPIL="1"
33
		;;
34
	i)
35
		echo " => installation"
36
		export CAIRO_DOCK_INSTALL="1"
37
		;;
38
	u)
39
		echo " => include unstable applets"
40
		export CAIRO_DOCK_UNSTABLE="1"
41
		;;
42
	d)
43
		echo " => use folder $OPTARG"
44
		export CAIRO_DOCK_DIR="$OPTARG"
45
		;;
46
	D)
47
		echo " => build documentation $OPTARG"
48
		export CAIRO_DOCK_DOC="1"
49
		;;
50
	g)
51
		echo " => enable glitz"
52
		export CAIRO_DOCK_GLITZ_OPTION="--enable-glitz"
53
		;;
54
	m)
55
		echo " => minimum requirements"
56
		export CAIRO_DOCK_PLUG_INS_OPTION="--without-mail --without-weblet"
57
		;;
58
	h)
59
		echo "-a : run autoreconf"
60
		echo "-c : clean all"
61
		echo "-C : compil"
62
		echo "-i : install (will ask root password)"
63
		echo "-u : include still unstable applets"
64
		echo "-d rep : compile in the folder 'rep'"
65
		exit 0
66
		;;
67
	*)
68
		echo "unexpected argument"
69
		exit 1
70
		;;
71
	esac
72
done
73
export CAIRO_DOCK_EXTRACT_MESSAGE=${CAIRO_DOCK_DIR}/utils/cairo-dock-extract-message
74
export CAIRO_DOCK_GEN_TRANSLATION=${CAIRO_DOCK_DIR}/cairo-dock/po/generate-translation.sh
75
76
echo ""
77
78
rm -f $CAIRO_DOCK_DIR/compile.log
79
80
cd $CAIRO_DOCK_DIR
81
find . -name linguas -execdir mv linguas LINGUAS \;
82
find . -name potfiles.in -execdir mv potfiles.in POTFILES.in \;
83
84
85
cd $CAIRO_DOCK_DIR/cairo-dock
86
echo "*********************************"
87
echo "* Compilation of cairo-dock ... *"
88
echo "*********************************"
89
if test "$CAIRO_DOCK_CLEAN" = "1"; then
90
	rm -f config.* configure configure.lineno intltool-extract intltool-merge intltool-update libtool ltmain.sh Makefile.in Makefile aclocal.m4 install-sh install depcomp missing compile cairo-dock.pc stamp-h1 cairo-dock.conf 
91
	rm -rf autom4te.cache src/.deps src/.libs src/Makefile src/Makefile.in po/Makefile po/Makefile.in po/*.gmo src/*.o src/*.lo src/*.la
92
	if test "$CAIRO_DOCK_DOC" = "1"; then
93
		rm -rf doc/html
94
		rm -rf doc/latex
95
	fi
96
fi
97
if test "$CAIRO_DOCK_AUTORECONF" = "1"; then
98
	if test -e po; then
99
		echo "generating translation files ..."
100
		if test -x $CAIRO_DOCK_EXTRACT_MESSAGE; then
101
			rm -f data/messages
102
			for c in data/*.conf
103
			do
104
				$CAIRO_DOCK_EXTRACT_MESSAGE $c
105
			done;
106
			$CAIRO_DOCK_EXTRACT_MESSAGE data/ChangeLog.txt
107
		fi
108
		cd po
109
		$CAIRO_DOCK_GEN_TRANSLATION
110
		cd ..
111
	fi
112
	echo  "* configuring ..."
113
	/usr/bin/time -f "  time elapsed : %Us" autoreconf -isf > /dev/null && ./configure --prefix=$CAIRO_DOCK_PREFIX $CAIRO_DOCK_GLITZ_OPTION > /dev/null
114
	if test ! "$?" = "0"; then
115
		echo "  Attention : an error has occured !"
116
		echo "Error while configuring cairo-dock" >> $CAIRO_DOCK_DIR/compile.log
117
	else
118
		echo "  -> passed"
119
	fi
120
fi
121
if test "$CAIRO_DOCK_CLEAN" = "1" -a -e Makefile; then
122
	make clean > /dev/null
123
fi
124
if test "$CAIRO_DOCK_COMPIL" = "1"; then
125
	echo  "* compiling ..."
126
	/usr/bin/time -f "  time elapsed : %Us" make > /dev/null
127
	if test ! "$?" = "0"; then
128
		echo "  Attention : an error has occured !"
129
		echo "Error while compiling cairo-dock" >> $CAIRO_DOCK_DIR/compile.log
130
	else
131
		echo "  -> passed"
132
	fi
133
fi
134
if test "$CAIRO_DOCK_DOC" = "1"; then
135
	echo  "* generating documentation ..."
136
	cd doc
137
	/usr/bin/time -f "  time elapsed : %Us" doxygen dox.config > /dev/null
138
	if test ! "$?" = "0"; then
139
		echo "  Attention : an error has occured !"
140
		echo "Error while generating documentation" >> $CAIRO_DOCK_DIR/compile.log
141
	else
142
		echo "  -> passed"
143
	fi
144
	cd ..
145
fi
146
if test "$CAIRO_DOCK_INSTALL" = "1"; then
147
	echo "*  installation of cairo-dock..."
148
	$SUDO rm -f $CAIRO_DOCK_PREFIX/bin/cairo-dock
149
	$SUDO rm -rf $CAIRO_DOCK_PREFIX/share/cairo-dock
150
	$SUDO rm -rf $CAIRO_DOCK_PREFIX/lib/cairo-dock
151
	/usr/bin/time -f "  time elapsed : %Us" $SUDO make install > /dev/null
152
	if test ! "$?" = "0"; then
153
		echo "  Attention : an error has occured !"
154
		echo "Error while installing cairo-dock" >> $CAIRO_DOCK_DIR/compile.log
155
	else
156
		echo "  -> passed"
157
	fi
158
	$SUDO chmod +x $CAIRO_DOCK_PREFIX/bin/cairo-dock-update.sh
159
	$SUDO chmod +x $CAIRO_DOCK_PREFIX/bin/launch-cairo-dock-after-beryl.sh
160
	$SUDO chmod +x $CAIRO_DOCK_PREFIX/bin/cairo-dock-package-theme.sh
161
fi
162
163
164
### On liste les plug-ins a compiler.
165
cd $CAIRO_DOCK_DIR/plug-ins
166
export liste_stable="`sed "/^#/d" Applets.stable`"
167
export liste_all="`find . -maxdepth 1  -type d | cut -d "/" -f 2 | /bin/grep -v '\.'`"
168
if test "$CAIRO_DOCK_UNSTABLE" = "1"; then
169
	export liste_plugins="`echo $liste_all`"
170
else
171
	export liste_plugins="`echo $liste_stable`"
172
fi
173
echo "the following applets will be compiled :"
174
echo "$liste_plugins"
175
176
echo "*************************************"
177
echo "* Compilation of stable modules ... *"
178
echo "*************************************"
179
180
### on extrait les messages des plug-ins a traduire.
181
if test "$CAIRO_DOCK_AUTORECONF" = "1"; then
182
	echo "extracting sentences to translate..."
183
	for plugin in $liste_plugins
184
	do
185
		if test -d $plugin; then
186
			cd $plugin
187
			if test -e Makefile.am -a "$plugin" != "$CAIRO_DOCK_EXCLUDE"; then
188
				if test -e po; then
189
					echo "generating translation files for $plugin ..."
190
					if test -x $CAIRO_DOCK_EXTRACT_MESSAGE; then
191
						rm -f data/messages
192
						for c in data/*.conf
193
						do
194
							$CAIRO_DOCK_EXTRACT_MESSAGE "$c"
195
						done;
196
					fi
197
					cd po
198
					$CAIRO_DOCK_GEN_TRANSLATION # defient obsolete.
199
					cd ..
200
				fi
201
			fi
202
			cd ..
203
		fi
204
	done;
205
fi
206
207
cd po
208
$CAIRO_DOCK_GEN_TRANSLATION all
209
cd ..
210
211
212
### On compile les plug-ins stables en une passe.
213
export compil_ok="1"
214
if test "$CAIRO_DOCK_AUTORECONF" = "1"; then
215
	echo  "* configuring stable plug-ins ..."
216
	/usr/bin/time -f "  time elapsed : %Us" autoreconf -isf > /dev/null && ./configure $CAIRO_DOCK_PLUG_INS_OPTION --prefix=$CAIRO_DOCK_PREFIX > /dev/null
217
	if test ! "$?" = "0"; then
218
		echo "  Attention : an error has occured !"
219
		echo "Error while configuring stable plug-ins" >> $CAIRO_DOCK_DIR/compile.log
220
		export compil_ok="0"
221
	else
222
		echo "  -> passed"
223
	fi
224
fi
225
if test "$CAIRO_DOCK_CLEAN" = "1" -a -e Makefile; then
226
	make clean > /dev/null
227
fi
228
if test "$CAIRO_DOCK_COMPIL" = "1"; then
229
	echo  "* compiling stable plug-ins ..."
230
	/usr/bin/time -f "  time elapsed : %Us" make > /dev/null
231
	if test ! "$?" = "0"; then
232
		echo "  Attention : an error has occured !"
233
		echo "Error while compiling stable plug-ins" >> $CAIRO_DOCK_DIR/compile.log
234
		export compil_ok="0"
235
	else
236
		echo "  -> passed"
237
	fi
238
fi
239
if test "$CAIRO_DOCK_INSTALL" = "1"; then
240
	echo "*  installation of stable plug-ins ..."
241
	/usr/bin/time -f "  time elapsed : %Us" $SUDO make install > /dev/null
242
	if test ! "$?" = "0"; then
243
		echo "  Attention : an error has occured !"
244
		echo "Error while installing stable plug-ins" >> $CAIRO_DOCK_DIR/compile.log
245
		export compil_ok="0"
246
	else
247
		echo "  -> passed"
248
	fi
249
fi
250
251
### On les compilera un a un si la compil globale a foirre.
252
if test "$compil_ok" = "0"; then
253
	if test "$CAIRO_DOCK_UNSTABLE" = "0"; then
254
		export liste_all="$liste_stable"
255
	fi
256
	export liste_stable=""
257
fi
258
259
### On compile un a un les plug-ins instables.
260
if test "$CAIRO_DOCK_UNSTABLE" = "1" -o "$compil_ok" = "0"; then
261
	for plugin in $liste_all
262
	do
263
		if test "`echo $liste_stable | grep $plugin`" = ""; then
264
			cd $plugin
265
			export exluded="0"
266
			for e in $CAIRO_DOCK_EXCLUDE
267
			do
268
				if test "$e" = "$plugin"; then
269
					export exluded="1"
270
				fi
271
			done;
272
			if test -e Makefile.am -a "$exluded" != "1"; then
273
				
274
				echo "************************************"
275
				echo "* Compilation of module $plugin ... *"
276
				echo "************************************"
277
				if test "$CAIRO_DOCK_CLEAN" = "1"; then
278
					rm -f config.* configure configure.lineno intltool-extract intltool-merge intltool-update libtool ltmain.sh Makefile.in Makefile aclocal.m4 missing stamp-h1 depcomp compile install-sh
279
					rm -rf autom4te.cache src/.deps src/.libs src/Makefile src/Makefile.in po/Makefile po/Makefile.in po/*.gmo src/*.o src/*.lo src/*.la
280
				fi
281
				if test "$CAIRO_DOCK_AUTORECONF" = "1"; then
282
					if test -e po; then
283
						if test -x $CAIRO_DOCK_EXTRACT_MESSAGE; then
284
							rm -f data/messages
285
							for c in data/*.conf
286
							do
287
								$CAIRO_DOCK_EXTRACT_MESSAGE $c
288
							done;
289
						fi
290
						cd po
291
						$CAIRO_DOCK_GEN_TRANSLATION
292
						cd ..
293
					fi
294
					echo  "* configuring ..."
295
					/usr/bin/time -f "  time elapsed : %Us" autoreconf -isf > /dev/null && ./configure --prefix=$CAIRO_DOCK_PREFIX $CAIRO_DOCK_GLITZ_OPTION > /dev/null
296
					if test ! "$?" = "0"; then
297
						echo "  Attention : an error has occured !"
298
						echo "Error while configuring $plugin" >> $CAIRO_DOCK_DIR/compile.log
299
					else
300
						echo "  -> passed"
301
					fi
302
				fi
303
				if test "$CAIRO_DOCK_CLEAN" = "1" -a -e Makefile; then
304
					make clean > /dev/null
305
				fi
306
				if test "$CAIRO_DOCK_COMPIL" = "1"; then
307
					echo  "* compiling ..."
308
					/usr/bin/time -f "  time elapsed : %Us" make > /dev/null
309
					if test ! "$?" = "0"; then
310
						echo "  Attention : an error has occured !"
311
						echo "Error while compiling $plugin" >> $CAIRO_DOCK_DIR/compile.log
312
					else
313
						echo "  -> passed"
314
					fi
315
				fi
316
				if test "$CAIRO_DOCK_INSTALL" = "1"; then
317
					echo "*  installation of module $plugin..."
318
					/usr/bin/time -f "  time elapsed : %Us" $SUDO make install > /dev/null
319
					if test ! "$?" = "0"; then
320
						echo "  Attention : an error has occured !"
321
						echo "Error while installing $plugin" >> $CAIRO_DOCK_DIR/compile.log
322
					else
323
						echo "  -> passed"
324
					fi
325
				fi
326
			fi
327
			cd ..
328
		fi
329
	done;
330
fi
331
332
if test "$CAIRO_DOCK_INSTALL" = "1"; then
333
	$SUDO rm -f $CAIRO_DOCK_PREFIX/lib/cairo-dock/*.la
334
	
335
	echo "check :"
336
	echo "------------"
337
	date +"compil ended at %c"
338
	ls -l $CAIRO_DOCK_PREFIX/bin/cairo-dock
339
	ls -l $CAIRO_DOCK_PREFIX/lib/cairo-dock
340
#	nb_plugins = "`ls $CAIRO_DOCK_PREFIX/lib/cairo-dock/*.so | wc -w`"
341
fi
342
343
cd $CAIRO_DOCK_DIR
344
echo "number of lines/word/caracters of sources (.c only) :"
345
sed '/^ *$/d' cairo-dock/src/*.c plug-ins/*/src/*.c | sed '/^\t*$/d'  | sed '/^\t*\/\/*/d' | sed '/\t*\/\*/d' | wc
346
347
if test -e compile.log; then
348
	echo "\033[8;34mSome errors were encountered :\033[0m"
349
	cat compile.log
350
else
351
	echo "Compile is a success !"
352
fi
353
354
exit