From: "Fabian Groffen (grobian)" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: toolchain-funcs.eclass
Date: Sun, 24 May 2009 07:25:48 +0000 [thread overview]
Message-ID: <E1M885c-0004uz-8g@stork.gentoo.org> (raw)
grobian 09/05/24 07:25:48
Modified: toolchain-funcs.eclass
Log:
gen_usr_ldscript:
* remove old USERLAND=Darwin hack
* add install_name adjusting case for Darwin
* add symlink creating cases for IRIX, AIX and HPUX
* likewise for Interix and Windows
* add support for -a for all platforms
* add EPREFIX for Prefix compatability (could use inherit prefix for
definition of EPREFIX variable)
tc-is-static-only:
* added function, currently only returning true for FreeMiNT (no shared
libraries)
reviewed by vapier
Revision Changes Path
1.91 eclass/toolchain-funcs.eclass
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?rev=1.91&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?rev=1.91&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?r1=1.90&r2=1.91
Index: toolchain-funcs.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- toolchain-funcs.eclass 5 Apr 2009 07:50:08 -0000 1.90
+++ toolchain-funcs.eclass 24 May 2009 07:25:48 -0000 1.91
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.90 2009/04/05 07:50:08 grobian Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.91 2009/05/24 07:25:48 grobian Exp $
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
@@ -155,6 +155,18 @@
esac
}
+# @FUNCTION: tc-is-static-only
+# @DESCRIPTION:
+# Return shell true if the target does not support shared libs, shell false
+# otherwise.
+tc-is-static-only() {
+ local host=${CTARGET:-${CHOST}}
+
+ # *MiNT doesn't have shared libraries, only platform so far
+ return $([[ ${host} == *-mint* ]])
+}
+
+
# Parse information from CBUILD/CHOST/CTARGET rather than
# use external variables from the profile.
tc-ninja_magic_to_arch() {
@@ -403,6 +415,10 @@
# correctly to point to the latest version of the library present.
gen_usr_ldscript() {
local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname)
+ [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
+
+ tc-is-static-only && return
+
# Just make sure it exists
dodir /usr/${libdir}
@@ -418,26 +434,96 @@
[[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
for lib in "$@" ; do
- if [[ ${USERLAND} == "Darwin" ]] ; then
- ewarn "Not creating fake dynamic library for $lib on Darwin;"
- ewarn "making a symlink instead."
- dosym "/${libdir}/${lib}" "/usr/${libdir}/${lib}"
+ local tlib
+ if ${auto} ; then
+ lib="lib${lib}${suffix}"
else
- local tlib
+ # Ensure /lib/${lib} exists to avoid dangling scripts/symlinks.
+ # This especially is for AIX where $(get_libname) can return ".a",
+ # so /lib/${lib} might be moved to /usr/lib/${lib} (by accident).
+ [[ -r ${ED}/${libdir}/${lib} ]] || continue
+ #TODO: better die here?
+ fi
+
+ case ${CTARGET:-${CHOST}} in
+ *-darwin*)
if ${auto} ; then
- lib="lib${lib}${suffix}"
- tlib=$(scanelf -qF'%S#F' "${D}"/usr/${libdir}/${lib})
- mv "${D}"/usr/${libdir}/${lib}* "${D}"/${libdir}/ || die
+ tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
+ else
+ tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib})
+ fi
+ [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}"
+ tlib=${tlib##*/}
+
+ if ${auto} ; then
+ mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die
+ rm -f "${ED}"/${libdir}/${lib}
+ fi
+
+ # Mach-O files have an id, which is like a soname, it tells how
+ # another object linking against this lib should reference it.
+ # Since we moved the lib from usr/lib into lib this reference is
+ # wrong. Hence, we update it here. We don't configure with
+ # libdir=/lib because that messes up libtool files.
+ # Make sure we don't lose the specific version, so just modify the
+ # existing install_name
+ install_name_tool \
+ -id "${EPREFIX}"/${libdir}/${tlib} \
+ "${ED}"/${libdir}/${tlib}
+ # Now as we don't use GNU binutils and our linker doesn't
+ # understand linker scripts, just create a symlink.
+ pushd "${ED}/usr/${libdir}" > /dev/null
+ ln -snf "../../${libdir}/${tlib}" "${lib}"
+ popd > /dev/null
+ ;;
+ *-aix*|*-irix*|*-hpux*|*-interix*|*-winnt*)
+ if ${auto} ; then
+ mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
+ # no way to retrieve soname on these platforms (?)
+ tlib=$(readlink "${ED}"/${libdir}/${lib})
+ tlib=${tlib##*/}
+ if [[ -z ${tlib} ]] ; then
+ # ok, apparently was not a symlink, don't remove it and
+ # just link to it
+ tlib=${lib}
+ else
+ rm -f "${ED}"/${libdir}/${lib}
+ fi
+ else
+ tlib=${lib}
+ fi
+
+ # we don't have GNU binutils on these platforms, so we symlink
+ # instead, which seems to work fine. Keep it relative, otherwise
+ # we break some QA checks in Portage
+ # on interix, the linker scripts would work fine in _most_
+ # situations. if a library links to such a linker script the
+ # absolute path to the correct library is inserted into the binary,
+ # which is wrong, since anybody linking _without_ libtool will miss
+ # some dependencies, since the stupid linker cannot find libraries
+ # hardcoded with absolute paths (as opposed to the loader, which
+ # seems to be able to do this).
+ # this has been seen while building shared-mime-info which needs
+ # libxml2, but links without libtool (and does not add libz to the
+ # command line by itself).
+ pushd "${ED}/usr/${libdir}" > /dev/null
+ ln -snf "../../${libdir}/${tlib}" "${lib}"
+ popd > /dev/null
+ ;;
+ *)
+ if ${auto} ; then
+ tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
+ [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"
+ mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
# some SONAMEs are funky: they encode a version before the .so
if [[ ${tlib} != ${lib}* ]] ; then
- mv "${D}"/usr/${libdir}/${tlib}* "${D}"/${libdir}/ || die
+ mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die
fi
- [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"
- rm -f "${D}"/${libdir}/${lib}
+ rm -f "${ED}"/${libdir}/${lib}
else
tlib=${lib}
fi
- cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
+ cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
/* GNU ld script
Since Gentoo has critical dynamic libraries in /lib, and the static versions
in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
@@ -448,9 +534,10 @@
See bug http://bugs.gentoo.org/4411 for more info.
*/
${output_format}
- GROUP ( /${libdir}/${tlib} )
+ GROUP ( ${EPREFIX}/${libdir}/${tlib} )
END_LDSCRIPT
- fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"
- fi
+ ;;
+ esac
+ fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"
done
}
next reply other threads:[~2009-05-24 7:25 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-24 7:25 Fabian Groffen (grobian) [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-28 7:51 [gentoo-commits] gentoo-x86 commit in eclass: toolchain-funcs.eclass Mike Frysinger (vapier)
2015-04-13 5:38 Mike Frysinger (vapier)
2015-03-31 4:27 Mike Frysinger (vapier)
2015-03-16 21:12 Mike Frysinger (vapier)
2015-03-16 19:26 Mike Frysinger (vapier)
2015-03-10 17:56 Mike Frysinger (vapier)
2015-02-27 6:08 Mike Frysinger (vapier)
2014-11-01 5:19 Mike Frysinger (vapier)
2014-10-15 22:52 Anthony G. Basile (blueness)
2014-10-15 22:30 Anthony G. Basile (blueness)
2014-10-15 22:27 Anthony G. Basile (blueness)
2014-01-17 3:46 Mike Frysinger (vapier)
2014-01-14 20:48 Mike Frysinger (vapier)
2014-01-14 5:33 Mike Frysinger (vapier)
2013-10-12 21:31 Mike Frysinger (vapier)
2013-09-30 1:34 Mike Frysinger (vapier)
2013-05-14 20:40 Mike Frysinger (vapier)
2012-12-29 5:08 Mike Frysinger (vapier)
2012-09-13 5:06 Mike Frysinger (vapier)
2012-07-26 16:43 Mike Frysinger (vapier)
2012-07-25 18:27 Mike Frysinger (vapier)
2012-07-21 16:11 Mike Frysinger (vapier)
2012-06-14 3:38 Mike Frysinger (vapier)
2012-05-10 3:31 Mike Frysinger (vapier)
2011-12-10 19:45 Mike Frysinger (vapier)
2011-10-17 19:11 Mike Frysinger (vapier)
2011-09-12 21:42 Mike Frysinger (vapier)
2011-09-09 19:14 Mike Frysinger (vapier)
2011-09-06 22:54 Mike Frysinger (vapier)
2011-07-12 14:29 Alexis Ballier (aballier)
2010-10-28 4:16 Mike Frysinger (vapier)
2010-09-11 17:12 Mike Frysinger (vapier)
2010-08-20 15:04 Donnie Berkholz (dberkholz)
2010-05-23 2:00 Mike Frysinger (vapier)
2010-04-22 18:28 Raul Porcel (armin76)
2010-03-15 23:51 Mike Frysinger (vapier)
2009-12-01 4:44 Mike Frysinger (vapier)
2009-11-27 21:31 Mike Frysinger (vapier)
2009-09-02 20:08 Fabian Groffen (grobian)
2009-09-02 9:00 Fabian Groffen (grobian)
2009-08-15 15:12 Fabian Groffen (grobian)
2009-08-15 15:11 Fabian Groffen (grobian)
2009-04-05 7:50 Fabian Groffen (grobian)
2009-04-04 17:17 Fabian Groffen (grobian)
2009-03-28 11:09 Mike Frysinger (vapier)
2009-03-01 8:09 Mike Frysinger (vapier)
2009-02-25 0:25 Joshua Kinard (kumba)
2009-01-27 23:35 Mike Frysinger (vapier)
2009-01-08 11:06 Gordon Malm (gengor)
2009-01-08 9:56 Gordon Malm (gengor)
2009-01-08 6:33 Gordon Malm (gengor)
2009-01-08 3:46 Gordon Malm (gengor)
2008-09-16 6:40 Mike Frysinger (vapier)
2008-07-03 5:26 Donnie Berkholz (dberkholz)
2008-06-01 8:56 Alexis Ballier (aballier)
2008-04-16 14:16 Mike Frysinger (vapier)
2008-01-02 1:01 Mike Frysinger (vapier)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1M885c-0004uz-8g@stork.gentoo.org \
--to=grobian@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox