diff options
author | Richard Hughes <richard@hughsie.com> | 2018-04-19 11:32:04 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2018-04-19 11:33:02 +0100 |
commit | 5cc48065c9e3110d611dbcabb5ea1b182c4a0235 (patch) | |
tree | 0bc75b2da0702383858ffd57444be1f855e940ef | |
parent | 8e9b5b192a62af0a2440062443877dd06680c2c5 (diff) | |
download | gusb-wip/hughsie/runtime-version.tar.gz |
Add g_usb_version_string() for fwupdwip/hughsie/runtime-version
-rw-r--r-- | gusb/gusb-version.c | 41 | ||||
-rw-r--r-- | gusb/gusb-version.h.in | 6 | ||||
-rw-r--r-- | gusb/meson.build | 1 |
3 files changed, 47 insertions, 1 deletions
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 <richard@hughsie.com> + * + * 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 <richard@hughsie.com> + * Copyright (C) 2010-2018 Richard Hughes <richard@hughsie.com> * * Licensed under the GNU Lesser General Public License Version 2.1 * @@ -34,6 +34,8 @@ #ifndef __GUSB_VERSION_H #define __GUSB_VERSION_H +#include <glib.h> + /** * 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, |