Use CT_DoExecLog when building libelf.
/trunk/scripts/build/tools/100-libelf.sh | 7 4 3 0 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
3 VERSION=$(cat .version)
6 PREFIX_DEFAULT=/usr/local
17 # Given an option string and the following argument,
18 # echoes the value of the option.
19 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
20 # If --var val => echoes val and returns non null, meaning second arg was used
25 echo "${1}" |cut -d '=' -f 2-
36 # The set_xxx functions will set the corresponding configuration variable
37 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
39 PREFIX=$(get_optval "$1" "$2")
44 BINDIR=$(get_optval "$1" "$2")
49 LIBDIR=$(get_optval "$1" "$2")
54 DOCDIR=$(get_optval "$1" "$2")
59 MANDIR=$(get_optval "$1" "$2")
63 # The set_contrib function is different in that it will work like the others,
64 # except in two cases:
65 # If all => replaces all with the list of all available contribs
66 # If list => just echoes the list of all available contribs, and instructs
67 # caller to quit immediately by setting do_quit to non null.
68 # (can't use the return code, see above).
70 opt_val=$(get_optval "$1" "$2")
74 CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma \
75 |xargs -I {} basename {} .patch.lzma \
76 |sed -r -e ':a; /$/N; s/\n/,/; ta;'
81 echo "Available contributions:"
82 LC_ALL=C ls -1 contrib/*.patch.lzma \
83 |xargs -I {} basename {} .patch.lzma \
86 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
93 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
95 USAGE: ./configure [OPTION]...
97 Defaults for the options are specified in brackets.
100 -h, --help display this help and exit
102 Installation directories:
103 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
104 --local don't install, and use current directory
106 By default, \`make install' will install all the files in
107 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
108 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
109 for instance \`--prefix=\${HOME}'.
111 For better control, use the options below.
113 Fine tuning of the installation directories:
114 --bindir=DIR user executables [PREFIX/bin]
115 --libdir=DIR object code libraries [PREFIX/lib]
116 --docdir=DIR info documentation [PREFIX/share/doc]
117 --mandir=DIR man documentation [PREFIX/share/man]
120 --with-contrib=XXX Include externally contributed features found in the
121 contrib/ sub-directory. Set to a comma-separated list
122 of features. Use 'all' to use all contributions, and
123 'list' to see which are available.
132 #---------------------------------------------------------------------
135 while [ $# -ne 0 ]; do
137 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
138 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
139 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
140 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
141 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
142 --local) LOCAL_set=1; shift;;
144 set_contrib "$1" "$2" && shift || shift 2
145 [ "${do_quit}" = "1" ] && exit 0
147 --help|-h) do_help; exit 0;;
153 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
155 # Special case when installing locally
156 if [ "${LOCAL_set}" = "1" ]; then
160 set_docdir "" $(pwd)/docs
161 set_mandir "" $(pwd)/docs
164 #---------------------------------------------------------------------
165 # Some sanity checks, now
167 # If this version is a svn snapshot, try to get the revision number
168 # If we can't get the revision number, use date
169 printf "Computing version string... "
172 REVISION=$(LC_ALL=C svnversion)
173 case "${REVISION}" in
175 VERSION="${VERSION}unknown@$(date +%Y%m%d.%H%M%S)";;
177 URL=$(LC_ALL=C svn info 2>/dev/null |egrep 'URL: ' |cut -d ' ' -f 2-)
178 ROOT=$(LC_ALL=C svn info 2>/dev/null |egrep 'Repository Root: ' |cut -d ' ' -f 3-)
179 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
182 # Arrange to have no / in the directory name, no need to create an
183 # arbitrarily deep directory structure
184 VERSION=$(echo "${VERSION}" |sed -r -e 's|/+|_|g;')
189 # Now we have the version string, we can build up the paths
190 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
191 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
192 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
193 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
195 # Check bash is present, and at least version 3.0
196 printf "Checking bash is at least bash-3.0... "
197 [ -x /bin/bash ] || do_error "bash 3.0 or above was not found in /bin/bash"
198 bash_version=$(/bin/bash -c 'echo ${BASH_VERSION}')
199 bash_major=$(/bin/bash -c 'echo ${BASH_VERSINFO[0]}')
200 [ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed (/bin/bash is ${bash_version})"
201 echo "ok (${bash_version})"
203 printf "Applying contributed code: "
204 # It's safer to change all ',' to spaces rather than setting IFS
205 CONTRIB_list=$(echo "${CONTRIB_list}" |sed -r -e 's/,+/ /g;')
206 for c in ${CONTRIB_list}; do
208 if [ ! -f "contrib/${c}.patch.lzma" ]; then
209 do_error "Contribution '${c}' does not exist"
211 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
215 printf "Building up Makefile... "
216 sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
217 -e "s,@@LIBDIR@@,${LIBDIR},g;" \
218 -e "s,@@DOCDIR@@,${DOCDIR},g;" \
219 -e "s,@@MANDIR@@,${MANDIR},g;" \
220 -e "s,@@VERSION@@,${VERSION},g;" \
221 -e "s,@@DATE@@,${DATE},g;" \
222 -e "s,@@LOCAL@@,${LOCAL_set},g;" \
223 Makefile.in >Makefile
227 crosstool-NG configured as follows:
233 CONTRIB='${CONTRIB_list}'