mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
Merge branch 'meson'
This commit is contained in:
commit
22989d60e3
10 changed files with 309 additions and 12 deletions
|
@ -9,7 +9,7 @@ variables:
|
|||
before_script:
|
||||
- echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
|
||||
- apk update
|
||||
- apk add musl-dev eudev-libs eudev-dev linux-headers cmake ninja gcc scdoc
|
||||
- apk add musl-dev eudev-libs eudev-dev linux-headers meson ninja gcc scdoc
|
||||
- apk add libxcb-dev xcb-util-wm-dev xcb-util-cursor-dev cairo-dev yaml-dev
|
||||
- apk add wayland-dev wayland-protocols wlroots-dev
|
||||
- apk add json-c-dev libmpdclient-dev alsa-lib-dev
|
||||
|
@ -19,7 +19,7 @@ debug:
|
|||
script:
|
||||
- mkdir -p bld/debug
|
||||
- cd bld/debug
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
- meson --buildtype=debug ../..
|
||||
- ninja -k0
|
||||
|
||||
release:
|
||||
|
@ -27,7 +27,7 @@ release:
|
|||
script:
|
||||
- mkdir -p bld/release
|
||||
- cd bld/release
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
- meson --buildtype=minsize ../../
|
||||
- ninja -k0
|
||||
|
||||
x11_only:
|
||||
|
@ -35,7 +35,7 @@ x11_only:
|
|||
script:
|
||||
- mkdir -p bld/debug
|
||||
- cd bld/debug
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_X11=yes -DENABLE_WAYLAND=no ../../
|
||||
- meson --buildtype=debug -Dbackend-x11=enabled -Dbackend-wayland=disabled ../../
|
||||
- ninja -k0
|
||||
|
||||
wayland_only:
|
||||
|
@ -43,7 +43,7 @@ wayland_only:
|
|||
script:
|
||||
- mkdir -p bld/debug
|
||||
- cd bld/debug
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_X11=no -DENABLE_WAYLAND=yes ../../
|
||||
- meson --buildtype=debug -Dbackend-x11=disabled -Dbackend-wayland=enabled ../../
|
||||
- ninja -k0
|
||||
|
||||
plugins_as_shared_modules:
|
||||
|
@ -51,5 +51,5 @@ plugins_as_shared_modules:
|
|||
script:
|
||||
- mkdir -p bld/debug
|
||||
- cd bld/debug
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCORE_PLUGINS_AS_SHARED_LIBRARIES=yes ../../
|
||||
- meson --buildtype=debug -Dcore-plugins-as-shared-libraries=true ../../
|
||||
- ninja -k0
|
||||
|
|
6
PKGBUILD
6
PKGBUILD
|
@ -1,11 +1,11 @@
|
|||
pkgname=f00bar
|
||||
pkgver=0.9.0.r162.g879d5ce
|
||||
pkgver=0.9.0.r200.gaaa5239
|
||||
pkgrel=1
|
||||
pkgdesc="Simplistic and highly configurable status panel for X and Wayland"
|
||||
arch=('x86_64')
|
||||
url=https://gitlab.com/dnkl/f00bar
|
||||
license=(mit)
|
||||
makedepends=('scdoc')
|
||||
makedepends=('meson' 'ninja' 'scdoc' 'gzip')
|
||||
depends=(
|
||||
'libxcb' 'xcb-util' 'xcb-util-cursor' 'xcb-util-wm'
|
||||
'wayland' 'wlroots'
|
||||
|
@ -23,7 +23,7 @@ pkgver() {
|
|||
}
|
||||
|
||||
build() {
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=enabled -Dbackend-wayland=enabled ../
|
||||
ninja
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pkgname=f00bar-wayland
|
||||
pkgver=0.9.0.r186.g5ace4d7
|
||||
pkgver=0.9.0.r200.gaaa5239
|
||||
pkgrel=1
|
||||
pkgdesc="Simplistic and highly configurable status panel for Wayland"
|
||||
arch=('x86_64')
|
||||
|
@ -7,7 +7,7 @@ url=https://gitlab.com/dnkl/f00bar
|
|||
license=(mit)
|
||||
conflicts=('f00bar')
|
||||
provides=('f00bar')
|
||||
makedepends=('scdoc')
|
||||
makedepends=('meson' 'ninja' 'scdoc' 'gzip')
|
||||
depends=(
|
||||
'wayland' 'wlroots'
|
||||
'freetype2' 'fontconfig' 'cairo'
|
||||
|
@ -23,7 +23,7 @@ pkgver() {
|
|||
}
|
||||
|
||||
build() {
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_X11=0 -DENABLE_WAYLAND=1 ../
|
||||
meson --buildtype=minsize --prefix=/usr -Dbackend-x11=disabled -Dbackend-wayland=enabled ../
|
||||
ninja
|
||||
}
|
||||
|
||||
|
|
50
bar/meson.build
Normal file
50
bar/meson.build
Normal file
|
@ -0,0 +1,50 @@
|
|||
bar_backends = []
|
||||
|
||||
# TODO: X11
|
||||
if enable_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
|
||||
wayland_protocols = dependency('wayland-protocols')
|
||||
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||
|
||||
wscanner = dependency('wayland-scanner', native: true)
|
||||
wscanner_prog = find_program(
|
||||
wscanner.get_pkgconfig_variable('wayland_scanner'), native: true)
|
||||
|
||||
wayland_protocol_header = generator(
|
||||
wscanner_prog,
|
||||
output: '@BASENAME@.h',
|
||||
arguments: ['client-header', '@INPUT@', '@OUTPUT@'])
|
||||
wayland_protocol_source = generator(
|
||||
wscanner_prog,
|
||||
output: '@BASENAME@.c',
|
||||
arguments: ['private-code', '@INPUT@', '@OUTPUT@'])
|
||||
|
||||
generated_wayland_protocols = []
|
||||
foreach prot : [
|
||||
'../external/wlr-protocols/unstable/wlr-layer-shell-unstable-v1.xml',
|
||||
wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml',
|
||||
wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml']
|
||||
|
||||
generated_wayland_protocols += [
|
||||
wayland_protocol_header.process(prot),
|
||||
wayland_protocol_source.process(prot)]
|
||||
endforeach
|
||||
|
||||
bar_wayland = declare_dependency(
|
||||
sources: ['wayland.c', 'wayland.h'] + generated_wayland_protocols,
|
||||
dependencies: [wayland_client, wayland_cursor, cairo, cairo_ft])
|
||||
|
||||
bar_backends += [bar_wayland]
|
||||
endif
|
||||
|
||||
bar = declare_dependency(
|
||||
sources: ['bar.c', 'bar.h', 'private.h', 'backend.h'],
|
||||
dependencies: bar_backends + [threads])
|
||||
|
||||
install_headers('bar.h', subdir: 'f00bar/bar')
|
19
decorations/meson.build
Normal file
19
decorations/meson.build
Normal file
|
@ -0,0 +1,19 @@
|
|||
deco_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
|
||||
|
||||
decorations = []
|
||||
foreach deco : ['background', 'stack', 'underline']
|
||||
if get_option('core-plugins-as-shared-libraries')
|
||||
shared_module('@0@'.format(deco), '@0@.c'.format(deco),
|
||||
dependencies: deco_sdk,
|
||||
name_prefix: 'decoration_',
|
||||
install: true,
|
||||
install_dir: get_option('libdir') + '/f00bar')
|
||||
else
|
||||
lib = static_library(
|
||||
'decoration_@0@'.format(deco), '@0@.c'.format(deco), dependencies: deco_sdk)
|
||||
|
||||
decorations += [declare_dependency(
|
||||
link_with: lib,
|
||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(deco.underscorify()))]
|
||||
endif
|
||||
endforeach
|
22
doc/meson.build
Normal file
22
doc/meson.build
Normal file
|
@ -0,0 +1,22 @@
|
|||
sh = find_program('sh', native: true)
|
||||
scdoc = dependency('scdoc', native: true)
|
||||
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
|
||||
gzip = find_program('gzip', native: true)
|
||||
|
||||
foreach man_src : ['f00bar.1.scd', 'f00bar.5.scd', 'f00bar-decorations.5.scd',
|
||||
'f00bar-modules.5.scd', 'f00bar-particles.5.scd',
|
||||
'f00bar-tags.5.scd']
|
||||
parts = man_src.split('.')
|
||||
name = parts[-3]
|
||||
section = parts[-2]
|
||||
out = '@0@.@1@.gz'.format(name, section)
|
||||
|
||||
custom_target(
|
||||
out,
|
||||
output: out,
|
||||
input: man_src,
|
||||
command: [sh, '-c', '@0@ < @INPUT@ | @1@ > doc/@2@'.format(
|
||||
scdoc_prog.path(), gzip.path(), out)],
|
||||
install: true,
|
||||
install_dir: '@0@/man@1@'.format(get_option('mandir'), section))
|
||||
endforeach
|
101
meson.build
Normal file
101
meson.build
Normal file
|
@ -0,0 +1,101 @@
|
|||
project('f00bar', 'c',
|
||||
license: 'MIT',
|
||||
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
|
||||
|
||||
add_project_arguments(
|
||||
['-D_GNU_SOURCE',
|
||||
'-Wno-unused-result'] +
|
||||
(get_option('core-plugins-as-shared-libraries') ? ['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
dl = cc.find_library('dl', required : false)
|
||||
threads = dependency('threads')
|
||||
fontconfig = dependency('fontconfig')
|
||||
cairo = dependency('cairo')
|
||||
cairo_ft = dependency('cairo-ft')
|
||||
yaml = dependency('yaml-0.1')
|
||||
|
||||
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'))
|
||||
xcb_ewmh = dependency('xcb-ewmh', required: get_option('backend-x11'))
|
||||
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)
|
||||
|
||||
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_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'))
|
||||
|
||||
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
|
||||
|
||||
if enable_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'))
|
||||
xcb_stuff = declare_dependency(link_with: xcb_stuff_lib)
|
||||
install_headers('xcb.h', subdir: 'f00bar')
|
||||
endif
|
||||
|
||||
subdir('doc')
|
||||
subdir('bar')
|
||||
subdir('decorations')
|
||||
subdir('particles')
|
||||
subdir('modules')
|
||||
|
||||
executable(
|
||||
'f00bar',
|
||||
'color.h',
|
||||
'config-verify.c', 'config-verify.h',
|
||||
'config.c', 'config.h',
|
||||
'decoration.h',
|
||||
'font.c', 'font.h',
|
||||
'log.c', 'log.h',
|
||||
'main.c',
|
||||
'module.c', 'module.h',
|
||||
'particle.c', 'particle.h',
|
||||
'plugin.c', 'plugin.h',
|
||||
'tag.c', 'tag.h',
|
||||
'tllist.h',
|
||||
'yml.c', 'yml.h',
|
||||
dependencies: [bar, cairo, cairo_ft, fontconfig, yaml, threads, dl] +
|
||||
decorations + particles + modules,
|
||||
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
|
||||
export_dynamic: true,
|
||||
install: true,
|
||||
install_rpath: '$ORIGIN/../' + get_option('libdir') + '/f00bar')
|
||||
|
||||
install_headers(
|
||||
'color.h',
|
||||
'config.h',
|
||||
'config-verify.h',
|
||||
'decoration.h',
|
||||
'font.h',
|
||||
'log.h',
|
||||
'module.h',
|
||||
'particle.h',
|
||||
'tag.h',
|
||||
'tllist.h',
|
||||
'yml.h',
|
||||
subdir: 'f00bar')
|
7
meson_options.txt
Normal file
7
meson_options.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
option(
|
||||
'backend-x11', type: 'feature', value: 'enabled', description: 'XCB (X11) backend')
|
||||
option(
|
||||
'backend-wayland', type: 'feature', value: 'enabled', description: 'Wayland backend')
|
||||
option(
|
||||
'core-plugins-as-shared-libraries', type: 'boolean', value: false,
|
||||
description: 'Compiles modules, particles and decorations as shared libraries, which are loaded on-demand')
|
67
modules/meson.build
Normal file
67
modules/meson.build
Normal file
|
@ -0,0 +1,67 @@
|
|||
module_sdk = declare_dependency(dependencies: [cairo, cairo_ft, threads])
|
||||
|
||||
modules = []
|
||||
|
||||
alsa = dependency('alsa')
|
||||
udev = dependency('libudev')
|
||||
json = dependency('json-c')
|
||||
mpd = dependency('libmpdclient')
|
||||
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
|
||||
|
||||
# Module name -> (source-list, dep-list)
|
||||
deps = {
|
||||
'alsa': [[], [alsa]],
|
||||
'backlight': [[], [udev]],
|
||||
'battery': [[], [udev]],
|
||||
'clock': [[], []],
|
||||
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
|
||||
'label': [[], []],
|
||||
'mpd': [[], [mpd]],
|
||||
'network': [[], []],
|
||||
'removables': [[], [dynlist, udev]],
|
||||
}
|
||||
|
||||
if enable_x11
|
||||
deps_x11_only = {
|
||||
'xkb': [[], [xcb_stuff, xcb_xkb]],
|
||||
'xwindow': [[], [xcb_stuff]],
|
||||
}
|
||||
endif
|
||||
|
||||
foreach mod, data : deps
|
||||
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: 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
|
||||
|
||||
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: 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
|
31
particles/meson.build
Normal file
31
particles/meson.build
Normal file
|
@ -0,0 +1,31 @@
|
|||
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')
|
||||
shared_module('@0@'.format(particle), '@0@.c'.format(particle),
|
||||
dependencies: particle_sdk,
|
||||
name_prefix: 'particle_',
|
||||
install: true,
|
||||
install_dir: get_option('libdir') + '/f00bar')
|
||||
else
|
||||
lib = static_library(
|
||||
'particle_@0@'.format(particle), '@0@.c'.format(particle),
|
||||
dependencies: particle_sdk)
|
||||
|
||||
particles += [declare_dependency(
|
||||
link_with: lib,
|
||||
compile_args: '-DHAVE_PLUGIN_@0@'.format(particle.underscorify()))]
|
||||
endif
|
||||
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'),
|
||||
override_options : ['b_lundef=false'],
|
||||
install: get_option('core-plugins-as-shared-libraries'),
|
||||
install_dir: get_option('libdir') + '/f00bar',
|
||||
)
|
||||
|
||||
dynlist = declare_dependency(link_with: dynlist_lib)
|
Loading…
Add table
Reference in a new issue