diff options
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/build_environment.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/cmd/pkg.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 6 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/modules/package.py | 25 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/netlib-lapack/package.py | 40 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/openblas/package.py | 52 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/py-scipy/package.py | 12 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/qt/package.py | 70 |
9 files changed, 187 insertions, 47 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 46ca03bec4..70d46a7f77 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -27,7 +27,8 @@ __all__ = ['set_install_permissions', 'install', 'install_tree', 'traverse_tree' 'force_remove', 'join_path', 'ancestor', 'can_access', 'filter_file', 'FileFilter', 'change_sed_delimiter', 'is_exe', 'force_symlink', 'set_executable', 'copy_mode', 'unset_executable_mode', - 'remove_dead_links', 'remove_linked_tree', 'fix_darwin_install_name'] + 'remove_dead_links', 'remove_linked_tree', 'find_library_path', + 'fix_darwin_install_name'] import os import glob @@ -395,6 +396,7 @@ def remove_linked_tree(path): else: shutil.rmtree(path, True) + def fix_darwin_install_name(path): """ Fix install name of dynamic libraries on Darwin to have full path. @@ -420,3 +422,17 @@ def fix_darwin_install_name(path): if dep == os.path.basename(loc): subprocess.Popen(["install_name_tool", "-change",dep,loc,lib], stdout=subprocess.PIPE).communicate()[0] break + + +def find_library_path(libname, *paths): + """Searches for a file called <libname> in each path. + + Return: + directory where the library was found, if found. None otherwise. + + """ + for path in paths: + library = join_path(path, libname) + if os.path.exists(library): + return path + return None diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 119a255a34..640db0c1d1 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -59,6 +59,11 @@ SPACK_SHORT_SPEC = 'SPACK_SHORT_SPEC' SPACK_DEBUG_LOG_DIR = 'SPACK_DEBUG_LOG_DIR' +# Platform-specific library suffix. +dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so' + + + class MakeExecutable(Executable): """Special callable executable object for make so the user can specify parallel or not on a per-invocation basis. Using @@ -246,6 +251,9 @@ def set_module_variables_for_package(pkg, module): # a Prefix object. m.prefix = pkg.prefix + # Platform-specific library suffix. + m.dso_suffix = dso_suffix + def get_rpaths(pkg): """Get a list of all the rpaths for a package.""" diff --git a/lib/spack/spack/cmd/pkg.py b/lib/spack/spack/cmd/pkg.py index cf478d3763..20a3fc5fc2 100644 --- a/lib/spack/spack/cmd/pkg.py +++ b/lib/spack/spack/cmd/pkg.py @@ -77,7 +77,8 @@ def get_git(): def list_packages(rev): git = get_git() - relpath = spack.packages_path[len(spack.prefix + os.path.sep):] + os.path.sep + pkgpath = os.path.join(spack.packages_path, 'packages') + relpath = pkgpath[len(spack.prefix + os.path.sep):] + os.path.sep output = git('ls-tree', '--full-tree', '--name-only', rev, relpath, output=str) return sorted(line[len(relpath):] for line in output.split('\n') if line) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 9dcfbee661..4065553131 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -929,6 +929,9 @@ class Package(object): install(env_path, env_install_path) dump_packages(self.spec, packages_dir) + # Run post install hooks before build stage is removed. + spack.hooks.post_install(self) + # Stop timer. self._total_time = time.time() - start_time build_time = self._total_time - self._fetch_time @@ -957,9 +960,6 @@ class Package(object): # the database, so that we don't need to re-read from file. spack.installed_db.add(self.spec, self.prefix) - # Once everything else is done, run post install hooks - spack.hooks.post_install(self) - def sanity_check_prefix(self): """This function checks whether install succeeded.""" diff --git a/var/spack/repos/builtin/packages/modules/package.py b/var/spack/repos/builtin/packages/modules/package.py new file mode 100644 index 0000000000..b014ee460c --- /dev/null +++ b/var/spack/repos/builtin/packages/modules/package.py @@ -0,0 +1,25 @@ +from spack import * + +class Modules(Package): + """ The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. """ + + homepage = "http://modules.sf.net" + url = "http://downloads.sourceforge.net/project/modules/Modules/modules-3.2.10/modules-3.2.10.tar.gz" + + version('3.2.10', '8b097fdcb90c514d7540bb55a3cb90fb') + + depends_on("tcl") + + def install(self, spec, prefix): + + options = ['--prefix=%s' % prefix, + '--disable-debug', + '--disable-dependency-tracking', + '--disable-silent-rules', + '--disable-versioning', + '--datarootdir=%s' % prefix.share, + 'CPPFLAGS=-DUSE_INTERP_ERRORLINE'] + + configure(*options) + make() + make("install") diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py index c4b7ce3b04..05436332ac 100644 --- a/var/spack/repos/builtin/packages/netlib-lapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py @@ -31,8 +31,16 @@ class NetlibLapack(Package): depends_on('cmake') depends_on('blas', when='+external-blas') - def install(self, spec, prefix): - cmake_args = ['-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if '+shared' in spec else 'OFF'), + + def patch(self): + # Fix cblas CMakeLists.txt -- has wrong case for subdirectory name. + filter_file('${CMAKE_CURRENT_SOURCE_DIR}/CMAKE/', + '${CMAKE_CURRENT_SOURCE_DIR}/cmake/', 'CBLAS/CMakeLists.txt', string=True) + + + def install_one(self, spec, prefix, shared): + cmake_args = ['-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if shared else 'OFF'), + '-DCBLAS=ON', # always build CBLAS '-DCMAKE_BUILD_TYPE:STRING=%s' % ('Debug' if '+debug' in spec else 'Release'), '-DLAPACKE:BOOL=%s' % ('ON' if '+lapacke' in spec else 'OFF')] if '+external-blas' in spec: @@ -45,7 +53,33 @@ class NetlibLapack(Package): cmake_args.extend(std_cmake_args) - with working_dir('spack-build', create=True): + build_dir = 'spack-build' + ('-shared' if shared else '-static') + with working_dir(build_dir, create=True): cmake('..', *cmake_args) make() make("install") + + + def install(self, spec, prefix): + # Always build static libraries. + self.install_one(spec, prefix, False) + + # Build shared libraries if requested. + if '+shared' in spec: + self.install_one(spec, prefix, True) + + + def setup_dependent_package(self, module, dspec): + # This is WIP for a prototype interface for virtual packages. + # We can update this as more builds start depending on BLAS/LAPACK. + libdir = find_library_path('libblas.a', self.prefix.lib64, self.prefix.lib) + + self.spec.blas_static_lib = join_path(libdir, 'libblas.a') + self.spec.lapack_static_lib = join_path(libdir, 'liblapack.a') + + if '+shared' in self.spec: + self.spec.blas_shared_lib = join_path(libdir, 'libblas.%s' % dso_suffix) + self.spec.lapack_shared_lib = join_path(libdir, 'liblapack.%s' % dso_suffix) + + + diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 1d10f217c4..4ec829a85b 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -1,5 +1,6 @@ from spack import * import sys +import os class Openblas(Package): """OpenBLAS: An optimized BLAS library""" @@ -10,29 +11,60 @@ class Openblas(Package): version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc') version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9') + variant('shared', default=True, description="Build shared libraries as well as static libs.") + # virtual dependency provides('blas') provides('lapack') + def install(self, spec, prefix): - extra=[] + make_defs = ['CC=%s' % spack_cc, + 'FC=%s' % spack_fc] + + make_targets = ['libs', 'netlib'] + + # Build shared if variant is set. + if '+shared' in spec: + make_targets += ['shared'] + else: + make_defs += ['NO_SHARED=1'] + + # fix missing _dggsvd_ and _sggsvd_ if spec.satisfies('@0.2.16'): - extra.extend([ - 'BUILD_LAPACK_DEPRECATED=1' # fix missing _dggsvd_ and _sggsvd_ - ]) + make_defs += ['BUILD_LAPACK_DEPRECATED=1'] + + make_args = make_defs + make_targets + make(*make_args) - make('libs', 'netlib', 'shared', 'CC=cc', 'FC=f77',*extra) - make("tests") - make('install', "PREFIX='%s'" % prefix) + make("tests", *make_defs) + + # no quotes around prefix (spack doesn't use a shell) + make('install', "PREFIX=%s" % prefix, *make_defs) - lib_dsuffix = 'dylib' if sys.platform == 'darwin' else 'so' # Blas virtual package should provide blas.a and libblas.a with working_dir(prefix.lib): symlink('libopenblas.a', 'blas.a') symlink('libopenblas.a', 'libblas.a') - symlink('libopenblas.%s' % lib_dsuffix, 'libblas.%s' % lib_dsuffix) + if '+shared' in spec: + symlink('libopenblas.%s' % dso_suffix, 'libblas.%s' % dso_suffix) # Lapack virtual package should provide liblapack.a with working_dir(prefix.lib): symlink('libopenblas.a', 'liblapack.a') - symlink('libopenblas.%s' % lib_dsuffix, 'liblapack.%s' % lib_dsuffix) + if '+shared' in spec: + symlink('libopenblas.%s' % dso_suffix, 'liblapack.%s' % dso_suffix) + + + def setup_dependent_package(self, module, dspec): + # This is WIP for a prototype interface for virtual packages. + # We can update this as more builds start depending on BLAS/LAPACK. + libdir = find_library_path('libopenblas.a', self.prefix.lib64, self.prefix.lib) + + self.spec.blas_static_lib = join_path(libdir, 'libopenblas.a') + self.spec.lapack_static_lib = self.spec.blas_static_lib + + if '+shared' in self.spec: + self.spec.blas_shared_lib = join_path(libdir, 'libopenblas.%s' % dso_suffix) + self.spec.lapack_shared_lib = self.spec.blas_shared_lib + diff --git a/var/spack/repos/builtin/packages/py-scipy/package.py b/var/spack/repos/builtin/packages/py-scipy/package.py index c2161c90c4..4d47c641ee 100644 --- a/var/spack/repos/builtin/packages/py-scipy/package.py +++ b/var/spack/repos/builtin/packages/py-scipy/package.py @@ -11,9 +11,15 @@ class PyScipy(Package): extends('python') depends_on('py-nose') - depends_on('py-numpy') - depends_on('blas') - depends_on('lapack') + depends_on('py-numpy+blas+lapack') def install(self, spec, prefix): + if 'atlas' in spec: + # libatlas.so actually isn't always installed, but this + # seems to make the build autodetect things correctly. + env['ATLAS'] = join_path(spec['atlas'].prefix.lib, 'libatlas.' + dso_suffix) + else: + env['BLAS'] = spec['blas'].blas_shared_lib + env['LAPACK'] = spec['lapack'].lapack_shared_lib + python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index d08e8e81e1..ab09469042 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -1,41 +1,31 @@ -import os from spack import * import os class Qt(Package): """Qt is a comprehensive cross-platform C++ application framework.""" - homepage = "http://qt.io" - list_url = 'http://download.qt-project.org/official_releases/qt/' - list_depth = 2 - - version('5.4.2', 'fa1c4d819b401b267eb246a543a63ea5', - url='http://download.qt-project.org/official_releases/qt/5.4/5.4.2/single/qt-everywhere-opensource-src-5.4.2.tar.gz') - - version('5.4.0', 'e8654e4b37dd98039ba20da7a53877e6', - url='http://download.qt-project.org/official_releases/qt/5.4/5.4.0/single/qt-everywhere-opensource-src-5.4.0.tar.gz') - - version('5.3.2', 'febb001129927a70174467ecb508a682', - url='http://download.qt.io/archive/qt/5.3/5.3.2/single/qt-everywhere-opensource-src-5.3.2.tar.gz') - - version('5.2.1', 'a78408c887c04c34ce615da690e0b4c8', - url='http://download.qt.io/archive/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.tar.gz') - - version('4.8.6', '2edbe4d6c2eff33ef91732602f3518eb', - url="http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz") + homepage = 'http://qt.io' + url = 'http://download.qt.io/archive/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.gz' - version('3.3.8b', '9f05b4125cfe477cc52c9742c3c09009', - url="http://download.qt.io/archive/qt/3/qt-x11-free-3.3.8b.tar.gz") + version('5.5.1', '59f0216819152b77536cf660b015d784') + version('5.4.2', 'fa1c4d819b401b267eb246a543a63ea5') + version('5.4.0', 'e8654e4b37dd98039ba20da7a53877e6') + version('5.3.2', 'febb001129927a70174467ecb508a682') + version('5.2.1', 'a78408c887c04c34ce615da690e0b4c8') + version('4.8.6', '2edbe4d6c2eff33ef91732602f3518eb') + version('3.3.8b', '9f05b4125cfe477cc52c9742c3c09009') - variant('mesa', default=False, description='depend on mesa') # Add patch for compile issues with qt3 found with use in the OpenSpeedShop project - variant('krellpatch', default=False, description="build with openspeedshop based patch.") + variant('krellpatch', default=False, description="Build with openspeedshop based patch.") + variant('mesa', default=False, description="Depend on mesa.") + variant('gtk', default=False, description="Build with gtkplus.") + patch('qt3krell.patch', when='@3.3.8b+krellpatch') # Use system openssl for security. #depends_on("openssl") depends_on("glib") - depends_on("gtkplus") + depends_on("gtkplus", when='+gtk') depends_on("libxml2") depends_on("zlib") depends_on("dbus", when='@4:') @@ -56,6 +46,34 @@ class Qt(Package): depends_on("libxcb") + def url_for_version(self, version): + url = "http://download.qt.io/archive/qt/" + + if version >= Version('5'): + url += "%s/%s/single/qt-everywhere-opensource-src-%s.tar.gz" % \ + (version.up_to(2), version, version) + elif version >= Version('4.8'): + url += "%s/%s/qt-everywhere-opensource-src-%s.tar.gz" % \ + (version.up_to(2), version, version) + elif version >= Version('4.6'): + url += "%s/qt-everywhere-opensource-src-%s.tar.gz" % \ + (version.up_to(2), version) + elif version >= Version('4.0'): + url += "%s/qt-x11-opensource-src-%s.tar.gz" % \ + (version.up_to(2), version) + elif version >= Version('3'): + url += "%s/qt-x11-free-%s.tar.gz" % \ + (version.up_to(1), version) + elif version >= Version('2.1'): + url += "%s/qt-x11-%s.tar.gz" % \ + (version.up_to(1), version) + else: + url += "%s/qt-%s.tar.gz" % \ + (version.up_to(1), version) + + return url + + def setup_environment(self, spack_env, env): env.set('QTDIR', self.prefix) @@ -88,7 +106,7 @@ class Qt(Package): '-v', '-opensource', '-opengl', - "-release", + '-release', '-shared', '-confirm-license', '-openssl-linked', @@ -97,7 +115,7 @@ class Qt(Package): '-no-openvg', '-no-pch', # NIS is deprecated in more recent glibc - "-no-nis"] + '-no-nis'] # Don't disable all the database drivers, but should # really get them into spack at some point. |