-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
161 additions
and
139 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,138 +1,34 @@ | ||
project( | ||
'xdg-desktop-portal-hyprland', | ||
'c', | ||
version: '0.5.0', | ||
project('xdg-desktop-portal-hyprland', 'cpp', 'c', | ||
version: '2.0.0', | ||
license: 'MIT', | ||
meson_version: '>=0.58.0', | ||
default_options: ['c_std=c11', 'warning_level=2', 'werror=false'], | ||
) | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
add_project_arguments(cc.get_supported_arguments([ | ||
'-Wno-missing-braces', | ||
'-Wno-missing-field-initializers', | ||
'-Wno-unused-parameter', | ||
'-D_POSIX_C_SOURCE=200809L', | ||
'-D_GNU_SOURCE', | ||
]), language: 'c') | ||
|
||
prefix = get_option('prefix') | ||
sysconfdir = get_option('sysconfdir') | ||
add_project_arguments('-DSYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') | ||
|
||
inc = include_directories('include') | ||
|
||
rt = cc.find_library('rt') | ||
pipewire = dependency('libpipewire-0.3', version: '>= 0.3.62') | ||
hyprland_protos = dependency('hyprland-protocols', version: '>=0.2', fallback: 'hyprland-protocols') | ||
wayland_client = dependency('wayland-client') | ||
wayland_protos = dependency('wayland-protocols', version: '>=1.24') | ||
iniparser = dependency('inih') | ||
gbm = dependency('gbm') | ||
drm = dependency('libdrm') | ||
uuid = dependency('uuid') | ||
|
||
epoll = dependency('', required: false) | ||
if (not cc.has_function('timerfd_create', prefix: '#include <sys/timerfd.h>') or | ||
not cc.has_function('signalfd', prefix: '#include <sys/signalfd.h>')) | ||
epoll = dependency('epoll-shim') | ||
endif | ||
|
||
if get_option('sd-bus-provider') == 'auto' | ||
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') | ||
sdbus = dependency('libsystemd', | ||
required: false, | ||
not_found_message: 'libsystemd not found, trying libelogind', | ||
) | ||
if not sdbus.found() | ||
sdbus = dependency('libelogind', | ||
required: false, | ||
not_found_message: 'libelogind not found, trying basu', | ||
) | ||
endif | ||
if not sdbus.found() | ||
sdbus = dependency('basu', | ||
required: false, | ||
) | ||
endif | ||
if not sdbus.found() | ||
error('Neither libsystemd, nor libelogind, nor basu was found') | ||
endif | ||
meson_version: '>=0.63.0', | ||
default_options: [ | ||
'warning_level=2', | ||
'optimization=3', | ||
'buildtype=release', | ||
'debug=false', | ||
# 'cpp_std=c++23' # not yet supported by meson, as of version 0.63.0 | ||
],) | ||
|
||
# clang v14.0.6 uses C++2b instead of C++23, so we've gotta account for that | ||
# replace the following with a project default option once meson gets support for C++23 | ||
cpp_compiler = meson.get_compiler('cpp') | ||
if cpp_compiler.has_argument('-std=c++23') | ||
add_global_arguments('-std=c++23', language: 'cpp') | ||
elif cpp_compiler.has_argument('-std=c++2b') | ||
add_global_arguments('-std=c++2b', language: 'cpp') | ||
else | ||
sdbus = dependency(get_option('sd-bus-provider')) | ||
error('Could not configure current C++ compiler (' + cpp_compiler.get_id() + ' ' + cpp_compiler.version() + ') with required C++ standard (C++23)') | ||
endif | ||
add_project_arguments('-DHAVE_' + sdbus.name().to_upper() + '=1', language: 'c') | ||
|
||
subdir('protocols') | ||
|
||
xdpw_files = files([ | ||
'src/core/main.c', | ||
'src/core/logger.c', | ||
'src/core/config.c', | ||
'src/core/request.c', | ||
'src/core/session.c', | ||
'src/core/timer.c', | ||
'src/core/timespec_util.c', | ||
'src/core/utils.c', | ||
'src/screenshot/screenshot.c', | ||
'src/screencast/screencast.c', | ||
'src/screencast/screencast_common.c', | ||
'src/screencast/wlr_screencast.c', | ||
'src/screencast/pipewire_screencast.c', | ||
'src/screencast/fps_limit.c', | ||
'src/globalshortcuts/global_shortcuts.c' | ||
]) | ||
|
||
executable( | ||
'xdg-desktop-portal-hyprland', | ||
[xdpw_files, wl_proto_files], | ||
dependencies: [ | ||
wayland_client, | ||
sdbus, | ||
pipewire, | ||
rt, | ||
iniparser, | ||
gbm, | ||
drm, | ||
epoll, | ||
uuid, | ||
], | ||
include_directories: [inc], | ||
install: true, | ||
install_dir: get_option('libexecdir'), | ||
) | ||
|
||
conf_data = configuration_data() | ||
conf_data.set('libexecdir', | ||
join_paths(get_option('prefix'), get_option('libexecdir'))) | ||
conf_data.set('systemd_service', '') | ||
|
||
systemd = dependency('systemd', required: get_option('systemd')) | ||
|
||
if systemd.found() | ||
systemd_service_file = 'xdg-desktop-portal-hyprland.service' | ||
user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir', | ||
pkgconfig_define: ['prefix', get_option('prefix')]) | ||
conf_data.set('systemd_service', 'SystemdService=' + systemd_service_file) | ||
|
||
configure_file( | ||
configuration: conf_data, | ||
input: 'contrib/systemd/' + systemd_service_file + '.in', | ||
output: '@BASENAME@', | ||
install_dir: user_unit_dir, | ||
) | ||
endif | ||
|
||
configure_file( | ||
configuration: conf_data, | ||
input: 'org.freedesktop.impl.portal.desktop.hyprland.service.in', | ||
output: '@BASENAME@', | ||
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'), | ||
) | ||
|
||
install_data( | ||
'hyprland.portal', | ||
install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal', 'portals'), | ||
) | ||
add_project_arguments(cpp_compiler.get_supported_arguments([ | ||
'-Wall', | ||
'-Wextra', | ||
'-Wno-pointer-arith', | ||
'-Wno-unused-parameter', | ||
'-Wno-unused-value', | ||
'-Wno-missing-field-initializers', | ||
'-Wno-narrowing', | ||
]), language: 'cpp') | ||
|
||
wayland_protos = dependency('wayland-protocols', version: '>=1.24') |
This file contains 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,49 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
makeWrapper, | ||
meson, | ||
ninja, | ||
pkg-config, | ||
wayland-protocols, | ||
wayland-scanner, | ||
hyprland-share-picker, | ||
grim, | ||
slurp, | ||
hyprland-protocols, | ||
wayland, | ||
version ? "git", | ||
}: | ||
stdenv.mkDerivation { | ||
pname = "xdg-desktop-portal-hyprland"; | ||
inherit version; | ||
|
||
src = ../.; | ||
|
||
strictDeps = true; | ||
depsBuildBuild = [pkg-config]; | ||
nativeBuildInputs = [ | ||
meson | ||
ninja | ||
pkg-config | ||
wayland-scanner | ||
makeWrapper | ||
]; | ||
buildInputs = [ | ||
hyprland-protocols | ||
wayland | ||
wayland-protocols | ||
]; | ||
|
||
postInstall = '' | ||
wrapProgram $out/libexec/xdg-desktop-portal-hyprland --prefix PATH ":" ${lib.makeBinPath [hyprland-share-picker grim slurp]} | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/hyprwm/xdg-desktop-portal-hyprland"; | ||
description = "xdg-desktop-portal backend for Hyprland"; | ||
maintainers = with maintainers; [fufexan]; | ||
platforms = platforms.linux; | ||
license = licenses.mit; | ||
}; | ||
} |
This file contains 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,34 @@ | ||
{ | ||
stdenv, | ||
lib, | ||
cmake, | ||
qtbase, | ||
makeShellWrapper, | ||
wrapQtAppsHook, | ||
hyprland, | ||
slurp, | ||
version ? "git", | ||
... | ||
}: | ||
stdenv.mkDerivation { | ||
pname = "hyprland-share-picker"; | ||
inherit version; | ||
src = ../hyprland-share-picker; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
wrapQtAppsHook | ||
makeShellWrapper | ||
]; | ||
buildInputs = [ | ||
qtbase | ||
]; | ||
|
||
dontWrapQtApps = true; | ||
|
||
postInstall = '' | ||
wrapProgramShell $out/bin/hyprland-share-picker \ | ||
"''${qtWrapperArgs[@]}" \ | ||
--prefix PATH ":" ${lib.makeBinPath [slurp hyprland]} | ||
''; | ||
} |
This file contains 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,28 @@ | ||
{ | ||
self, | ||
inputs, | ||
lib, | ||
}: let | ||
mkJoinedOverlays = overlays: final: prev: | ||
lib.foldl' (attrs: overlay: attrs // (overlay final prev)) {} overlays; | ||
mkDate = longDate: (lib.concatStringsSep "-" [ | ||
(builtins.substring 0 4 longDate) | ||
(builtins.substring 4 2 longDate) | ||
(builtins.substring 6 2 longDate) | ||
]); | ||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); | ||
in { | ||
default = mkJoinedOverlays (with self.overlays; [ | ||
xdg-desktop-portal-hyprland | ||
hyprland-share-picker | ||
]); | ||
xdg-desktop-portal-hyprland = final: prev: { | ||
xdg-desktop-portal-hyprland = final.callPackage ./default.nix { | ||
inherit (final) hyprland-protocols hyprland-share-picker; | ||
inherit version; | ||
}; | ||
}; | ||
hyprland-share-picker = final: prev: { | ||
hyprland-share-picker = final.libsForQt5.callPackage ./hyprland-share-picker.nix {inherit version;}; | ||
}; | ||
} |
This file contains 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
This file contains 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,18 @@ | ||
globber = run_command('find', '.', '-name', '*.cpp', check: true) | ||
src = globber.stdout().strip().split('\n') | ||
|
||
executable('xdg-desktop-portal-hyprland', src, | ||
dependencies: [ | ||
dependency('wayland-client'), | ||
dependency('wayland-protocols'), | ||
dependency('cairo'), | ||
dependency('libjpeg') | ||
dependency('pango'), | ||
dependency('pangocairo') | ||
dependency('sdbus'), | ||
dependency('threads'), | ||
hyprland_protos, | ||
], | ||
install: true, | ||
install_dir: get_option('libexecdir') | ||
) |