Skip to content

Commit

Permalink
AutotoolsPackage: reworked recipe for autoreconf
Browse files Browse the repository at this point in the history
  • Loading branch information
alalazo committed Jan 25, 2017
1 parent d6182d4 commit 634805c
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 122 deletions.
30 changes: 25 additions & 5 deletions lib/spack/spack/build_systems/autotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from subprocess import PIPE
from subprocess import check_call

from spack.package import PackageBase, run_after
import llnl.util.tty as tty
from llnl.util.filesystem import working_dir, join_path
from llnl.util.filesystem import working_dir, join_path, force_remove
from spack.package import PackageBase, run_after, run_before
from spack.util.executable import Executable


Expand Down Expand Up @@ -81,8 +81,14 @@ class AutotoolsPackage(PackageBase):
#: phase
install_targets = ['install']

#: Callback names for build-time test
build_time_test_callbacks = ['check']

#: Set to true to force the autoreconf step even if configure is present
force_autoreconf = False
#: Options to be passed to autoreconf when using the default implementation
autoreconf_extra_args = []

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."""
Expand Down Expand Up @@ -184,6 +190,11 @@ def patch(self):
if not self._do_patch_config_guess():
raise RuntimeError('Failed to find suitable config.guess')

@run_before('autoreconf')
def delete_configure_to_force_update(self):
if self.force_autoreconf:
force_remove(self.configure_abs_path)

def autoreconf(self, spec, prefix):
"""Not needed usually, configure should be already there"""
# If configure exists nothing needs to be done
Expand All @@ -202,11 +213,20 @@ def autoreconf(self, spec, prefix):
tty.warn('*********************************************************')
with working_dir(self.configure_directory):
m = inspect.getmodule(self)
# This part should be redundant in principle, but
# won't hurt
m.libtoolize()
m.aclocal()
m.autoconf()
autogen = Executable('./autogen.sh')
autogen()
# This line is what is needed most of the time
# --install, --verbose, --force
autoreconf_args = ['-ivf']
if 'pkg-config' in spec:
autoreconf_args += [
'-I',
join_path(spec['pkg-config'].prefix, 'share', 'aclocal'),
]
autoreconf_args += self.autoreconf_extra_args
m.autoreconf(*autoreconf_args)

@run_after('autoreconf')
def set_configure_or_die(self):
Expand Down
19 changes: 6 additions & 13 deletions var/spack/repos/builtin/packages/bash-completion/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from spack import *


class BashCompletion(Package):
class BashCompletion(AutotoolsPackage):
"""Programmable completion functions for bash."""
homepage = "https://github.com/scop/bash-completion"
url = "https://github.com/scop/bash-completion/archive/2.3.tar.gz"
url = "https://github.com/scop/bash-completion/archive/2.3.tar.gz"

version('2.3', '67e50f5f3c804350b43f2b664c33dde811d24292')
version('develop', git='https://github.com/scop/bash-completion.git')
Expand All @@ -41,16 +41,9 @@ class BashCompletion(Package):
# Other dependencies
depends_on('bash@4.1:', type='run')

def install(self, spec, prefix):
make_args = ['--prefix=%s' % prefix]

autoreconf('-i')
configure(*make_args)
make()
# make("check") # optional, requires dejagnu and tcllib
make("install",
parallel=False)

@run_after('install')
def show_message_to_user(self):
prefix = self.prefix
# Guidelines for individual user as provided by the author at
# https://github.com/scop/bash-completion
print('=====================================================')
Expand All @@ -59,6 +52,6 @@ def install(self, spec, prefix):
print('')
print('# Use bash-completion, if available')
print('[[ $PS1 && -f %s/share/bash-completion/bash_completion ]] && \ ' % prefix) # NOQA: ignore=E501
print(' . %s/share/bash-completion/bash_completion' % prefix)
print(' . %s/share/bash-completion/bash_completion' % prefix)
print('')
print('=====================================================')
2 changes: 2 additions & 0 deletions var/spack/repos/builtin/packages/bison/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ class Bison(AutotoolsPackage):
version('3.0.4', 'a586e11cd4aff49c3ff6d3b6a4c9ccf8')

depends_on("m4", type='build')

build_directory = 'spack-build'
16 changes: 0 additions & 16 deletions var/spack/repos/builtin/packages/czmq/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,3 @@ class Czmq(AutotoolsPackage):
depends_on('autoconf', type='build')
depends_on('pkg-config', type='build')
depends_on('zeromq')

def autoreconf(self, spec, prefix):
# Work around autogen.sh oddities
# bash = which("bash")
# bash("./autogen.sh")
mkdirp("config")
autoreconf = which("autoreconf")
autoreconf("--install", "--verbose", "--force",
"-I", "config",
"-I", join_path(spec['pkg-config'].prefix,
"share", "aclocal"),
"-I", join_path(spec['automake'].prefix,
"share", "aclocal"),
"-I", join_path(spec['libtool'].prefix,
"share", "aclocal"),
)
8 changes: 4 additions & 4 deletions var/spack/repos/builtin/packages/elfutils/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Elfutils(AutotoolsPackage):

homepage = "https://fedorahosted.org/elfutils/"

depends_on('libtool', type='build')
depends_on('automake', type='build')
depends_on('autoconf', type='build')

version('0.163',
git='git://git.fedorahosted.org/git/elfutils.git',
tag='elfutils-0.163')

provides('elf')

def autoreconf(self, spec, prefix):
autoreconf = which('autoreconf')
autoreconf('-if')

def configure_args(self):
return ['--enable-maintainer-mode']
8 changes: 0 additions & 8 deletions var/spack/repos/builtin/packages/flex/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,3 @@ def url_for_version(self, version):
url += "/archive/flex-{0}.tar.gz".format(version.dashed)

return url

def autoreconf(self, spec, prefix):
pass

@when('@:2.6.0')
def autoreconf(self, spec, prefix):
libtoolize('--install', '--force')
autoreconf('--install', '--force')
2 changes: 1 addition & 1 deletion var/spack/repos/builtin/packages/gcc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def spec_dir(self):
spec_dir = glob("%s/lib64/gcc/*/*" % self.prefix)
return spec_dir[0] if spec_dir else None

@AutotoolsPackage.sanity_check('install')
@run_after('install')
def write_rpath_specs(self):
"""Generate a spec file so the linker adds a rpath to the libs
the compiler used to build the executable."""
Expand Down
17 changes: 2 additions & 15 deletions var/spack/repos/builtin/packages/glib/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,9 @@ class Glib(AutotoolsPackage):
# around a legitimate usage.
patch('no-Werror=format-security.patch')

force_autoreconf = True

def url_for_version(self, version):
"""Handle glib's version-based custom URLs."""
url = 'http://ftp.gnome.org/pub/gnome/sources/glib'
return url + '/%s/glib-%s.tar.xz' % (version.up_to(2), version)

def autoreconf(self, spec, prefix):
autoreconf = which("autoreconf")
autoreconf("--install", "--verbose", "--force",
"-I", "config",
"-I", join_path(spec['pkg-config'].prefix,
"share", "aclocal"),
"-I", join_path(spec['automake'].prefix,
"share", "aclocal"),
"-I", join_path(spec['libtool'].prefix,
"share", "aclocal"),
)

def install(self, spec, prefix):
make("install", parallel=False)
26 changes: 14 additions & 12 deletions var/spack/repos/builtin/packages/gource/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
from spack import *


class Gource(Package):
class Gource(AutotoolsPackage):
"""Software version control visualization."""

homepage = "http://gource.io"
url = "https://github.com/acaudwell/Gource/releases/download/gource-0.44/gource-0.44.tar.gz"
url = "https://github.com/acaudwell/Gource/releases/download/gource-0.44/gource-0.44.tar.gz"

version('0.44', '79cda1bfaad16027d59cce55455bfab88b57c69d')

Expand All @@ -49,15 +49,17 @@ class Gource(Package):
depends_on('sdl2')
depends_on('sdl2-image')

def install(self, spec, prefix):
make_args = ['--prefix=%s' % prefix,
'--disable-dependency-tracking',
'--without-x',
'--with-boost=%s' % spec['boost'].prefix]
parallel = False
force_autoreconf = True

autoreconf('-i')
configure(*make_args)
make()
def url_for_version(self, version):
tmp = 'https://github.com/acaudwell/Gource/releases/download/gource-{0}/gource-{0}.tar.gz' # NOQA: ignore=E501
return tmp.format(version.dotted)

make("install",
parallel=False)
def configure_args(self):
spec = self.spec
return [
'--disable-dependency-tracking',
'--without-x',
'--with-boost=%s' % spec['boost'].prefix
]
16 changes: 2 additions & 14 deletions var/spack/repos/builtin/packages/libgd/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class Libgd(AutotoolsPackage):
"""

homepage = "https://github.com/libgd/libgd"
url = "https://github.com/libgd/libgd/archive/gd-2.1.1.tar.gz"
url = 'https://github.com/libgd/libgd/releases/download/gd-2.2.4/libgd-2.2.4.tar.gz'

version('2.2.4', '0a3c307b5075edbe1883543dd1153c02')
version('2.2.3', 'a67bd15fa33d4aac0a1c7904aed19f49')
version('2.1.1', 'e91a1a99903e460e7ba00a794e72cc1e')

Expand All @@ -54,16 +55,3 @@ class Libgd(AutotoolsPackage):
depends_on('libpng')
depends_on('libtiff')
depends_on('fontconfig')

def autoreconf(self, spec, prefix):
autoreconf("--install", "--force",
"-I", "m4",
"-I", join_path(spec['gettext'].prefix,
"share", "aclocal"),
"-I", join_path(spec['pkg-config'].prefix,
"share", "aclocal"),
"-I", join_path(spec['automake'].prefix,
"share", "aclocal"),
"-I", join_path(spec['libtool'].prefix,
"share", "aclocal")
)
28 changes: 5 additions & 23 deletions var/spack/repos/builtin/packages/libquo/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import os


class Libquo(Package):
class Libquo(AutotoolsPackage):
"""A high-level, easy to use programming interface tailored specifically
for MPI/MPI+X codes that may benefit from evolving process binding
policies during their execution. QUO allows for arbitrary process binding
Expand All @@ -44,25 +43,8 @@ class Libquo(Package):
depends_on('automake', type='build')
depends_on('libtool', type='build')

def install(self, spec, prefix):
autoreconf_options = [
'--install',
'--verbose',
'--force',
'-I', 'config',
'-I', os.path.join(spec['automake'].prefix,
'share', 'aclocal'),
'-I', os.path.join(spec['libtool'].prefix,
'share', 'aclocal')
def configure_args(self):
return [
'CC={0}'.format(self.spec['mpi'].mpicc),
'FC={0}'.format(self.spec['mpi'].mpifc)
]
autoreconf(*autoreconf_options)

configure_options = [
'--prefix={0}'.format(prefix),
'CC=%s' % join_path(spec['mpi'].prefix.bin, "mpicc"),
'FC=%s' % join_path(spec['mpi'].prefix.bin, "mpif90")
]
configure(*configure_options)

make()
make('install')
2 changes: 2 additions & 0 deletions var/spack/repos/builtin/packages/libuv/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ class Libuv(AutotoolsPackage):
depends_on('libtool', type='build')

def autoreconf(self, spec, prefix):
# This is needed because autogen.sh generates on-the-fly
# an m4 macro needed during configuration
bash = which("bash")
bash('autogen.sh')
7 changes: 4 additions & 3 deletions var/spack/repos/builtin/packages/netcdf-cxx4/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class NetcdfCxx4(AutotoolsPackage):
version('4.2.1', 'd019853802092cf686254aaba165fc81')

depends_on('netcdf')

depends_on('automake', type='build')
depends_on('autoconf', type='build')
depends_on('libtool', type='build')

def autoreconf(self, spec, prefix):
# Rebuild to prevent problems of inconsistency in git repo
which('autoreconf')('-ivf')
force_autoreconf = True
20 changes: 12 additions & 8 deletions var/spack/repos/builtin/packages/plumed/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from spack import *


class Plumed(Package):
class Plumed(AutotoolsPackage):
"""PLUMED is an open source library for free energy calculations in
molecular systems which works together with some of the most popular
molecular dynamics engines.
Expand Down Expand Up @@ -67,6 +67,8 @@ class Plumed(Package):
depends_on('gsl', when='+gsl')

depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')

# Dictionary mapping PLUMED versions to the patches it provides
# interactively
Expand All @@ -84,6 +86,8 @@ class Plumed(Package):
}
}

force_autoreconf = True

def apply_patch(self, other):
plumed = subprocess.Popen(
[join_path(self.spec.prefix.bin, 'plumed'), 'patch', '-p'],
Expand All @@ -99,12 +103,15 @@ def setup_dependent_package(self, module, ext_spec):
# Make plumed visible from dependent packages
module.plumed = Executable(join_path(self.spec.prefix.bin, 'plumed'))

def install(self, spec, prefix):
@run_before('autoreconf')
def filter_gslcblas(self):
# This part is needed to avoid linking with gsl cblas
# interface which will mask the cblas interface
# provided by optimized libraries due to linking order
filter_file('-lgslcblas', '', 'configure.ac')
autoreconf('-ivf')

def configure_args(self):
spec = self.spec

# From plumed docs :
# Also consider that this is different with respect to what some other
Expand All @@ -114,8 +121,7 @@ def install(self, spec, prefix):
# with MPI you should use:
#
# > ./configure CXX="$MPICXX"
configure_opts = ['--prefix=' + prefix]

configure_opts = []
# If using MPI then ensure the correct compiler wrapper is used.
if '+mpi' in spec:
configure_opts.extend([
Expand Down Expand Up @@ -153,6 +159,4 @@ def install(self, spec, prefix):
configure_opts.extend([
'--enable-modules={0}'.format("".join(module_opts))])

configure(*configure_opts)
make()
make('install')
return configure_opts

0 comments on commit 634805c

Please sign in to comment.