-
Notifications
You must be signed in to change notification settings - Fork 2k
libdecor: Add recipe #22387
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
Open
jwillikers
wants to merge
26
commits into
conan-io:master
Choose a base branch
from
jwillikers:libdecor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+281
−0
Open
libdecor: Add recipe #22387
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
82f14ab
libdecor: Add recipe
jwillikers 2261c07
Update for fixed Pango package
jwillikers 8c6cf3c
Fix typo
jwillikers 025268a
Use def instead of lambda
jwillikers 6184bc5
Bump Meson
jwillikers 9b86c11
Bump Wayland Protocols
jwillikers f2b08da
Patch to build statically and use wayland-protocols like xkbcommon
jwillikers 9dcc395
Fix test package
jwillikers 008ca6f
Add patch source
jwillikers 59144c6
Remove extra blank line
jwillikers 8a9ea3f
Merge branch 'master' into libdecor
jwillikers ed5eb39
Merge branch 'master' into libdecor
jwillikers d5fea0f
Merge branch 'master' into libdecor
jwillikers 883f997
Merge branch 'master' into libdecor
jwillikers 3e55b9b
Merge branch 'master' into libdecor
jwillikers d39b720
Merge branch 'master' into libdecor
jwillikers 8c35eb1
Merge branch 'master' into libdecor
jwillikers 3e231a9
Merge branch 'master' into libdecor
jwillikers b4f7e5b
Default with_gtk option to false for old Gtk in CCI
jwillikers 5d29776
Update recipes/libdecor/all/test_package/meson.build
jwillikers f5d37bb
Update recipes/libdecor/all/conanfile.py
jwillikers 45fb68b
Bump dependencies
jwillikers fc7c136
Use dependencies.build
jwillikers 70c2c17
Use version 3 of GTK and re-enable with_gtk as the default
jwillikers 00ac9a7
Default the with_gtk option to false for CCI
jwillikers e6fcb16
Cleanups
AbrilRBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sources: | ||
"0.2.2": | ||
url: "https://gitlab.freedesktop.org/libdecor/libdecor/-/releases/0.2.2/downloads/libdecor-0.2.2.tar.xz" | ||
sha256: "16a288e24354d461b20dda9cf38e68543569134f04e4b7fa2914aa647907dfac" | ||
patches: | ||
"0.2.2": | ||
- patch_file: "patches/0.2.2-0001-Rename-os_create_anonymous_file-to-avoid-a-conflict-.patch" | ||
patch_description: "Rename os_create_anonymous_file to avoid a conflict in wayland-cursor" | ||
patch_type: "portability" | ||
patch_source: "https://gitlab.freedesktop.org/libdecor/libdecor/-/merge_requests/146" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import os | ||
import textwrap | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save | ||
from conan.tools.gnu import PkgConfigDeps | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.meson import Meson, MesonToolchain | ||
from conan.tools.scm import Version | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class libdecorConan(ConanFile): | ||
name = "libdecor" | ||
package_type = "shared-library" | ||
description = "libdecor is a library that can help Wayland clients draw window decorations for them." | ||
topics = ("decoration", "wayland", "window") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://gitlab.freedesktop.org/libdecor/libdecor" | ||
license = "MIT" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"with_dbus": [True, False], | ||
"with_gtk": [True, False], | ||
} | ||
default_options = { | ||
"with_dbus": True, | ||
"with_gtk": True, | ||
} | ||
|
||
@property | ||
def _has_build_profile(self): | ||
return hasattr(self, "settings_build") | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def configure(self): | ||
self.settings.rm_safe("compiler.cppstd") | ||
self.settings.rm_safe("compiler.libcxx") | ||
self.options["pango"].with_cairo = True | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("cairo/1.18.0") | ||
if self.options.get_safe("with_dbus"): | ||
self.requires("dbus/1.15.8") | ||
if self.options.get_safe("with_gtk"): | ||
self.requires("gtk/system", options={"version": "3"}) | ||
# Linking the test package results in missing freetype symbols without this. | ||
# It appears that this is due to an issue with a dependency such as pango or cairo pulling in the system freetype instead of Conan's. | ||
# Or potentially, it's related to an incorrectly specified dependency. | ||
self.requires("pango/1.51.0", transitive_libs=True) | ||
self.requires("wayland/1.22.0", transitive_headers=True) | ||
|
||
def validate(self): | ||
if self.settings.os != "Linux": | ||
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") | ||
if not self.dependencies["pango"].options.with_cairo: | ||
raise ConanInvalidConfiguration(f"{self.ref} requires the with_cairo option of pango to be enabled") | ||
if self.options.get_safe("with_gtk") and Version(self.dependencies["gtk"].options.version) < 3: | ||
raise ConanInvalidConfiguration(f"{self.ref} requires at least version 3 of GTK when the with_gtk option is enabled") | ||
|
||
def build_requirements(self): | ||
self.tool_requires("meson/1.4.0") | ||
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): | ||
self.tool_requires("pkgconf/2.2.0") | ||
self.tool_requires("wayland/<host_version>") | ||
self.tool_requires("wayland-protocols/1.33") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def _patch_sources(self): | ||
apply_conandata_patches(self) | ||
replace_in_file( | ||
self, | ||
os.path.join(self.source_folder, "src", "plugins", "meson.build"), | ||
"gtk_dep = dependency('gtk+-3.0', required: get_option('gtk'))", | ||
"gtk_dep = dependency('gtk', required: get_option('gtk'))", | ||
) | ||
|
||
def generate(self): | ||
def feature(option): | ||
return "enabled" if self.options.get_safe(option) else "disabled" | ||
|
||
tc = MesonToolchain(self) | ||
tc.project_options["dbus"] = feature("with_dbus") | ||
tc.project_options["demo"] = False | ||
tc.project_options["gtk"] = feature("with_gtk") | ||
tc.generate() | ||
pkg_config_deps = PkgConfigDeps(self) | ||
if self._has_build_profile: | ||
pkg_config_deps.build_context_activated = ["wayland-protocols"] | ||
else: | ||
# Manually generate pkgconfig file of wayland-protocols since | ||
# PkgConfigDeps.build_context_activated can't work with legacy 1 profile | ||
# We must use legacy conan v1 deps_cpp_info because self.dependencies doesn't | ||
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# contain build requirements when using 1 profile. | ||
wp_prefix = self.dependencies.build["wayland-protocols"].package_folder | ||
wp_version = self.dependencies.build["wayland-protocols"].ref.version | ||
wp_pkg_content = textwrap.dedent(f"""\ | ||
prefix={wp_prefix} | ||
datarootdir=${{prefix}}/res | ||
pkgdatadir=${{datarootdir}}/wayland-protocols | ||
Name: Wayland Protocols | ||
Description: Wayland protocol files | ||
Version: {wp_version} | ||
""") | ||
save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) | ||
pkg_config_deps.generate() | ||
virtual_build_env = VirtualBuildEnv(self) | ||
virtual_build_env.generate() | ||
|
||
def build(self): | ||
self._patch_sources() | ||
meson = Meson(self) | ||
meson.configure() | ||
meson.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
meson = Meson(self) | ||
meson.install() | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
|
||
def package_info(self): | ||
libdecor_soversion = "0" | ||
self.cpp_info.libs = [f"decor-{libdecor_soversion}"] | ||
self.cpp_info.set_property("pkg_config_name", f"libdecor-{libdecor_soversion}") | ||
|
||
self.cpp_info.includedirs = [os.path.join(self.package_folder, "include", f"libdecor-{libdecor_soversion}")] | ||
|
||
plugins_soversion = "1" | ||
self.runenv_info.define("LIBDECOR_PLUGIN_DIR", os.path.join(self.package_folder, "lib", "libdecor", f"plugins-{plugins_soversion}")) |
96 changes: 96 additions & 0 deletions
96
...ibdecor/all/patches/0.2.2-0001-Rename-os_create_anonymous_file-to-avoid-a-conflict-.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
From 64638f1affc4fcff1ca07e6544101b7beeecd563 Mon Sep 17 00:00:00 2001 | ||
From: Jordan Williams <[email protected]> | ||
Date: Mon, 4 Mar 2024 07:01:04 -0600 | ||
Subject: [PATCH] Rename os_create_anonymous_file to avoid a conflict in | ||
wayland-cursor | ||
|
||
Fixes #66. | ||
--- | ||
demo/c++-demo.cc | 2 +- | ||
demo/demo.c | 2 +- | ||
src/os-compatibility.c | 2 +- | ||
src/os-compatibility.h | 2 +- | ||
src/plugins/cairo/libdecor-cairo.c | 2 +- | ||
src/plugins/gtk/libdecor-gtk.c | 2 +- | ||
6 files changed, 6 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/demo/c++-demo.cc b/demo/c++-demo.cc | ||
index 72f63db..1a29ec7 100644 | ||
--- a/demo/c++-demo.cc | ||
+++ b/demo/c++-demo.cc | ||
@@ -94,7 +94,7 @@ public: | ||
stride = width * 4; | ||
size = stride * height; | ||
|
||
- fd = os_create_anonymous_file(size); | ||
+ fd = libdecor_os_create_anonymous_file(size); | ||
if (fd < 0) { | ||
cerr << "Creating a buffer file for " << size << | ||
" B failed: " << strerror(errno) << endl; | ||
diff --git a/demo/demo.c b/demo/demo.c | ||
index c347845..a736a46 100644 | ||
--- a/demo/demo.c | ||
+++ b/demo/demo.c | ||
@@ -1026,7 +1026,7 @@ create_shm_buffer(int width, | ||
stride = width * 4; | ||
size = stride * height; | ||
|
||
- fd = os_create_anonymous_file(size); | ||
+ fd = libdecor_os_create_anonymous_file(size); | ||
if (fd < 0) { | ||
fprintf(stderr, "creating a buffer file for %d B failed: %s\n", | ||
size, strerror(errno)); | ||
diff --git a/src/os-compatibility.c b/src/os-compatibility.c | ||
index 8287da0..2376647 100644 | ||
--- a/src/os-compatibility.c | ||
+++ b/src/os-compatibility.c | ||
@@ -148,7 +148,7 @@ os_resize_anonymous_file(int fd, off_t size) | ||
* XDG_RUNTIME_DIR. | ||
*/ | ||
int | ||
-os_create_anonymous_file(off_t size) | ||
+libdecor_os_create_anonymous_file(off_t size) | ||
{ | ||
static const char template[] = "/libdecor-shared-XXXXXX"; | ||
const char *path; | ||
diff --git a/src/os-compatibility.h b/src/os-compatibility.h | ||
index d0e69ac..6ce49d0 100644 | ||
--- a/src/os-compatibility.h | ||
+++ b/src/os-compatibility.h | ||
@@ -29,6 +29,6 @@ | ||
#include <sys/types.h> | ||
|
||
int | ||
-os_create_anonymous_file(off_t size); | ||
+libdecor_os_create_anonymous_file(off_t size); | ||
|
||
#endif /* OS_COMPATIBILITY_H */ | ||
diff --git a/src/plugins/cairo/libdecor-cairo.c b/src/plugins/cairo/libdecor-cairo.c | ||
index 765800d..30f6f87 100644 | ||
--- a/src/plugins/cairo/libdecor-cairo.c | ||
+++ b/src/plugins/cairo/libdecor-cairo.c | ||
@@ -597,7 +597,7 @@ create_shm_buffer(struct libdecor_plugin_cairo *plugin_cairo, | ||
stride = buffer_width * 4; | ||
size = stride * buffer_height; | ||
|
||
- fd = os_create_anonymous_file(size); | ||
+ fd = libdecor_os_create_anonymous_file(size); | ||
if (fd < 0) { | ||
fprintf(stderr, "creating a buffer file for %d B failed: %s\n", | ||
size, strerror(errno)); | ||
diff --git a/src/plugins/gtk/libdecor-gtk.c b/src/plugins/gtk/libdecor-gtk.c | ||
index ef638f1..8655d45 100644 | ||
--- a/src/plugins/gtk/libdecor-gtk.c | ||
+++ b/src/plugins/gtk/libdecor-gtk.c | ||
@@ -595,7 +595,7 @@ create_shm_buffer(struct libdecor_plugin_gtk *plugin_gtk, | ||
stride = buffer_width * 4; | ||
size = stride * buffer_height; | ||
|
||
- fd = os_create_anonymous_file(size); | ||
+ fd = libdecor_os_create_anonymous_file(size); | ||
if (fd < 0) { | ||
fprintf(stderr, "creating a buffer file for %d B failed: %s\n", | ||
size, strerror(errno)); | ||
-- | ||
2.44.0 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.meson import Meson | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build_requirements(self): | ||
self.tool_requires("meson/1.4.0") | ||
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): | ||
self.tool_requires("pkgconf/2.2.0") | ||
|
||
def build(self): | ||
meson = Meson(self) | ||
meson.configure() | ||
meson.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
project('test_package', 'c') | ||
|
||
libdecor_dep = dependency('libdecor-0') | ||
|
||
executable('test_package', | ||
sources: [ | ||
'test_package.c', | ||
], | ||
dependencies: [ | ||
libdecor_dep, | ||
], | ||
) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <stdlib.h> | ||
#include <libdecor.h> | ||
|
||
int main(int argc, char **argv) { | ||
struct libdecor_state *state = libdecor_state_new(0, 0); | ||
if (!state) { | ||
return EXIT_FAILURE; | ||
} | ||
libdecor_state_free(state); | ||
return EXIT_SUCCESS; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"0.2.2": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.