summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <haubi@gentoo.org>2013-11-05 15:03:13 +0000
committerMichael Haubenwallner <haubi@gentoo.org>2013-11-05 15:03:13 +0000
commit30610cea65a80392a41b5129b7cdf2b0fefbec48 (patch)
tree3236f36f91b853262a64f2f08565201cdccb904f /sys-devel
parentFix bug 478128 (don't mention non-distro upgrades) again. Thanks Nuno J. Silva. (diff)
downloadgentoo-2-30610cea65a80392a41b5129b7cdf2b0fefbec48.tar.gz
gentoo-2-30610cea65a80392a41b5129b7cdf2b0fefbec48.tar.bz2
gentoo-2-30610cea65a80392a41b5129b7cdf2b0fefbec48.zip
native-cctools-3: Add mkexpfile helper v1 for AIX.
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key A630CCB8)
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/native-cctools/ChangeLog10
-rw-r--r--sys-devel/native-cctools/files/aix-mkexpfile-156
-rw-r--r--sys-devel/native-cctools/native-cctools-3.ebuild110
3 files changed, 174 insertions, 2 deletions
diff --git a/sys-devel/native-cctools/ChangeLog b/sys-devel/native-cctools/ChangeLog
index bc58ae5cd7b0..f9b8af5cfdeb 100644
--- a/sys-devel/native-cctools/ChangeLog
+++ b/sys-devel/native-cctools/ChangeLog
@@ -1,6 +1,12 @@
# 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.3 2011/06/07 12:41:30 haubi Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/ChangeLog,v 1.4 2013/11/05 15:03:13 haubi Exp $
+
+*native-cctools-3 (05 Nov 2013)
+
+ 05 Nov 2013; Michael Haubenwallner <haubi@gentoo.org> +files/aix-mkexpfile-1,
+ +native-cctools-3.ebuild:
+ Add mkexpfile helper v1 for AIX.
*native-cctools-2 (07 Jun 2011)
diff --git a/sys-devel/native-cctools/files/aix-mkexpfile-1 b/sys-devel/native-cctools/files/aix-mkexpfile-1
new file mode 100644
index 000000000000..7b36f3bc1f7a
--- /dev/null
+++ b/sys-devel/native-cctools/files/aix-mkexpfile-1
@@ -0,0 +1,56 @@
+#! /usr/bin/env bash
+# Copyright 2013-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/aix-mkexpfile-1,v 1.1 2013/11/05 15:03:13 haubi Exp $
+
+# Creating shared libraries on AIX involves lots of commands. While there is
+# the ld-wrapper supporting the '-soname' flag already, it also is necessary
+# to create the list of exported symbols from all the local object files only,
+# because with the -bexpfull linker flag we would export symbols from static
+# objects found in libc.a too, which should be privately linked into
+# subsequent shared libs instead of importing them from current sharedlib.
+
+# Also, -bexpfull may trigger this AIX 7.1 kernel bug:
+# https://www-304.ibm.com/support/docview.wss?uid=isg1IV39558
+
+# Example to use this helper script, in combination with ld-wrapper:
+# gcc -shared -soname=lib.so.1 -o lib.so *.o -Wl,-bexport:`mkexpfile *.o`
+
+nm=${0%mkexpfile}nm
+showwith=
+expfile="ld.aix.exports.$$"
+srcobjs=()
+
+while [[ $# -gt 0 ]]
+do
+ arg=$1
+ shift
+
+ case ${arg} in
+ --) srcobjs=( "${srcobjs[@]}" "$@" ); break ;;
+ --show-with=*) showwith=${arg#--show-with=} ;;
+ -o) expfile=$1; shift ;;
+ -o*) expfile=${arg#-o}; ;;
+ *) srcobjs=( "${srcobjs[@]}" "${arg}" ) ;;
+ esac
+done
+
+rm -f "${expfile}" || exit 1
+
+type ${nm} >/dev/null 2>&1 || nm=nm
+
+${nm} -PCpgl "${srcobjs[@]}" |
+ awk '{
+ if ((($2 == "T") || ($2 == "D") || ($2 == "B") || ($2 == "W") || ($2 == "V") || ($2 == "Z")) && (substr($1,1,1) != ".")) {
+ if (($2 == "W") || ($2 == "V") || ($2 == "Z")) {
+ print $1 " weak"
+ } else {
+ print $1
+ }
+ }
+ }' |
+ sort -u > "${expfile}" || exit 1
+
+printf "%s\n" "${showwith}${expfile}"
+
+exit 0
diff --git a/sys-devel/native-cctools/native-cctools-3.ebuild b/sys-devel/native-cctools/native-cctools-3.ebuild
new file mode 100644
index 000000000000..0cb79b0c8e91
--- /dev/null
+++ b/sys-devel/native-cctools/native-cctools-3.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/native-cctools-3.ebuild,v 1.1 2013/11/05 15:03:13 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"
+
+AIX_LD_V=2
+AIX_MKEXPFILE_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-${AIX_LD_V}")
+ wrappers=("${wrappers[@]}" "mkexpfile=${FILESDIR}/aix-mkexpfile-${AIX_MKEXPFILE_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}
+}