summaryrefslogtreecommitdiff
path: root/scripts/scan-pkgs.sh
blob: bc688b924a385dae913115839f963026837aa863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.
#
# Scan host-tool prerequisites of certain packages before building.

if test -z "$BASH_VERSION"; then
	foo=`$BASH -c 'echo "$BASH_VERSION"'`
else
	foo=$BASH_VERSION
fi

if test -z "$foo"; then
	echo OpenADK requires GNU bash to be installed.
	exit 1
fi

test -z "$BASH_VERSION$KSH_VERSION" && exec $BASH $0 "$@"

[[ -n $BASH_VERSION ]] && shopt -s extglob
topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
OStype=$(uname)
out=0

. $topdir/.config

if [[ -n $ADK_NATIVE ]];then
	if [[ -n $ADK_PACKAGE_NEON ]];then
		NEED_LIBXML2_DEV="$NEED_LIBXML2_DEV neon"
	fi
	if [[ -n $ADK_PACKAGE_LZOP ]];then
		NEED_LZODEV="$NEED_LZODEV lzop"
	fi
	if [[ -n $ADK_PACKAGE_LIBIMAGEMAGICK ]];then
		NEED_JPEGDEV="$NEED_JPEGDEV libimagemagick"
		NEED_TIFFDEV="$NEED_TIFFDEV libimagemagick"
	fi
	if [[ -n $ADK_PACKAGE_DISPLAY ]];then
		NEED_X11DEV="$NEED_X11DEV display"
		NEED_XEXTDEV="$NEED_XEXTDEV display"
	fi
	if [[ -n $ADK_PACKAGE_GIT ]];then
		NEED_CURLDEV="$NEED_CURLDEV git"
	fi
	if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
		NEED_RPM="$NEED_RPM rpm"
	fi
	if [[ -n $ADK_PACKAGE_WPA_SUPPLICANT_WITH_OPENSSL ]]; then
		NEED_LIBSSLDEV="$NEED_LIBSSLDEV wpa_supplicant"
	fi
	if [[ -n $ADK_COMPILE_BIND ]]; then
		NEED_LIBSSLDEV="$NEED_LIBSSLDEV bind"
	fi
	if [[ -n $ADK_PACKAGE_IW ]]; then
		NEED_LIBNLDEV="$NEED_LIBNLDEV iw"
	fi
	if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_KERBEROS ]]; then
		NEED_LIBKRB5DEV="$NEED_LIBKRB5DEV nfs-utils"
	fi
	if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_TIRPC ]]; then
		NEED_LIBTIRPCDEV="$NEED_LIBTIRPCDEV nfs-utils"
	fi
fi

if [[ -n $ADK_PACKAGE_LIBX11 ]]; then
	NEED_X11="$NEED_X11 libx11"
fi

if [[ -n $ADK_PACKAGE_LIBNL ]]; then
	NEED_FLEX="$NEED_FLEX libnl"
fi

if [[ -n $ADK_PACKAGE_GPSD ]]; then
	NEED_PYTHON="$NEED_PYTHON gpsd"
fi

if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
	NEED_YASM="$NEED_YASM firefox"
	NEED_LIBIDL="$NEED_LIBIDL firefox"
	NEED_PYTHON="$NEED_PYTHON firefox"
	NEED_ZIP="$NEED_ZIP firefox"
fi

if [[ -n $ADK_PACKAGE_MESALIB ]]; then
	NEED_MAKEDEPEND="$NEED_MAKEDEPEND mesalib"
fi

if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
	NEED_BISON="$NEED_BISON heimdal-server"
fi

if [[ -n $ADK_COMPILE_KRB5 ]]; then
	NEED_BISON="$NEED_BISON krb5"
fi

if [[ -n $ADK_COMPILE_OPENJDK ]]; then
	NEED_ZIP="$NEED_ZIP openjdk"
	NEED_GXX="$NEED_GXX openjdk"
	NEED_XSLTPROC="$NEED_XSLTPROC openjdk"
fi

if [[ -n $ADK_COMPILE_OPENJDK ]]; then
	cd ${TOPDIR}/jtools; bash prereq.sh
	[ $? -ne 0 ] && out=1
fi

if [[ -n $ADK_COMPILE_OPENJDK7 ]]; then
	NEED_ZIP="$NEED_ZIP openjdk"
fi

if [[ -n $ADK_COMPILE_OPENJDK7 ]]; then
	cd ${TOPDIR}/jtools; bash prereq.sh
	[ $? -ne 0 ] && out=1
fi

if [[ -n $ADK_PACKAGE_LIBXCB ]]; then
	NEED_XSLTPROC="$NEED_XSLTPROC libxcb"
fi

if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
	NEED_BISON="$NEED_BISON pcmciautils"
	NEED_FLEX="$NEED_FLEX pcmciautils"
fi

if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
	NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
fi

if [[ -n $ADK_COMPILE_AUTOCONF ]]; then
	NEED_M4="$NEED_M4 autoconf"
fi

if [[ -n $ADK_COMPILE_AUTOMAKE ]]; then
	NEED_AUTOCONF="$NEED_AUTOCONF automake"
fi

if [[ -n $ADK_COMPILE_LIBTOOL ]]; then
	NEED_AUTOMAKE="$NEED_AUTOMAKE libtool"
fi

if [[ -n $ADK_PACKAGE_SQUID ]]; then
	NEED_GXX="$NEED_GXX squid"
fi

if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
	NEED_INTL="$NEED_INTL xkeyboard-config"
fi

if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
	NEED_FLEX="$NEED_FLEX libpcap"
	NEED_BISON="$NEED_BISON libpcap"
fi

if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
	NEED_WWW="$NEED_WWW libXfont"
	NEED_XMLTO="$NEED_XMLTO libXfont"
fi

if [[ -n $ADK_PACKAGE_PACEMAKER_MGMTD ]]; then
	NEED_SWIG="$NEED_SWIG pacemaker-mgmtd"
fi

if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
	NEED_GPERF="$NEED_GPERF eglibc"
fi

if [[ -n $ADK_PACKAGE_GLIB ]]; then
	NEED_GETTEXT="$NEED_GETTEXT glib"
fi

if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
	NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
fi

if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
	NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
fi

if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
	NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
fi

if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
	NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
fi

if [[ -n $NEED_GETTEXT ]]; then
	if ! which gettext >/dev/null 2>&1; then
		echo >&2 You need gettext to build $NEED_GETTEXT
		out=1
	elif ! which msgfmt >/dev/null 2>&1; then
		echo >&2 You need msgfmt to build $NEED_GETTEXT
		out=1
	fi
fi

if [[ -n $NEED_LIBTIRPCDEV ]];then
	if ! test -f /usr/include/tirpc/netconfig.h >/dev/null; then
		echo >&2 You need tirpc headers to build $NEED_LIBTIRPCDEV
		out=1
	fi
fi

if [[ -n $NEED_LIBXML2_DEV ]];then
	if ! test -f /usr/include/libxml2/libxml/xmlversion.h >/dev/null; then
		echo >&2 You need libxml2 headers to build $NEED_LIBXML2_DEV
		out=1
	fi
fi

if [[ -n $NEED_LIBKRB5DEV ]];then
	if ! test -f /usr/include/krb5.h >/dev/null; then
		echo >&2 You need krb5 headers to build $NEED_LIBKRB5DEV
		out=1
	fi
fi

if [[ -n $NEED_CURLDEV ]];then
	if ! test -f /usr/include/curl/curl.h >/dev/null; then
		if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
			echo >&2 You need curl headers to build $NEED_CURLDEV
			out=1
		fi
	fi
fi

if [[ -n $NEED_TIFFDEV ]];then
	if ! test -f /usr/include/tiff.h >/dev/null; then
		echo >&2 You need libtiff headers to build $NEED_TIFFDEV
		out=1
	fi
fi

if [[ -n $NEED_JPEGDEV ]];then
	if ! test -f /usr/include/jpeglib.h >/dev/null; then
		echo >&2 You need libjpeg headers to build $NEED_JPEGDEV
		out=1
	fi
fi

if [[ -n $NEED_LZODEV ]];then
	if ! test -f /usr/include/lzo/lzo1.h >/dev/null; then
		echo >&2 You need liblzo headers to build $NEED_LZODEV
		out=1
	fi
fi

if [[ -n $NEED_LIBNLDEV ]];then
	if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
		echo >&2 You need libnl headers to build $NEED_LIBNLDEV
		out=1
	fi
fi

if [[ -n $NEED_X11DEV ]];then
	if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
		echo >&2 You need X11 headers to build $NEED_X11DEV
		out=1
	fi
fi

if [[ -n $NEED_X11 ]];then
	if ! test -f /usr/include/X11/X.h >/dev/null; then
	  if ! test -f /usr/local/include/X11/X.h >/dev/null; then
		echo >&2 You need X11 headers to build $NEED_X11
		out=1
	  fi
	fi
fi

if [[ -n $NEED_XEXTDEV ]];then
	if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
		echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
		out=1
	fi
fi

if [[ -n $NEED_LIBSSLDEV ]]; then
	if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
		echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
		out=1
	fi
fi

if [[ -n $NEED_MKFONTDIR ]]; then
	if ! which mkfontdir >/dev/null 2>&1; then
		echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
		out=1
	fi
fi

if [[ -n $NEED_M4 ]]; then
	if ! which m4 >/dev/null 2>&1; then
		echo >&2 You need GNU m4 to build $NEED_M4
		out=1
	fi
fi

if [[ -n $NEED_AUTOCONF ]]; then
	if ! which autoconf >/dev/null 2>&1; then
		echo >&2 You need autoconf to build $NEED_AUTOCONF
		out=1
	fi
fi

if [[ -n $NEED_AUTOMAKE ]]; then
	if ! which automake >/dev/null 2>&1; then
		echo >&2 You need automake to build $NEED_AUTOMAKE
		out=1
	fi
fi

if [[ -n $NEED_INTL ]]; then
	if ! which intltool-update >/dev/null 2>&1; then
		echo >&2 You need intltool to build $NEED_INTL
		out=1
	fi
fi

if [[ -n $NEED_WWW ]]; then
	if ! which w3m >/dev/null 2>&1; then
		if ! which lynx >/dev/null 2>&1; then
			if ! which links >/dev/null 2>&1; then
				echo >&2 You need w3m/links/lynx to build $NEED_WWW
				out=1
			fi
		fi
	fi
fi

if [[ -n $NEED_BISON ]]; then
	if ! which bison >/dev/null 2>&1; then
		echo >&2 You need bison to build $NEED_BISON
		out=1
	fi
fi

if [[ -n $NEED_ZIP ]]; then
	if ! which zip >/dev/null 2>&1; then
		echo >&2 You need zip to build $NEED_ZIP
		out=1
	fi
fi

if [[ -n $NEED_LIBIDL ]]; then
	if ! which libIDL-config-2 >/dev/null 2>&1; then
		echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
		out=1
	fi
fi

if [[ -n $NEED_SWIG ]]; then
	if ! which swig >/dev/null 2>&1; then
		echo >&2 You need swig to build $NEED_SWIG
		out=1
	fi
fi

if [[ -n $NEED_GPERF ]]; then
	if ! which gperf >/dev/null 2>&1; then
		echo >&2 You need gperf to build $NEED_GPERF
		out=1
	fi
fi

if [[ -n $NEED_GXX ]]; then
	if ! which g++ >/dev/null 2>&1; then
		echo >&2 You need GNU c++ compiler to build $NEED_GXX
		out=1
	fi
fi

if [[ -n $NEED_RUBY ]]; then
	if ! which ruby >/dev/null 2>&1; then
		echo >&2 You need ruby to build $NEED_RUBY
		out=1
	fi
fi

if [[ -n $NEED_XKBCOMP ]]; then
	if ! which xkbcomp >/dev/null 2>&1; then
		echo >&2 You need xkbcomp to build $NEED_XKBCOMP
		out=1
	fi
fi

if [[ -n $NEED_RPM ]]; then
	if ! which rpmbuild >/dev/null 2>&1; then
		echo >&2 You need rpmbuild to to use $NEED_RPM package backend
		out=1
	fi
fi

if [[ -n $NEED_FLEX ]]; then
	if ! which flex >/dev/null 2>&1; then
		echo >&2 You need flex to build $NEED_FLEX
		out=1
	fi
fi

if [[ -n $NEED_YASM ]]; then
	if ! which yasm >/dev/null 2>&1; then
		echo >&2 You need yasm to build $NEED_YASM
		out=1
	fi
fi

if [[ -n $NEED_XSLTPROC ]]; then
	if ! which xsltproc >/dev/null 2>&1; then
		echo >&2 You need xsltproc to build $NEED_XSLTPROC
		out=1
	fi
fi

if [[ -n $NEED_DBUSGLIB ]]; then
	if ! which dbus-binding-tool >/dev/null 2>&1; then
		echo >&2 You need dbus-binding-tool to build $NEED_DBUSGLIB
		out=1
	fi
fi

if [[ -n $NEED_PYTHON ]]; then
	if ! which python >/dev/null 2>&1; then
		if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
			echo >&2 You need python to build $NEED_PYTHON
			out=1
		fi
	fi
fi

if [[ -n $NEED_MAKEDEPEND ]]; then
	if ! which makedepend >/dev/null 2>&1; then
		echo >&2 You need makedepend to build $NEED_MAKEDEPEND
		out=1
	fi
fi

if [[ -n $ADK_USE_CCACHE ]]; then
        if ! which ccache >/dev/null 2>&1; then
                echo >&2 You have selected to build with ccache, but ccache could not be found.
                out=1
        fi
fi

exit $out