GRIB-446 and GRIB-693: Missing version information in grib_api header files

This commit is contained in:
Shahram Najm 2015-02-25 17:42:04 +00:00
parent c555c97e28
commit 99840ed7da
14 changed files with 70 additions and 44 deletions

View File

@ -15,11 +15,18 @@ AC_CONFIG_MACRO_DIR([m4])
. ${srcdir}/version.sh
GRIB_API_MAIN_VERSION="${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_REVISION_VERSION}"
echo $GRIB_API_MAIN_VERSION
ECCODES_MAIN_VERSION="${ECCODES_MAJOR_VERSION}.${ECCODES_MINOR_VERSION}.${ECCODES_REVISION_VERSION}"
echo $ECCODES_MAIN_VERSION
PACKAGE_VERSION="${ECCODES_MAIN_VERSION}"
ECCODES_VERSION_STR="${ECCODES_MAIN_VERSION}"
ECCODES_PATCH_VERSION="${ECCODES_REVISION_VERSION}"
AC_SUBST(ECCODES_MAIN_VERSION)
AC_SUBST(ECCODES_VERSION_STR)
AC_SUBST(ECCODES_MAJOR_VERSION)
AC_SUBST(ECCODES_MINOR_VERSION)
AC_SUBST(ECCODES_PATCH_VERSION)
PACKAGE_VERSION="${GRIB_API_MAIN_VERSION}"
AC_SUBST(GRIB_API_MAIN_VERSION)
AC_SUBST(GRIB_ABI_CURRENT)
AC_SUBST(GRIB_ABI_REVISION)
AC_SUBST(GRIB_ABI_AGE)
@ -31,6 +38,7 @@ AM_SANITY_CHECK
AC_CONFIG_SRCDIR([src/grib_api.h])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_FILES([src/eccodes_version.h])
AC_CONFIG_FILES([rpms/eccodes.pc rpms/eccodes.spec rpms/eccodes_f90.pc])
AM_INIT_AUTOMAKE($PACKAGE_NAME,[${PACKAGE_VERSION}],[http://www.ecmwf.int])
@ -39,14 +47,14 @@ samples_files_path="${datadir}/eccodes/samples"
ifs_samples_files_path="${datadir}/eccodes/ifs_samples"
default_perl_install="${prefix}/perl"
AC_DEFINE_UNQUOTED(GRIB_API_MAIN_VERSION,$GRIB_API_MAIN_VERSION,Grib Api version)
AC_DEFINE_UNQUOTED(GRIB_API_MAJOR_VERSION,$GRIB_API_MAJOR_VERSION,Grib Api Major release)
AC_DEFINE_UNQUOTED(GRIB_API_MINOR_VERSION,$GRIB_API_MINOR_VERSION,Grib Api Minor release)
AC_DEFINE_UNQUOTED(GRIB_API_REVISION_VERSION,$GRIB_API_REVISION_VERSION,Grib Api Revision release)
AC_DEFINE_UNQUOTED(ECCODES_MAIN_VERSION,$ECCODES_MAIN_VERSION,ecCodes version)
AC_DEFINE_UNQUOTED(ECCODES_MAJOR_VERSION,$ECCODES_MAJOR_VERSION,ecCodes Major release)
AC_DEFINE_UNQUOTED(ECCODES_MINOR_VERSION,$ECCODES_MINOR_VERSION,ecCodes Minor release)
AC_DEFINE_UNQUOTED(ECCODES_REVISION_VERSION,$ECCODES_REVISION_VERSION,ecCodes Revision release)
AC_DEFINE_UNQUOTED(GRIB_ABI_CURRENT,$GRIB_ABI_CURRENT,Grib Api Current ABI version)
AC_DEFINE_UNQUOTED(GRIB_ABI_REVISION,$GRIB_ABI_REVISION,Grib Api Revision ABI version)
AC_DEFINE_UNQUOTED(GRIB_ABI_AGE,$GRIB_ABI_AGE,Grib Api Age of ABI version)
AC_DEFINE_UNQUOTED(GRIB_ABI_CURRENT,$GRIB_ABI_CURRENT,ecCodes Current ABI version)
AC_DEFINE_UNQUOTED(GRIB_ABI_REVISION,$GRIB_ABI_REVISION,ecCodes Revision ABI version)
AC_DEFINE_UNQUOTED(GRIB_ABI_AGE,$GRIB_ABI_AGE,ecCodes Age of ABI version)
AH_TEMPLATE([_LARGE_FILE_API],

View File

@ -13,13 +13,13 @@
#include "eccodes_ecbuild_config.h" /* generated by ecbuild */
#define GRIB_API_VERSION_STR "@ECCODES_VERSION_STR@"
#define ECCODES_VERSION_STR "@ECCODES_VERSION_STR@"
/* GRIB_API_VERSION is defined in grib_api.h from the 3 version components below */
/* ECCODES_VERSION is defined in grib_api.h from the 3 version components below */
#define GRIB_API_MAJOR_VERSION @ECCODES_MAJOR_VERSION@
#define GRIB_API_MINOR_VERSION @ECCODES_MINOR_VERSION@
#define GRIB_API_REVISION_VERSION @ECCODES_PATCH_VERSION@
#define ECCODES_MAJOR_VERSION @ECCODES_MAJOR_VERSION@
#define ECCODES_MINOR_VERSION @ECCODES_MINOR_VERSION@
#define ECCODES_REVISION_VERSION @ECCODES_PATCH_VERSION@
#define ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@"

View File

@ -2,7 +2,7 @@ set -e
make dist
. ./version.sh
libraryVersion=$GRIB_API_MAJOR_VERSION.$GRIB_API_MINOR_VERSION.$GRIB_API_REVISION_VERSION
libraryVersion=$ECCODES_MAJOR_VERSION.$ECCODES_MINOR_VERSION.$ECCODES_REVISION_VERSION
tar=grib_api-$libraryVersion.tar.gz
dir=grib_api-$libraryVersion

View File

@ -368,6 +368,7 @@ list( APPEND grib_api_extra_srcs
)
configure_file( grib_api_version.c.in grib_api_version.c @ONLY )
configure_file( eccodes_version.h.in eccodes_version.h @ONLY )
# We ship our own generated lex/yacc C files
#ecbuild_generate_yy(YYPREFIX grib_yy
@ -390,3 +391,5 @@ ecbuild_add_library(TARGET eccodes
install( FILES grib_api.h eccodes.h eccodes_windef.h DESTINATION include )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/eccodes_version.h DESTINATION include )

View File

@ -10,7 +10,7 @@ AM_CPPFLAGS = -DECCODES_SAMPLES_PATH=\"$(ECCODES_SAMPLES_PATH)\" \
lib_LTLIBRARIES = libeccodes.la
include_HEADERS = grib_api.h eccodes.h eccodes_windef.h
include_HEADERS = grib_api.h eccodes.h eccodes_windef.h eccodes_version.h
libeccodes_la_prototypes= \
action.c \

View File

@ -24,7 +24,7 @@ extern "C" {
#include "grib_api.h"
#define CODES_VERSION GRIB_API_VERSION
#define CODES_VERSION ECCODES_VERSION
/* sections */
#define CODES_SECTION_PRODUCT GRIB_SECTION_PRODUCT

21
src/eccodes_version.h.in Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright 2005-2015 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#ifndef eccodes_version_H
#define eccodes_version_H
#define ECCODES_VERSION_STR "@ECCODES_VERSION_STR@"
#define ECCODES_MAJOR_VERSION @ECCODES_MAJOR_VERSION@
#define ECCODES_MINOR_VERSION @ECCODES_MINOR_VERSION@
#define ECCODES_REVISION_VERSION @ECCODES_PATCH_VERSION@
#define ECCODES_VERSION (ECCODES_MAJOR_VERSION*10000+ECCODES_MINOR_VERSION*100+ECCODES_REVISION_VERSION)
#endif /* eccodes_version_H */

View File

@ -135,9 +135,9 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len)
char result[30]={0,};
size_t size;
int major=GRIB_API_MAJOR_VERSION;
int minor=GRIB_API_MINOR_VERSION;
int revision=GRIB_API_REVISION_VERSION;
int major=ECCODES_MAJOR_VERSION;
int minor=ECCODES_MINOR_VERSION;
int revision=ECCODES_REVISION_VERSION;
sprintf(result,"%d.%d.%d",major,minor,revision);
size=sizeof(result);

View File

@ -41,8 +41,7 @@ extern "C" {
typedef enum ProductKind {PRODUCT_GRIB, PRODUCT_BUFR, PRODUCT_ANY} ProductKind;
#define GRIB_API_VERSION (GRIB_API_MAJOR_VERSION*10000+GRIB_API_MINOR_VERSION*100+GRIB_API_REVISION_VERSION)
#include "eccodes_version.h"
/* sections */
#define GRIB_SECTION_PRODUCT (1<<0)

View File

@ -74,11 +74,6 @@ extern "C" {
/* Replace Unix rint() for Windows */
double rint(double x);
/* define version numbers here on Windows */
#define GRIB_API_MAJOR_VERSION 0
#define GRIB_API_MINOR_VERSION 10
#define GRIB_API_REVISION_VERSION 0
#ifndef S_ISREG
#define S_ISREG(mode) (mode & S_IFREG)
#endif

View File

@ -221,16 +221,16 @@ void grib_context_set_logging_proc(grib_context* c, grib_log_proc p)
long grib_get_api_version()
{
return GRIB_API_VERSION;
return ECCODES_VERSION;
}
void grib_print_api_version(FILE* out)
{
fprintf(out,"%d.%d.%d",
GRIB_API_MAJOR_VERSION,
GRIB_API_MINOR_VERSION,
GRIB_API_REVISION_VERSION);
if (GRIB_API_MAJOR_VERSION < 1) {
ECCODES_MAJOR_VERSION,
ECCODES_MINOR_VERSION,
ECCODES_REVISION_VERSION);
if (ECCODES_MAJOR_VERSION < 1) {
fprintf(out, "%s", " PRE-RELEASE");
}
}

View File

@ -30,9 +30,9 @@ int main( int argc,char* argv[])
int c=0;
int nfiles=0;
unsigned long print_flags=0;
int major=GRIB_API_MAJOR_VERSION;
int minor=GRIB_API_MINOR_VERSION;
int revision=GRIB_API_REVISION_VERSION;
int major=ECCODES_MAJOR_VERSION;
int minor=ECCODES_MINOR_VERSION;
int revision=ECCODES_REVISION_VERSION;
while (1) {
c = getopt (argc, argv, "vds");
@ -62,7 +62,7 @@ int main( int argc,char* argv[])
printf("\n");
printf("eccodes Version %d.%d.%d",
major,minor,revision);
if (GRIB_API_MAJOR_VERSION < 1) printf(" PRE-RELEASE");
if (ECCODES_MAJOR_VERSION < 1) printf(" PRE-RELEASE");
printf("\n");
printf("\n");
#if GRIB_PTHREADS

View File

@ -3046,9 +3046,9 @@ static int define_netcdf_dimensions(hypercube *h, fieldset *fs, int ncid, datase
}
else
{
int major = GRIB_API_MAJOR_VERSION;
int minor = GRIB_API_MINOR_VERSION;
int revision = GRIB_API_REVISION_VERSION;
int major = ECCODES_MAJOR_VERSION;
int minor = ECCODES_MINOR_VERSION;
int revision = ECCODES_REVISION_VERSION;
time(&now);
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S GMT", gmtime(&now));

View File

@ -13,9 +13,9 @@
PACKAGE_NAME='eccodes'
# Package version
GRIB_API_MAJOR_VERSION=0
GRIB_API_MINOR_VERSION=10
GRIB_API_REVISION_VERSION=0
ECCODES_MAJOR_VERSION=0
ECCODES_MINOR_VERSION=10
ECCODES_REVISION_VERSION=0
GRIB_ABI_CURRENT=1
GRIB_ABI_REVISION=0