dev-lang/ghc: restore HCFLAGS=-O1 for UNREG arches
authorSergei Trofimovich <slyfox@gentoo.org>
Tue, 23 May 2017 20:58:12 +0000 (21:58 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Tue, 23 May 2017 21:15:48 +0000 (22:15 +0100)
This fix is primary to restore ia64 support.

But in general it speeds GHC build up substantially:
from 10+ hours down to 3.5 hours.

Package-Manager: Portage-2.3.6, Repoman-2.3.2

dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch [new file with mode: 0644]
dev-lang/ghc/ghc-8.0.2.ebuild

diff --git a/dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch b/dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch
new file mode 100644 (file)
index 0000000..b64d65b
--- /dev/null
@@ -0,0 +1,35 @@
+ghc -O2 generates too large C files for unregisterised compiler.
+On ia64 it causes DynFlags to compile for 60 minutes (then assembler
+crashes).
+
+To decrease C code inflation we don't use -O2 in UNREG mode.
+diff --git a/mk/config.mk.in b/mk/config.mk.in
+index bfaaa66..d8f93b3 100644
+--- a/mk/config.mk.in
++++ b/mk/config.mk.in
+@@ -72,11 +72,2 @@ GhcStage3HcOpts=-O2
+
+-# Disable -O2 optimization. Otherwise amount of generated C code
+-# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')
+-# and sometimes not compile at all (powerpc64 overflows something
+-# on 'compiler/hsSyn/HsExpr.lhs').
+-ifeq "$(GhcUnregisterised)" "YES"
+-GhcStage1HcOpts=
+-GhcStage2HcOpts=
+-GhcStage3HcOpts=
+-endif
+
+@@ -894 +885,13 @@ CURSES_INCLUDE_DIRS = @CURSES_INCLUDE_DIRS@
+ CURSES_LIB_DIRS = @CURSES_LIB_DIRS@
++
++# Disable -O2 optimization. Otherwise amount of generated C code
++# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')
++# and sometimes not compile at all (powerpc64 overflows something
++# on 'compiler/hsSyn/HsExpr.lhs').
++ifeq "$(GhcUnregisterised)" "YES"
++GhcStage1HcOpts=
++GhcStage2HcOpts=
++GhcStage3HcOpts=
++
++GhcLibHcOpts=
++endif
index 5dc0277ec6fdd0b2e80483e37b6519101369c1ed..6ca4874cefef6f46452dc7e0ef0735ba7e308269 100644 (file)
@@ -459,6 +459,7 @@ src_prepare() {
                epatch "${FILESDIR}"/${PN}-8.0.1-par-g0-on-A32.patch
                epatch "${FILESDIR}"/${PN}-8.0.2_rc2-old-sphinx.patch
                epatch "${FILESDIR}"/${PN}-8.0.2-libffi-alpha.patch
+               epatch "${FILESDIR}"/${PN}-8.0.2-O2-unreg.patch
 
                if use prefix; then
                        # Make configure find docbook-xsl-stylesheets from Prefix