Bart De VOS pointed out that removing absolute paths from the libc linker scripts is plainly wrong.
It dates from dawn ages of the original crosstool code, and is not well explained. At that time, binutils might not understand the sysroot stuff, and it was necessary to remove absolute paths in that case.
/trunk/scripts/build/libc/glibc.sh | 14 2 12 0 ++------------
1 file changed, 2 insertions(+), 12 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 /bin/bash/^GNU bash, version 3\.
29 PREFIX_DEFAULT=/usr/local
42 # Simply print the error message, and exit. Obvious, he?
48 # A small function to test for existence of various tools
49 # Usage: has_or_abort foobar
50 # -> foobar must exist in PATH or be an exiting fully qualified file name
51 # Usage: has_or_abort foobar/string
52 # -> foobar must exist in PATH or be an existing FQFN, and $(foobar --version) must contain 'string'
56 printf "Checking for '${tool}'... "
57 where=$(which "${tool}" 2>/dev/null || true)
58 if [ -z "${where}" ]; then
60 [ ${FORCE} -eq 0 ] && do_error " Bailing out..."
64 if [ -n "${regexp}" ]; then
65 str=$(${tool} --version 2>&1 |egrep "${regexp}" |head -n 1)
66 if [ -z "${str}" ]; then
67 printf " failed: '${tool} --version' does not match regexp '${regexp}'."
68 [ ${FORCE} -eq 0 ] && do_error " Bailing out..."
76 # Given an option string and the following argument,
77 # echoes the value of the option.
78 # If --var=val => echoes val and returns 0, meaning second arg was not consumed
79 # If --var val => echoes val and returns non null, meaning second arg was used
84 echo "${1}" |cut -d '=' -f 2-
95 # The set_xxx functions will set the corresponding configuration variable
96 # They return 0 if second arg was not consumed, and non-zero if it was consumed.
98 PREFIX=$(get_optval "$1" "$2")
103 BINDIR=$(get_optval "$1" "$2")
108 LIBDIR=$(get_optval "$1" "$2")
113 DOCDIR=$(get_optval "$1" "$2")
118 MANDIR=$(get_optval "$1" "$2")
122 # The set_contrib function is different in that it will work like the others,
123 # except in two cases:
124 # If all => replaces all with the list of all available contribs
125 # If list => just echoes the list of all available contribs, and instructs
126 # caller to quit immediately by setting do_quit to non null.
127 # (can't use the return code, see above).
129 opt_val=$(get_optval "$1" "$2")
133 CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma \
134 |xargs -I {} basename {} .patch.lzma \
135 |sed -r -e ':a; /$/N; s/\n/,/; ta;'
140 echo "Available contributions:"
141 LC_ALL=C ls -1 contrib/*.patch.lzma \
142 |xargs -I {} basename {} .patch.lzma \
145 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
152 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
154 USAGE: ./configure [OPTION]...
156 Defaults for the options are specified in brackets.
159 -h, --help display this help and exit
160 --force force ./configure to complete, even if one or more
161 tools were not found. Use at your own risk, only if
162 you know what you are doing!
164 Installation directories:
165 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
166 --local don't install, and use current directory
168 By default, \`make install' will install all the files in
169 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
170 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
171 for instance \`--prefix=\${HOME}'.
173 For better control, use the options below.
175 Fine tuning of the installation directories:
176 --bindir=DIR user executables [PREFIX/bin]
177 --libdir=DIR object code libraries [PREFIX/lib]
178 --docdir=DIR info documentation [PREFIX/share/doc]
179 --mandir=DIR man documentation [PREFIX/share/man]
182 --with-contrib=XXX Include externally contributed features found in the
183 contrib/ sub-directory. Set to a comma-separated list
184 of features. Use 'all' to use all contributions, and
185 'list' to see which are available.
189 #---------------------------------------------------------------------
192 while [ $# -ne 0 ]; do
194 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
195 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
196 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
197 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
198 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
199 --local) LOCAL_set=1; shift;;
200 --force) FORCE=1; shift;;
202 set_contrib "$1" "$2" && shift || shift 2
203 [ "${do_quit}" = "1" ] && exit 0
205 --help|-h) do_help; exit 0;;
211 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
213 # Special case when installing locally
214 if [ "${LOCAL_set}" = "1" ]; then
218 set_docdir "" $(pwd)/docs
219 set_mandir "" $(pwd)/docs
222 #---------------------------------------------------------------------
223 # Some sanity checks, now
225 # If this version is a svn snapshot, try to get the revision number
226 # If we can't get the revision number, use date
227 printf "Computing version string... "
230 REVISION=$(LC_ALL=C svnversion)
231 case "${REVISION}" in
233 VERSION="${VERSION}unknown@$(date +%Y%m%d.%H%M%S)";;
235 URL=$(LC_ALL=C svn info 2>/dev/null |egrep 'URL: ' |cut -d ' ' -f 2-)
236 ROOT=$(LC_ALL=C svn info 2>/dev/null |egrep 'Repository Root: ' |cut -d ' ' -f 3-)
237 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
240 # Arrange to have no / in the directory name, no need to create an
241 # arbitrarily deep directory structure
242 VERSION=$(echo "${VERSION}" |sed -r -e 's|/+|_|g;')
247 # Now we have the version string, we can build up the paths
248 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
249 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
250 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
251 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
253 # Check the existence of absolutely required tools
256 for tool in ${TOOLS_TO_CHECK}; do
257 has_or_abort "${tool}"
261 # It's safer to change all ',' to spaces rather than setting IFS
262 CONTRIB_list=$(echo "${CONTRIB_list}" |sed -r -e 's/,+/ /g;')
263 if [ -n "${CONTRIB_list}" ]; then
265 printf "Applying contributed code: "
266 for c in ${CONTRIB_list}; do
268 if [ ! -f "contrib/${c}.patch.lzma" ]; then
269 do_error "Contribution '${c}' does not exist"
271 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
276 printf "Building up Makefile... "
277 sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
278 -e "s,@@LIBDIR@@,${LIBDIR},g;" \
279 -e "s,@@DOCDIR@@,${DOCDIR},g;" \
280 -e "s,@@MANDIR@@,${MANDIR},g;" \
281 -e "s,@@VERSION@@,${VERSION},g;" \
282 -e "s,@@DATE@@,${DATE},g;" \
283 -e "s,@@LOCAL@@,${LOCAL_set},g;" \
284 Makefile.in >Makefile
289 crosstool-NG configured as follows:
295 CONTRIB='${CONTRIB_list}'