Skip to content

Commit e6fcb16

Browse files
committed
Cleanups
1 parent 00ac9a7 commit e6fcb16

File tree

1 file changed

+11
-37
lines changed

1 file changed

+11
-37
lines changed

recipes/libdecor/all/conanfile.py

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
import os
2-
import textwrap
32

43
from conan import ConanFile
54
from conan.errors import ConanInvalidConfiguration
6-
from conan.tools.env import VirtualBuildEnv
7-
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save
5+
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir
86
from conan.tools.gnu import PkgConfigDeps
97
from conan.tools.layout import basic_layout
108
from conan.tools.meson import Meson, MesonToolchain
119
from conan.tools.scm import Version
1210

13-
required_conan_version = ">=1.53.0"
11+
required_conan_version = ">=2.4"
1412

1513

1614
class libdecorConan(ConanFile):
1715
name = "libdecor"
18-
package_type = "shared-library"
1916
description = "libdecor is a library that can help Wayland clients draw window decorations for them."
2017
topics = ("decoration", "wayland", "window")
2118
url = "https://github.com/conan-io/conan-center-index"
2219
homepage = "https://gitlab.freedesktop.org/libdecor/libdecor"
2320
license = "MIT"
21+
22+
package_type = "shared-library"
2423
settings = "os", "arch", "compiler", "build_type"
2524
options = {
2625
"with_dbus": [True, False],
@@ -32,18 +31,12 @@ class libdecorConan(ConanFile):
3231
"with_gtk": False,
3332
}
3433

35-
@property
36-
def _has_build_profile(self):
37-
return hasattr(self, "settings_build")
34+
implements = ["auto_shared_fpic"]
35+
languages = "C"
3836

3937
def export_sources(self):
4038
export_conandata_patches(self)
4139

42-
def configure(self):
43-
self.settings.rm_safe("compiler.cppstd")
44-
self.settings.rm_safe("compiler.libcxx")
45-
self.options["pango"].with_cairo = True
46-
4740
def layout(self):
4841
basic_layout(self, src_folder="src")
4942

@@ -68,14 +61,15 @@ def validate(self):
6861
raise ConanInvalidConfiguration(f"{self.ref} requires at least version 3 of GTK when the with_gtk option is enabled")
6962

7063
def build_requirements(self):
71-
self.tool_requires("meson/1.4.0")
64+
self.tool_requires("meson/[>=1.2.3 <2]")
7265
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str):
73-
self.tool_requires("pkgconf/2.2.0")
66+
self.tool_requires("pkgconf/[>=2.2 <3]")
7467
self.tool_requires("wayland/<host_version>")
7568
self.tool_requires("wayland-protocols/1.33")
7669

7770
def source(self):
7871
get(self, **self.conan_data["sources"][self.version], strip_root=True)
72+
self._patch_sources()
7973

8074
def _patch_sources(self):
8175
apply_conandata_patches(self)
@@ -96,30 +90,10 @@ def feature(option):
9690
tc.project_options["gtk"] = feature("with_gtk")
9791
tc.generate()
9892
pkg_config_deps = PkgConfigDeps(self)
99-
if self._has_build_profile:
100-
pkg_config_deps.build_context_activated = ["wayland-protocols"]
101-
else:
102-
# Manually generate pkgconfig file of wayland-protocols since
103-
# PkgConfigDeps.build_context_activated can't work with legacy 1 profile
104-
# We must use legacy conan v1 deps_cpp_info because self.dependencies doesn't
105-
# contain build requirements when using 1 profile.
106-
wp_prefix = self.dependencies.build["wayland-protocols"].package_folder
107-
wp_version = self.dependencies.build["wayland-protocols"].ref.version
108-
wp_pkg_content = textwrap.dedent(f"""\
109-
prefix={wp_prefix}
110-
datarootdir=${{prefix}}/res
111-
pkgdatadir=${{datarootdir}}/wayland-protocols
112-
Name: Wayland Protocols
113-
Description: Wayland protocol files
114-
Version: {wp_version}
115-
""")
116-
save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content)
93+
pkg_config_deps.build_context_activated = ["wayland-protocols"]
11794
pkg_config_deps.generate()
118-
virtual_build_env = VirtualBuildEnv(self)
119-
virtual_build_env.generate()
12095

12196
def build(self):
122-
self._patch_sources()
12397
meson = Meson(self)
12498
meson.configure()
12599
meson.build()
@@ -135,7 +109,7 @@ def package_info(self):
135109
self.cpp_info.libs = [f"decor-{libdecor_soversion}"]
136110
self.cpp_info.set_property("pkg_config_name", f"libdecor-{libdecor_soversion}")
137111

138-
self.cpp_info.includedirs = [os.path.join(self.package_folder, "include", f"libdecor-{libdecor_soversion}")]
112+
self.cpp_info.includedirs = [os.path.join("include", f"libdecor-{libdecor_soversion}")]
139113

140114
plugins_soversion = "1"
141115
self.runenv_info.define("LIBDECOR_PLUGIN_DIR", os.path.join(self.package_folder, "lib", "libdecor", f"plugins-{plugins_soversion}"))

0 commit comments

Comments
 (0)