diff options
-rw-r--r-- | var/spack/repos/builtin/packages/libtree/package.py | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/var/spack/repos/builtin/packages/libtree/package.py b/var/spack/repos/builtin/packages/libtree/package.py index 5d5aaa78ab..b361343ad9 100644 --- a/var/spack/repos/builtin/packages/libtree/package.py +++ b/var/spack/repos/builtin/packages/libtree/package.py @@ -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 @@ class Libtree(CMakePackage): 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) - # 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') + # 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') - # testing - depends_on('googletest', type='test') + # header only dependencies + 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 @@ class Libtree(CMakePackage): 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') |