New package: date (#19515)

* Add new package: date

* date: resolve style conformance issues

* date: explicitly disable some cmake options

Explicitly disable CMake options corresponding to variant
'tzdb=download'

* date: make more cmake options explicit

* date: simplify defining cmake cli args
This commit is contained in:
Geoffrey Gunter 2020-10-26 18:18:34 -07:00 committed by GitHub
parent bc4e7eabfe
commit e9223062a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,49 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Date(CMakePackage):
"""A date and time library based on the C++11/14/17 <chrono> header"""
homepage = "https://github.com/HowardHinnant/date"
url = "https://github.com/HowardHinnant/date/archive/v3.0.0.zip"
version('3.0.0', sha256='ddbec664607bb6ec7dd4c7be1f9eefc3d8ce88293ffc9391486ce6ce887ec9b2')
variant('cxxstd',
default='17',
values=('11', '14', '17'),
description='Use the specified C++ standard when building')
variant('shared',
default=False,
description='Build shared instead of static libraries')
variant('tz', default=False, description='Build/install of TZ library')
variant('tzdb',
default='download',
values=('download', 'system', 'manual'),
description="Timezone database source (automatic download, use "
"operating system's database, or manually specify)")
depends_on('cmake@3.7.0:', type='build')
depends_on('curl', when='+tz tzdb=download')
def cmake_args(self):
spec = self.spec
args = [
self.define('CMAKE_CXX_STANDARD', spec.variants['cxxstd'].value),
self.define('CMAKE_CXX_STANDARD_REQUIRED', True),
self.define('BUILD_SHARED_LIBS', '+shared' in spec),
self.define('BUILD_TZ_LIB', '+tz' in spec),
]
tzdb = spec.variants['tzdb'].value
args.extend([
self.define('USE_SYSTEM_TZ_DB', tzdb == 'system'),
self.define('MANUAL_TZ_DB', tzdb == 'manual'),
])
return args