Skip to content

Commit

Permalink
Workaround for external zlib, spack-built pkg-config in var/spack/rep…
Browse files Browse the repository at this point in the history
…os/builtin/packages/freetype/package.py: find zlib.pc and add directory to PKG_CONFIG_PATH
  • Loading branch information
climbfuji committed Dec 27, 2024
1 parent c0dc357 commit ecc987c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion var/spack/repos/builtin/packages/freetype/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand All @@ -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):
Expand Down

0 comments on commit ecc987c

Please sign in to comment.