Move version number to src/cairo-version.h

This commit is contained in:
Behdad Esfahbod 2008-08-28 17:21:37 -04:00
parent 82303d6170
commit 89900525fb
13 changed files with 74 additions and 90 deletions

View file

@ -5,6 +5,7 @@ if CAIRO_HAS_PNG_FUNCTIONS
SUBDIRS += boilerplate test perf
endif
configure: src/cairo-version.h
.PHONY: doc test retest recheck check-valgrind
# We have some generated header files, so we really need to build the
@ -57,7 +58,6 @@ endif
EXTRA_DIST = \
autogen.sh \
Version.mk \
AUTHORS \
BIBLIOGRAPHY \
BUGS \

View file

@ -2,12 +2,6 @@
# Win32 makefile
#
ifeq ($(SUBMAKEFILE),1)
include ../Version.mk
else
include Version.mk
endif
CC := cl
LINK := link
@ -24,7 +18,7 @@ EXE_LDFLAGS = libpng.lib zlib.lib gdi32.lib msimg32.lib user32.lib
DEFAULT_CFLAGS = -MD -nologo $(OPT)
DEFAULT_CFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
DEFAULT_CFLAGS += -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
DEFAULT_CFLAGS += -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
DEFAULT_CFLAGS += -I.
DEFAULT_CFLAGS += $(PIXMAN_CFLAGS)
DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1 -DLIBCAIRO_EXPORTS
@ -32,8 +26,6 @@ DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1 -DLIBCAIRO_EXPORTS
CFLAGS := $(DEFAULT_CFLAGS)
CAIRO_VERSION = $(CAIRO_VERSION_MAJOR).$(CAIRO_VERSION_MINOR).$(CAIRO_VERSION_MICRO)
# Only if this was called as the top-level makefile
ifeq ($(SUBMAKEFILE),)
@ -45,10 +37,7 @@ all: inform cairo
src/cairo-features.h:
@echo Warning: creating default cairo-features.h
@(cat src/cairo-features-win32.h | \
sed 's,@CAIRO_VERSION_MAJOR@,'$(CAIRO_VERSION_MAJOR)',g' | \
sed 's,@CAIRO_VERSION_MINOR@,'$(CAIRO_VERSION_MINOR)',g' | \
sed 's,@CAIRO_VERSION_MICRO@,'$(CAIRO_VERSION_MICRO)',g' > src/cairo-features.h)
@cp src/cairo-features-win32.h src/cairo-features.h
cairo: src/cairo-features.h
@list='$(SUBDIRS)'; for f in $$list ; do \

View file

@ -54,8 +54,7 @@ Here are the steps to follow to create a new cairo release:
find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' ! -name 'cairo-features-win32.h' | \
xargs git diff X.Y.Z.. --
4) Increment cairo_version_{minor|micro} and LT_{CURRENT|VERSION|AGE}
in configure.in:
4) Increment cairo_version_{minor|micro} in src/cairo-version.h:
If there are backward-incompatible changes in the API, stop
now and don't release. Go back and fix the API instead. Cairo
@ -71,10 +70,7 @@ Here are the steps to follow to create a new cairo release:
Otherwise, (ie. there are only bug fixes), increment
cairo_version_micro to the next larger (even) number.
Adjust LT_CURRENT, LT_VERSION, and LT_AGE as described in the
comments in configure.in.
5) Commit the changes to NEWS and configure.in
5) Commit the changes to NEWS and src/cairo-version.h
It's especially important to mention the new version number in your
commit log.
@ -102,7 +98,7 @@ Here are the steps to follow to create a new cairo release:
prints it for you.
7) Increment cairo_version_micro to the next larger (odd) number in
configure, commit, and push.
src/cairo-version.h, commit, and push.
8) Push the newly created tag out to the central tree with a command
something like:

View file

@ -1,10 +0,0 @@
#
# cairo package version number, (as distinct from shared library version)
#
# For the minor number: odd => unstable series
# even => stable series
# For the micro number: odd => in-progress development (from git)
# even => tar-file snapshot or release
cairo_version_major=1
cairo_version_minor=7
cairo_version_micro=5

View file

@ -2,9 +2,11 @@ AC_PREREQ(2.58)
dnl Parse Version.mk and declare m4 variables out of it
m4_define([cairo_version_macro],
m4_bpatsubst(m4_include(Version.mk),
[^\([a-zA-Z0-9_]*\) *= *\(.*\)],
[[m4_define(\1, \[\2\])]]))
m4_translit(
m4_bpatsubst(m4_include(src/cairo-version.h),
[^.define \([a-zA-Z0-9_]*\) *\([0-9][0-9]*\)],
[[m4_define(\1, \[\2\])]]),
[A-Z], [a-z]))
cairo_version_macro
AC_INIT([cairo],
@ -1023,24 +1025,6 @@ AC_CONFIG_COMMANDS([src/cairo-features.h],
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
#ifdef __cplusplus
# define CAIRO_BEGIN_DECLS extern "C" {
# define CAIRO_END_DECLS }
#else
# define CAIRO_BEGIN_DECLS
# define CAIRO_END_DECLS
#endif
#ifndef cairo_public
# define cairo_public
#endif
#define CAIRO_VERSION_MAJOR $CAIRO_VERSION_MAJOR
#define CAIRO_VERSION_MINOR $CAIRO_VERSION_MINOR
#define CAIRO_VERSION_MICRO $CAIRO_VERSION_MICRO
#define CAIRO_VERSION_STRING "$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
_EOF
for FEATURE in $CAIRO_FEATURES; do
echo "#define CAIRO_HAS_$FEATURE 1" >> $outfile
@ -1062,9 +1046,6 @@ _EOF
],[
CAIRO_FEATURES='$CAIRO_FEATURES'
CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
CAIRO_VERSION_MAJOR=$CAIRO_VERSION_MAJOR
CAIRO_VERSION_MINOR=$CAIRO_VERSION_MINOR
CAIRO_VERSION_MICRO=$CAIRO_VERSION_MICRO
])
AC_CONFIG_COMMANDS([src/cairo-no-features.h],
[

View file

@ -201,8 +201,11 @@ CAIRO_VERSION_MINOR
CAIRO_VERSION_MICRO
CAIRO_VERSION_STRING
CAIRO_VERSION_ENCODE
CAIRO_VERSION_STRINGIZE
cairo_version
cairo_version_string
<SUBSECTION Private>
CAIRO_VERSION_STRINGIZE_
</SECTION>
<SECTION>

View file

@ -255,7 +255,7 @@ cairo_<emphasis>backend</emphasis>_surface_create().
</para>
@surface:
@Returns:
@surface:
@Returns:

View file

@ -166,6 +166,22 @@ that later versions compare greater than earlier versions.
@minor: the minor component of the version number
@micro: the micro component of the version number
@Returns: the encoded version.
<!-- ##### MACRO CAIRO_VERSION_STRINGIZE ##### -->
<para>
This macro encodes the given cairo version into an string. The numbers
returned by %CAIRO_VERSION_STRING and cairo_version_string() are encoded using this macro.
The parameters to this macro must expand to numerical literals.
</para>
@major: the major component of the version number
@minor: the minor component of the version number
@micro: the micro component of the version number
@Returns: a string literal containing the version.
@Since: 1.8
<!-- ##### FUNCTION cairo_version ##### -->
<para>

View file

@ -79,6 +79,7 @@ cairo_base_sources = \
cairo-paginated-surface-private.h \
cairo-analysis-surface.c \
cairo-analysis-surface-private.h \
cairo-version.h \
cairoint.h
cairo_all_sources = $(cairo_base_sources) $(cairo_base_headers)
cairo_headers = $(cairo_base_headers)

View file

@ -1,28 +1,6 @@
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
#if defined(__cplusplus)
# define CAIRO_BEGIN_DECLS extern "C" {
# define CAIRO_END_DECLS }
#else
# define CAIRO_BEGIN_DECLS
# define CAIRO_END_DECLS
#endif
#ifndef cairo_public
#ifdef LIBCAIRO_EXPORTS
#define cairo_public __declspec(dllexport)
#else
#define cairo_public __declspec(dllimport)
#endif
#endif
#define CAIRO_VERSION_MAJOR @CAIRO_VERSION_MAJOR@
#define CAIRO_VERSION_MINOR @CAIRO_VERSION_MINOR@
#define CAIRO_VERSION_MICRO @CAIRO_VERSION_MICRO@
#define CAIRO_VERSION_STRING "@CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@"
#define HAVE_WINDOWS_H 1
#define CAIRO_HAS_SVG_SURFACE 1
@ -32,9 +10,5 @@
#define CAIRO_HAS_WIN32_FONT 1
#define CAIRO_HAS_PNG_FUNCTIONS 1
#define PACKAGE_NAME "cairo"
#define PACKAGE_TARNAME "cairo"
#define PACKAGE_STRING "cairo @CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@"
#endif

View file

@ -259,7 +259,7 @@ _cairo_image_surface_create_with_masks (unsigned char *data,
status = _pixman_format_from_masks (masks, &pixman_format);
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
fprintf (stderr,
"Error: Cairo " PACKAGE_VERSION " does not yet support the requested image format:\n"
"Error: Cairo %s does not yet support the requested image format:\n"
"\tDepth: %d\n"
"\tAlpha mask: 0x%08lx\n"
"\tRed mask: 0x%08lx\n"
@ -267,6 +267,7 @@ _cairo_image_surface_create_with_masks (unsigned char *data,
"\tBlue mask: 0x%08lx\n"
"Please file an enhancement request (quoting the above) at:\n"
PACKAGE_BUGREPORT "\n",
cairo_version_string (),
masks->bpp, masks->alpha_mask,
masks->red_mask, masks->green_mask, masks->blue_mask);

8
src/cairo-version.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef CAIRO_VERSION_H
#define CAIRO_VERSION_H
#define CAIRO_VERSION_MAJOR 1
#define CAIRO_VERSION_MINOR 7
#define CAIRO_VERSION_MICRO 5
#endif

View file

@ -38,21 +38,46 @@
#ifndef CAIRO_H
#define CAIRO_H
#include "cairo-version.h"
#include "cairo-features.h"
#include "cairo-deprecated.h"
#ifdef __cplusplus
# define CAIRO_BEGIN_DECLS extern "C" {
# define CAIRO_END_DECLS }
#else
# define CAIRO_BEGIN_DECLS
# define CAIRO_END_DECLS
#endif
#ifndef cairo_public
# define cairo_public
#endif
CAIRO_BEGIN_DECLS
#define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
((major) * 10000) \
+ ((minor) * 100) \
#define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
((major) * 10000) \
+ ((minor) * 100) \
+ ((micro) * 1))
#define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
CAIRO_VERSION_MAJOR, \
CAIRO_VERSION_MINOR, \
#define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
CAIRO_VERSION_MAJOR, \
CAIRO_VERSION_MINOR, \
CAIRO_VERSION_MICRO)
#define CAIRO_VERSION_STRINGIZE_(major, minor, micro) \
#major"."#minor"."#micro
#define CAIRO_VERSION_STRINGIZE(major, minor, micro) \
CAIRO_VERSION_STRINGIZE_(major, minor, micro)
#define CAIRO_VERSION_STRING CAIRO_VERSION_STRINGIZE( \
CAIRO_VERSION_MAJOR, \
CAIRO_VERSION_MINOR, \
CAIRO_VERSION_MICRO)
cairo_public int
cairo_version (void);