diff --git a/eclass/toolchain-gcc.eclass b/eclass/toolchain-gcc.eclass index 918e2f14..e938d001 100644 --- a/eclass/toolchain-gcc.eclass +++ b/eclass/toolchain-gcc.eclass @@ -16,31 +16,31 @@ DESCRIPTION="Based on the ${ECLASS} eclass" FEATURES=${FEATURES/multilib-strict/} -toolchain_pkg_setup() { +toolchain-gcc_pkg_setup() { gcc_pkg_setup } -toolchain_src_unpack() { +toolchain-gcc_src_unpack() { gcc_src_unpack } -toolchain_src_compile() { +toolchain-gcc_src_compile() { gcc_src_compile } -toolchain_src_test() { +toolchain-gcc_src_test() { gcc_src_test } -toolchain_pkg_preinst() { +toolchain-gcc_pkg_preinst() { ${ETYPE}_pkg_preinst } -toolchain_src_install() { +toolchain-gcc_src_install() { ${ETYPE}_src_install } -toolchain_pkg_postinst() { +toolchain-gcc_pkg_postinst() { ${ETYPE}_pkg_postinst } -toolchain_pkg_prerm() { +toolchain-gcc_pkg_prerm() { ${ETYPE}_pkg_prerm } -toolchain_pkg_postrm() { +toolchain-gcc_pkg_postrm() { ${ETYPE}_pkg_postrm } #----<< eclass stuff >>---- @@ -142,6 +142,7 @@ else [[ -n ${PIE_VER} ]] && IUSE="${IUSE} nopie" [[ -n ${PP_VER} ]] && IUSE="${IUSE} nossp" [[ -n ${HTB_VER} ]] && IUSE="${IUSE} boundschecking" + [[ -n ${LLVM_VER} ]] && IUSE="${IUSE} llvm" [[ -n ${D_VER} ]] && IUSE="${IUSE} d" if version_is_at_least 3 ; then @@ -485,7 +486,7 @@ _want_stuff() { return 1 } want_boundschecking() { _want_stuff HTB_VER boundschecking ; } -want_llvm() { _want_stuff LLVM_VER Low Level Virtual Machine ; } +want_llvm() { _want_stuff LLVM_VER llvm ; } want_pie() { _want_stuff PIE_VER !nopie ; } want_ssp() { _want_stuff PP_VER !nossp ; } @@ -1268,6 +1269,23 @@ gcc_do_configure() { confgcc="${confgcc} --disable-nls" fi + # LLVM Support + if use llvm && ! use build ; then + einfo "Enabling LLVM" + confgcc="${confgcc} --enable-checking --program-prefix=llvm-" + sed -e 's,^LLVMSRCDIR.*,LLVMSRCDIR := $(shell llvm-config --src-root),' \ + -e 's,\$(LLVMSRCDIR)/include,$(shell llvm-config --includedir),g' \ + -e 's,^LLVMOBJDIR.*,LLVMOBJDIR := $(shell llvm-config --obj-root),' \ + -e 's,\$(LLVMOBJDIR)/include,$(shell llvm-config --includedir),g' \ + -e 's,^LLVMBINPATH.*,LLVMBINPATH = $(shell llvm-config --bindir),' \ + -e 's,\$(LLVMBINPATH)/llvm-config,llvm-config,' \ + -i "${S}"/gcc/Makefile.in || die "sed failed" + + sed -e 's,^LLVMBASEPATH.*,LLVMBASEPATH = $(shell llvm-config --obj-root),' \ + -i "${S}"/libcpp/Makefile.in || die "sed failed" + + fi + # reasonably sane globals (hopefully) # --disable-libunwind-exceptions needed till unwind sections get fixed. see ps.m for details confgcc="${confgcc} \ @@ -1416,7 +1434,7 @@ gcc_do_make() { else STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O"} fi - + if is_crosscompile; then # In 3.4, BOOT_CFLAGS is never used on a crosscompile... # but I'll leave this in anyways as someone might have had @@ -1985,6 +2003,11 @@ do_gcc_HTB_patches() { } do_gcc_LLVM_patches() { + if ! want_llvm + then + return 0 + fi + epatch "${WORKDIR}/gcc-${LLVM_GCC_VER}-llvm${LLVM_VER}.patch" release_version="${release_version}, LLVM-${LLVM_GCC_VER}-${LLVM_VER}" } diff --git a/eclass/toolchain-llvm.eclass b/eclass/toolchain-llvm.eclass index d423f472..8d0f1391 100644 --- a/eclass/toolchain-llvm.eclass +++ b/eclass/toolchain-llvm.eclass @@ -198,6 +198,7 @@ toolchain-llvm_src_compile() { --enable-assertions \ --enable-shared \ --enable-optimized \ + --enable-pic \ ${myconf} ${EXTRA_ECONF}" echo ./configure ${myconf} "${S}"/configure ${myconf} || die "configure failed"