22#
33# SPDX-License-Identifier: (Apache-2.0 OR MIT)
44
5- from spack_repo .builtin .build_systems .autotools import AutotoolsPackage
5+ from spack_repo .builtin .build_systems .autotools import AutotoolsBuilder , AutotoolsPackage
6+ from spack_repo .builtin .build_systems .cmake import CMakeBuilder , CMakePackage
67
78from spack .package import *
89
910
10- class Libxslt (AutotoolsPackage ):
11+ class Libxslt (CMakePackage , AutotoolsPackage ):
1112 """Libxslt is the XSLT C library developed for the GNOME project. XSLT
1213 itself is a an XML language to define transformation for XML. Libxslt is
1314 based on libxml2 the XML C library developed for the GNOME project. It also
@@ -22,6 +23,8 @@ class Libxslt(AutotoolsPackage):
2223
2324 license ("X11" , checked_by = "wdconinc" )
2425
26+ build_system (conditional ("cmake" , when = "@1.1.35:" ), "autotools" , default = "cmake" )
27+
2528 version ("1.1.42" , sha256 = "85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb" )
2629 version ("1.1.41" , sha256 = "3ad392af91115b7740f7b50d228cc1c5fc13afc1da7f16cb0213917a37f71bda" )
2730 version ("1.1.40" , sha256 = "194715db023035f65fb566402f2ad2b5eab4c29d541f511305c40b29b1f48d13" )
@@ -48,7 +51,9 @@ class Libxslt(AutotoolsPackage):
4851 depends_on ("libxml2+python" , when = "+python" )
4952 depends_on ("xz" )
5053 depends_on ("zlib-api" )
54+
5155 depends_on ("libgcrypt" , when = "+crypto" )
56+ conflicts ("+crypto" , when = "platform=windows" )
5257
5358 depends_on ("python+shared" , when = "+python" )
5459 extends ("python" , when = "+python" )
@@ -59,6 +64,20 @@ def url_for_version(self, v):
5964 else :
6065 return f"http://xmlsoft.org/sources/libxslt-{ v } .tar.gz"
6166
67+ @run_after ("install" )
68+ @on_package_attributes (run_tests = True )
69+ def import_module_test (self ):
70+ if self .spec .satisfies ("+python" ):
71+ with working_dir ("spack-test" , create = True ):
72+ python ("-c" , "import libxslt" )
73+
74+ def patch (self ):
75+ # Remove flags not recognized by the NVIDIA compiler
76+ if self .spec .satisfies ("build_system=autotools %nvhpc" ):
77+ filter_file ("-Wmissing-format-attribute" , "" , "configure" )
78+
79+
80+ class AutotoolsBuilder (AutotoolsBuilder ):
6281 def configure_args (self ):
6382 args = []
6483
@@ -74,14 +93,12 @@ def configure_args(self):
7493
7594 return args
7695
77- @run_after ("install" )
78- @on_package_attributes (run_tests = True )
79- def import_module_test (self ):
80- if self .spec .satisfies ("+python" ):
81- with working_dir ("spack-test" , create = True ):
82- python ("-c" , "import libxslt" )
8396
84- def patch (self ):
85- # Remove flags not recognized by the NVIDIA compiler
86- if self .spec .satisfies ("%nvhpc" ):
87- filter_file ("-Wmissing-format-attribute" , "" , "configure" )
97+ class CMakeBuilder (CMakeBuilder ):
98+ def cmake_args (self ):
99+ return [
100+ self .define_from_variant ("LIBXSLT_WITH_PYTHON" , "python" ),
101+ self .define_from_variant ("LIBXSLT_WITH_CRYPTO" , "crypto" ),
102+ self .define ("DLIBXSLT_WITH_MODULES" , False ),
103+ self .define ("DLIBXSLT_WITH_TESTS" , False ),
104+ ]
0 commit comments