[librsvg: 2/4] Rename librsvg-features.[ch] to rsvg-features.[ch]




commit b8c8756a0e8148afb2752acb62f06c57c917e4b4
Author: Sven Neumann <sven svenfoo org>
Date:   Mon Sep 28 10:46:09 2020 +0200

    Rename librsvg-features.[ch] to rsvg-features.[ch]
    
    Move gtk-doc comments to the header file and remove the now empty
    libsrvg/rsvg-feature.c.
    
    Split the generated version information out into rsvg-version.h.
    This keeps the generated file small and makes sure that gtk-doc finds
    the comments describing the version checks even if srcdir != builddir.
    
    Also remove C files that only hold gtk-doc comments from the list of
    source files that are compiled into the library.

 .gitignore                                      |  8 +---
 Makefile.am                                     |  7 ++++
 configure.ac                                    |  3 +-
 librsvg/librsvg-features.h.in                   | 54 -------------------------
 librsvg/{librsvg-features.c => rsvg-features.h} | 49 +++++++++++++++++++++-
 librsvg/rsvg-version.h.in                       | 13 ++++++
 librsvg/rsvg.h                                  |  3 +-
 po/POTFILES.in                                  |  8 ----
 rsvg-c-srcs.mk                                  | 22 +++++-----
 win32/README.txt                                |  2 +-
 10 files changed, 83 insertions(+), 86 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 56f70b3c..54c014f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,9 +12,6 @@ configure
 depcomp
 gtk-doc.make
 install-sh
-librsvg-enum-types.c
-librsvg-enum-types.h
-librsvg-features.h
 librsvg-zip
 librsvg.spec
 libtool
@@ -23,10 +20,6 @@ missing
 rsvg
 rsvg-convert
 rsvg-dimensions
-rsvg-view
-rsvg-view-3
-s-enum-types-c
-s-enum-types-h
 stamp-h1
 test-driver
 test-performance
@@ -60,6 +53,7 @@ doc/xml/
 gdk-pixbuf-loader/gdk-pixbuf.loaders
 gdk-pixbuf-loader/librsvg.thumbnailer
 gdk-pixbuf-loader/rsvg-loader
+librsvg/rsvg-version.h
 m4/gettext.m4
 m4/gtk-doc.m4
 m4/host-cpu-c-abi.m4
diff --git a/Makefile.am b/Makefile.am
index cdc509d1..fc1ff0f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -132,6 +132,12 @@ LIBRSVG_C_API_SRC =                                                \
        librsvg/benches/pixbuf_from_surface.rs                  \
        $(NULL)
 
+LIBRSVG_C_API_DOC_SRC =                                                \
+       librsvg/rsvg-base.c                                     \
+       librsvg/rsvg-features.c                                 \
+       librsvg/rsvg-handle.c                                   \
+       librsvg/rsvg-pixbuf.c
+
 RUST_EXTRA =                                           \
        Cargo.lock                                      \
        cargo-vendor-config                             \
@@ -270,6 +276,7 @@ dist_doc_DATA =                             \
 EXTRA_DIST =                           \
        $(LIBRSVG_INTERNALS_SRC)        \
        $(LIBRSVG_C_API_SRC)            \
+       $(LIBRSVG_C_API_DOC_SRC)        \
        $(RUST_EXTRA)                   \
        $(LIBRSVG_CRATE_SRC)            \
        librsvg.doap                    \
diff --git a/configure.ac b/configure.ac
index eafae701..3122a088 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,3 +1,4 @@
+
 # Package version, the "human readable" version
 m4_define([rsvg_major_version],[2])
 m4_define([rsvg_minor_version],[51])
@@ -379,7 +380,7 @@ AC_SUBST([AM_CFLAGS])
 AC_SUBST([AM_LDFLAGS])
 
 AC_CONFIG_FILES([
-librsvg/librsvg-features.h
+librsvg/rsvg-version.h
 Makefile
 librsvg-zip
 gdk-pixbuf-loader/Makefile
diff --git a/librsvg/librsvg-features.c b/librsvg/rsvg-features.h
similarity index 76%
rename from librsvg/librsvg-features.c
rename to librsvg/rsvg-features.h
index 15b4a8c2..906c3a0e 100644
--- a/librsvg/librsvg-features.c
+++ b/librsvg/rsvg-features.h
@@ -1,3 +1,10 @@
+#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
+#warning "Including <librsvg/rsvg-features.h> directly is deprecated."
+#endif
+
+#ifndef RSVG_FEATURES_H
+#define RSVG_FEATURES_H
+
 /**
  * SECTION: rsvg-features
  * @short_description: Check for the version of librsvg being used.
@@ -15,8 +22,6 @@
  * the system where the program is running.
  */
 
-#include "rsvg.h"
-
 /**
  * LIBRSVG_MAJOR_VERSION:
  *
@@ -113,6 +118,41 @@
  * @rsvg_major_version, @rsvg_minor_version, @rsvg_micro_version
  * instead.
  */
+#define LIBRSVG_CHECK_VERSION(major,minor,micro) \
+  (LIBRSVG_MAJOR_VERSION > (major) || \
+   (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \
+   (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && LIBRSVG_MICRO_VERSION >= 
(micro)))
+
+#ifndef __GI_SCANNER__
+#define LIBRSVG_HAVE_SVGZ  (TRUE)
+#define LIBRSVG_HAVE_CSS   (TRUE)
+
+#define LIBRSVG_CHECK_FEATURE(FEATURE) (defined(LIBRSVG_HAVE_##FEATURE) && LIBRSVG_HAVE_##FEATURE)
+#endif
+
+#ifndef __GTK_DOC_IGNORE__
+
+/*
+ * On Windows builds, we need to decorate variables that are exposed in the public API
+ * so that they can be properly exported and linked to, for DLL builds
+ */
+#ifndef RSVG_VAR
+# ifdef G_PLATFORM_WIN32
+#  ifndef RSVG_STATIC
+#   ifdef RSVG_COMPILATION
+#    define RSVG_VAR extern __declspec (dllexport)
+#   else /* RSVG_COMPILATION */
+#    define RSVG_VAR extern __declspec (dllimport)
+#   endif /* !RSVG_COMPILATION */
+#  else /* !RSVG_STATIC */
+#   define RSVG_VAR extern
+#  endif /* RSVG_STATIC */
+# else /* G_PLATFORM_WIN32 */
+#  define RSVG_VAR extern
+# endif /* !G_PLATFORM_WIN32 */
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
 
 /**
  * rsvg_major_version:
@@ -122,6 +162,7 @@
  *
  * Since: 2.52
  */
+RSVG_VAR const guint rsvg_major_version;
 
 /**
  * rsvg_minor_version:
@@ -131,6 +172,7 @@
  *
  * Since: 2.52
  */
+RSVG_VAR const guint rsvg_minor_version;
 
 /**
  * rsvg_micro_version:
@@ -140,3 +182,6 @@
  *
  * Since: 2.52
  */
+RSVG_VAR const guint rsvg_micro_version;
+
+#endif
diff --git a/librsvg/rsvg-version.h.in b/librsvg/rsvg-version.h.in
new file mode 100644
index 00000000..5fe431a9
--- /dev/null
+++ b/librsvg/rsvg-version.h.in
@@ -0,0 +1,13 @@
+#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
+#warning "Including <librsvg/rsvg-version.h> directly is deprecated."
+#endif
+
+#ifndef RSVG_VERSION_H
+#define RSVG_VERSION_H
+
+#define LIBRSVG_MAJOR_VERSION (@LIBRSVG_MAJOR_VERSION@)
+#define LIBRSVG_MINOR_VERSION (@LIBRSVG_MINOR_VERSION@)
+#define LIBRSVG_MICRO_VERSION (@LIBRSVG_MICRO_VERSION@)
+#define LIBRSVG_VERSION "@PACKAGE_VERSION@"
+
+#endif
diff --git a/librsvg/rsvg.h b/librsvg/rsvg.h
index c8c7d916..2b863768 100644
--- a/librsvg/rsvg.h
+++ b/librsvg/rsvg.h
@@ -427,7 +427,8 @@ const char *rsvg_handle_get_metadata    (RsvgHandle *handle);
 
 G_END_DECLS
 
-#include "librsvg-features.h"
+#include "rsvg-features.h"
+#include "rsvg-version.h"
 #include "rsvg-cairo.h"
 
 #undef __RSVG_RSVG_H_INSIDE__
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d9bd029f..cbef3f21 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,13 +1,5 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
-librsvg/librsvg-enum-types.c
-librsvg/librsvg-features.c
-librsvg/rsvg-base.c
-librsvg/rsvg-handle.c
-librsvg/rsvg-load.c
-librsvg/rsvg-pixbuf.c
-librsvg/rsvg-size-callback.c
-librsvg/s-enum-types-c
 rsvg_internals/benches/box_blur.rs
 rsvg_internals/benches/composite.rs
 rsvg_internals/benches/lighting.rs
diff --git a/rsvg-c-srcs.mk b/rsvg-c-srcs.mk
index e46cbd08..d6290da7 100644
--- a/rsvg-c-srcs.mk
+++ b/rsvg-c-srcs.mk
@@ -1,19 +1,17 @@
 headers =                      \
        librsvg/rsvg.h          \
-       librsvg/rsvg-cairo.h
+       librsvg/rsvg-cairo.h    \
+       librsvg/rsvg-features.h
 
-extra_inc_headers =    \
-       librsvg/librsvg-features.h
+extra_inc_headers =            \
+       librsvg/rsvg-version.h
 
-librsvg_c_srcs =       \
-       librsvg/librsvg-features.c              \
-       librsvg/librsvg-features.h              \
-       librsvg/rsvg-base.c                     \
-       librsvg/rsvg-cairo.h                    \
-       librsvg/rsvg-css.h                      \
-       librsvg/rsvg-handle.c                   \
-       librsvg/rsvg-pixbuf.c                   \
-       librsvg/rsvg.h                          \
+librsvg_c_srcs =               \
+       librsvg/rsvg-cairo.h    \
+       librsvg/rsvg-css.h      \
+       librsvg/rsvg-features.h \
+       librsvg/rsvg-version.h  \
+       librsvg/rsvg.h          \
        $(NULL)
 
 rsvg_convert_srcs = rsvg-convert.c
diff --git a/win32/README.txt b/win32/README.txt
index f3394d67..231e2a6d 100644
--- a/win32/README.txt
+++ b/win32/README.txt
@@ -62,7 +62,7 @@ and save those files without the .in file extension:
 ===========                              ==============
 config-msvc.mak.in                    -> config-msvc.mak
 config.h.win32.in                     -> config.h.win32
-$(srcroot)\librsvg\rsvg-features.h.in -> $(srcroot)\librsvg\rsvg-features.h
+$(srcroot)\librsvg\rsvg-version.h.in  -> $(srcroot)\librsvg\rsvg-version.h
 
 From this directory in a Visual Studio command prompt, run the following:
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]