/[gentoo-x86]/eclass/toolchain.eclass
Gentoo

Diff of /eclass/toolchain.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.381 Revision 1.382
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.381 2009/01/12 22:51:38 maekke Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.382 2009/01/28 02:27:01 vapier Exp $
4# 4#
5# Maintainer: Toolchain Ninjas <toolchain@gentoo.org> 5# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
6 6
7HOMEPAGE="http://gcc.gnu.org/" 7HOMEPAGE="http://gcc.gnu.org/"
8LICENSE="GPL-2 LGPL-2.1" 8LICENSE="GPL-2 LGPL-2.1"
1742 fi 1742 fi
1743 create_gcc_env_entry vanilla 1743 create_gcc_env_entry vanilla
1744 fi 1744 fi
1745 # Make sure we dont have stuff lying around that 1745 # Make sure we dont have stuff lying around that
1746 # can nuke multiple versions of gcc 1746 # can nuke multiple versions of gcc
1747
1748 gcc_slot_java
1749
1750 # Move <cxxabi.h> to compiler-specific directories
1751 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
1752 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
1753
1754 # These should be symlinks
1755 dodir /usr/bin
1747 cd "${D}"${LIBPATH} 1756 cd "${D}"${BINPATH}
1757 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
1758 # For some reason, g77 gets made instead of ${CTARGET}-g77...
1759 # this should take care of that
1760 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
1761
1762 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
1763 ln -sf ${CTARGET}-${x} ${x}
1764
1765 # Create version-ed symlinks
1766 dosym ${BINPATH}/${CTARGET}-${x} \
1767 /usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1768 dosym ${BINPATH}/${CTARGET}-${x} \
1769 /usr/bin/${x}-${GCC_CONFIG_VER}
1770 fi
1771
1772 if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then
1773 rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER}
1774 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
1775 fi
1776 done
1777
1778 # I do not know if this will break gcj stuff, so I'll only do it for
1779 # objc for now; basically "ffi.h" is the correct file to include,
1780 # but it gets installed in .../GCCVER/include and yet it does
1781 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
1782 # is installed in .../GCCVER/include/libffi; the following fixes
1783 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
1784 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
1785 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
1786 rm -r "${D}"${LIBPATH}/include/libffi || die
1787 fi
1788
1789 # Now do the fun stripping stuff
1790 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1791 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1792 # gcc used to install helper binaries in lib/ but then moved to libexec/
1793 [[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1794 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1795
1796 cd "${S}"
1797 if is_crosscompile; then
1798 rm -rf "${D}"/usr/share/{man,info}
1799 rm -rf "${D}"${DATAPATH}/{man,info}
1800 else
1801 local cxx_mandir=${WORKDIR}/build/${CTARGET}/libstdc++-v3/docs/doxygen/man
1802 if [[ -d ${cxx_mandir} ]] ; then
1803 # clean bogus manpages #113902
1804 find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1805 cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
1806 fi
1807 has noinfo ${FEATURES} \
1808 && rm -r "${D}/${DATAPATH}"/info \
1809 || prepinfo "${DATAPATH}"
1810 has noman ${FEATURES} \
1811 && rm -r "${D}/${DATAPATH}"/man \
1812 || prepman "${DATAPATH}"
1813 fi
1814 # prune empty dirs left behind
1815 find "${D}" -type d | xargs rmdir >& /dev/null
1816
1817 # install testsuite results
1818 if use test; then
1819 docinto testsuite
1820 find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc
1821 find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \
1822 | xargs -0 dodoc
1823 fi
1824
1825 # Rather install the script, else portage with changing $FILESDIR
1826 # between binary and source package borks things ....
1827 if ! is_crosscompile ; then
1828 insinto "${DATAPATH}"
1829 if tc_version_is_at_least 4.0 ; then
1830 newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1831 find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1832 else
1833 doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1834 fi
1835 exeinto "${DATAPATH}"
1836 doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1837 doexe "${GCC_FILESDIR}"/c{89,99} || die
1838 fi
1839
1840 # use gid of 0 because some stupid ports don't have
1841 # the group 'root' set to gid 0
1842 chown -R root:0 "${D}"${LIBPATH}
1843
1844 # Create config files for eselect-compiler
1845 create_eselect_conf
1846
1847 # Cpoy the needed minispec for hardened gcc 4
1848 copy_minispecs_gcc_specs
1849}
1850
1851gcc_slot_java() {
1852 local x
1748 1853
1749 # Move Java headers to compiler-specific dir 1854 # Move Java headers to compiler-specific dir
1750 for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do 1855 for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1751 [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/ 1856 [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1752 done 1857 done
1756 mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/ 1861 mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1757 rm -rf "${D}"${PREFIX}/include/${x} 1862 rm -rf "${D}"${PREFIX}/include/${x}
1758 fi 1863 fi
1759 done 1864 done
1760 1865
1761 if [[ -d ${D}${PREFIX}/lib/security ]] ; then 1866 if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1762 dodir /${LIBPATH}/security 1867 dodir /${LIBPATH}/security
1763 mv -f "${D}"${PREFIX}/lib/security/* "${D}"${LIBPATH}/security 1868 mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1764 rm -rf "${D}"${PREFIX}/lib/security 1869 rm -rf "${D}"${PREFIX}/lib*/security
1765 fi 1870 fi
1766 1871
1767 # Move libgcj.spec to compiler-specific directories 1872 # Move libgcj.spec to compiler-specific directories
1768 [[ -f ${D}${PREFIX}/lib/libgcj.spec ]] && \ 1873 [[ -f ${D}${PREFIX}/lib/libgcj.spec ]] && \
1769 mv -f "${D}"${PREFIX}/lib/libgcj.spec "${D}"${LIBPATH}/libgcj.spec 1874 mv -f "${D}"${PREFIX}/lib/libgcj.spec "${D}"${LIBPATH}/libgcj.spec
1875
1876 # SLOT up libgcj.pc (and let gcc-config worry about links)
1877 local libgcj=$(find "${D}"${PREFIX}/lib/pkgconfig/ -name 'libgcj*.pc')
1878 if [[ -n ${libgcj} ]] ; then
1879 sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${libgcj}"
1880 mv "${libgcj}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die
1881 fi
1770 1882
1771 # Rename jar because it could clash with Kaffe's jar if this gcc is 1883 # Rename jar because it could clash with Kaffe's jar if this gcc is
1772 # primary compiler (aka don't have the -<version> extension) 1884 # primary compiler (aka don't have the -<version> extension)
1773 cd "${D}"${BINPATH} 1885 cd "${D}"${BINPATH}
1774 [[ -f jar ]] && mv -f jar gcj-jar 1886 [[ -f jar ]] && mv -f jar gcj-jar
1775
1776 # Move <cxxabi.h> to compiler-specific directories
1777 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
1778 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
1779
1780 # These should be symlinks
1781 dodir /usr/bin
1782 cd "${D}"${BINPATH}
1783 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
1784 # For some reason, g77 gets made instead of ${CTARGET}-g77...
1785 # this should take care of that
1786 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
1787
1788 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
1789 ln -sf ${CTARGET}-${x} ${x}
1790
1791 # Create version-ed symlinks
1792 dosym ${BINPATH}/${CTARGET}-${x} \
1793 /usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1794 dosym ${BINPATH}/${CTARGET}-${x} \
1795 /usr/bin/${x}-${GCC_CONFIG_VER}
1796 fi
1797
1798 if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then
1799 rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER}
1800 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
1801 fi
1802 done
1803
1804 # I do not know if this will break gcj stuff, so I'll only do it for
1805 # objc for now; basically "ffi.h" is the correct file to include,
1806 # but it gets installed in .../GCCVER/include and yet it does
1807 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
1808 # is installed in .../GCCVER/include/libffi; the following fixes
1809 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
1810 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
1811 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
1812 rm -r "${D}"${LIBPATH}/include/libffi || die
1813 fi
1814
1815 # Now do the fun stripping stuff
1816 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1817 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1818 # gcc used to install helper binaries in lib/ but then moved to libexec/
1819 [[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1820 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1821
1822 cd "${S}"
1823 if is_crosscompile; then
1824 rm -rf "${D}"/usr/share/{man,info}
1825 rm -rf "${D}"${DATAPATH}/{man,info}
1826 else
1827 local cxx_mandir=${WORKDIR}/build/${CTARGET}/libstdc++-v3/docs/doxygen/man
1828 if [[ -d ${cxx_mandir} ]] ; then
1829 # clean bogus manpages #113902
1830 find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1831 cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
1832 fi
1833 has noinfo ${FEATURES} \
1834 && rm -r "${D}/${DATAPATH}"/info \
1835 || prepinfo "${DATAPATH}"
1836 has noman ${FEATURES} \
1837 && rm -r "${D}/${DATAPATH}"/man \
1838 || prepman "${DATAPATH}"
1839 fi
1840 # prune empty dirs left behind
1841 find "${D}" -type d | xargs rmdir >& /dev/null
1842
1843 # install testsuite results
1844 if use test; then
1845 docinto testsuite
1846 find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc
1847 find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \
1848 | xargs -0 dodoc
1849 fi
1850
1851 # Rather install the script, else portage with changing $FILESDIR
1852 # between binary and source package borks things ....
1853 if ! is_crosscompile ; then
1854 insinto "${DATAPATH}"
1855 if tc_version_is_at_least 4.0 ; then
1856 newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1857 find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1858 else
1859 doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1860 fi
1861 exeinto "${DATAPATH}"
1862 doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1863 doexe "${GCC_FILESDIR}"/c{89,99} || die
1864 fi
1865
1866 # use gid of 0 because some stupid ports don't have
1867 # the group 'root' set to gid 0
1868 chown -R root:0 "${D}"${LIBPATH}
1869
1870 # Create config files for eselect-compiler
1871 create_eselect_conf
1872
1873 # Cpoy the needed minispec for hardened gcc 4
1874 copy_minispecs_gcc_specs
1875} 1887}
1876 1888
1877# Move around the libs to the right location. For some reason, 1889# Move around the libs to the right location. For some reason,
1878# when installing gcc, it dumps internal libraries into /usr/lib 1890# when installing gcc, it dumps internal libraries into /usr/lib
1879# instead of the private gcc lib path 1891# instead of the private gcc lib path

Legend:
Removed from v.1.381  
changed lines
  Added in v.1.382

  ViewVC Help
Powered by ViewVC 1.1.20