1
1
import os
2
- import textwrap
3
2
4
3
from conan import ConanFile
5
4
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
8
6
from conan .tools .gnu import PkgConfigDeps
9
7
from conan .tools .layout import basic_layout
10
8
from conan .tools .meson import Meson , MesonToolchain
11
9
from conan .tools .scm import Version
12
10
13
- required_conan_version = ">=1.53.0 "
11
+ required_conan_version = ">=2.4 "
14
12
15
13
16
14
class libdecorConan (ConanFile ):
17
15
name = "libdecor"
18
- package_type = "shared-library"
19
16
description = "libdecor is a library that can help Wayland clients draw window decorations for them."
20
17
topics = ("decoration" , "wayland" , "window" )
21
18
url = "https://github.com/conan-io/conan-center-index"
22
19
homepage = "https://gitlab.freedesktop.org/libdecor/libdecor"
23
20
license = "MIT"
21
+
22
+ package_type = "shared-library"
24
23
settings = "os" , "arch" , "compiler" , "build_type"
25
24
options = {
26
25
"with_dbus" : [True , False ],
@@ -32,18 +31,12 @@ class libdecorConan(ConanFile):
32
31
"with_gtk" : False ,
33
32
}
34
33
35
- @property
36
- def _has_build_profile (self ):
37
- return hasattr (self , "settings_build" )
34
+ implements = ["auto_shared_fpic" ]
35
+ languages = "C"
38
36
39
37
def export_sources (self ):
40
38
export_conandata_patches (self )
41
39
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
-
47
40
def layout (self ):
48
41
basic_layout (self , src_folder = "src" )
49
42
@@ -68,14 +61,15 @@ def validate(self):
68
61
raise ConanInvalidConfiguration (f"{ self .ref } requires at least version 3 of GTK when the with_gtk option is enabled" )
69
62
70
63
def build_requirements (self ):
71
- self .tool_requires ("meson/1.4.0 " )
64
+ self .tool_requires ("meson/[>=1.2.3 <2] " )
72
65
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] " )
74
67
self .tool_requires ("wayland/<host_version>" )
75
68
self .tool_requires ("wayland-protocols/1.33" )
76
69
77
70
def source (self ):
78
71
get (self , ** self .conan_data ["sources" ][self .version ], strip_root = True )
72
+ self ._patch_sources ()
79
73
80
74
def _patch_sources (self ):
81
75
apply_conandata_patches (self )
@@ -96,30 +90,10 @@ def feature(option):
96
90
tc .project_options ["gtk" ] = feature ("with_gtk" )
97
91
tc .generate ()
98
92
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" ]
117
94
pkg_config_deps .generate ()
118
- virtual_build_env = VirtualBuildEnv (self )
119
- virtual_build_env .generate ()
120
95
121
96
def build (self ):
122
- self ._patch_sources ()
123
97
meson = Meson (self )
124
98
meson .configure ()
125
99
meson .build ()
@@ -135,7 +109,7 @@ def package_info(self):
135
109
self .cpp_info .libs = [f"decor-{ libdecor_soversion } " ]
136
110
self .cpp_info .set_property ("pkg_config_name" , f"libdecor-{ libdecor_soversion } " )
137
111
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 } " )]
139
113
140
114
plugins_soversion = "1"
141
115
self .runenv_info .define ("LIBDECOR_PLUGIN_DIR" , os .path .join (self .package_folder , "lib" , "libdecor" , f"plugins-{ plugins_soversion } " ))
0 commit comments