diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index a54230cb2392cc..45f3b46a905951 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -2,6 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os from spack.build_systems.autotools import AutotoolsBuilder from spack.build_systems.cmake import CMakeBuilder @@ -54,6 +55,7 @@ class Freetype(AutotoolsPackage, CMakePackage): depends_on("bzip2") depends_on("libpng") + depends_on("zlib-api") for plat in ["linux", "darwin"]: depends_on("pkgconfig", type="build", when="platform=%s" % plat) @@ -95,7 +97,7 @@ def configure_args(self): "--with-bzip2=yes", "--with-harfbuzz=no", "--with-png=yes", - "--with-zlib=no", + "--with-zlib=yes", ] if self.spec.satisfies("@2.9.1:"): args.append("--enable-freetype-config") @@ -106,6 +108,11 @@ def configure_args(self): def setup_build_environment(self, env): if self.spec.satisfies("+pic"): env.set("CFLAGS", "-fPIC") + if self.spec["zlib-api"].external: + env.append_path( + "PKG_CONFIG_PATH", + os.path.dirname(find_first(self.spec["zlib-api"].prefix, "zlib.pc", bfs_depth=10)), + ) class CMakeBuilder(CMakeBuilder):