Skip to content

Commit

Permalink
(conan-io#15326) avahi: Add pkgconf as a tool_requires
Browse files Browse the repository at this point in the history
Avahi uses pkg-config to install, so it is required when building.
Unfortunately, Avahi doesn't accept pkgconf in place of pkg-config.
Overriding Avahi's check solves this problem.
  • Loading branch information
jwillikers authored and StellaSmith committed Feb 2, 2023
1 parent 83a65bd commit 8d34867
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions recipes/avahi/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from conan import ConanFile
from conan.tools.env import VirtualBuildEnv
from conan.tools.env import Environment, VirtualBuildEnv
from conan.tools.files import copy, get, rmdir, rm
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps
from conan.tools.layout import basic_layout
Expand Down Expand Up @@ -43,9 +43,11 @@ def requirements(self):

def build_requirements(self):
self.tool_requires("glib/2.75.2")
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str):
self.tool_requires("pkgconf/1.9.3")

def validate(self):
if self.info.settings.os != "Linux":
if self.settings.os != "Linux":
raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.")

def configure(self):
Expand All @@ -71,6 +73,10 @@ def generate(self):
tc.generate()
AutotoolsDeps(self).generate()
PkgConfigDeps(self).generate()
# Override Avahi's problematic check for the pkg-config executable.
env = Environment()
env.define("have_pkg_config", "yes")
env.vars(self).save_script("conanbuild_pkg_config")

def build(self):
autotools = Autotools(self)
Expand Down

0 comments on commit 8d34867

Please sign in to comment.