Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
man_cfg=configuration_data()
man_cfg.set('sysconfdir',sysconfdir)
blocaled_8=configure_file(
input:'blocaled.8.in',
output:'blocaled.8',
configuration:man_cfg
)
install_man(blocaled_8)

conf_cfg=configuration_data()
conf_cfg.set('localeconfig',localeconfig)
conf_cfg.set('keyboardconfig',keyboardconfig)
conf_cfg.set('xkbdconfig',xkbdconfig)
blocaled_conf = configure_file(
input: 'blocaled.conf.in',
output: 'blocaled.conf',
configuration:conf_cfg
)
install_data(blocaled_conf, install_dir: sysconfdir)

serv_cfg=configuration_data()
serv_cfg.set('libexecdir', prefix + '/' + get_option('libexecdir'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
serv_cfg.set('libexecdir', prefix + '/' + get_option('libexecdir'))
serv_cfg.set('libexecdir', prefix / get_option('libexecdir'))

The a / b operator is syntactic sugar for join_paths(a, b), it guarantees "smart" path joining regardless of edge cases such as "libexecdir lies outside of prefix so it ends up being an absolute path" (may be relevant on NixOS??) and is also just more readable if you ask me. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your kind review. I am not an expert in meson/python, and I'm learning while doing this. Will apply.

service = configure_file(
input: 'org.freedesktop.locale1.service.in',
output: 'org.freedesktop.locale1.service',
configuration:serv_cfg
)
install_data(
service,
install_dir: dbussystemservicesdir,
)
install_data(
'org.freedesktop.locale1.xml',
install_dir: dbusinterfacesdir,
)
install_data(
'org.freedesktop.locale1.conf',
install_dir: get_option('sysconfdir') + '/dbus-1/system.d',
)
install_data(
'org.freedesktop.locale1.policy',
install_dir: polkitactiondir,
)
install_data(
'kbd-model-map',
install_dir: pkgdatadir,
)
62 changes: 62 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
project('blocaled', 'c', version: '0.7')
package_str=meson.project_name()+' '+meson.project_version()
cc=meson.get_compiler('c')

glib_ver='>=2.44' # TODO: Check this
dbus_dep=dependency('dbus-1')
polkit_dep=dependency('polkit-gobject-1')
deps= [
dependency('gio-unix-2.0', version: glib_ver),
dependency('gio-2.0', version: glib_ver),
dependency('glib-2.0', version: glib_ver),
dbus_dep,
polkit_dep,
dependency('libdaemon'),
]

codegen_prog=find_program('gdbus-codegen')
if not codegen_prog.found()
error('Failed to find gdbus-codegen')
endif
gnome=import('gnome')

#Options
prefix=get_option('prefix')
sysconfdir=get_option('sysconfdir')
pidfile=get_option('pidfile')
localeconfig=get_option('localeconfig')
keyboardconfig=get_option('keyboardconfig')
xkbdconfig=get_option('xkbdconfig')
pkgdatadir=prefix+'/'+get_option('datadir')+'/'+meson.project_name()

#dbus and polkit directories
dbusinterfacesdir=dbus_dep.get_variable(pkgconfig: 'interfaces_dir',
pkgconfig_define: ['prefix',prefix])
dbussystemservicesdir=dbus_dep.get_variable(pkgconfig: 'system_bus_services_dir',
pkgconfig_define: ['prefix',prefix])
polkitactiondir=polkit_dep.get_variable(pkgconfig: 'actiondir',
pkgconfig_define: ['prefix',prefix])

#Configuration in config.h (very different from autotools)
config_h=configuration_data()
config_h.set_quoted('PACKAGE_STRING',package_str)
config_h.set_quoted('PIDFILE',pidfile)
config_h.set_quoted('SYSCONFDIR',sysconfdir)
config_h.set_quoted('LOCALECONFIG',localeconfig)
config_h.set_quoted('KEYBOARDCONFIG',keyboardconfig)
config_h.set_quoted('XKBDCONFIG',xkbdconfig)
config_h.set_quoted('PKGDATADIR',pkgdatadir)
configure_file(configuration:config_h, output:'config.h')
top_inc=include_directories('.')

subdir('src')
subdir('data')
#subdir('tests')

summary('prefix',prefix,section:package_str)
summary('sysconfdir',sysconfdir,section:package_str)
summary('pid file',pidfile,section:package_str)
summary('locale config file',localeconfig,section:package_str)
summary('keyboard config file',keyboardconfig,section:package_str)
summary('X11 keyboard config file',xkbdconfig,section:package_str)
summary('compiler',cc.get_id(),section:package_str)
12 changes: 12 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
option('pidfile', type : 'string',
value: '/run/blocaled.pid',
description: 'pid filename')
option('localeconfig', type : 'string',
value: '/etc/locale.conf',
description: 'locale configuration filename')
option('keyboardconfig', type : 'string',
value: '/etc/sysconfig/console',
description: 'keyboard configuration filename')
option('xkbdconfig', type : 'string',
value: '/etc/X11/xorg.conf.d/30-keyboard.conf',
description: 'X keyboard configuration filename')
17 changes: 17 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
localed_src = [
'localed.c',
'shellparser.c',
'polkitasync.c',
'main.c',
]
gdbus_src = gnome.gdbus_codegen('locale1-generated',
interface_prefix: 'org.freedesktop.',
sources: meson.project_source_root()+ '/data/org.freedesktop.locale1.xml',
namespace: 'BLocaled',
)
executable('blocaled', localed_src, gdbus_src,
dependencies: deps,
include_directories: top_inc,
install: true,
install_dir: get_option('libexecdir'),
)