Merge branch 'eschnett/gcc-osx-2' of git://github.com/eschnett/spack into eschnett-eschnett/gcc-osx-2
This commit is contained in:
commit
9061800b30
@ -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++,
|
||||||
@ -47,24 +48,29 @@ 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("isl", when='@5.0:')
|
depends_on("isl", when='@5.0:')
|
||||||
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')
|
||||||
|
|
||||||
|
# TODO: integrate these libraries.
|
||||||
#depends_on("ppl")
|
#depends_on("ppl")
|
||||||
#depends_on("cloog")
|
#depends_on("cloog")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
# libjava/configure needs a minor fix to install into spack paths.
|
# libjava/configure needs a minor fix to install into spack paths.
|
||||||
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
|
||||||
@ -72,21 +78,24 @@ def install(self, spec, prefix):
|
|||||||
"--libdir=%s/lib64" % prefix,
|
"--libdir=%s/lib64" % prefix,
|
||||||
"--disable-multilib",
|
"--disable-multilib",
|
||||||
"--enable-languages=" + ','.join(enabled_languages),
|
"--enable-languages=" + ','.join(enabled_languages),
|
||||||
"--with-mpc=%s" % spec['mpc'].prefix,
|
"--with-mpc=%s" % spec['mpc'].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
|
||||||
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
|
if spec.satisfies('+binutils'):
|
||||||
binutils_options = ["--with-sysroot=/",
|
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
|
||||||
"--with-stage1-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
binutils_options = ["--with-sysroot=/",
|
||||||
"--with-boot-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
"--with-stage1-ldflags=%s %s" %
|
||||||
"--with-ld=%s/bin/ld" % spec['binutils'].prefix,
|
(self.rpath_args, static_bootstrap_flags),
|
||||||
"--with-as=%s/bin/as" % spec['binutils'].prefix]
|
"--with-boot-ldflags=%s %s" %
|
||||||
options.extend(binutils_options)
|
(self.rpath_args, static_bootstrap_flags),
|
||||||
|
"--with-gnu-ld",
|
||||||
|
"--with-ld=%s/bin/ld" % spec['binutils'].prefix,
|
||||||
|
"--with-gnu-as",
|
||||||
|
"--with-as=%s/bin/as" % spec['binutils'].prefix]
|
||||||
|
options.extend(binutils_options)
|
||||||
# Isl
|
# Isl
|
||||||
if 'isl' in spec:
|
if 'isl' in spec:
|
||||||
isl_options = ["--with-isl=%s" % spec['isl'].prefix]
|
isl_options = ["--with-isl=%s" % spec['isl'].prefix]
|
||||||
@ -114,7 +123,8 @@ def write_rpath_specs(self):
|
|||||||
"""Generate a spec file so the linker adds a rpath to the libs
|
"""Generate a spec file so the linker adds a rpath to the libs
|
||||||
the compiler used to build the executable."""
|
the compiler used to build the executable."""
|
||||||
if not self.spec_dir:
|
if not self.spec_dir:
|
||||||
tty.warn("Could not install specs for %s." % self.spec.format('$_$@'))
|
tty.warn("Could not install specs for %s." %
|
||||||
|
self.spec.format('$_$@'))
|
||||||
return
|
return
|
||||||
|
|
||||||
gcc = Executable(join_path(self.prefix.bin, 'gcc'))
|
gcc = Executable(join_path(self.prefix.bin, 'gcc'))
|
||||||
@ -124,5 +134,6 @@ def write_rpath_specs(self):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
out.write(line + "\n")
|
out.write(line + "\n")
|
||||||
if line.startswith("*link:"):
|
if line.startswith("*link:"):
|
||||||
out.write("-rpath %s/lib:%s/lib64 \\\n"% (self.prefix, self.prefix))
|
out.write("-rpath %s/lib:%s/lib64 \\\n" %
|
||||||
|
(self.prefix, self.prefix))
|
||||||
set_install_permissions(specs_file)
|
set_install_permissions(specs_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user