From 28c4809a8fea6f51217bca105c8ad19a62a2c5ae Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Sat, 28 Jan 2023 13:32:17 -0500 Subject: freetype: add CMake support (#35107) --- .../repos/builtin/packages/freetype/package.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index 80ee0c2c52..1b0459a03a 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -3,10 +3,12 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.build_systems.autotools import AutotoolsBuilder +from spack.build_systems.cmake import CMakeBuilder from spack.package import * -class Freetype(AutotoolsPackage): +class Freetype(AutotoolsPackage, CMakePackage): """FreeType is a freely available software library to render fonts. It is written in C, designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output (glyph images) @@ -28,9 +30,12 @@ class Freetype(AutotoolsPackage): version("2.7", sha256="7b657d5f872b0ab56461f3bd310bd1c5ec64619bd15f0d8e08282d494d9cfea4") version("2.5.3", sha256="41217f800d3f40d78ef4eb99d6a35fd85235b64f81bc56e4812d7672fca7b806") + build_system("cmake", "autotools", default="autotools") + depends_on("bzip2") depends_on("libpng") - depends_on("pkgconfig", type="build") + for plat in ["linux", "darwin", "cray"]: + depends_on("pkgconfig", type="build", when="platform=%s" % plat) conflicts( "%intel", @@ -47,6 +52,8 @@ class Freetype(AutotoolsPackage): headers.directories = [self.prefix.include.freetype2] return headers + +class AutotoolsBuilder(AutotoolsBuilder): def configure_args(self): args = [ "--with-brotli=no", @@ -58,3 +65,14 @@ class Freetype(AutotoolsPackage): if self.spec.satisfies("@2.9.1:"): args.append("--enable-freetype-config") return args + + +class CMakeBuilder(CMakeBuilder): + def cmake_args(self): + return [ + self.define("FT_DISABLE_ZLIB", True), + self.define("FT_DISABLE_BROTLI", True), + self.define("FT_DISABLE_HARFBUZZ", True), + self.define("FT_REQUIRE_PNG", True), + self.define("FT_REQUIRE_BZIP2", True), + ] -- cgit v1.2.3-70-g09d2