diff options
author | Pete Batard <pbatard@gmail.com> | 2011-05-09 21:39:14 +0100 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2011-05-09 21:39:14 +0100 |
commit | fb7c03b1c7b08e0c4061e420ac637962e2ba837c (patch) | |
tree | bc9871bcc0f63efdd053e18ba0339d358d39796c | |
parent | d2858ef6f6cca239d470fe1f88b80fc6661becd8 (diff) | |
download | libusb-fb7c03b1c7b08e0c4061e420ac637962e2ba837c.tar.gz |
Move library release version number from configure.ac to libusb/version.h
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | libusb/core.c | 3 | ||||
-rw-r--r-- | libusb/libusb-1.0.rc | 24 | ||||
-rw-r--r-- | libusb/libusb_version.h | 29 | ||||
-rw-r--r-- | libusb/libusb_version.h.in | 29 | ||||
-rw-r--r-- | libusb/libusbi.h | 2 | ||||
-rw-r--r-- | libusb/version.h | 13 |
7 files changed, 42 insertions, 81 deletions
diff --git a/configure.ac b/configure.ac index fcf32fd..1aa606b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,14 +1,18 @@ -m4_define(LIBUSB_MAJOR, [1]) -m4_define(LIBUSB_MINOR, [0]) -m4_define(LIBUSB_MICRO, [8]) -m4_define(LIBUSB_NANO, [10336]) +dnl These m4 macros are whitespace sensitive and break if moved around much. +m4_define([LU_VERSION_H], m4_include([libusb/version.h])) +m4_define([LU_DEFINE_VERSION_ATOM], + [m4_define([$1], m4_bregexp(LU_VERSION_H, + [^#define\s*$1\s*\([0-9]*\).*], [\1]))]) +dnl The m4_bregexp() returns (only) the numbers following the #define named +dnl in the first macro parameter. m4_define() then defines the name for use +dnl in AC_INIT(). -AC_INIT([libusb], LIBUSB_MAJOR.LIBUSB_MINOR.LIBUSB_MICRO, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/]) -AC_SUBST([LIBUSB_VERSION_MAJOR], [LIBUSB_MAJOR]) -AC_SUBST([LIBUSB_VERSION_MINOR], [LIBUSB_MINOR]) -AC_SUBST([LIBUSB_VERSION_MICRO], [LIBUSB_MICRO]) -AC_SUBST([LIBUSB_VERSION_NANO], [LIBUSB_NANO]) +LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR]) +LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR]) +LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO]) + +AC_INIT([libusb], LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/]) # Library versioning # These numbers should be tweaked on every release. Read carefully: @@ -202,7 +206,6 @@ AC_SUBST(LTLDFLAGS) AC_CONFIG_FILES([libusb-1.0.pc]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([libusb/Makefile]) -AC_CONFIG_FILES([libusb/libusb_version.h]) AC_CONFIG_FILES([examples/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([doc/doxygen.cfg]) diff --git a/libusb/core.c b/libusb/core.c index 32811c1..a7837ce 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -40,8 +40,7 @@ const struct usbi_os_backend * const usbi_backend = &windows_backend; #endif struct libusb_context *usbi_default_context = NULL; -const struct libusb_version libusb_version_internal = { LIBUSB_VERSION_MAJOR, -LIBUSB_VERSION_MINOR, LIBUSB_VERSION_MICRO, LIBUSB_VERSION_NANO}; +const struct libusb_version libusb_version_internal = { LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO}; static int default_context_refcnt = 0; static usbi_mutex_static_t default_context_lock = USBI_MUTEX_INITIALIZER; diff --git a/libusb/libusb-1.0.rc b/libusb/libusb-1.0.rc index d579653..6072159 100644 --- a/libusb/libusb-1.0.rc +++ b/libusb/libusb-1.0.rc @@ -6,15 +6,19 @@ * viewed with utilities such as Windows Explorer. */ #include "winresrc.h" -#include "libusb_version.h" -#define __DEFTOSTR(x) #x -#define _DEFTOSTR(x) __DEFTOSTR(x) -#define LIBUSB_PACKAGE_VERSION _DEFTOSTR(LIBUSB_VERSION_MAJOR.LIBUSB_VERSION_MINOR.LIBUSB_VERSION_MICRO.LIBUSB_VERSION_NANO) +#include "version.h" +#ifndef LIBUSB_VERSIONSTRING +#define LU_STR(s) #s +#define LU_XSTR(s) LU_STR(s) +#define LIBUSB_VERSIONSTRING \ + LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \ + LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) +#endif VS_VERSION_INFO VERSIONINFO - FILEVERSION LIBUSB_VERSION_MAJOR,LIBUSB_VERSION_MINOR,LIBUSB_VERSION_MICRO,LIBUSB_VERSION_NANO - PRODUCTVERSION LIBUSB_VERSION_MAJOR,LIBUSB_VERSION_MINOR,LIBUSB_VERSION_MICRO,LIBUSB_VERSION_NANO + FILEVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO + PRODUCTVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -31,15 +35,15 @@ BEGIN BEGIN VALUE "Comments", "http://libusb.org/\0" VALUE "CompanyName", "libusb.org\0" - VALUE "FileDescription", "libusb-1\0" - VALUE "FileVersion", LIBUSB_PACKAGE_VERSION "\0" + VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0" + VALUE "FileVersion", LIBUSB_VERSIONSTRING VALUE "InternalName", "libusb\0" VALUE "LegalCopyright", "See individual source files, GNU LGPL v2.1 or later.\0" VALUE "LegalTrademarks", "http://www.gnu.org/licenses/lgpl-2.1.html\0" VALUE "OriginalFilename", "libusb-1.0.dll\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "libusb-1\0" - VALUE "ProductVersion", LIBUSB_PACKAGE_VERSION "\0" + VALUE "ProductName", "libusb-1.0\0" + VALUE "ProductVersion", LIBUSB_VERSIONSTRING VALUE "SpecialBuild", "\0" END END diff --git a/libusb/libusb_version.h b/libusb/libusb_version.h deleted file mode 100644 index fdce667..0000000 --- a/libusb/libusb_version.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Version header for libusb - * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org> - * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com> - * - * 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 - */ - -#ifndef __LIBUSB_VERSION_H__ -#define __LIBUSB_VERSION_H__ - -#define LIBUSB_VERSION_MAJOR 1 -#define LIBUSB_VERSION_MINOR 0 -#define LIBUSB_VERSION_MICRO 8 -#define LIBUSB_VERSION_NANO 10336 - -#endif diff --git a/libusb/libusb_version.h.in b/libusb/libusb_version.h.in deleted file mode 100644 index f27a59a..0000000 --- a/libusb/libusb_version.h.in +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Version header for libusb - * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org> - * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com> - * - * 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 - */ - -#ifndef __LIBUSB_VERSION_H__ -#define __LIBUSB_VERSION_H__ - -#define LIBUSB_VERSION_MAJOR @LIBUSB_VERSION_MAJOR@ -#define LIBUSB_VERSION_MINOR @LIBUSB_VERSION_MINOR@ -#define LIBUSB_VERSION_MICRO @LIBUSB_VERSION_MICRO@ -#define LIBUSB_VERSION_NANO @LIBUSB_VERSION_NANO@ - -#endif diff --git a/libusb/libusbi.h b/libusb/libusbi.h index 322ebbc..9a3db69 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -31,7 +31,7 @@ #endif #include <libusb.h> -#include "libusb_version.h" +#include "version.h" /* Inside the libusb code, mark all public functions as follows: * return_type API_EXPORTED function_name(params) { ... } diff --git a/libusb/version.h b/libusb/version.h new file mode 100644 index 0000000..d8334ec --- /dev/null +++ b/libusb/version.h @@ -0,0 +1,13 @@ +/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */ +#ifndef LIBUSB_MAJOR +#define LIBUSB_MAJOR 1 +#endif +#ifndef LIBUSB_MINOR +#define LIBUSB_MINOR 0 +#endif +#ifndef LIBUSB_MICRO +#define LIBUSB_MICRO 8 +#endif +#ifndef LIBUSB_NANO +#define LIBUSB_NANO 0 +#endif |