mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-21 20:05:42 +02:00
Merge remote-tracking branch 'origin/master' into releases/1.0
This commit is contained in:
commit
418f562045
10 changed files with 80 additions and 67 deletions
6
PKGBUILD
6
PKGBUILD
|
@ -18,9 +18,9 @@ depends=(
|
||||||
optdepends=('xcb-util-errors: better X error messages')
|
optdepends=('xcb-util-errors: better X error messages')
|
||||||
source=()
|
source=()
|
||||||
|
|
||||||
# pkgver() {
|
pkgver() {
|
||||||
# git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||||
# }
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=enabled -Dbackend-wayland=enabled ../
|
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=enabled -Dbackend-wayland=enabled ../
|
||||||
|
|
|
@ -18,9 +18,9 @@ depends=(
|
||||||
'libmpdclient')
|
'libmpdclient')
|
||||||
source=()
|
source=()
|
||||||
|
|
||||||
# pkgver() {
|
pkgver() {
|
||||||
# git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||||
# }
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=disabled -Dbackend-wayland=enabled ../
|
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=disabled -Dbackend-wayland=enabled ../
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
bar_backends = []
|
bar_backends = []
|
||||||
|
|
||||||
# TODO: X11
|
if backend_x11
|
||||||
if enable_x11
|
bar_x11 = declare_dependency(
|
||||||
bar_x11 = declare_dependency(sources: ['xcb.c', 'xcb.h'],
|
sources: ['xcb.c', 'xcb.h'], dependencies: [xcb_stuff, cairo, cairo_ft])
|
||||||
dependencies: [xcb_stuff, cairo, cairo_ft])
|
|
||||||
bar_backends += [bar_x11]
|
bar_backends += [bar_x11]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# TODO: conditional Wayland
|
if backend_wayland
|
||||||
if enable_wayland
|
|
||||||
wayland_protocols = dependency('wayland-protocols')
|
wayland_protocols = dependency('wayland-protocols')
|
||||||
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ deco_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
|
||||||
|
|
||||||
decorations = []
|
decorations = []
|
||||||
foreach deco : ['background', 'stack', 'underline']
|
foreach deco : ['background', 'stack', 'underline']
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
if plugs_as_libs
|
||||||
shared_module('@0@'.format(deco), '@0@.c'.format(deco),
|
shared_module('@0@'.format(deco), '@0@.c'.format(deco),
|
||||||
dependencies: deco_sdk,
|
dependencies: deco_sdk,
|
||||||
name_prefix: 'decoration_',
|
name_prefix: 'decoration_',
|
||||||
|
|
|
@ -4,7 +4,12 @@ f00bar(1)
|
||||||
f00bar - modular status panel for X11 and Wayland
|
f00bar - modular status panel for X11 and Wayland
|
||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
*f00bar*
|
*f00bar* [ -v ]
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
*-v, --version*
|
||||||
|
Show the version number and quit
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
*f00bar* is a light-weight and configurable status panel (_bar_, for
|
*f00bar* is a light-weight and configurable status panel (_bar_, for
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
sh = find_program('sh', native: true)
|
|
||||||
scdoc = dependency('scdoc', native: true)
|
scdoc = dependency('scdoc', native: true)
|
||||||
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
|
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
|
||||||
|
|
||||||
|
|
7
main.c
7
main.c
|
@ -122,6 +122,13 @@ main(int argc, const char *const *argv)
|
||||||
{
|
{
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
|
||||||
|
printf("f00bar version %s\n", F00BAR_VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const struct sigaction sa = {.sa_handler = &signal_handler};
|
const struct sigaction sa = {.sa_handler = &signal_handler};
|
||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sigaction(SIGTERM, &sa, NULL);
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
|
|
75
meson.build
75
meson.build
|
@ -1,15 +1,34 @@
|
||||||
project('f00bar', 'c',
|
project('f00bar', 'c',
|
||||||
|
version: '1.0.1',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
version: '1.0.0',
|
meson_version: '>=0.48.0',
|
||||||
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
|
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
|
||||||
|
|
||||||
add_project_arguments(
|
plugs_as_libs = get_option('core-plugins-as-shared-libraries')
|
||||||
['-D_GNU_SOURCE'] +
|
|
||||||
(get_option('core-plugins-as-shared-libraries') ?
|
|
||||||
['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
|
|
||||||
language: 'c',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
version = '"@0@"'.format(meson.project_version())
|
||||||
|
|
||||||
|
sh = find_program('sh', native: true)
|
||||||
|
git = find_program('git', required: false, native: true)
|
||||||
|
|
||||||
|
if git.found()
|
||||||
|
commit_hash = run_command(
|
||||||
|
[sh.path(), '-c',
|
||||||
|
'@0@ --git-dir=$MESON_SOURCE_ROOT/.git describe --always --tags'.format(
|
||||||
|
git.path())])
|
||||||
|
|
||||||
|
branch = run_command(
|
||||||
|
[sh.path(), '-c',
|
||||||
|
'@0@ --git-dir=$MESON_SOURCE_ROOT/.git rev-parse --abbrev-ref HEAD'.format(
|
||||||
|
git.path())])
|
||||||
|
|
||||||
|
if commit_hash.returncode() == 0 and branch.returncode() == 0
|
||||||
|
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(
|
||||||
|
commit_hash.stdout().strip(), branch.stdout().strip())
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Common dependencies
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
dl = cc.find_library('dl', required : false)
|
dl = cc.find_library('dl', required : false)
|
||||||
threads = dependency('threads')
|
threads = dependency('threads')
|
||||||
|
@ -18,6 +37,7 @@ cairo = dependency('cairo')
|
||||||
cairo_ft = dependency('cairo-ft')
|
cairo_ft = dependency('cairo-ft')
|
||||||
yaml = dependency('yaml-0.1')
|
yaml = dependency('yaml-0.1')
|
||||||
|
|
||||||
|
# X11/XCB dependencies
|
||||||
xcb_aux = dependency('xcb-aux', required: get_option('backend-x11'))
|
xcb_aux = dependency('xcb-aux', required: get_option('backend-x11'))
|
||||||
xcb_cursor = dependency('xcb-cursor', required: get_option('backend-x11'))
|
xcb_cursor = dependency('xcb-cursor', required: get_option('backend-x11'))
|
||||||
xcb_event = dependency('xcb-event', required: get_option('backend-x11'))
|
xcb_event = dependency('xcb-event', required: get_option('backend-x11'))
|
||||||
|
@ -26,35 +46,33 @@ xcb_randr = dependency('xcb-randr', required: get_option('backend-x11'))
|
||||||
xcb_render = dependency('xcb-render', required: get_option('backend-x11'))
|
xcb_render = dependency('xcb-render', required: get_option('backend-x11'))
|
||||||
cairo_xcb = dependency('cairo-xcb', required: get_option('backend-x11'))
|
cairo_xcb = dependency('cairo-xcb', required: get_option('backend-x11'))
|
||||||
xcb_errors = dependency('xcb-errors', required: false)
|
xcb_errors = dependency('xcb-errors', required: false)
|
||||||
|
backend_x11 = xcb_aux.found() and xcb_cursor.found() and xcb_event.found() and \
|
||||||
|
xcb_ewmh.found() and xcb_randr.found() and xcb_render.found() and \
|
||||||
|
cairo_xcb.found()
|
||||||
|
|
||||||
if xcb_aux.found() and xcb_cursor.found() and xcb_event.found() and \
|
# Wayland dependencies
|
||||||
xcb_ewmh.found() and xcb_randr.found() and xcb_render.found() and \
|
|
||||||
cairo_xcb.found()
|
|
||||||
|
|
||||||
enable_x11 = true
|
|
||||||
add_project_arguments('-DENABLE_X11', language: 'c')
|
|
||||||
else
|
|
||||||
enable_x11 = false
|
|
||||||
endif
|
|
||||||
|
|
||||||
wayland_client = dependency('wayland-client', required: get_option('backend-wayland'))
|
wayland_client = dependency('wayland-client', required: get_option('backend-wayland'))
|
||||||
wayland_cursor = dependency('wayland-cursor', required: get_option('backend-wayland'))
|
wayland_cursor = dependency('wayland-cursor', required: get_option('backend-wayland'))
|
||||||
wlroots = dependency('wlroots', required: get_option('backend-wayland'))
|
wlroots = dependency('wlroots', required: get_option('backend-wayland'))
|
||||||
|
backend_wayland = wayland_client.found() and wayland_cursor.found() and wlroots.found()
|
||||||
|
|
||||||
if wayland_client.found() and wayland_cursor.found() and wlroots.found()
|
add_project_arguments(
|
||||||
enable_wayland = true
|
['-D_GNU_SOURCE',
|
||||||
add_project_arguments('-DENABLE_WAYLAND', language: 'c')
|
'-DF00BAR_VERSION=@0@'.format(version)] +
|
||||||
else
|
(backend_x11 ? ['-DENABLE_X11'] : []) +
|
||||||
enable_wayland = false
|
(backend_wayland ? ['-DENABLE_WAYLAND'] : []) +
|
||||||
endif
|
(plugs_as_libs ? ['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
|
||||||
|
language: 'c',
|
||||||
|
)
|
||||||
|
|
||||||
if enable_x11
|
if backend_x11
|
||||||
xcb_stuff_lib = static_library(
|
xcb_stuff_lib = static_library(
|
||||||
'xcb-stuff', 'xcb.c', 'xcb.h',
|
'xcb-stuff', 'xcb.c', 'xcb.h',
|
||||||
dependencies: [xcb_aux, xcb_cursor, xcb_event, xcb_ewmh, xcb_randr,
|
dependencies: [xcb_aux, xcb_cursor, xcb_event, xcb_ewmh, xcb_randr,
|
||||||
xcb_render, cairo_xcb, xcb_errors],
|
xcb_render, cairo_xcb, xcb_errors],
|
||||||
c_args: xcb_errors.found() ? '-DHAVE_XCB_ERRORS' : [],
|
c_args: xcb_errors.found() ? '-DHAVE_XCB_ERRORS' : [],
|
||||||
pic: get_option('core-plugins-as-shared-libraries'))
|
pic: plugs_as_libs)
|
||||||
|
|
||||||
xcb_stuff = declare_dependency(link_with: xcb_stuff_lib)
|
xcb_stuff = declare_dependency(link_with: xcb_stuff_lib)
|
||||||
install_headers('xcb.h', subdir: 'f00bar')
|
install_headers('xcb.h', subdir: 'f00bar')
|
||||||
endif
|
endif
|
||||||
|
@ -100,3 +118,10 @@ install_headers(
|
||||||
'tllist.h',
|
'tllist.h',
|
||||||
'yml.h',
|
'yml.h',
|
||||||
subdir: 'f00bar')
|
subdir: 'f00bar')
|
||||||
|
|
||||||
|
message('')
|
||||||
|
message('Build type: @0@'.format(get_option('buildtype')))
|
||||||
|
message('XCB backend: @0@'.format(backend_x11))
|
||||||
|
message('Wayland backend: @0@'.format(backend_wayland))
|
||||||
|
message('Core modules as plugins: @0@'.format(plugs_as_libs))
|
||||||
|
message('')
|
||||||
|
|
|
@ -21,8 +21,8 @@ deps = {
|
||||||
'removables': [[], [dynlist, udev]],
|
'removables': [[], [dynlist, udev]],
|
||||||
}
|
}
|
||||||
|
|
||||||
if enable_x11
|
if backend_x11
|
||||||
deps_x11_only = {
|
deps += {
|
||||||
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
||||||
'xwindow': [[], [xcb_stuff]],
|
'xwindow': [[], [xcb_stuff]],
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ foreach mod, data : deps
|
||||||
sources = data[0]
|
sources = data[0]
|
||||||
dep = data[1]
|
dep = data[1]
|
||||||
|
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
if plugs_as_libs
|
||||||
shared_module(mod, '@0@.c'.format(mod), sources,
|
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||||
dependencies: [module_sdk] + dep,
|
dependencies: [module_sdk] + dep,
|
||||||
name_prefix: 'module_',
|
name_prefix: 'module_',
|
||||||
|
@ -45,23 +45,3 @@ foreach mod, data : deps
|
||||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if enable_x11
|
|
||||||
foreach mod, data : deps_x11_only
|
|
||||||
sources = data[0]
|
|
||||||
dep = data[1]
|
|
||||||
|
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
|
||||||
shared_module(mod, '@0@.c'.format(mod), sources,
|
|
||||||
dependencies: [module_sdk] + dep,
|
|
||||||
name_prefix: 'module_',
|
|
||||||
install: true,
|
|
||||||
install_dir: join_paths(get_option('libdir'), 'f00bar'))
|
|
||||||
else
|
|
||||||
modules += [declare_dependency(
|
|
||||||
sources: ['@0@.c'.format(mod)] + sources,
|
|
||||||
dependencies: [module_sdk] + dep,
|
|
||||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
endif
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ particle_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
|
||||||
|
|
||||||
particles = []
|
particles = []
|
||||||
foreach particle : ['empty', 'list', 'map', 'progress-bar', 'ramp', 'string']
|
foreach particle : ['empty', 'list', 'map', 'progress-bar', 'ramp', 'string']
|
||||||
if get_option('core-plugins-as-shared-libraries')
|
if plugs_as_libs
|
||||||
shared_module('@0@'.format(particle), '@0@.c'.format(particle),
|
shared_module('@0@'.format(particle), '@0@.c'.format(particle),
|
||||||
dependencies: particle_sdk,
|
dependencies: particle_sdk,
|
||||||
name_prefix: 'particle_',
|
name_prefix: 'particle_',
|
||||||
|
@ -18,10 +18,9 @@ endforeach
|
||||||
|
|
||||||
dynlist_lib = build_target(
|
dynlist_lib = build_target(
|
||||||
'dynlist', 'dynlist.c', 'dynlist.h', dependencies: particle_sdk,
|
'dynlist', 'dynlist.c', 'dynlist.h', dependencies: particle_sdk,
|
||||||
target_type: (get_option('core-plugins-as-shared-libraries')
|
target_type: plugs_as_libs ? 'shared_library' : 'static_library',
|
||||||
? 'shared_library' : 'static_library'),
|
|
||||||
override_options : ['b_lundef=false'],
|
override_options : ['b_lundef=false'],
|
||||||
install: get_option('core-plugins-as-shared-libraries'),
|
install: plugs_as_libs,
|
||||||
install_dir: get_option('libdir') + '/f00bar',
|
install_dir: get_option('libdir') + '/f00bar',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue