From 1dc2cc1443ef106bf8fd5ec26a0861b5e4cd0e83 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 12 Jul 2015 01:04:12 +0100 Subject: first draft of our sanely splitted gcc, it works, but there is still some work to do --- sys-devel/base-gcc/base-gcc-4.8.4.ebuild | 87 +++++++++++++------------------- sys-devel/base-gcc/files/c89 | 20 ++++++++ sys-devel/base-gcc/files/c99 | 21 ++++++++ 3 files changed, 75 insertions(+), 53 deletions(-) create mode 100755 sys-devel/base-gcc/files/c89 create mode 100755 sys-devel/base-gcc/files/c99 (limited to 'sys-devel/base-gcc') diff --git a/sys-devel/base-gcc/base-gcc-4.8.4.ebuild b/sys-devel/base-gcc/base-gcc-4.8.4.ebuild index e5bd7281..54e81e91 100644 --- a/sys-devel/base-gcc/base-gcc-4.8.4.ebuild +++ b/sys-devel/base-gcc/base-gcc-4.8.4.ebuild @@ -47,62 +47,24 @@ src_prepare() { } src_install() { - cd "${WORKDIR}/build" - emake -j1 -C "${CTARGET}/libgcc" DESTDIR="${D}" install-shared || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libgcc" DESTDIR="${D}" install-shared || die - fi - - if use mudlap ; then - emake -j1 -C "${CTARGET}/libmudflap" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libmudflap" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - fi - fi - - if use openmp ; then - emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libgomp" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - fi - fi + # first, install full gcc + toolchain_src_install - for lib in "libatomic" "libitm" "libsanitizer/asan" "libstdc++-v3/src" ; do - emake -j1 -C "${CTARGET}/$lib" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - done + # define folders to be dropped, as they are provided by sys-devel/gcc-${PV} + export local bindir="${D}usr/bin" + export local libexecdir="${D}usr/libexec" + export local usrdir="${D}usr/$(uname -m)-pc-linux-gnu" + export local sharedir="${D}usr/share" + export local debugdir="${D}usr/lib/debug" + export local libdir="${D}usr/lib/gcc/$(uname -m)-pc-linux-gnu/${PV}" if use multilib ; then - for lib in "libatomic" "libitm" "libsanitizer/asan" "libstdc++-v3/src" ; do - emake -j1 -C "${CTARGET}/32/$lib" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - done - fi - - if use quadmath ; then - emake -j1 -C "${CTARGET}/libquadmath" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libquadmath" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - fi + export local multilibdir="${D}usr/lib/gcc/$(uname -m)-pc-linux-gnu/${PV}/32" fi - if use fortran ; then - emake -j1 -C "${CTARGET}/libgfortran" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libgfortran" DESTDIR="${D}" install-toolexeclibLTLIBRARIES || die - fi - fi - - if use objc ; then - emake -j1 -C "${CTARGET}/libobjc" DESTDIR="${D}" install-libs || die - if use multilib ; then - emake -j1 -C "${CTARGET}/32/libobjc" DESDIR="${D}" install-libs || die - fi - fi - - dodit /etc/env.d/gcc - create_gcc_ent_entry - - if want_minispecs ; then - copy_minispecs_gcc_specs - fi + # drop binaries, debug symbols && headers, they're provided by sys-devel/gcc-${PV} + for extra in "$bindir" "$libexecdir" "$usrdir" "$sharedir" "$debugdir" "$libdir/include" "$libdir/finclude" "$libdir/include-fixed" "$libdir/plugin"; do + rm -rf "$extra" + done } pkg_preinst() { @@ -110,5 +72,24 @@ pkg_preinst() { } pkg_postinst() { - : + # RogentOS specific bits to always force the latest gcc profile + export local gcc_atom=$(best_version sys-devel/base-gcc) + export local gcc_ver= + if [[ -n "${gcc_atom}" ]] ; then + elog "Found latest base-gcc to be: ${gcc_atom}, forcing this profile" + gcc_ver=$(portageq metadata "${ROOT}" installed "${gcc_atom}" PV) + else + eerror "No sys-devel/base-gcc installed" + fi + + if [[ -n "${gcc_ver}" ]] ; then + export local target="${CTARGET:${CHOST}}-${gcc_ver}" + export local env_target="${ROOT}/etc/env.d/gcc/${target}" + if [[ -e "${env_target}-vanilla" ]] ; then + elog "Setting: ${target} GCC profile" + gcc-config "${target}" + fi + else + eerror "No sys-devel/base-gcc version installed? Cannot set a proper GCC profile" + fi } diff --git a/sys-devel/base-gcc/files/c89 b/sys-devel/base-gcc/files/c89 new file mode 100755 index 00000000..cee0325f --- /dev/null +++ b/sys-devel/base-gcc/files/c89 @@ -0,0 +1,20 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-2.95): +# -ansi +# -std=c89 +# -std=iso9899:1990 + +for i; do + case "$i" in + -ansi|-std=c89|-std=iso9899:1990) + ;; + -std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" diff --git a/sys-devel/base-gcc/files/c99 b/sys-devel/base-gcc/files/c99 new file mode 100755 index 00000000..c9542095 --- /dev/null +++ b/sys-devel/base-gcc/files/c99 @@ -0,0 +1,21 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-3.3): +# -std=c99 +# -std=c9x +# -std=iso9899:1999 +# -std=iso9899:199x + +for i; do + case "$i" in + -std=c9[9x]|-std=iso9899:199[9x]) + ;; + -ansi|-std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} -- cgit v1.2.3