summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/glibc/files/eblits/src_install.eblit~')
-rw-r--r--sys-libs/glibc/files/eblits/src_install.eblit~252
1 files changed, 252 insertions, 0 deletions
diff --git a/sys-libs/glibc/files/eblits/src_install.eblit~ b/sys-libs/glibc/files/eblits/src_install.eblit~
new file mode 100644
index 0000000..28034f4
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_install.eblit~
@@ -0,0 +1,252 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_install.eblit,v 1.9 2009/12/19 23:44:54 vapier Exp $
+
+toolchain-glibc_src_install() {
+ local GBUILDDIR
+ if want_linuxthreads ; then
+ GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-linuxthreads
+ else
+ GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl
+ fi
+
+ local install_root=${ED}
+ is_crosscompile && install_root="${install_root}/usr/${CTARGET}"
+ if want_linuxthreads ; then
+ cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads
+ einfo "Installing GLIBC ${ABI} with linuxthreads ..."
+ else # nptlonly
+ cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
+ einfo "Installing GLIBC ${ABI} with NPTL ..."
+ fi
+ make PARALLELMFLAGS="${MAKEOPTS}" \
+ install_root="${install_root}" \
+ install || die
+
+ if is_crosscompile ; then
+ # punt all the junk not needed by a cross-compiler
+ cd "${D}"/usr/${CTARGET} || die
+ rm -rf ./{,usr/}{bin,etc,sbin,share} ./{,usr/}*/{gconv,misc}
+ fi
+
+ if want_linuxthreads && want_nptl ; then
+ einfo "Installing NPTL to $(alt_libdir)/tls/..."
+ cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
+ dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
+
+ local l src_lib
+ for l in libc libm librt libpthread libthread_db ; do
+ # take care of shared lib first ...
+ l=${l}.so
+ if [[ -e ${l} ]] ; then
+ src_lib=${l}
+ else
+ src_lib=$(eval echo */${l})
+ fi
+ cp -a ${src_lib} "${D}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
+ fperms a+rx $(alt_libdir)/tls/${l}
+ dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
+
+ # then grab the linker script or the symlink ...
+ if [[ -L ${D}$(alt_usrlibdir)/${l} ]] ; then
+ dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
+ else
+ sed \
+ -e "s:/${l}:/tls/${l}:g" \
+ -e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
+ "${D}"$(alt_usrlibdir)/${l} > "${D}"$(alt_usrlibdir)/nptl/${l}
+ fi
+
+ # then grab the static lib ...
+ src_lib=${src_lib/%.so/.a}
+ [[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
+ cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+ src_lib=${src_lib/%.a/_nonshared.a}
+ if [[ -e ${src_lib} ]] ; then
+ cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+ fi
+ done
+
+ # use the nptl linker instead of the linuxthreads one as the linuxthreads
+ # one may lack TLS support and that can be really bad for business
+ cp -a elf/ld.so "${D}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
+ fi
+
+ # We'll take care of the cache ourselves
+ rm -f "${D}"/etc/ld.so.cache
+
+ # Some things want this, notably ash.
+ dosym libbsd-compat.a $(alt_usrlibdir)/libbsd.a
+
+ # Handle includes for different ABIs if glibc itself doesn't do it
+ # XXX: curr glibc should finally handle all of them correctly
+ #case $(tc-arch) in
+ # amd64|mips|ppc|s390) ;;
+ # *) prep_ml_includes $(alt_headers) ;;
+ #esac
+
+ # When cross-compiling for a non-multilib setup, make sure we have
+ # lib and a proper symlink setup
+ if is_crosscompile && ! use multilib && ! has_multilib_profile && [[ $(get_libdir) != "lib" ]] ; then
+ cd "${D}"$(alt_libdir)/..
+ mv $(get_libdir) lib || die
+ ln -s lib $(get_libdir) || die
+ cd "${D}"$(alt_usrlibdir)/..
+ mv $(get_libdir) lib || die
+ ln -s lib $(get_libdir) || die
+ fi
+
+ #################################################################
+ # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+ # Make sure we install some symlink hacks so that when we build
+ # a 2nd stage cross-compiler, gcc finds the target system
+ # headers correctly. See gcc/doc/gccinstall.info
+ if is_crosscompile ; then
+ dosym usr/include ${EPREFIX}/usr/${CTARGET}/sys-include
+ return 0
+ fi
+
+ # Everything past this point just needs to be done once ...
+ is_final_abi || return 0
+
+ # Make sure the non-native interp can be found on multilib systems
+ if has_multilib_profile ; then
+ case $(tc-arch) in
+ amd64)
+ [[ ! -e ${D}/lib ]] && dosym $(get_abi_LIBDIR amd64) /lib
+ dosym ../$(get_abi_LIBDIR x86)/ld-linux.so.2 /lib/ld-linux.so.2
+ ;;
+ ppc64)
+ [[ ! -e ${D}/lib ]] && dosym $(get_abi_LIBDIR ppc64) /lib
+ dosym ../$(get_abi_LIBDIR ppc)/ld.so.1 /lib/ld.so.1
+ ;;
+ esac
+ fi
+
+ # Files for Debian-style locale updating
+ dodir /usr/share/i18n
+ sed \
+ -e "/^#/d" \
+ -e "/SUPPORTED-LOCALES=/d" \
+ -e "s: \\\\::g" -e "s:/: :g" \
+ "${S}"/localedata/SUPPORTED > "${D}"/usr/share/i18n/SUPPORTED \
+ || die "generating /usr/share/i18n/SUPPORTED failed"
+ cd "${WORKDIR}"/extra/locale
+ dosbin locale-gen || die
+ doman *.[0-8]
+ insinto /etc
+ doins locale.gen || die
+
+ # Make sure all the ABI's can find the locales and so we only
+ # have to generate one set
+ local a
+ keepdir /usr/$(get_libdir)/locale
+ for a in $(get_install_abis) ; do
+ if [[ ! -e ${D}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+ dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+ fi
+ done
+
+ if ! has noinfo ${FEATURES} && [[ -n ${INFOPAGE_VER} ]] ; then
+ einfo "Installing info pages..."
+
+ make \
+ -C "${GBUILDDIR}" \
+ PARALLELMFLAGS="${MAKEOPTS}" \
+ install_root="${install_root}" \
+ info -i || die
+ fi
+
+ if [[ -n ${MANPAGE_VER} ]] ; then
+ einfo "Installing man pages..."
+
+ # Install linuxthreads man pages even if nptl is enabled
+ cd "${WORKDIR}"/man
+ doman *.3thr
+ fi
+
+ cd "${S}"
+
+ # Install misc network config files
+ insinto /etc
+ doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
+ doins "${WORKDIR}"/extra/etc/*.conf || die
+ doinitd "${WORKDIR}"/extra/etc/nscd || die
+
+ sed -i -e "s:@PIDFILE@:$(strings "${D}"/usr/sbin/nscd | grep nscd.pid):" "${D}"/etc/init.d/nscd
+
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+ doenvd "${T}"/00glibc || die
+
+ dodoc BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README*
+
+ # Prevent overwriting of the /etc/localtime symlink. We'll handle the
+ # creation of the "factory" symlink in pkg_postinst().
+ rm -f "${D}"/etc/localtime
+}
+
+toolchain-glibc_headers_install() {
+ local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
+ cd "${GBUILDDIR}"
+ make install_root="${ED}/usr/${CTARGET}" install-headers || die "install-headers failed"
+ # Copy over headers that are not part of install-headers ... these
+ # are pretty much taken verbatim from crosstool, see it for more details
+ insinto $(alt_headers)/bits
+ doins misc/syscall-list.h bits/stdio_lim.h || die "doins include bits"
+ insinto $(alt_headers)/gnu
+ doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
+ # Make sure we install the sys-include symlink so that when
+ # we build a 2nd stage cross-compiler, gcc finds the target
+ # system headers correctly. See gcc/doc/gccinstall.info
+ dosym usr/include /usr/${CTARGET}/sys-include
+}
+
+src_strip() {
+ # gdb is lame and requires some debugging information to remain in
+ # libpthread, so we need to strip it by hand. libthread_db makes no
+ # sense stripped as it is only used when debugging.
+ local pthread=$(hasq splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+ env \
+ -uRESTRICT \
+ CHOST=${CTARGET} \
+ STRIP_MASK="/*/{,tls/}${pthread}*" \
+ prepallstrip
+ # if user has stripping enabled and does not have split debug turned on,
+ # then leave the debugging sections in libpthread.
+ if ! hasq nostrip ${FEATURES} && ! hasq splitdebug ${FEATURES} ; then
+ ${STRIP:-${CTARGET}-strip} --strip-debug "${D}"/*/libpthread-*.so
+ fi
+}
+
+eblit-glibc-src_install() {
+ if just_headers ; then
+ toolchain-glibc_headers_install
+ return
+ fi
+
+ setup_env
+
+ if [[ -z ${OABI} ]] ; then
+ local abilist=""
+ if has_multilib_profile ; then
+ abilist=$(get_install_abis)
+ einfo "Installing multilib glibc for ABIs: ${abilist}"
+ elif is_crosscompile || tc-is-cross-compiler ; then
+ abilist=${DEFAULT_ABI}
+ fi
+ if [[ -n ${abilist} ]] ; then
+ OABI=${ABI}
+ for ABI in ${abilist} ; do
+ export ABI
+ eblit-glibc-src_install
+ done
+ ABI=${OABI}
+ unset OABI
+ src_strip
+ return 0
+ fi
+ fi
+
+ toolchain-glibc_src_install
+ [[ -z ${OABI} ]] && src_strip
+}