Since my last patch didn't get traction, here is a new approach to building gcc on Darwin:
- Add a variant specifying whether to build with binutils, defaulting to true - Auto-detect whether this is Darwin; if so, set binutils and gold defaults to false, as they don't work on Darwin - Disable Go, which doesn't build on Darwin - Clean up handling configure options
This commit is contained in:
parent
bcf705b85e
commit
77c17e1d92
1 changed files with 16 additions and 13 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
import sys
|
||||||
|
|
||||||
class Gcc(Package):
|
class Gcc(Package):
|
||||||
"""The GNU Compiler Collection includes front ends for C, C++,
|
"""The GNU Compiler Collection includes front ends for C, C++,
|
||||||
|
@ -49,13 +50,14 @@ class Gcc(Package):
|
||||||
version('4.6.4', 'b407a3d1480c11667f293bfb1f17d1a4')
|
version('4.6.4', 'b407a3d1480c11667f293bfb1f17d1a4')
|
||||||
version('4.5.4', '27e459c2566b8209ab064570e1b378f7')
|
version('4.5.4', '27e459c2566b8209ab064570e1b378f7')
|
||||||
|
|
||||||
variant('gold', default=True, description="Build the gold linker plugin for ld-based LTO")
|
variant('binutils', default=sys.platform != 'darwin', description="Build via binutils")
|
||||||
|
variant('gold', default=sys.platform != 'darwin', description="Build the gold linker plugin for ld-based LTO")
|
||||||
|
|
||||||
depends_on("mpfr")
|
depends_on("mpfr")
|
||||||
depends_on("gmp")
|
depends_on("gmp")
|
||||||
depends_on("mpc") # when @4.5:
|
depends_on("mpc") # when @4.5:
|
||||||
depends_on("binutils~libiberty", when='~gold')
|
depends_on("binutils~libiberty", when='+binutils ~gold')
|
||||||
depends_on("binutils~libiberty+gold", when='+gold')
|
depends_on("binutils~libiberty+gold", when='+binutils +gold')
|
||||||
|
|
||||||
# Save these until we can do optional deps.
|
# Save these until we can do optional deps.
|
||||||
depends_on("isl", when=DEPENDS_ON_ISL_PREDICATE)
|
depends_on("isl", when=DEPENDS_ON_ISL_PREDICATE)
|
||||||
|
@ -67,7 +69,7 @@ def install(self, spec, prefix):
|
||||||
filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure', string=True)
|
filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure', string=True)
|
||||||
|
|
||||||
enabled_languages = set(('c', 'c++', 'fortran', 'java', 'objc'))
|
enabled_languages = set(('c', 'c++', 'fortran', 'java', 'objc'))
|
||||||
if spec.satisfies("@4.7.1:"):
|
if spec.satisfies("@4.7.1:") and sys.platform != 'darwin':
|
||||||
enabled_languages.add('go')
|
enabled_languages.add('go')
|
||||||
|
|
||||||
# Generic options to compile GCC
|
# Generic options to compile GCC
|
||||||
|
@ -79,15 +81,16 @@ def install(self, spec, prefix):
|
||||||
"--with-mpfr=%s" % spec['mpfr'].prefix,
|
"--with-mpfr=%s" % spec['mpfr'].prefix,
|
||||||
"--with-gmp=%s" % spec['gmp'].prefix,
|
"--with-gmp=%s" % spec['gmp'].prefix,
|
||||||
"--enable-lto",
|
"--enable-lto",
|
||||||
"--with-gnu-ld",
|
|
||||||
"--with-gnu-as",
|
|
||||||
"--with-quad"]
|
"--with-quad"]
|
||||||
# Binutils
|
# Binutils
|
||||||
|
if spec.satisfies('+binutils'):
|
||||||
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
|
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
|
||||||
binutils_options = ["--with-sysroot=/",
|
binutils_options = ["--with-sysroot=/",
|
||||||
"--with-stage1-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
"--with-stage1-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
||||||
"--with-boot-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
"--with-boot-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
||||||
|
"--with-gnu-ld",
|
||||||
"--with-ld=%s/bin/ld" % spec['binutils'].prefix,
|
"--with-ld=%s/bin/ld" % spec['binutils'].prefix,
|
||||||
|
"--with-gnu-as",
|
||||||
"--with-as=%s/bin/as" % spec['binutils'].prefix]
|
"--with-as=%s/bin/as" % spec['binutils'].prefix]
|
||||||
options.extend(binutils_options)
|
options.extend(binutils_options)
|
||||||
# Isl
|
# Isl
|
||||||
|
|
Loading…
Reference in a new issue