libxml2 package: add CMake builder; add version 2.13.5 (#47878)

This commit is contained in:
John W. Parent 2025-04-04 20:43:01 -04:00 committed by GitHub
parent 2f4c5f2aa2
commit 924204828e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,11 +5,11 @@
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
from spack.build_systems import autotools, nmake from spack.build_systems import autotools, cmake, nmake
from spack.package import * from spack.package import *
class Libxml2(AutotoolsPackage, NMakePackage): class Libxml2(AutotoolsPackage, CMakePackage, NMakePackage):
"""Libxml2 is the XML C parser and toolkit developed for the Gnome """Libxml2 is the XML C parser and toolkit developed for the Gnome
project (but usable outside of the Gnome platform), it is free project (but usable outside of the Gnome platform), it is free
software available under the MIT License.""" software available under the MIT License."""
@ -106,7 +106,12 @@ def url_for_version(self, version):
sha256="5dc43fed02b443d2563a502a52caafe39477c06fc30b70f786d5ed3eb5aea88d", sha256="5dc43fed02b443d2563a502a52caafe39477c06fc30b70f786d5ed3eb5aea88d",
when="@2.9.11:2.9.14", when="@2.9.11:2.9.14",
) )
build_system(conditional("nmake", when="platform=windows"), "autotools", default="autotools") build_system(
conditional("nmake", when="platform=windows"),
conditional("cmake", when="@2.11:"),
"autotools",
default="autotools",
)
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
if name == "cflags" and self.spec.satisfies("+pic"): if name == "cflags" and self.spec.satisfies("+pic"):
@ -262,6 +267,18 @@ def configure_args(self):
return args return args
class CMakeBuilder(AnyBuilder, cmake.CMakeBuilder):
def cmake_args(self):
args = [
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("LIBXML2_WITH_PYTHON", "python"),
self.define("LIBXML2_WITH_LZMA", True),
self.define("LIBXML2_WITH_ZLIB", True),
self.define("LIBXML2_WITH_TESTS", True),
]
return args
class NMakeBuilder(AnyBuilder, nmake.NMakeBuilder): class NMakeBuilder(AnyBuilder, nmake.NMakeBuilder):
phases = ("configure", "build", "install") phases = ("configure", "build", "install")