diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2017-08-04 10:46:07 -0500 |
---|---|---|
committer | Gregory Lee <lee218@llnl.gov> | 2017-08-04 08:46:07 -0700 |
commit | 452f382293cffe6fbf134db13cb1420d11e93689 (patch) | |
tree | a8d1bb0ef13d3ed0e1c08f7d5d015eda3748db66 | |
parent | f6c2adc0ada7c569234acf01ee5e3c602e945821 (diff) | |
download | spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.gz spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.bz2 spack-452f382293cffe6fbf134db13cb1420d11e93689.tar.xz spack-452f382293cffe6fbf134db13cb1420d11e93689.zip |
Add a QMakePackage base class (#4925)
* Add a QMakePackage base class
* Fix sqlite linking bug in qt-creator
* Add latest version of qt-creator
* Add latest version of qwt
* Use raw strings for regular expressions
* Increase minimum required version of qt
* Add comment about specific version of sqlite required
* Fixes for latest version of qwt and qt-creator
* Older versions of Qwt only work with older versions of Qt
-rw-r--r-- | lib/spack/docs/packaging_guide.rst | 5 | ||||
-rw-r--r-- | lib/spack/spack/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/qmake.py | 87 | ||||
-rw-r--r-- | lib/spack/spack/cmd/build.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/cmd/configure.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/cmd/create.py | 38 | ||||
-rw-r--r-- | lib/spack/spack/test/build_system_guess.py | 1 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/qt-creator/package.py | 34 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/qwt/package.py | 21 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/sqlite/package.py | 4 |
10 files changed, 159 insertions, 35 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index e4b10cdf53..5d7d69e3d7 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -2118,7 +2118,10 @@ The classes that are currently provided by Spack are: | :py:class:`.CMakePackage` | Specialized class for packages | | | built using CMake | +-------------------------------+----------------------------------+ - | :py:class:`.WafPackage` | Specialize class for packages | + | :py:class:`.QMakePackage` | Specialized class for packages | + | | build using QMake | + +-------------------------------+----------------------------------+ + | :py:class:`.WafPackage` | Specialized class for packages | | | built using Waf | +-------------------------------+----------------------------------+ | :py:class:`.RPackage` | Specialized class for | diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index e77a0c75cd..aca906f2e9 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -172,6 +172,7 @@ from spack.package import Package, run_before, run_after, on_package_attributes from spack.build_systems.makefile import MakefilePackage from spack.build_systems.autotools import AutotoolsPackage from spack.build_systems.cmake import CMakePackage +from spack.build_systems.qmake import QMakePackage from spack.build_systems.waf import WafPackage from spack.build_systems.python import PythonPackage from spack.build_systems.r import RPackage @@ -185,6 +186,7 @@ __all__ += [ 'MakefilePackage', 'AutotoolsPackage', 'CMakePackage', + 'QMakePackage', 'WafPackage', 'PythonPackage', 'RPackage', diff --git a/lib/spack/spack/build_systems/qmake.py b/lib/spack/spack/build_systems/qmake.py new file mode 100644 index 0000000000..c1a3193b7f --- /dev/null +++ b/lib/spack/spack/build_systems/qmake.py @@ -0,0 +1,87 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## + +import inspect + +from spack.directives import depends_on +from spack.package import PackageBase, run_after + + +class QMakePackage(PackageBase): + """Specialized class for packages built using qmake. + + For more information on the qmake build system, see: + http://doc.qt.io/qt-5/qmake-manual.html + + This class provides three phases that can be overridden: + + 1. :py:meth:`~.QMakePackage.qmake` + 2. :py:meth:`~.QMakePackage.build` + 3. :py:meth:`~.QMakePackage.install` + + They all have sensible defaults and for many packages the only thing + necessary will be to override :py:meth:`~.QMakePackage.qmake_args`. + """ + #: Phases of a qmake package + phases = ['qmake', 'build', 'install'] + + #: This attribute is used in UI queries that need to know the build + #: system base class + build_system_class = 'QMakePackage' + + #: Callback names for build-time test + build_time_test_callbacks = ['check'] + + depends_on('qt', type='build') + + def qmake_args(self): + """Produces a list containing all the arguments that must be passed to + qmake + """ + return [] + + def qmake(self, spec, prefix): + """Run ``qmake`` to configure the project and generate a Makefile.""" + inspect.getmodule(self).qmake(*self.qmake_args()) + + def build(self, spec, prefix): + """Make the build targets""" + inspect.getmodule(self).make() + + def install(self, spec, prefix): + """Make the install targets""" + inspect.getmodule(self).make('install') + + # Tests + + def check(self): + """Searches the Makefile for a ``check:`` target and runs it if found. + """ + self._if_make_target_execute('check') + + run_after('build')(PackageBase._run_default_build_time_test_callbacks) + + # Check that self.prefix is there after installation + run_after('install')(PackageBase.sanity_check_prefix) diff --git a/lib/spack/spack/cmd/build.py b/lib/spack/spack/cmd/build.py index 413b73a08e..8ecaca9c12 100644 --- a/lib/spack/spack/cmd/build.py +++ b/lib/spack/spack/cmd/build.py @@ -34,6 +34,7 @@ level = "long" build_system_to_phase = { AutotoolsPackage: 'build', CMakePackage: 'build', + QMakePackage: 'build', WafPackage: 'build', PythonPackage: 'build', PerlPackage: 'build', diff --git a/lib/spack/spack/cmd/configure.py b/lib/spack/spack/cmd/configure.py index 4b590e6176..562582fe09 100644 --- a/lib/spack/spack/cmd/configure.py +++ b/lib/spack/spack/cmd/configure.py @@ -38,6 +38,7 @@ level = "long" build_system_to_phase = { AutotoolsPackage: 'configure', CMakePackage: 'cmake', + QMakePackage: 'qmake', WafPackage: 'configure', PerlPackage: 'configure', } diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 62de3e24e9..239f75b996 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -193,6 +193,18 @@ class CMakePackageTemplate(PackageTemplate): return args""" +class QMakePackageTemplate(PackageTemplate): + """Provides appropriate overrides for QMake-based packages""" + + base_class_name = 'QMakePackage' + + body = """\ + def qmake_args(self): + # FIXME: If not needed delete this function + args = [] + return args""" + + class SconsPackageTemplate(PackageTemplate): """Provides appropriate overrides for SCons-based packages""" @@ -363,6 +375,7 @@ templates = { 'autotools': AutotoolsPackageTemplate, 'autoreconf': AutoreconfPackageTemplate, 'cmake': CMakePackageTemplate, + 'qmake': QMakePackageTemplate, 'scons': SconsPackageTemplate, 'waf': WafPackageTemplate, 'bazel': BazelPackageTemplate, @@ -426,18 +439,19 @@ class BuildSystemGuesser: # uses. If the regular expression matches a file contained in the # archive, the corresponding build system is assumed. clues = [ - ('/configure$', 'autotools'), - ('/configure.(in|ac)$', 'autoreconf'), - ('/Makefile.am$', 'autoreconf'), - ('/CMakeLists.txt$', 'cmake'), - ('/SConstruct$', 'scons'), - ('/waf$', 'waf'), - ('/setup.py$', 'python'), - ('/NAMESPACE$', 'r'), - ('/WORKSPACE$', 'bazel'), - ('/Build.PL$', 'perlbuild'), - ('/Makefile.PL$', 'perlmake'), - ('/(GNU)?[Mm]akefile$', 'makefile'), + (r'/configure$', 'autotools'), + (r'/configure\.(in|ac)$', 'autoreconf'), + (r'/Makefile\.am$', 'autoreconf'), + (r'/CMakeLists\.txt$', 'cmake'), + (r'/SConstruct$', 'scons'), + (r'/waf$', 'waf'), + (r'/setup\.py$', 'python'), + (r'/NAMESPACE$', 'r'), + (r'/WORKSPACE$', 'bazel'), + (r'/Build\.PL$', 'perlbuild'), + (r'/Makefile\.PL$', 'perlmake'), + (r'/.*\.pro$', 'qmake'), + (r'/(GNU)?[Mm]akefile$', 'makefile'), ] # Peek inside the compressed file. diff --git a/lib/spack/spack/test/build_system_guess.py b/lib/spack/spack/test/build_system_guess.py index 733173e3fc..54431e0020 100644 --- a/lib/spack/spack/test/build_system_guess.py +++ b/lib/spack/spack/test/build_system_guess.py @@ -34,6 +34,7 @@ import spack.stage params=[ ('configure', 'autotools'), ('CMakeLists.txt', 'cmake'), + ('project.pro', 'qmake'), ('SConstruct', 'scons'), ('waf', 'waf'), ('setup.py', 'python'), diff --git a/var/spack/repos/builtin/packages/qt-creator/package.py b/var/spack/repos/builtin/packages/qt-creator/package.py index a3f50004ae..4b3054b7b6 100644 --- a/var/spack/repos/builtin/packages/qt-creator/package.py +++ b/var/spack/repos/builtin/packages/qt-creator/package.py @@ -23,24 +23,36 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * -import os -class QtCreator(Package): +class QtCreator(QMakePackage): """The Qt Creator IDE.""" homepage = 'https://www.qt.io/ide/' - url = 'http://download.qt.io/official_releases/qtcreator/4.1/4.1.0/qt-creator-opensource-src-4.1.0.tar.gz' + url = 'http://download.qt.io/official_releases/qtcreator/4.3/4.3.1/qt-creator-opensource-src-4.3.1.tar.gz' list_url = 'http://download.qt.io/official_releases/qtcreator/' list_depth = 2 - version('4.1.0', '657727e4209befa4bf5889dff62d9e0a') + version('4.3.1', '6769ea47f287e2d9e30ff92acb899eef') + version('4.1.0', '657727e4209befa4bf5889dff62d9e0a') - depends_on("qt") + depends_on('qt@5.6.0:+opengl') + # Qt Creator comes bundled with its own copy of sqlite. Qt has a build + # dependency on Python, which has a dependency on sqlite. If Python is + # built with a different version of sqlite than the bundled copy, it will + # cause symbol conflict. Force Spack to build with the same version of + # sqlite as the bundled copy. + depends_on('sqlite@3.8.10.2') - def install(self, spec, prefix): - os.environ['INSTALL_ROOT'] = self.prefix - qmake = which('qmake') - qmake('-r') - make() - make("install") + # Qt Creator 4.3.0+ requires a C++14 compiler + conflicts('%gcc@:4.8', when='@4.3.0:') + + def url_for_version(self, version): + url = 'http://download.qt.io/official_releases/qtcreator/{0}/{1}/qt-creator-opensource-src-{1}.tar.gz' + return url.format(version.up_to(2), version) + + def setup_environment(self, spack_env, run_env): + spack_env.set('INSTALL_ROOT', self.prefix) + + def qmake_args(self): + return ['-r'] diff --git a/var/spack/repos/builtin/packages/qwt/package.py b/var/spack/repos/builtin/packages/qwt/package.py index 111ba034c7..10ca44e1c3 100644 --- a/var/spack/repos/builtin/packages/qwt/package.py +++ b/var/spack/repos/builtin/packages/qwt/package.py @@ -25,7 +25,7 @@ from spack import * -class Qwt(Package): +class Qwt(QMakePackage): """The Qwt library contains GUI Components and utility classes which are primarily useful for programs with a technical background. Beside a framework for 2D plots it provides scales, sliders, dials, compasses, @@ -33,18 +33,17 @@ class Qwt(Package): ranges of type double. """ homepage = "http://qwt.sourceforge.net/" - url = "https://downloads.sourceforge.net/project/qwt/qwt/5.2.2/qwt-5.2.2.tar.bz2" + url = "https://sourceforge.net/projects/qwt/files/qwt/6.1.3/qwt-6.1.3.tar.bz2" + version('6.1.3', '19d1f5fa5e22054d22ee3accc37c54ba') version('5.2.2', '70d77e4008a6cc86763737f0f24726ca') - depends_on("qt") - - def install(self, spec, prefix): + depends_on('qt+opengl') + # Qwt 6.1.1 and older use a constant that was removed in Qt 5.4 + # https://bugs.launchpad.net/ubuntu/+source/qwt-qt5/+bug/1485213 + depends_on('qt@:5.3', when='@:6.1.1') + def patch(self): # Subvert hardcoded prefix - filter_file(r'/usr/local/qwt-\$\$VERSION', prefix, 'qwtconfig.pri') - - qmake = which('qmake') - qmake() - make() - make("install") + filter_file(r'/usr/local/qwt-\$\$(QWT_)?VERSION.*', + self.prefix, 'qwtconfig.pri') diff --git a/var/spack/repos/builtin/packages/sqlite/package.py b/var/spack/repos/builtin/packages/sqlite/package.py index 56062c1472..66b76e1be1 100644 --- a/var/spack/repos/builtin/packages/sqlite/package.py +++ b/var/spack/repos/builtin/packages/sqlite/package.py @@ -33,8 +33,12 @@ class Sqlite(AutotoolsPackage): """ homepage = "www.sqlite.org" + version('3.20.0', 'e262a28b73cc330e7e83520c8ce14e4d', + url='https://www.sqlite.org/2017/sqlite-autoconf-3200000.tar.gz') version('3.18.0', 'a6687a8ae1f66abc8df739aeadecfd0c', url='https://www.sqlite.org/2017/sqlite-autoconf-3180000.tar.gz') + version('3.8.10.2', 'a18bfc015cd49a1e7a961b7b77bc3b37', + url='https://www.sqlite.org/2015/sqlite-autoconf-3081002.tar.gz') version('3.8.5', '0544ef6d7afd8ca797935ccc2685a9ed', url='https://www.sqlite.org/2014/sqlite-autoconf-3080500.tar.gz') |