Get rid of CT_BINUTILS_FILE.
/trunk/scripts/build/binutils.sh | 56 28 28 0 +++++++++++++++++++++++-----------------------
/trunk/scripts/crosstool.sh | 1 0 1 0 -
2 files changed, 28 insertions(+), 29 deletions(-)
3 VERSION=$( cat .version )
6 # All absolutely required tools, one per line to ease diff.
7 # See function 'has_or_abort, below, for syntax
8 # - Hopefully, if gcc is present, then all associated tools will be
9 # - awk must be GNU awk
10 # - makeinfo for building docs, even if discarded later on
11 # - others obvious... :-/
13 # Format of a pattern to check for, one per line:
14 # pattern := tool_test OR pattern || tool_test
15 # tool_test := tool=regexp OR tool
16 # tool := basename of the tool OR absolute pathname to the tool
17 # regexp := valid grep(1) extended regular expression, $( tool --version)
18 # will be matched against this regexp.
20 # In case a pattern list is given (eg foo || bar || buz), then tests are performed
21 # from left to right, stopping at the first matching test (like the shell
22 # would parse 'foo || bar || buz' ).
25 # /bin/bash=^GNU bash, version 3\.
26 # will ensure that /bin/bash exists, and that $( /bin/bash --version )
27 # matches the regexp '^GNU bash, version 3\.'
28 # autoconf=(GNU Autoconf) || autoconf2.50
30 # - 'autoconf' is to be found in the PATH, and that $( autoconf --version )
31 # matches the regexp '(GNU Autoconf)' (which btw is the signature of
34 # - 'autoconf2.50' is to be found in the PATH
37 /bin/bash=^GNU bash, version 3\.
46 automake=\(GNU automake\) (1\.[[:digit:]]{2,}\.|[2-9][[:digit:]]*\.)
47 libtool=\(GNU libtool\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)
55 PREFIX_DEFAULT=/usr/local
68 # Simply print the error message, and exit. Obvious, he?
74 # A small function to test for existence of various tools
75 # Usage: has_or_abort test_pattern (see top of file, TOOLS_TO_CHECK, for
76 # complete pattern format)
79 tool_pattern="$( echo "${1}" |"${sed}" -r -e 's/ *\|\| */\n/g;' )"
82 for item in ${tool_pattern}; do
92 printf "Checking for '${tool}'... "
93 where=$( which "${tool}" 2>/dev/null )
94 if [ -z "${where}" ]; then
98 elif [ -n "${regexp}" ]; then
99 tool_version=$( ${tool} --version 2>&1 )
100 str=$( echo "${tool_version}" |"${grep}" -E "${regexp}" |head -n 1 )
101 if [ -z "${str}" ]; then
110 if [ -z "${where}" ]; then
111 for item in ${tool_pattern}; do
121 echo " could not find '${tool}' matching regexp '${regexp}'"
123 echo "Either you are missing entirely the needed tool,"
124 echo "or the version you have is tool old."
125 [ ${FORCE} -eq 0 ] && do_error "Bailing out..."
131 # Given an option string and the following argument,
132 # echoes the value of the option.
133 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
134 # If --var val => echoes val and returns non null, meaning second arg was used
138 echo "${1}" |cut -d '=' -f 2-
148 # The set_xxx functions will set the corresponding configuration variable
149 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
151 PREFIX="$( get_optval "$1" "$2" )"
155 BINDIR="$( get_optval "$1" "$2" )"
159 LIBDIR="$( get_optval "$1" "$2" )"
163 DOCDIR="$( get_optval "$1" "$2" )"
167 MANDIR="$( get_optval "$1" "$2" )"
170 # The set_contrib function is different in that it will work like the others,
171 # except in two cases:
172 # If all => replaces all with the list of all available contribs
173 # If list => just echoes the list of all available contribs, and instructs
174 # caller to quit immediately by setting do_quit to non null.
175 # (can't use the return code, see above).
177 opt_val="$( get_optval "$1" "$2" )"
181 CONTRIB_list="$( LC_ALL=C ls -1 contrib/*.patch.lzma \
182 |xargs -I {} basename {} .patch.lzma \
183 |"${sed}" -r -e ':a; /$/N; s/\n/,/; ta;' \
188 echo "Available contributions:"
189 LC_ALL=C ls -1 contrib/*.patch.lzma \
190 |xargs -I {} basename {} .patch.lzma \
191 |"${sed}" -r -e 's/^/ /;'
193 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
200 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
202 USAGE: ./configure [OPTION]...
204 Defaults for the options are specified in brackets.
207 -h, --help display this help and exit
208 --force force ./configure to complete, even if one or more
209 tools were not found. Use at your own risk, only if
210 you know what you are doing!
212 Installation directories:
213 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
214 --local don't install, and use current directory
216 By default, \`make install' will install all the files in
217 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
218 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
219 for instance \`--prefix=\${HOME}'.
221 For better control, use the options below.
223 Fine tuning of the installation directories:
224 --bindir=DIR user executables [PREFIX/bin]
225 --libdir=DIR object code libraries [PREFIX/lib]
226 --docdir=DIR info documentation [PREFIX/share/doc]
227 --mandir=DIR man documentation [PREFIX/share/man]
230 --with-contrib=XXX Include externally contributed features found in the
231 contrib/ sub-directory. Set to a comma-separated list
232 of features. Use 'all' to use all contributions, and
233 'list' to see which are available.
237 #---------------------------------------------------------------------
238 # Some sanity checks, now
240 # We check for grep and sed manually, because it is used in has_or_abort
241 printf "Checking for 'grep'... "
242 grep="$( which grep 2>/dev/null )"
243 [ -z "${grep}" ] && do_error "not found"
245 printf "Checking whether '${grep}' supports -E... "
246 if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
251 printf "Checking for 'sed'... "
252 sed="$( which sed 2>/dev/null )"
253 [ -z "${sed}" ] && do_error "not found"
256 # Check the existence of absolutely required tools
260 for tool in ${TOOLS_TO_CHECK}; do
261 has_or_abort "${tool}"
265 #---------------------------------------------------------------------
268 while [ $# -ne 0 ]; do
270 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
271 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
272 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
273 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
274 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
275 --local) LOCAL_set=1; shift;;
276 --force) FORCE=1; shift;;
278 set_contrib "$1" "$2" && shift || shift 2
279 [ "${do_quit}" = "1" ] && exit 0
281 --help|-h) do_help; exit 0;;
287 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
289 # Special case when installing locally
290 if [ "${LOCAL_set}" = "1" ]; then
291 set_prefix "" "$( pwd )"
292 set_bindir "" "$( pwd )"
293 set_libdir "" "$( pwd )"
294 set_docdir "" "$( pwd )/docs"
295 set_mandir "" "$( pwd )/docs"
298 #---------------------------------------------------------------------
299 # Apply contributed code
301 # It's safer to change all ',' to spaces rather than setting IFS
302 CONTRIB_list="$( echo "${CONTRIB_list}" \
303 |"${sed}" -r -e 's/,+/ /g; s/ +/ /g; s/^ //g; s/ $//g;' \
305 if [ -n "${CONTRIB_list}" ]; then
307 printf "Applying contributed code: "
308 for c in ${CONTRIB_list}; do
310 if [ ! -f "contrib/${c}.patch.lzma" ]; then
311 do_error "Contribution '${c}' does not exist"
313 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
318 #---------------------------------------------------------------------
319 # Compute the version string
321 # If this version is a svn snapshot, try to get the revision number
322 # If we can't get the revision number, use date
323 printf "Computing version string... "
326 REVISION="$( LC_ALL=C svnversion )"
327 case "${REVISION}" in
329 VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
331 URL="$( LC_ALL=C svn info 2>/dev/null \
335 ROOT="$( LC_ALL=C svn info 2>/dev/null \
336 |"${grep}" '^Repository Root: ' \
339 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
342 # Arrange to have no / in the directory name, no need to create an
343 # arbitrarily deep directory structure
344 VERSION="$( echo "${VERSION}" |"${sed}" -r -e 's|/+|_|g;' )"
349 #---------------------------------------------------------------------
350 # Compute and check install paths
352 # Now we have the version string, we can build up the paths
353 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
354 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
355 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
356 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
358 # Check that install PATHs are absolute
359 for p in BIN LIB DOC MAN; do
361 eval v='"${'"${var}"'}"'
364 *) do_error "'${var}' is not an absolute path: '${v}'"
368 #---------------------------------------------------------------------
371 printf "Building up Makefile... "
372 "${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
373 s,@@LIBDIR@@,${LIBDIR},g
374 s,@@DOCDIR@@,${DOCDIR},g
375 s,@@MANDIR@@,${MANDIR},g
376 s,@@VERSION@@,${VERSION},g
378 s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
383 crosstool-NG configured as follows:
389 CONTRIB='${CONTRIB_list}'