summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/cmake/package.py6
-rw-r--r--var/spack/repos/builtin/packages/libmng/package.py20
2 files changed, 25 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py
index 7daade48e7..9b4b760a33 100644
--- a/var/spack/repos/builtin/packages/cmake/package.py
+++ b/var/spack/repos/builtin/packages/cmake/package.py
@@ -162,6 +162,12 @@ class Cmake(Package):
depends_on("gmake", when="platform=freebsd")
depends_on("qt", when="+qtgui")
+ # Qt depends on libmng, which is a CMake package;
+ # ensure we build using a non CMake build system
+ # when libmng is build as a transitive dependency of CMake
+ for plat in ["linux", "darwin", "freebsd"]:
+ with when(f"platform={plat}"):
+ depends_on("libmng build_system=autotools", when="+qtgui")
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21135
conflicts(
diff --git a/var/spack/repos/builtin/packages/libmng/package.py b/var/spack/repos/builtin/packages/libmng/package.py
index 3a5f6cb27d..d3b59562f4 100644
--- a/var/spack/repos/builtin/packages/libmng/package.py
+++ b/var/spack/repos/builtin/packages/libmng/package.py
@@ -3,10 +3,13 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import spack.build_systems
+import spack.build_systems.autotools
+import spack.build_systems.cmake
from spack.package import *
-class Libmng(CMakePackage):
+class Libmng(CMakePackage, AutotoolsPackage):
"""THE reference library for reading, displaying, writing
and examining Multiple-Image Network Graphics. MNG is the animation
extension to the popular PNG image format."""
@@ -26,9 +29,24 @@ class Libmng(CMakePackage):
depends_on("zlib-api")
depends_on("lcms")
+ build_system("cmake", "autotools", default="cmake")
+
def patch(self):
# jpeg requires stdio to be included before its headers.
filter_file(r"^(\#include \<jpeglib\.h\>)", "#include<stdio.h>\n\\1", "libmng_types.h")
+
+class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder):
def cmake_args(self):
return ["-DWITH_LCMS2:BOOL=ON", "-DWITH_LCMS1:BOOL=OFF"]
+
+
+class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
+ @run_before("configure")
+ def clean_preconf(self):
+ """Required, otherwise configure will crash as subdirectories have
+ already been configured"""
+ make("distclean")
+
+ def configure_args(self):
+ return ["--with-lcms2", "--without-lcms1"]