Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wayland: Fix compatibility with Conan 1.52 #12771

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions recipes/wayland/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.files import copy, get, mkdir, replace_in_file, rmdir, save
from conan.tools.gnu.pkgconfigdeps.pc_files_creator import get_pc_files_and_content
from conan.tools.files import copy, get, replace_in_file, rmdir
from conan.tools.layout import basic_layout
from conan.tools.meson import Meson, MesonToolchain
from conan.tools.scm import Version
Expand Down Expand Up @@ -82,21 +81,20 @@ def generate(self):
tc.project_options["documentation"] = False
if Version(self.version) >= "1.18.91":
tc.project_options["scanner"] = True

# Generate PC files for the tool_requires wayland package to ensure wayland-scanner is found for build machine.
if cross_building(self):
native_generators_folder = os.path.join(self.generators_folder, "native")
mkdir(self, native_generators_folder)
for target in ["wayland", "expat", "libxml2", "libiconv"]:
for pc_name, pc_content in get_pc_files_and_content(self, self.dependencies.build[target]).items():
save(self, os.path.join(native_generators_folder, pc_name), pc_content)
tc.project_options["build.pkg_config_path"] = native_generators_folder
tc.generate()

def _patch_sources(self):
replace_in_file(self, os.path.join(self.source_folder, "meson.build"),
"subdir('tests')", "#subdir('tests')")

if cross_building(self):
replace_in_file(self, f"{self.source_folder}/src/meson.build",
"scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())",
"# scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())")
replace_in_file(self, f"{self.source_folder}/src/meson.build",
"wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))",
"wayland_scanner_for_build = find_program('wayland-scanner')")

def build(self):
self._patch_sources()
meson = Meson(self)
Expand Down