summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-08-28 17:21:37 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-08-28 17:28:08 -0400
commit89900525fb78b20c532b8d983c238896f6e4820c (patch)
treeddc77eb531cce26facceea5792b32c4b56541bba
parent82303d6170aa541a3dc8c2519c7cc1445fc18842 (diff)
Move version number to src/cairo-version.h
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.win3215
-rw-r--r--RELEASING10
-rw-r--r--Version.mk10
-rw-r--r--configure.in29
-rw-r--r--doc/public/cairo-sections.txt3
-rw-r--r--doc/public/tmpl/cairo-surface.sgml4
-rw-r--r--doc/public/tmpl/cairo-version.sgml16
-rw-r--r--src/Makefile.am1
-rw-r--r--src/cairo-features-win32.h26
-rw-r--r--src/cairo-image-surface.c3
-rw-r--r--src/cairo-version.h8
-rw-r--r--src/cairo.h37
13 files changed, 74 insertions, 90 deletions
diff --git a/Makefile.am b/Makefile.am
index 56026ccd..b2eeccd8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/Makefile.win32 b/Makefile.win32
index a55f12c2..a00ff34f 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -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 \
diff --git a/RELEASING b/RELEASING
index 3dfe29bb..ac306fce 100644
--- a/RELEASING
+++ b/RELEASING
@@ -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:
diff --git a/Version.mk b/Version.mk
deleted file mode 100644
index f0426020..00000000
--- a/Version.mk
+++ /dev/null
@@ -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
diff --git a/configure.in b/configure.in
index 01ccaf36..41dab9d3 100644
--- a/configure.in
+++ b/configure.in
@@ -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],
[
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 622ca915..9a49e420 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -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>
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index adc47bb2..6b6c2f4a 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -255,7 +255,7 @@ cairo_<emphasis>backend</emphasis>_surface_create().
</para>
-@surface:
-@Returns:
+@surface:
+@Returns:
diff --git a/doc/public/tmpl/cairo-version.sgml b/doc/public/tmpl/cairo-version.sgml
index 62de21d7..836c9b8b 100644
--- a/doc/public/tmpl/cairo-version.sgml
+++ b/doc/public/tmpl/cairo-version.sgml
@@ -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>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2b9459b3..012f294a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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)
diff --git a/src/cairo-features-win32.h b/src/cairo-features-win32.h
index 21f99703..754b98ac 100644
--- a/src/cairo-features-win32.h
+++ b/src/cairo-features-win32.h
@@ -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
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index cfbdd077..4225548a 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -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);
diff --git a/src/cairo-version.h b/src/cairo-version.h
new file mode 100644
index 00000000..bfe4958d
--- /dev/null
+++ b/src/cairo-version.h
@@ -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
diff --git a/src/cairo.h b/src/cairo.h
index 77bfe281..a2015076 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -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);