2014-01-08 17:21:02 +08:00
|
|
|
##############################################################################
|
2017-09-07 11:44:16 +08:00
|
|
|
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
|
2014-01-08 17:21:02 +08:00
|
|
|
# Produced at the Lawrence Livermore National Laboratory.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# This file is part of Spack.
|
2016-05-12 12:22:25 +08:00
|
|
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
2014-01-08 17:21:02 +08:00
|
|
|
# LLNL-CODE-647188
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2017-11-05 08:08:04 +08:00
|
|
|
# For details, see https://github.com/spack/spack
|
2017-06-25 13:22:55 +08:00
|
|
|
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2016-05-12 12:22:25 +08:00
|
|
|
# it under the terms of the GNU Lesser General Public License (as
|
|
|
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# 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
|
2016-05-12 12:22:25 +08:00
|
|
|
# conditions of the GNU Lesser General Public License for more details.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2016-05-12 12:22:25 +08:00
|
|
|
# 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
|
2014-01-08 17:21:02 +08:00
|
|
|
##############################################################################
|
2013-02-14 09:50:44 +08:00
|
|
|
from spack import *
|
|
|
|
|
2016-08-10 16:50:00 +08:00
|
|
|
|
2013-02-14 09:50:44 +08:00
|
|
|
class Cmake(Package):
|
2014-10-08 18:07:54 +08:00
|
|
|
"""A cross-platform, open-source build system. CMake is a family of
|
|
|
|
tools designed to build, test and package software."""
|
2017-01-15 19:16:41 +08:00
|
|
|
homepage = 'https://www.cmake.org'
|
|
|
|
url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz'
|
|
|
|
list_url = 'https://cmake.org/files/'
|
2017-04-02 05:03:54 +08:00
|
|
|
list_depth = 1
|
2014-07-31 14:30:07 +08:00
|
|
|
|
2017-11-21 23:04:53 +08:00
|
|
|
version('3.10.0', 'f3f8e70ca3055f3cd288f89ff233057e')
|
2017-10-05 22:57:20 +08:00
|
|
|
version('3.9.4', '33769e001bdcd788f565bf378692e5ae')
|
2017-08-08 06:41:34 +08:00
|
|
|
version('3.9.0', '180e23b4c9b55915d271b315297f6951')
|
|
|
|
version('3.8.2', 'b5dff61f6a7f1305271ab3f6ae261419')
|
2017-05-20 06:31:20 +08:00
|
|
|
version('3.8.1', 'e8ef820ddf7a650845252bca846696e7')
|
2017-04-18 23:59:59 +08:00
|
|
|
version('3.8.0', 'f28cba717ba38ad82a488daed8f45b5b')
|
2017-01-19 00:17:31 +08:00
|
|
|
version('3.7.2', '79bd7e65cd81ea3aa2619484ad6ff25a')
|
2016-12-19 08:20:13 +08:00
|
|
|
version('3.7.1', 'd031d5a06e9f1c5367cdfc56fbd2a1c8')
|
2016-08-02 00:18:48 +08:00
|
|
|
version('3.6.1', 'd6dd661380adacdb12f41b926ec99545')
|
2016-07-11 09:02:51 +08:00
|
|
|
version('3.6.0', 'aa40fbecf49d99c083415c2411d12db9')
|
2016-04-17 13:11:19 +08:00
|
|
|
version('3.5.2', '701386a1b5ec95f8d1075ecf96383e02')
|
2016-03-30 07:10:49 +08:00
|
|
|
version('3.5.1', 'ca051f4a66375c89d1a524e726da0296')
|
2016-03-09 00:44:21 +08:00
|
|
|
version('3.5.0', '33c5d09d4c33d4ffcc63578a6ba8777e')
|
2016-02-04 06:28:09 +08:00
|
|
|
version('3.4.3', '4cb3ff35b2472aae70f542116d616e63')
|
2016-02-04 05:24:59 +08:00
|
|
|
version('3.4.0', 'cd3034e0a44256a0917e254167217fc8')
|
|
|
|
version('3.3.1', '52638576f4e1e621fed6c3410d3a1b12')
|
2016-12-08 01:33:54 +08:00
|
|
|
version('3.1.0', '188eb7dc9b1b82b363bc51c0d3f1d461')
|
2016-02-04 05:24:59 +08:00
|
|
|
version('3.0.2', 'db4c687a31444a929d2fdc36c4dfb95f')
|
2015-08-20 05:18:02 +08:00
|
|
|
version('2.8.10.2', '097278785da7182ec0aea8769d06860c')
|
2014-10-26 11:25:25 +08:00
|
|
|
|
2016-12-08 01:33:54 +08:00
|
|
|
variant('ownlibs', default=True, description='Use CMake-provided third-party libraries')
|
2016-08-02 00:18:48 +08:00
|
|
|
variant('qt', default=False, description='Enables the build of cmake-gui')
|
|
|
|
variant('doc', default=False, description='Enables the generation of html and man page documentation')
|
|
|
|
variant('openssl', default=True, description="Enables CMake's OpenSSL features")
|
|
|
|
variant('ncurses', default=True, description='Enables the build of the ncurses gui')
|
|
|
|
|
2016-08-25 03:39:05 +08:00
|
|
|
depends_on('curl', when='~ownlibs')
|
|
|
|
depends_on('expat', when='~ownlibs')
|
|
|
|
# depends_on('jsoncpp', when='~ownlibs') # circular dependency
|
|
|
|
depends_on('zlib', when='~ownlibs')
|
|
|
|
depends_on('bzip2', when='~ownlibs')
|
|
|
|
depends_on('xz', when='~ownlibs')
|
|
|
|
depends_on('libarchive', when='~ownlibs')
|
2017-08-17 21:17:45 +08:00
|
|
|
depends_on('libuv@1.0.0:', when='~ownlibs')
|
|
|
|
depends_on('rhash', when='@3.8.0:~ownlibs')
|
2016-08-02 00:18:48 +08:00
|
|
|
depends_on('qt', when='+qt')
|
2016-03-09 23:46:56 +08:00
|
|
|
depends_on('python@2.7.11:', when='+doc', type='build')
|
2016-08-02 00:18:48 +08:00
|
|
|
depends_on('py-sphinx', when='+doc', type='build')
|
2017-08-17 21:17:45 +08:00
|
|
|
depends_on('openssl', when='+openssl')
|
|
|
|
depends_on('openssl@:1.0.99', when='@:3.6.9+openssl')
|
2016-08-02 00:18:48 +08:00
|
|
|
depends_on('ncurses', when='+ncurses')
|
2013-02-14 09:50:44 +08:00
|
|
|
|
2016-08-05 04:07:43 +08:00
|
|
|
# Cannot build with Intel, should be fixed in 3.6.2
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/16226
|
|
|
|
patch('intel-c-gnu11.patch', when='@3.6.0:3.6.1')
|
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
conflicts('+qt', when='^qt@5.4.0') # qt-5.4.0 has broken CMake modules
|
2015-08-20 05:18:02 +08:00
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
phases = ['bootstrap', 'build', 'install']
|
2016-03-09 00:44:21 +08:00
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
def url_for_version(self, version):
|
|
|
|
"""Handle CMake's version-based custom URLs."""
|
|
|
|
url = 'https://cmake.org/files/v{0}/cmake-{1}.tar.gz'
|
|
|
|
return url.format(version.up_to(2), version)
|
2016-03-09 00:44:21 +08:00
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
def bootstrap_args(self):
|
|
|
|
spec = self.spec
|
|
|
|
args = [
|
|
|
|
'--prefix={0}'.format(self.prefix),
|
|
|
|
'--parallel={0}'.format(make_jobs)
|
|
|
|
]
|
2016-08-02 00:18:48 +08:00
|
|
|
|
2016-08-25 03:39:05 +08:00
|
|
|
if '+ownlibs' in spec:
|
|
|
|
# Build and link to the CMake-provided third-party libraries
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--no-system-libs')
|
2016-08-25 03:39:05 +08:00
|
|
|
else:
|
|
|
|
# Build and link to the Spack-installed third-party libraries
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--system-libs')
|
|
|
|
|
|
|
|
if spec.satisfies('@3.2:'):
|
|
|
|
# jsoncpp requires CMake to build
|
|
|
|
# use CMake-provided library to avoid circular dependency
|
|
|
|
args.append('--no-system-jsoncpp')
|
2016-08-25 03:39:05 +08:00
|
|
|
|
2016-03-02 06:25:57 +08:00
|
|
|
if '+qt' in spec:
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--qt-gui')
|
2016-08-02 00:18:48 +08:00
|
|
|
else:
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--no-qt-gui')
|
2016-03-02 06:25:57 +08:00
|
|
|
|
2016-03-12 00:51:12 +08:00
|
|
|
if '+doc' in spec:
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--sphinx-html')
|
|
|
|
args.append('--sphinx-man')
|
2016-03-02 06:25:57 +08:00
|
|
|
|
2016-03-21 06:18:36 +08:00
|
|
|
if '+openssl' in spec:
|
2017-08-17 21:17:45 +08:00
|
|
|
args.append('--')
|
|
|
|
args.append('-DCMAKE_USE_OPENSSL=ON')
|
|
|
|
|
|
|
|
return args
|
2016-03-02 06:25:57 +08:00
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
def bootstrap(self, spec, prefix):
|
2016-08-02 00:18:48 +08:00
|
|
|
bootstrap = Executable('./bootstrap')
|
2017-08-17 21:17:45 +08:00
|
|
|
bootstrap(*self.bootstrap_args())
|
2016-08-02 00:18:48 +08:00
|
|
|
|
2017-08-17 21:17:45 +08:00
|
|
|
def build(self, spec, prefix):
|
2013-02-14 09:50:44 +08:00
|
|
|
make()
|
2017-08-17 21:17:45 +08:00
|
|
|
|
|
|
|
@run_after('build')
|
|
|
|
@on_package_attributes(run_tests=True)
|
|
|
|
def test(self):
|
|
|
|
# Some tests fail, takes forever
|
|
|
|
make('test')
|
|
|
|
|
|
|
|
def install(self, spec, prefix):
|
2013-02-14 09:50:44 +08:00
|
|
|
make('install')
|