diff options
Diffstat (limited to 'src/meson.build')
-rw-r--r-- | src/meson.build | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/src/meson.build b/src/meson.build index e965647..b1d326c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,8 +1,19 @@ version_split = meson.project_version().split('.') api_version = version_split[0] + '.' + version_split[1] -notifd_gir = 'AstalNotifd-' + api_version + '.gir' -notifd_typelib = 'AstalNotifd-' + api_version + '.typelib' -notifd_so = 'libastal-notifd.so.' + meson.project_version() +gir = 'AstalNotifd-' + api_version + '.gir' +typelib = 'AstalNotifd-' + api_version + '.typelib' +so = 'libastal-notifd.so.' + meson.project_version() + +config = configure_file( + input: 'config.vala.in', + output: 'config.vala', + configuration: { + 'VERSION': meson.project_version(), + 'MAJOR_VERSION': version_split[0], + 'MINOR_VERSION': version_split[1], + 'MICRO_VERSION': version_split[2], + }, +) deps = [ dependency('glib-2.0'), @@ -12,64 +23,58 @@ deps = [ dependency('gdk-pixbuf-2.0'), ] -sources = files( +sources = [ + config, 'daemon.vala', 'notifd.vala', - 'proxy.vala', 'notification.vala', -) + 'proxy.vala', +] -libnotifd = library( - meson.project_name(), - sources, - dependencies: deps, - vala_header: meson.project_name() + '.h', - vala_vapi: meson.project_name() + '.vapi', - vala_gir: notifd_gir, - version: meson.project_version(), - install: true, - install_dir: [true, true, true, true], -) +if get_option('lib') + lib = library( + meson.project_name(), + sources, + dependencies: deps, + vala_header: meson.project_name() + '.h', + vala_vapi: meson.project_name() + '.vapi', + vala_gir: gir, + version: meson.project_version(), + install: true, + install_dir: [true, true, true, true], + ) -import('pkgconfig').generate( - description: 'libastal-notifd', - libraries: libnotifd, - name: meson.project_name(), - filebase: meson.project_name() + '-' + api_version, - version: meson.project_version(), - subdirs: meson.project_name(), - requires: 'gio-2.0', - install_dir: get_option('libdir') / 'pkgconfig', -) + import('pkgconfig').generate( + description: 'libastal-notifd', + libraries: lib, + name: meson.project_name(), + filebase: meson.project_name() + '-' + api_version, + version: meson.project_version(), + subdirs: meson.project_name(), + requires: deps, + install_dir: get_option('libdir') / 'pkgconfig', + ) -if get_option('typelib') custom_target( - notifd_typelib, + typelib, command: [ find_program('g-ir-compiler'), '--output', '@OUTPUT@', '--shared-library', get_option('prefix') / get_option('libdir') / '@PLAINNAME@', - meson.current_build_dir() / notifd_gir, + meson.current_build_dir() / gir, ], - input: libnotifd, - output: notifd_typelib, - depends: libnotifd, + input: lib, + output: typelib, + depends: lib, install: true, install_dir: get_option('libdir') / 'girepository-1.0', ) endif -if get_option('cli_client') - cli = configure_file( - input: 'cli.vala.in', - output: 'cli.vala', - configuration: { - 'VERSION': meson.project_version(), - }, - ) +if get_option('cli') executable( meson.project_name(), - [cli, sources], + ['cli.vala', sources], dependencies: deps, install: true, ) |