diff --git a/base/libtool/libtool.conf b/base/libtool/libtool.conf new file mode 100644 index 000000000..13869db9b --- /dev/null +++ b/base/libtool/libtool.conf @@ -0,0 +1,57 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../libtool/libtool.conf +# Copyright (C) 2007 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +if atstage toolchain; then + buildloops=2 + + hook_add preconf 5 'libtool_cross' + libtool_cross() { + if [ $buildloop -eq 2 ]; then + # on the second loop we make it a cross compiler + + # remove --target and --host (default's at stage 0) + var_remove_regex confopt ' ' '--target=.*' + var_remove_regex confopt ' ' '--host=.*' + + # add --build and --host (default's at stage 1) + var_append confopt ' ' '--build=$arch_build' + var_append confopt ' ' '--host=$arch_target' + + # and set the prefix and the bindir (as gcc's) + var_append extraconfopt ' ' '--program-prefix=${arch_target}-' + + hook_add postmake 5 'libtool_cross_tweak' + fi + } + + # if we `export` them 0-libtool's configure will try to test that $CC is able + # to produce binaries, but as 1-glibc is not yet built the crt.o file is not + # found and the test fails. + libtool_cross_tweak() { + local x= y= + + # set the right CC,CXX,AR,.... + for x in gcc g++ ar ld nm strip as ranlib; do + case "$x" in + gcc) y=CC ;; + g++) y=CXX ;; + *) y=$( echo $x | tr [a-z] [A-Z] ) ;; + esac + + # TODO: turn this into a single `sed` call + sed -i -e "s,^$y=.*,$y=\"${arch_target}-$x\"," "$root$bindir/${arch_target}-libtool" + done + } +fi +