From e147679d4046f4059a2ebbc9c808d3a4192b644a Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:39:48 -0400 Subject: 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 --- var/spack/repos/builtin/packages/cmake/package.py | 6 ++++++ var/spack/repos/builtin/packages/libmng/package.py | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'var') 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 \)", "#include\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"] -- cgit v1.2.3-70-g09d2