root/trunk/freewrt/scripts/scan-pkgs.sh

Revision 3809, 4.6 kB (checked in by tg, 2 months ago)

we need mksh R34+ soonishâ„¢

Line 
1 # $FreeWRT: src/share/misc/licence.template,v 1.20 2006/12/11 21:04:56 tg Rel $
2 #-
3 # Copyright (c) 2006, 2007
4 #       Thorsten Glaser <tg@mirbsd.de>
5 #
6 # Provided that these terms and disclaimer and all copyright notices
7 # are retained or reproduced in an accompanying document, permission
8 # is granted to deal in this work without restriction, including un-
9 # limited rights to use, publicly perform, distribute, sell, modify,
10 # merge, give away, or sublicence.
11 #
12 # Advertising materials mentioning features or use of this work must
13 # display the following acknowledgement:
14 #       This product includes material provided by Thorsten Glaser.
15 # This acknowledgement does not need to be reprinted if this work is
16 # linked into a bigger work whose licence does not allow such clause
17 # and the author of this work is given due credit in the bigger work
18 # or its accompanying documents, where such information is generally
19 # kept, provided that said credits are retained.
20 #
21 # This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
22 # the utmost extent permitted by applicable law, neither express nor
23 # implied; without malicious intent or gross negligence. In no event
24 # may a licensor, author or contributor be held liable for indirect,
25 # direct, other damage, loss, or other issues arising in any way out
26 # of dealing in the work, even if advised of the possibility of such
27 # damage or existence of a defect, except proven that it results out
28 # of said person's immediate fault when using the work as intended.
29 #-
30 # Scan host-tool prerequisites of certain packages before building.
31
32 if test -z "$BASH_VERSION"; then
33         foo=`$BASH -c 'echo "$BASH_VERSION"'`
34 else
35         foo=$BASH_VERSION
36 fi
37
38 if test -z "$foo"; then
39         echo FreeWRT requires GNU bash to be installed, sorry.
40         exit 1
41 fi
42
43 test -z "$BASH_VERSION$KSH_VERSION" && exec $BASH $0 "$@"
44
45 [[ -n $BASH_VERSION ]] && shopt -s extglob
46 topdir=$(readlink -nf $(dirname $0)/.. || (cd $(dirname $0)/..; pwd -P))
47 export PATH=$topdir/lbin:$PATH
48 OStype=$(env NOFAKE=yes uname)
49 out=0
50
51 . $topdir/.config
52
53 #-- start adding dependencies here --
54
55 if [[ -n $FWRT_COMPILE_SABLEVM_CLASSPATH ]]; then
56         NEED_JIKES="$NEED_JIKES sablevm-classpath"
57 fi
58
59 if [[ -n $FWRT_COMPILE_SABLEVM_CLASSPATH ]]; then
60         NEED_FASTJAR="$NEED_FASTJAR sablevm-classpath"
61 fi
62
63 if [[ -n $FWRT_COMPILE_AVAHI ]]; then
64         NEED_PKGCONFIG="$NEED_PKGCONFIG avahi"
65 fi
66
67 if [[ -n $FWRT_PACKAGE_RUBY ]]; then
68         NEED_RUBY="$NEED_RUBY ruby"
69 fi
70
71 if [[ -n $FWRT_PACKAGE_GLIB2 ]]; then
72         NEED_GLIBZWO="$NEED_GLIBZWO glib2"
73         NEED_GETTEXT="$NEED_GETTEXT glib2"
74         NEED_PKGCONFIG="$NEED_PKGCONFIG glib2"
75 fi
76
77 #-- start checking dependencies here --
78
79 if [[ -n $NEED_JIKES ]]; then
80         if ! which jikes >/dev/null 2>&1; then
81                 echo >&2 You need jikes to build $NEED_JIKES
82                 out=1
83         fi
84 fi
85
86 if [[ -n $NEED_GETTEXT ]]; then
87         if ! which xgettext >/dev/null 2>&1; then
88                 echo >&2 You need gettext to build $NEED_GETTEXT
89                 out=1
90         elif ! which msgfmt >/dev/null 2>&1; then
91                 echo >&2 You need gettext to build $NEED_GETTEXT
92                 out=1
93         fi
94 fi
95
96 if [[ -n $NEED_FASTJAR ]]; then
97         if ! which fastjar >/dev/null 2>&1; then
98                 echo >&2 You need fastjar to build $NEED_FASTJAR
99                 out=1
100         fi
101 fi
102
103 if [[ -n $NEED_RUBY ]]; then
104         if ! which ruby >/dev/null 2>&1; then
105                 echo >&2 You need ruby to build $NEED_RUBY
106                 out=1
107         fi
108 fi
109
110 if [[ -n $NEED_PKGCONFIG ]]; then
111         if ! which pkg-config >/dev/null 2>&1; then
112                 echo >&2 You need pkg-config to build $NEED_PKGCONFIG
113                 out=1
114         fi
115 fi
116
117 if [[ -n $NEED_GLIBZWO ]]; then
118         if ! which glib-genmarshal >/dev/null 2>&1; then
119                 echo >&2 You need libglib2.0-dev to build $NEED_GLIBZWO
120                 out=1
121         fi
122 fi
123
124 if [[ -n $FWRT_USE_CCACHE ]]; then
125         if ! which ccache >/dev/null 2>&1; then
126                 echo >&2 You have selected to build with ccache, but ccache could not be found.
127                 out=1
128         fi
129 fi
130
131 if [[ -n $FWRT_COMPILE_MYSQL && $OStype != Linux ]]; then
132         echo >&2 mySQL does not build on non-GNU/Linux.
133         out=1
134 fi
135
136 #-- end of dependency checks
137
138 # other checks: mksh version for manpage stuff, mirmake
139 [[ $FWRT_MANPAGES = y ]] && if ! fgrep USE_TOOLS_MKSH=1 \
140     $topdir/lbin/prereq.mk >/dev/null 2>&1; then
141         [[ $(mksh -c ': check if mksh R34:2008/05/17 or up
142                 if [[ $KSH_VERSION = @(\@\(#\)MIRBSD KSH R)@(3[5-9]|[4-9][0-9]|[1-9][0-9][0-9])\ +([0-9])/+([0-9])/+([0-9])?(\ *) ]]; then
143                         i=0
144                 elif [[ $KSH_VERSION = @(\@\(#\)MIRBSD KSH R34)* ]]; then
145                         eval $(print "$KSH_VERSION" | sed '\''s#^.*R34 \([0-9]*\)/\([0-9]*\)/\([0-9]*\)\( .*\)*$#y=\1 m=\2 d=\3#'\'')
146                         (( i = y < 2008 ? 1 :
147                             y > 2008 ? 0 :
148                             m < 5 ? 1 :
149                             m > 5 ? 0 :
150                             d < 17 ? 1 : 0 ))
151                 else
152                         i=1
153                 fi
154         print $i') = 1 ]] && echo USE_TOOLS_MKSH=1 >>$topdir/lbin/prereq.mk
155 fi
156
157 exit $out
Note: See TracBrowser for help on using the browser.