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
This commit is contained in:
parent
ef9bb7ebe5
commit
e147679d40
@ -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(
|
||||
|
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user