Add libtree 3.0.0-rc9 (#27990)

This commit is contained in:
Harmen Stoppels 2021-12-14 14:17:38 +01:00 committed by GitHub
parent c1d51593d1
commit 9ec638c7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,12 +3,11 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.build_systems.cmake import CMakePackage
class Libtree(CMakePackage):
"""ldd as a tree with an option to bundle dependencies into a
single folder"""
class Libtree(MakefilePackage):
"""ldd as a tree"""
homepage = "https://github.com/haampie/libtree"
git = "https://github.com/haampie/libtree.git"
@ -16,6 +15,7 @@ class Libtree(CMakePackage):
maintainers = ['haampie']
version('master', branch='master')
version('3.0.0-rc9', sha256='6956c51d58a4f43a23fea0fe7fc5141034829058bfc434e089c9ef1d1848229a')
version('2.0.0', sha256='099e85d8ba3c3d849ce05b8ba2791dd25cd042a813be947fb321b0676ef71883')
version('1.2.3', sha256='4a912cf97109219fe931942a30579336b6ab9865395447bd157bbfa74bf4e8cf')
version('1.2.2', sha256='4ccf09227609869b85a170550b636defcf0b0674ecb0785063b81785b1c29bdd')
@ -35,20 +35,27 @@ def url_for_version(self, version):
return "https://github.com/haampie/libtree/archive/refs/tags/v{0}.tar.gz".format(version)
variant('chrpath', default=False, description='Use chrpath for deployment')
variant('strip', default=False, description='Use binutils strip for deployment')
# Version 3.x (Makefile)
@when('@3:')
def install(self, spec, prefix):
make('install', 'PREFIX=' + prefix)
# Version 2.x and earlier (CMake)
with when('@:2'):
variant('chrpath', default=False, description='Use chrpath for deployment')
variant('strip', default=False, description='Use binutils strip for deployment')
variant('build_type', default='RelWithDebInfo',
description='CMake build type',
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
depends_on('googletest', type='test')
depends_on('cmake@3:', type='build')
depends_on('chrpath', when='+chrpath', type='run')
depends_on('binutils', when='+strip', type='run')
# header only dependencies
depends_on('cpp-termcolor', when='@2.0:', type='build')
depends_on('cxxopts', when='@2.0:', type='build')
depends_on('elfio', when='@2.0:', type='build')
# runtime deps
depends_on('chrpath', when='+chrpath', type='run')
depends_on('binutils', when='+strip', type='run')
# testing
depends_on('googletest', type='test')
depends_on('cpp-termcolor', when='@2.0.0:2', type='build')
depends_on('cxxopts', when='@2.0.0:2', type='build')
depends_on('elfio', when='@2.0.0:2', type='build')
def cmake_args(self):
tests_enabled = 'ON' if self.run_tests else 'OFF'
@ -58,9 +65,17 @@ def cmake_args(self):
tests_define = 'BUILD_TESTING'
return [
self.define(tests_define, tests_enabled)
CMakePackage.define(tests_define, tests_enabled)
]
@when('@:2')
def edit(self, spec, prefix):
options = CMakePackage._std_args(self) + self.cmake_args()
options.append(self.stage.source_path)
with working_dir(self.build_directory):
cmake(*options)
@when('@:2')
def check(self):
with working_dir(self.build_directory):
ctest('--output-on-failure')