Skip to content

Commit

Permalink
autodetect version
Browse files Browse the repository at this point in the history
  • Loading branch information
t-8ch committed Dec 17, 2021
1 parent 210c975 commit f0c7eff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
project('pinentry-bemenu', 'c',
version : '0.7.0',
default_options : ['warning_level=3', 'c_std=c11'])


vcs_tag(
input : 'version.h.in',
output : 'version.h',
command : ['git', 'describe', '--tag', '--dirty', '--broken'],
)

compiler = meson.get_compiler('c')

bemenu = dependency('bemenu', version : '>= 0.6.0')
Expand All @@ -18,7 +24,6 @@ have_bemenu_set_bottom = compiler.has_function(
conf_data = configuration_data()

conf_data.set_quoted('PROJECT_NAME', meson.project_name())
conf_data.set_quoted('PROJECT_VERSION', meson.project_version())
conf_data.set10('HAVE_BEMENU_SET_BOTTOM', have_bemenu_set_bottom)

configure_file(configuration: conf_data, output : 'config.h')
Expand Down
3 changes: 2 additions & 1 deletion pinentry_bemenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <bemenu.h>

#include "config.h"
#include "version.h"
#include "options.h"

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
Expand Down Expand Up @@ -309,7 +310,7 @@ int main(int argc, const char **argv) {
assuan_fd_t out_fd = assuan_fdopen(STDOUT_FILENO);
assuan_fd_t fds[] = { in_fd, out_fd };

assuan_set_hello_line(ctx, PROJECT_NAME " v" PROJECT_VERSION);
assuan_set_hello_line(ctx, PROJECT_NAME " " PROJECT_VERSION);

r = assuan_init_pipe_server(ctx, fds);
GPG_NO_ERROR_OR_RETURN_ERRNO(r);
Expand Down

0 comments on commit f0c7eff

Please sign in to comment.