summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn W. Parent <45471568+johnwparent@users.noreply.github.com>2024-10-22 12:39:48 -0400
committerGitHub <noreply@github.com>2024-10-22 09:39:48 -0700
commite147679d4046f4059a2ebbc9c808d3a4192b644a (patch)
treeb2d546b599f07e84b61ebb7594c3e02c6fe8a4a1
parentef9bb7ebe59fc6053c7c8a2b9323a6037c10393e (diff)
downloadspack-e147679d4046f4059a2ebbc9c808d3a4192b644a.tar.gz
spack-e147679d4046f4059a2ebbc9c808d3a4192b644a.tar.bz2
spack-e147679d4046f4059a2ebbc9c808d3a4192b644a.tar.xz
spack-e147679d4046f4059a2ebbc9c808d3a4192b644a.zip
Libmng: Restore Autotools system (#46994)
* Libmng: Restore Autotools system CMake, when building its Qt gui, depends on Qt, which in turn, depends on libmng, a CMake based build. To avoid this obvious cyclic dependency, we re-introduce libmng's autotools build into Spack and require when building Qt as a CMake dependency, libmng is built with autotools * Ensure autotools constraint is limited to non-Windows * refactor qt-libmng relation from CMake
-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"]