taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit 87797df3f24a4515a44172fe4b86f6f650dea2e4
parent 825c0b56190fab060cbe3564bb397419813ce6e9
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 14 Nov 2024 22:42:05 +0100

adjust taler-mdb to gnunet changes for #8962

Diffstat:
M.gitignore | 3+++
Mconfigure.ac | 1+
Mdebian/taler-mdb.install | 1+
Msrc/.gitignore | 4++++
Msrc/Makefile.am | 16++++++++++++++++
Asrc/os_installation.c | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/taler-mdb-display.c | 5+++--
Msrc/taler-mdb-qr-show.c | 5++++-
Msrc/taler-mdb.c | 4+++-
Asrc/taler_mdb_util.h | 33+++++++++++++++++++++++++++++++++
10 files changed, 130 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -30,3 +30,6 @@ debian/taler-mdb.debhelper.log config.guess config.sub src/taler-mdb-qr-show +libtool +m4/ +ltmain.sh diff --git a/configure.ac b/configure.ac @@ -15,6 +15,7 @@ AM_INIT_AUTOMAKE AM_SILENT_RULES([yes]) AC_PROG_CC +LT_INIT # Checks for libraries. AC_CHECK_LIB([nfc], [nfc_open]) diff --git a/debian/taler-mdb.install b/debian/taler-mdb.install @@ -5,6 +5,7 @@ usr/bin/taler-mdb-qr-show usr/bin/taler-mdb-ads.sh usr/bin/taler-mdb-show.sh usr/bin/taler-mdb-network-check.sh +usr/lib/*/libtalermdb*.so.* usr/share/man/man1/taler-* usr/share/taler/ads/* usr/share/taler/mdb/* diff --git a/src/.gitignore b/src/.gitignore @@ -1,4 +1,8 @@ *.o +*.lo +*~ taler-nfc taler-coin-acceptor taler-mdb-display +.libs/ +libtalermdb.la diff --git a/src/Makefile.am b/src/Makefile.am @@ -12,9 +12,23 @@ if USE_COVERAGE XLIB = -lgcov endif +lib_LTLIBRARIES = \ + libtalermdb.la + +libtalermdb_la_SOURCES = \ + os_installation.c taler_mdb_util.h +libtalermdb_la_LIBADD = \ + -lgnunetutil \ + $(XLIB) +libtalermdb_la_LDFLAGS = \ + -version-info 0:0:0 \ + -export-dynamic -no-undefined + + taler_mdb_SOURCES = \ taler-mdb.c taler_mdb_LDADD = \ + libtalermdb.la \ -ltalermerchant \ -ltalerjson \ -ltalerutil \ @@ -31,6 +45,7 @@ taler_mdb_LDADD = \ taler_mdb_qr_show_SOURCES = \ taler-mdb-qr-show.c taler_mdb_qr_show_LDADD = \ + libtalermdb.la \ -lgnunetutil \ @QR_LIBS@ \ $(XLIB) @@ -39,5 +54,6 @@ taler_mdb_qr_show_LDADD = \ taler_mdb_display_SOURCES = \ taler-mdb-display.c taler_mdb_display_LDADD = \ + libtalermdb.la \ -lgnunetutil \ $(XLIB) diff --git a/src/os_installation.c b/src/os_installation.c @@ -0,0 +1,62 @@ +/* + This file is part of GNU Taler. + Copyright (C) 2019 Taler Systems SA + + Sync is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + Sync is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Sync; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file os_installation.c + * @brief initialize libgnunet OS subsystem for taler-mdb. + * @author Christian Grothoff + */ +#include "config.h" +#include <gnunet/gnunet_util_lib.h> +#include "taler_mdb_util.h" + + +/** + * Default project data used for installation path detection + * for GNU Taler merchant. + */ +static const struct GNUNET_OS_ProjectData mdb_pd = { + .libname = "libtalermdbutil", + .project_dirname = "taler", // FIXME: use taler-mdb! + .binary_name = "taler-mdb", + .env_varname = "TALER_MDB_PREFIX", + .base_config_varname = "TALER_BASE_CONFIG", + .bug_email = "taler@lists.gnu.org", + .homepage = "http://www.gnu.org/s/taler/", + .config_file = "taler-mdb.conf", + .user_config_file = "~/.config/taler-mdb.conf", + .version = PACKAGE_VERSION, + .is_gnu = 1, + .gettext_domain = "taler-mdb", + .gettext_path = NULL, +}; + + +/** + * Return default project data used by Taler merchant. + */ +const struct GNUNET_OS_ProjectData * +TALER_MDB_project_data (void) +{ + return &mdb_pd; +} + + +/* end of os_installation.c */ diff --git a/src/taler-mdb-display.c b/src/taler-mdb-display.c @@ -34,7 +34,7 @@ along with #include <fcntl.h> /* for adafruit pitft display */ #include <linux/fb.h> - +#include "taler_mdb_util.h" /** * Handle for the Framebuffer device @@ -275,7 +275,8 @@ main (int argc, GNUNET_GETOPT_OPTION_END }; - ret = GNUNET_PROGRAM_run (argc, + ret = GNUNET_PROGRAM_run (TALER_MDB_project_data (), + argc, argv, "taler-mdb-display", "Turn frame buffer display on or off\n", diff --git a/src/taler-mdb-qr-show.c b/src/taler-mdb-qr-show.c @@ -50,6 +50,8 @@ along with #include <fcntl.h> /* for adafruit pitft display */ #include <linux/fb.h> +#include "taler_mdb_util.h" + /** * Disable i18n support. @@ -433,7 +435,8 @@ main (int argc, GNUNET_GETOPT_OPTION_END }; - ret = GNUNET_PROGRAM_run (argc, + ret = GNUNET_PROGRAM_run (TALER_MDB_project_data (), + argc, argv, "taler-mdb-qr-show", "This is an application to show a QR code for a defined period of time before starting another program.\n", diff --git a/src/taler-mdb.c b/src/taler-mdb.c @@ -57,6 +57,7 @@ along with #include <fcntl.h> /* for adafruit pitft display */ #include <linux/fb.h> +#include "taler_mdb_util.h" #ifndef EXIT_NOTCONFIGURED #define EXIT_NOTCONFIGURED 6 @@ -3790,7 +3791,8 @@ main (int argc, READER_DISPLAY_REQUEST, READER_DISPLAY_REQUEST_TIME READER_DISPLAY_BACKEND_NOT_REACHABLE); - ret = GNUNET_PROGRAM_run (argc, + ret = GNUNET_PROGRAM_run (TALER_MDB_project_data (), + argc, argv, "taler-mdb", "This is an application for snack machines to pay with GNU Taler via NFC.\n", diff --git a/src/taler_mdb_util.h b/src/taler_mdb_util.h @@ -0,0 +1,33 @@ +/* + This file is part of TALER-MDB + Copyright (C) 2014, 2015 GNUnet e.V. + + TALER-MDB is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER-MDB is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER-MDB; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file include/taler-mdb_util.h + * @brief Interface for common utility functions + * @author Christian Grothoff + */ +#ifndef TALER_MDB_UTIL_H +#define TALER_MDB_UTIL_H + +#include <gnunet/gnunet_util_lib.h> + +/** + * Return default project data used by Taler-mdb. + */ +const struct GNUNET_OS_ProjectData * +TALER_MDB_project_data (void); + + +#endif