From fc5d3abb961aff5fc8882c70569f251c544b322f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 19 Apr 2018 11:32:04 +0100 Subject: Add g_usb_version_string() for fwupd --- gusb/gusb-version.c | 41 +++++++++++++++++++++++++++++++++++++++++ gusb/gusb-version.h.in | 6 +++++- gusb/meson.build | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gusb/gusb-version.c diff --git a/gusb/gusb-version.c b/gusb/gusb-version.c new file mode 100644 index 0000000..c17ad2f --- /dev/null +++ b/gusb/gusb-version.c @@ -0,0 +1,41 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2018 Richard Hughes + * + * Licensed under the GNU Lesser General Public License Version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "gusb-version.h" + +/** + * g_usb_version_string: + * + * Gets the GUsb installed runtime version. + * + * Returns: a version numer, e.g. "0.3.1" + * + * Since: 0.3.1 + **/ +const gchar * +g_usb_version_string (void) +{ + return G_STRINGIFY(G_USB_MAJOR_VERSION) "." + G_STRINGIFY(G_USB_MINOR_VERSION) "." + G_STRINGIFY(G_USB_MICRO_VERSION); +} diff --git a/gusb/gusb-version.h.in b/gusb/gusb-version.h.in index 97bcbb1..051ac8c 100644 --- a/gusb/gusb-version.h.in +++ b/gusb/gusb-version.h.in @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * - * Copyright (C) 2010 Richard Hughes + * Copyright (C) 2010-2018 Richard Hughes * * Licensed under the GNU Lesser General Public License Version 2.1 * @@ -34,6 +34,8 @@ #ifndef __GUSB_VERSION_H #define __GUSB_VERSION_H +#include + /** * G_USB_MAJOR_VERSION: * @@ -67,4 +69,6 @@ (G_USB_MAJOR_VERSION == (major) && G_USB_MINOR_VERSION == (minor) && \ G_USB_MICRO_VERSION >= (micro))) +const gchar *g_usb_version_string (void); + #endif /* __GUSB_VERSION_H */ diff --git a/gusb/meson.build b/gusb/meson.build index c39a8f1..7c25d51 100644 --- a/gusb/meson.build +++ b/gusb/meson.build @@ -48,6 +48,7 @@ gusb = shared_library( 'gusb-interface.c', 'gusb-source.c', 'gusb-util.c', + 'gusb-version.c', ], soversion : lt_current, version : lt_version, -- cgit v1.2.1