summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <haubi@gentoo.org>2011-02-09 15:53:53 +0000
committerMichael Haubenwallner <haubi@gentoo.org>2011-02-09 15:53:53 +0000
commit1da67128a2d96bdd768ee4db43d313c9cdb983cb (patch)
tree5246b3a98367c677e457e8b4dc8be5475aae091a /sys-devel
parentFix git url (diff)
downloadhistorical-1da67128a2d96bdd768ee4db43d313c9cdb983cb.tar.gz
historical-1da67128a2d96bdd768ee4db43d313c9cdb983cb.tar.bz2
historical-1da67128a2d96bdd768ee4db43d313c9cdb983cb.zip
On AIX, wrap ld to support '-soname' flag (#213277). Moved from prefix-overlay to gentoo-x86.
Package-Manager: portage-2.2.01.17865-prefix/cvs/AIX 00C0078A4C00
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/native-cctools/ChangeLog21
-rw-r--r--sys-devel/native-cctools/Manifest4
-rw-r--r--sys-devel/native-cctools/files/ld-aix-1141
-rw-r--r--sys-devel/native-cctools/metadata.xml5
-rw-r--r--sys-devel/native-cctools/native-cctools-1.ebuild108
5 files changed, 279 insertions, 0 deletions
diff --git a/sys-devel/native-cctools/ChangeLog b/sys-devel/native-cctools/ChangeLog
new file mode 100644
index 000000000000..1d4f0669bfb6
--- /dev/null
+++ b/sys-devel/native-cctools/ChangeLog
@@ -0,0 +1,21 @@
+# ChangeLog for sys-devel/native-cctools
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/ChangeLog,v 1.1 2011/02/09 15:53:53 haubi Exp $
+
+ 09 Feb 2011; Michael Haubenwallner <haubi@gentoo.org> +files/ld-aix-1,
+ +native-cctools-1.ebuild, +metadata.xml:
+ On AIX, wrap ld to support '-soname' flag (#213277).
+ Moved from prefix-overlay to gentoo-x86.
+
+ 17 Dec 2008; Fabian Groffen <grobian@gentoo.org> native-cctools-1.ebuild:
+ On Darwin, make sure we never link gnu-libtool as libtool, or br0rk4ge will
+ be guaranteed
+
+*native-cctools-1 (09 Feb 2011)
+
+ 21 Mar 2007; Fabian Groffen <grobian@gentoo.org> +files/ld-aix-1,
+ +native-cctools-1.ebuild, +metadata.xml:
+ Initial commit of native-cctools, a wrapper package around native installed
+ cctools (ld, as, ar, etc) for operating systems where GNU binutils doesn't
+ work, or the linker sources are unavailable.
+
diff --git a/sys-devel/native-cctools/Manifest b/sys-devel/native-cctools/Manifest
new file mode 100644
index 000000000000..57a05f8bde8b
--- /dev/null
+++ b/sys-devel/native-cctools/Manifest
@@ -0,0 +1,4 @@
+AUX ld-aix-1 2853 RMD160 f0c7717e9441c094ae8d362f25ecf8c2654d3fe6 SHA1 4d93ea7280dcfbfae09c000fc21050d959cef27f SHA256 7d01d3f320b4999ecbda5de28f762c273145843dfdfacc9ea9cf719cff1bfb49
+EBUILD native-cctools-1.ebuild 2771 RMD160 e1e8364fbf57d536fe93ccc48c852d45ef1c0813 SHA1 37ebe53ef743e28ffb3eea64ea78baedb85fcb05 SHA256 a34eb0a088022982d2948daa0ada079d6e9c75e64908798675af819e27a3c741
+MISC ChangeLog 953 RMD160 f5e9848a895307f073cab2aa217d5726ed4c9fd6 SHA1 38d0b1f96d56b8f855937e720b9a8b5f498f57f8 SHA256 ff9f3aefe18b4c7ccfb4cd065c23cc1e573c037f82aa455adea82a98d2023081
+MISC metadata.xml 159 RMD160 daf7422c2bde2c03abbeccce93691898dee7460a SHA1 dac0288d1bc404d23c4d31e83c51d9f9381a2828 SHA256 9f4e165acd1a7bdc5c8ccdb4a40a2e969e056b8463bfe94a1b2e29cc4ef62af4
diff --git a/sys-devel/native-cctools/files/ld-aix-1 b/sys-devel/native-cctools/files/ld-aix-1
new file mode 100644
index 000000000000..80ee12d7ffbf
--- /dev/null
+++ b/sys-devel/native-cctools/files/ld-aix-1
@@ -0,0 +1,141 @@
+#! /bin/ksh
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1,v 1.1 2011/02/09 15:53:53 haubi Exp $
+
+# Upon '-soname' and similar flags, create a "shared library" on AIX being an
+# archive file containing an Import File and the shared object file, as in:
+# http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html
+# with updates in:
+# http://lists.gnu.org/archive/html/libtool/2011-02/msg00000.html
+#
+# This helper script is meant not depend on anything Gentoo specific.
+
+ld=/usr/ccs/bin/ld
+ar=/usr/ccs/bin/ar
+strip=/usr/ccs/bin/strip
+dump=/usr/sbin/dump
+awk=/usr/bin/awk
+rm=/usr/bin/rm
+mkdir=/usr/bin/mkdir
+mv=/usr/bin/mv
+ln=/usr/bin/ln
+
+oldargs=
+output=
+soname=
+newargs=
+OBJECT_MODE=${OBJECT_MODE:-32}
+
+while [[ $# -gt 0 ]]
+do
+ arg=$1
+ shift
+ oldargs="${oldargs} '${arg}'"
+ case ${arg} in
+ -o)
+ newargs="${newargs} -o '$1'"
+ output=$1
+ oldargs="${oldargs} '$1'"
+ shift
+ ;;
+ -bM:SRE)
+ newargs="${newargs} '-G' '-bernotok'"
+ ;;
+ -soname=*)
+ soname=${arg#-soname=}
+ ;;
+ -h*)
+ soname=${arg#-h}
+ ;;
+ -soname|-h)
+ soname=$1
+ shift
+ ;;
+ -b32)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=32
+ ;;
+ -b64)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=64
+ ;;
+ *)
+ newargs="${newargs} '${arg}'"
+ ;;
+ esac
+done
+
+if [[ -z ${output} || -z ${soname} ]]; then
+ eval "exec ${ld} ${oldargs}"
+ exit 1
+fi
+
+# Running ld against the orginal target file to retain
+# ld error message when there's a problem with it:
+eval "${ld} -o '${output}' ${newargs}" || exit 1
+
+workdir="${output}.$$"
+
+${rm} -rf "${workdir}" || exit 1
+trap "${rm} -rf '${workdir}'" 0
+
+case ${soname} in
+*\(*\))
+ shro=${soname#*\(}
+ shro=${shro%\)}
+ shri=${shro%.*}.imp
+ ;;
+*\[*\])
+ shro=${soname#*\[}
+ shro=${shro%\]}
+ shri=${shro%.*}.imp
+ ;;
+none) # loadable only module, not linkable: no import file
+ shro='shr.o'
+ soname="${output##*/}(${shro})"
+ shri=
+ ;;
+auto)
+ shro='shr.o'
+ soname=${output##*/}
+ if [[ ${soname} == lib*.so* ]]; then
+ # linkable library: need import file
+ shri=${shro%.*}.imp
+ else
+ # loadable only module, not linkable: no import file
+ shri=
+ fi
+ soname="${soname}(${shro})"
+ ;;
+*)
+ shro='shr.o'
+ shri=${shro%.*}.imp
+ soname="${soname}(${shro})"
+ ;;
+esac
+
+export OBJECT_MODE
+
+${mkdir} "${workdir}" || exit 1
+${strip} -e "${output}" || exit 1
+if [[ -n ${shri} ]]; then
+ ${dump} -Tv "${output}" > "${workdir}"/syms || exit 1
+ ${awk} '
+ BEGIN {
+ print "#! '"${soname}"'"
+ print "# '"${OBJECT_MODE}"'"
+ }
+ {
+ if ($6 != "SECdef") {
+ if ($4 == "EXP" || $4 == "ImpExp") {
+ print $8
+ } else
+ if ($4 == "wEXP") {
+ print $8" weak"
+ }
+ }
+ }' <"${workdir}"/syms > "${workdir}"/${shri} || exit 1
+fi
+${mv} "${output}" "${workdir}/${shro}" || exit 1
+${ar} rc "${output}" ${shri:+"${workdir}/${shri}"} "${workdir}/${shro}" || exit 1
+exit 0
diff --git a/sys-devel/native-cctools/metadata.xml b/sys-devel/native-cctools/metadata.xml
new file mode 100644
index 000000000000..46dee96f4e7a
--- /dev/null
+++ b/sys-devel/native-cctools/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>prefix</herd>
+</pkgmetadata>
diff --git a/sys-devel/native-cctools/native-cctools-1.ebuild b/sys-devel/native-cctools/native-cctools-1.ebuild
new file mode 100644
index 000000000000..405912da23c4
--- /dev/null
+++ b/sys-devel/native-cctools/native-cctools-1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/native-cctools-1.ebuild,v 1.1 2011/02/09 15:53:53 haubi Exp $
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Host OS native assembler as and static linker ld"
+HOMEPAGE="http://youroperatingsystem.com/"
+SRC_URI=""
+
+LICENSE="GPL-2" # actually, we don't know, the wrapper is
+SLOT="0"
+
+LD_AIX_V=1
+
+KEYWORDS="~ppc-aix ~x86-interix ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+IUSE=""
+
+DEPEND="sys-devel/binutils-config"
+RDEPEND="${DEPEND}"
+
+src_install() {
+ LIBPATH=/usr/$(get_libdir)/binutils/${CHOST}/native-${PV}
+ BINPATH=/usr/${CHOST}/binutils-bin/native-${PV}
+
+ keepdir ${LIBPATH} || die
+ dodir ${BINPATH} || die
+
+ # allow for future hosts with different paths
+ nativepath=""
+ wrappers=()
+ case ${CHOST} in
+ *-solaris*)
+ nativepath=/usr/sfw/bin
+ ;;
+ *-aix*)
+ nativepath=/usr/ccs/bin
+ wrappers=("${wrappers[@]}" "ld=${FILESDIR}/ld-aix-${LD_AIX_V}")
+ ;;
+ *-apple-darwin*|*-netbsd*|*-openbsd*)
+ nativepath=/usr/bin
+ ;;
+ *-interix*)
+ nativepath=/opt/gcc.3.3/bin
+ ;;
+ *)
+ die "Don't know where the native linker for your platform is"
+ ;;
+ esac
+
+ what="addr2line as ar c++filt gprof ld nm objcopy objdump \
+ ranlib readelf elfdump size strings strip"
+ # Darwin things
+ what="${what} install_name_tool ld64 libtool lipo nmedit \
+ otool otool64 pagestuff redo_prebinding segedit"
+
+ # copy from the host os
+ cd "${ED}${BINPATH}"
+ for b in ${what} ; do
+ if [[ ${CHOST} == *-darwin* && ${b} == libtool ]] ; then
+ echo "linking darwin libtool ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ elif [[ -x ${nativepath}/g${b} ]] ; then
+ einfo "linking ${nativepath}/g${b}"
+ ln -s "${nativepath}/g${b}" "${b}"
+ elif [[ -x ${nativepath}/${b} ]] ; then
+ einfo "linking ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ else
+ ewarn "skipping ${b} (not in ${nativepath})"
+ fi
+ done
+
+ # post fix for Darwin's ranlib (doesn't like it when its called other than
+ # that, as libtool and ranlib are one tool)
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ rm -f ranlib
+ cat <<-EOF > ranlib
+ #!/usr/bin/env bash
+ exec ${nativepath}/ranlib "\$@"
+ EOF
+ chmod 755 ranlib
+ fi
+
+ exeinto ${BINPATH}
+ local wrapper source target
+ for wrapper in "${wrappers[@]}" ; do
+ source=${wrapper#*=}
+ target=${wrapper%%=*}
+ newexe "${source}" "${target}" || die
+ done
+ # Generate an env.d entry for this binutils
+ insinto /etc/env.d/binutils
+ cat <<-EOF > "${T}"/env.d
+ TARGET="${CHOST}"
+ VER="native-${PV}"
+ LIBPATH="${EPREFIX}/${LIBPATH}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins "${T}"/env.d ${CHOST}-native-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-native-${PV}
+}