diff --git a/var/spack/repos/builtin/packages/pango/package.py b/var/spack/repos/builtin/packages/pango/package.py index 8e423a762d34dd..06c68357b4149e 100644 --- a/var/spack/repos/builtin/packages/pango/package.py +++ b/var/spack/repos/builtin/packages/pango/package.py @@ -127,14 +127,10 @@ def configure_args(self): args.append("GTKDOC_MKPDF={0}".format(true)) args.append("GTKDOC_REBASE={0}".format(true)) - if self.spec["cairo"].satisfies("~shared"): - ldflags = [self.spec["pixman"].libs.search_flags] - libs = [self.spec["pixman"].libs.link_flags] - if self.spec["cairo"].satisfies("+png"): - ldflags.append(self.spec["libpng"].libs.search_flags) - libs.append(self.spec["libpng"].libs.link_flags) - args.append("LDFLAGS=%s" % " ".join(ldflags)) - args.append("LIBS=%s" % " ".join(libs)) + if self.spec.satisfies("^cairo ~shared"): + pkgconfig = which("pkg-config") + cairo_libs = pkgconfig("cairo", "--static", "--libs", output=str).strip() + args.append(f"LIBS={cairo_libs}") return args