forked from external/yambar
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')
|
||||
source=()
|
||||
|
||||
# pkgver() {
|
||||
# git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
# }
|
||||
pkgver() {
|
||||
git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=enabled -Dbackend-wayland=enabled ../
|
||||
|
|
|
@ -18,9 +18,9 @@ depends=(
|
|||
'libmpdclient')
|
||||
source=()
|
||||
|
||||
# pkgver() {
|
||||
# git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
# }
|
||||
pkgver() {
|
||||
git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=disabled -Dbackend-wayland=enabled ../
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
bar_backends = []
|
||||
|
||||
# TODO: X11
|
||||
if enable_x11
|
||||
bar_x11 = declare_dependency(sources: ['xcb.c', 'xcb.h'],
|
||||
dependencies: [xcb_stuff, cairo, cairo_ft])
|
||||
if backend_x11
|
||||
bar_x11 = declare_dependency(
|
||||
sources: ['xcb.c', 'xcb.h'], dependencies: [xcb_stuff, cairo, cairo_ft])
|
||||
bar_backends += [bar_x11]
|
||||
endif
|
||||
|
||||
# TODO: conditional Wayland
|
||||
if enable_wayland
|
||||
if backend_wayland
|
||||
wayland_protocols = dependency('wayland-protocols')
|
||||
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ deco_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
|
|||
|
||||
decorations = []
|
||||
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),
|
||||
dependencies: deco_sdk,
|
||||
name_prefix: 'decoration_',
|
||||
|
|
|
@ -4,7 +4,12 @@ f00bar(1)
|
|||
f00bar - modular status panel for X11 and Wayland
|
||||
|
||||
# SYNOPSIS
|
||||
*f00bar*
|
||||
*f00bar* [ -v ]
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*-v, --version*
|
||||
Show the version number and quit
|
||||
|
||||
# DESCRIPTION
|
||||
*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_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, "");
|
||||
|
||||
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};
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
|
|
75
meson.build
75
meson.build
|
@ -1,15 +1,34 @@
|
|||
project('f00bar', 'c',
|
||||
version: '1.0.1',
|
||||
license: 'MIT',
|
||||
version: '1.0.0',
|
||||
meson_version: '>=0.48.0',
|
||||
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
|
||||
|
||||
add_project_arguments(
|
||||
['-D_GNU_SOURCE'] +
|
||||
(get_option('core-plugins-as-shared-libraries') ?
|
||||
['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
|
||||
language: 'c',
|
||||
)
|
||||
plugs_as_libs = get_option('core-plugins-as-shared-libraries')
|
||||
|
||||
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')
|
||||
dl = cc.find_library('dl', required : false)
|
||||
threads = dependency('threads')
|
||||
|
@ -18,6 +37,7 @@ cairo = dependency('cairo')
|
|||
cairo_ft = dependency('cairo-ft')
|
||||
yaml = dependency('yaml-0.1')
|
||||
|
||||
# X11/XCB dependencies
|
||||
xcb_aux = dependency('xcb-aux', 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'))
|
||||
|
@ -26,35 +46,33 @@ xcb_randr = dependency('xcb-randr', 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'))
|
||||
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 \
|
||||
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 dependencies
|
||||
wayland_client = dependency('wayland-client', required: get_option('backend-wayland'))
|
||||
wayland_cursor = dependency('wayland-cursor', 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()
|
||||
enable_wayland = true
|
||||
add_project_arguments('-DENABLE_WAYLAND', language: 'c')
|
||||
else
|
||||
enable_wayland = false
|
||||
endif
|
||||
add_project_arguments(
|
||||
['-D_GNU_SOURCE',
|
||||
'-DF00BAR_VERSION=@0@'.format(version)] +
|
||||
(backend_x11 ? ['-DENABLE_X11'] : []) +
|
||||
(backend_wayland ? ['-DENABLE_WAYLAND'] : []) +
|
||||
(plugs_as_libs ? ['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
if enable_x11
|
||||
if backend_x11
|
||||
xcb_stuff_lib = static_library(
|
||||
'xcb-stuff', 'xcb.c', 'xcb.h',
|
||||
dependencies: [xcb_aux, xcb_cursor, xcb_event, xcb_ewmh, xcb_randr,
|
||||
xcb_render, cairo_xcb, 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)
|
||||
install_headers('xcb.h', subdir: 'f00bar')
|
||||
endif
|
||||
|
@ -100,3 +118,10 @@ install_headers(
|
|||
'tllist.h',
|
||||
'yml.h',
|
||||
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]],
|
||||
}
|
||||
|
||||
if enable_x11
|
||||
deps_x11_only = {
|
||||
if backend_x11
|
||||
deps += {
|
||||
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
||||
'xwindow': [[], [xcb_stuff]],
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ foreach mod, data : deps
|
|||
sources = data[0]
|
||||
dep = data[1]
|
||||
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
if plugs_as_libs
|
||||
shared_module(mod, '@0@.c'.format(mod), sources,
|
||||
dependencies: [module_sdk] + dep,
|
||||
name_prefix: 'module_',
|
||||
|
@ -45,23 +45,3 @@ foreach mod, data : deps
|
|||
compile_args: '-DHAVE_PLUGIN_@0@'.format(mod))]
|
||||
endif
|
||||
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 = []
|
||||
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),
|
||||
dependencies: particle_sdk,
|
||||
name_prefix: 'particle_',
|
||||
|
@ -18,10 +18,9 @@ endforeach
|
|||
|
||||
dynlist_lib = build_target(
|
||||
'dynlist', 'dynlist.c', 'dynlist.h', dependencies: particle_sdk,
|
||||
target_type: (get_option('core-plugins-as-shared-libraries')
|
||||
? 'shared_library' : 'static_library'),
|
||||
target_type: plugs_as_libs ? 'shared_library' : 'static_library',
|
||||
override_options : ['b_lundef=false'],
|
||||
install: get_option('core-plugins-as-shared-libraries'),
|
||||
install: plugs_as_libs,
|
||||
install_dir: get_option('libdir') + '/f00bar',
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue