patch older config.guess for newer architectures (#2221)

This commit is contained in:
Gregory Lee 2016-11-04 12:12:37 -07:00 committed by Todd Gamblin
parent 296a349d49
commit ee6eb508cb
12 changed files with 145 additions and 77 deletions

View File

@ -2026,8 +2026,8 @@ The last element of a package is its ``install()`` method. This is
where the real work of installation happens, and it's the main part of
the package you'll need to customize for each piece of software.
.. literalinclude:: ../../../var/spack/repos/builtin/packages/libelf/package.py
:pyobject: Libelf.install
.. literalinclude:: ../../../var/spack/repos/builtin/packages/libpng/package.py
:pyobject: Libpng.install
:linenos:
``install`` takes a ``spec``: a description of how the package should

View File

@ -24,7 +24,11 @@
##############################################################################
import inspect
import os
import os.path
import shutil
from subprocess import PIPE
from subprocess import check_call
import llnl.util.tty as tty
from spack.package import PackageBase
@ -46,6 +50,79 @@ class AutotoolsPackage(PackageBase):
# To be used in UI queries that require to know which
# build-system class we are using
build_system_class = 'AutotoolsPackage'
patch_config_guess = True
def do_patch_config_guess(self):
"""Some packages ship with an older config.guess and need to have
this updated when installed on a newer architecture."""
my_config_guess = None
config_guess = None
if os.path.exists('config.guess'):
# First search the top-level source directory
my_config_guess = 'config.guess'
else:
# Then search in all sub directories.
# We would like to use AC_CONFIG_AUX_DIR, but not all packages
# ship with their configure.in or configure.ac.
d = '.'
dirs = [os.path.join(d, o) for o in os.listdir(d)
if os.path.isdir(os.path.join(d, o))]
for dirname in dirs:
path = os.path.join(dirname, 'config.guess')
if os.path.exists(path):
my_config_guess = path
if my_config_guess is not None:
try:
check_call([my_config_guess], stdout=PIPE, stderr=PIPE)
# The package's config.guess already runs OK, so just use it
return True
except:
pass
# Look for a spack-installed automake package
if 'automake' in self.spec:
automake_path = os.path.join(self.spec['automake'].prefix, 'share',
'automake-' +
str(self.spec['automake'].version))
path = os.path.join(automake_path, 'config.guess')
if os.path.exists(path):
config_guess = path
if config_guess is not None:
try:
check_call([config_guess], stdout=PIPE, stderr=PIPE)
shutil.copyfile(config_guess, my_config_guess)
return True
except:
pass
# Look for the system's config.guess
if os.path.exists('/usr/share'):
automake_dir = [s for s in os.listdir('/usr/share') if
"automake" in s]
if automake_dir:
automake_path = os.path.join('/usr/share', automake_dir[0])
path = os.path.join(automake_path, 'config.guess')
if os.path.exists(path):
config_guess = path
if config_guess is not None:
try:
check_call([config_guess], stdout=PIPE, stderr=PIPE)
shutil.copyfile(config_guess, my_config_guess)
return True
except:
pass
return False
def patch(self):
"""Perform any required patches."""
if self.patch_config_guess and self.spec.satisfies(
'arch=linux-redhat7-ppc64le'):
if not self.do_patch_config_guess():
raise RuntimeError('Failed to find suitable config.guess')
def autoreconf(self, spec, prefix):
"""Not needed usually, configure should be already there"""

View File

@ -25,7 +25,7 @@
from spack import *
class Cairo(Package):
class Cairo(AutotoolsPackage):
"""Cairo is a 2D graphics library with support for multiple output
devices."""
homepage = "http://cairographics.org"
@ -40,9 +40,7 @@ class Cairo(Package):
depends_on("pkg-config", type="build")
depends_on("fontconfig@2.10.91:") # Require newer version of fontconfig.
def install(self, spec, prefix):
configure("--prefix=%s" % prefix,
"--disable-trace", # can cause problems with libiberty
"--enable-tee")
make()
make("install")
def configure_args(self):
args = ["--disable-trace", # can cause problems with libiberty
"--enable-tee"]
return args

View File

@ -33,6 +33,13 @@ class Dyninst(Package):
url = "https://github.com/dyninst/dyninst/archive/v9.2.0.tar.gz"
list_url = "http://www.dyninst.org/downloads/dyninst-8.x"
# version 9.2.1b was the latest git commit when trying to port to a
# ppc64le system to get fixes in computeAddrWidth independent of
# endianness. This version can be removed if the next release includes
# this change. The actual commit was
# b8596ad4023ec40ac07e669ff8ea3ec06e262703
version('9.2.1b', git='https://github.com/dyninst/dyninst.git',
commit='859cb778e20b619443c943c96dd1851da763142b')
version('9.2.0', 'ad023f85e8e57837ed9de073b59d6bab',
url="https://github.com/dyninst/dyninst/archive/v9.2.0.tar.gz")
version('9.1.0', '5c64b77521457199db44bec82e4988ac',
@ -67,19 +74,21 @@ def install(self, spec, prefix):
libdwarf = spec['libdwarf'].prefix
with working_dir('spack-build', create=True):
cmake('..',
'-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include,
'-DBoost_LIBRARY_DIR=%s' % spec['boost'].prefix.lib,
'-DBoost_NO_SYSTEM_PATHS=TRUE',
'-DLIBELF_INCLUDE_DIR=%s' % join_path(
libelf.include, 'libelf'),
'-DLIBELF_LIBRARIES=%s' % join_path(
libelf.lib, 'libelf.so'),
'-DLIBDWARF_INCLUDE_DIR=%s' % libdwarf.include,
'-DLIBDWARF_LIBRARIES=%s' % join_path(
libdwarf.lib, 'libdwarf.so'),
*std_cmake_args)
args = ['..',
'-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include,
'-DBoost_LIBRARY_DIR=%s' % spec['boost'].prefix.lib,
'-DBoost_NO_SYSTEM_PATHS=TRUE',
'-DLIBELF_INCLUDE_DIR=%s' % join_path(
libelf.include, 'libelf'),
'-DLIBELF_LIBRARIES=%s' % join_path(
libelf.lib, 'libelf.so'),
'-DLIBDWARF_INCLUDE_DIR=%s' % libdwarf.include,
'-DLIBDWARF_LIBRARIES=%s' % join_path(
libdwarf.lib, 'libdwarf.so')]
if spec.satisfies('arch=linux-redhat7-ppc64le'):
args.append('-Darch_ppc64_little_endian=1')
args += std_cmake_args
cmake(*args)
make()
make("install")

View File

@ -25,7 +25,7 @@
from spack import *
class Fontconfig(Package):
class Fontconfig(AutotoolsPackage):
"""Fontconfig customizing font access"""
homepage = "http://www.freedesktop.org/wiki/Software/fontconfig/"
url = "http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.1.tar.gz"
@ -36,10 +36,6 @@ class Fontconfig(Package):
depends_on('libxml2')
depends_on('pkg-config', type='build')
def install(self, spec, prefix):
configure("--prefix=%s" % prefix,
"--enable-libxml2",
"--disable-docs")
make()
make("install")
def configure_args(self):
args = ["--enable-libxml2", "--disable-docs"]
return args

View File

@ -24,9 +24,10 @@
##############################################################################
from spack import *
import sys
import shutil
class Graphviz(Package):
class Graphviz(AutotoolsPackage):
"""Graph Visualization Software"""
homepage = "http://www.graphviz.org"
url = "http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.38.0.tar.gz"
@ -46,11 +47,13 @@ class Graphviz(Package):
depends_on("swig")
depends_on("python")
depends_on("ghostscript")
depends_on("freetype")
depends_on("libtool", type='build')
depends_on("pkg-config", type='build')
def install(self, spec, prefix):
options = ['--prefix=%s' % prefix]
if '+perl' not in spec:
def configure_args(self):
options = []
if '+perl' not in self.spec:
options.append('--disable-perl')
# On OSX fix the compiler error:
@ -59,7 +62,9 @@ def install(self, spec, prefix):
# include <X11/Xlib.h>
if sys.platform == 'darwin':
options.append('CFLAGS=-I/opt/X11/include')
options.append('--with-ltdl-lib=%s/lib' % self.spec['libtool'].prefix)
configure(*options)
make()
make("install")
# A hack to patch config.guess in the libltdl sub directory
shutil.copyfile('./config/config.guess', 'libltdl/config/config.guess')
return options

View File

@ -25,7 +25,7 @@
from spack import *
class Libelf(Package):
class Libelf(AutotoolsPackage):
"""libelf lets you read, modify or create ELF object files in an
architecture-independent way. The library takes care of size
and endian issues, e.g. you can process a file for SPARC
@ -38,13 +38,13 @@ class Libelf(Package):
version('0.8.12', 'e21f8273d9f5f6d43a59878dc274fec7')
provides('elf')
depends_on('automake', type='build')
def configure_args(self):
args = ["--enable-shared",
"--disable-dependency-tracking",
"--disable-debug"]
return args
def install(self, spec, prefix):
configure("--prefix=" + prefix,
"--enable-shared",
"--disable-dependency-tracking",
"--disable-debug")
make()
# The mkdir commands in libelf's install can fail in parallel
make("install", parallel=False)
make('install', parallel=False)

View File

@ -23,9 +23,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import shutil
class Libiconv(Package):
class Libiconv(AutotoolsPackage):
"""GNU libiconv provides an implementation of the iconv() function
and the iconv program for character set conversion."""
@ -38,10 +39,10 @@ class Libiconv(Package):
# of C11 any more and thus might not exist.
patch("gets.patch")
def install(self, spec, prefix):
configure('--prefix={0}'.format(prefix),
'--enable-extra-encodings')
def configure_args(self):
args = ['--enable-extra-encodings']
make()
make('check')
make('install')
# A hack to patch config.guess in the libcharset sub directory
shutil.copyfile('./build-aux/config.guess',
'libcharset/build-aux/config.guess')
return args

View File

@ -25,7 +25,7 @@
from spack import *
class Libtiff(Package):
class Libtiff(AutotoolsPackage):
"""libtiff graphics format library"""
homepage = "http://www.simplesystems.org/libtiff/"
url = "ftp://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz"
@ -36,9 +36,3 @@ class Libtiff(Package):
depends_on('jpeg')
depends_on('zlib')
depends_on('xz')
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install")

View File

@ -25,7 +25,7 @@
from spack import *
class Lzma(Package):
class Lzma(AutotoolsPackage):
"""LZMA Utils are legacy data compression software with high compression
ratio. LZMA Utils are no longer developed, although critical bugs may be
fixed as long as fixing them doesn't require huge changes to the code.
@ -39,11 +39,3 @@ class Lzma(Package):
url = "http://tukaani.org/lzma/lzma-4.32.7.tar.gz"
version('4.32.7', '2a748b77a2f8c3cbc322dbd0b4c9d06a')
def install(self, spec, prefix):
configure('--prefix={0}'.format(prefix))
make()
if self.run_tests:
make('check') # one of the tests fails for me
make('install')

View File

@ -25,7 +25,7 @@
from spack import *
class PyPygobject(Package):
class PyPygobject(AutotoolsPackage):
"""bindings for the GLib, and GObject,
to be used in Python."""
@ -43,6 +43,4 @@ class PyPygobject(Package):
patch('pygobject-2.28.6-introspection-1.patch')
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install", parallel=False)
make('install', parallel=False)

View File

@ -25,7 +25,7 @@
from spack import *
class PyPygtk(Package):
class PyPygtk(AutotoolsPackage):
"""bindings for the Gtk in Python"""
homepage = "http://www.pygtk.org/"
url = "http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-2.24.0.tar.gz"
@ -41,6 +41,4 @@ class PyPygtk(Package):
depends_on('py-py2cairo')
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install", parallel=False)
make('install', parallel=False)