From 5e68f90e2c8ab6f179f15989c546994b0a43e18f Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 23 May 2016 01:57:36 +0200 Subject: [PATCH] Separate mypaint-config.h and config.h. MyPaint uses some of the constants from `mypaint-config.h` but much of the generated part from configuration should not be public because it conflicts with the configuration of other autotooled project. Split it so that the generated constants are not in the public header. This means also that config.h cannot be included from any of the other public headers and the main problem with this was that the macro MYPAINT_CONFIG_USE_GLIB cannot be used inside a public header anymore. I slightly reorganized installed files to account for this. --- Makefile.am | 14 ++++---------- brushmodes.c | 2 ++ fifo.c | 2 ++ gegl/mypaint-gegl-surface.c | 2 ++ gegl/mypaint-gegl-surface.h | 1 + glib/mypaint-brush.h | 3 --- glib/mypaint-gegl-glib.c | 1 + glib/mypaint-gegl-glib.h | 4 ---- helpers.c | 2 ++ mypaint-brush-settings.c | 2 ++ mypaint-brush-settings.h | 1 + mypaint-brush.c | 7 +++++++ mypaint-brush.h | 4 +--- mypaint-config.h.top => mypaint-config.h | 2 +- mypaint-config.h.bottom | 3 --- mypaint-fixed-tiled-surface.c | 6 ++++++ mypaint-fixed-tiled-surface.h | 1 + mypaint-glib-compat.h | 12 ++---------- mypaint-mapping.c | 6 ++++++ mypaint-mapping.h | 1 + mypaint-rectangle.c | 2 ++ mypaint-rectangle.h | 1 + mypaint-surface.c | 2 ++ mypaint-surface.h | 2 +- mypaint-tiled-surface.c | 3 +++ mypaint.c | 1 + operationqueue.c | 6 ++++++ rng-double.c | 2 ++ rng-double.h | 7 +++++++ tests/mypaint-benchmark.c | 5 +++++ tests/test-details.c | 1 + tilemap.c | 2 ++ tilemap.h | 4 ++++ utils.c | 3 +++ 34 files changed, 82 insertions(+), 35 deletions(-) rename mypaint-config.h.top => mypaint-config.h (89%) delete mode 100644 mypaint-config.h.bottom diff --git a/Makefile.am b/Makefile.am index de89cb96..1c28b547 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I m4macros +if WITH_GLIB libmypaint_glib = glib/mypaint-brush.h +endif ## GObject introspection ## @@ -98,6 +100,7 @@ nobase_libmypaint_public_HEADERS = \ LIBMYPAINT_SOURCES = \ brushmodes.c \ + config.h \ fifo.c \ helpers.c \ mypaint-mapping.c \ @@ -116,14 +119,7 @@ LIBMYPAINT_SOURCES = \ libmypaint_la_SOURCES = $(libmypaint_public_HEADERS) $(LIBMYPAINT_SOURCES) -# Force generated source files to be built first. -# Automatic dependency tracking does not always work as expected. See: -# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html -BUILT_SOURCES = mypaint-config.h -DISTCLEANFILES = mypaint-config.h MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@LIBMYPAINT_MINOR_VERSION@.gir.files - -mypaint-config.h: mypaint-config.h.top config.h mypaint-config.h.bottom - cat $^ >$@ +DISTCLEANFILES = MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@LIBMYPAINT_MINOR_VERSION@.gir.files EXTRA_DIST = \ brushsettings.json \ @@ -138,8 +134,6 @@ EXTRA_DIST = \ generate.py \ helpers.h \ libmypaint.c \ - mypaint-config.h.bottom \ - mypaint-config.h.top \ operationqueue.h \ rng-double.h \ tiled-surface-private.h \ diff --git a/brushmodes.c b/brushmodes.c index aa794da2..b4ae0a9e 100644 --- a/brushmodes.c +++ b/brushmodes.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include diff --git a/fifo.c b/fifo.c index 2943632b..56faab8d 100644 --- a/fifo.c +++ b/fifo.c @@ -15,6 +15,8 @@ * */ +#include + #include #include "fifo.h" diff --git a/gegl/mypaint-gegl-surface.c b/gegl/mypaint-gegl-surface.c index 260dc50b..5c86d3c3 100644 --- a/gegl/mypaint-gegl-surface.c +++ b/gegl/mypaint-gegl-surface.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include diff --git a/gegl/mypaint-gegl-surface.h b/gegl/mypaint-gegl-surface.h index ffef4043..37c06651 100644 --- a/gegl/mypaint-gegl-surface.h +++ b/gegl/mypaint-gegl-surface.h @@ -21,6 +21,7 @@ G_BEGIN_DECLS +#include #include #include diff --git a/glib/mypaint-brush.h b/glib/mypaint-brush.h index b2faa8ea..98459fc5 100644 --- a/glib/mypaint-brush.h +++ b/glib/mypaint-brush.h @@ -3,7 +3,6 @@ #include -#if MYPAINT_CONFIG_USE_GLIB #include #define MYPAINT_TYPE_BRUSH (mypaint_brush_get_type ()) @@ -22,6 +21,4 @@ GType mypaint_fixed_tiled_surface_get_type(void); #define MYPAINT_VALUE_HOLDS_RECTANGLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_TYPE_RECTANGLE)) GType mypaint_rectangle_get_type(void); -#endif - #endif // MYPAINTBRUSHGLIB_H diff --git a/glib/mypaint-gegl-glib.c b/glib/mypaint-gegl-glib.c index 186d6602..9a8ef545 100644 --- a/glib/mypaint-gegl-glib.c +++ b/glib/mypaint-gegl-glib.c @@ -1,3 +1,4 @@ +#include #include #if MYPAINT_CONFIG_USE_GLIB diff --git a/glib/mypaint-gegl-glib.h b/glib/mypaint-gegl-glib.h index 65854665..47061d4d 100644 --- a/glib/mypaint-gegl-glib.h +++ b/glib/mypaint-gegl-glib.h @@ -3,13 +3,9 @@ #include -#if MYPAINT_CONFIG_USE_GLIB - #include #define MYPAINT_GEGL_TYPE_TILED_SURFACE (mypaint_gegl_tiled_surface_get_type ()) #define MYPAINT_GEGL_VALUE_HOLDS_TILED_SURFACE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_GEGL_TYPE_TILED_SURFACE)) GType mypaint_gegl_tiled_surface_get_type(void); -#endif - #endif // MYPAINTGEGLGLIB_H diff --git a/helpers.c b/helpers.c index b64a7499..35f210aa 100644 --- a/helpers.c +++ b/helpers.c @@ -17,6 +17,8 @@ #ifndef HELPERS_C #define HELPERS_C +#include + #include #include #include diff --git a/mypaint-brush-settings.c b/mypaint-brush-settings.c index 337c163f..d827e503 100644 --- a/mypaint-brush-settings.c +++ b/mypaint-brush-settings.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include "mypaint-brush-settings.h" #include diff --git a/mypaint-brush-settings.h b/mypaint-brush-settings.h index 64cd9821..221d257f 100644 --- a/mypaint-brush-settings.h +++ b/mypaint-brush-settings.h @@ -17,6 +17,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include diff --git a/mypaint-brush.c b/mypaint-brush.c index f309392e..ce6d6915 100644 --- a/mypaint-brush.c +++ b/mypaint-brush.c @@ -14,12 +14,19 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include #include #include #include +#if MYPAINT_CONFIG_USE_GLIB +#include +#include +#endif + #include "mypaint-brush.h" #include "mypaint-brush-settings.h" diff --git a/mypaint-brush.h b/mypaint-brush.h index e375deb7..837ed031 100644 --- a/mypaint-brush.h +++ b/mypaint-brush.h @@ -18,7 +18,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include #include #include @@ -26,8 +26,6 @@ G_BEGIN_DECLS typedef struct MyPaintBrush MyPaintBrush; -#include - MyPaintBrush * mypaint_brush_new(void); diff --git a/mypaint-config.h.top b/mypaint-config.h similarity index 89% rename from mypaint-config.h.top rename to mypaint-config.h index 64b22e91..55e60933 100644 --- a/mypaint-config.h.top +++ b/mypaint-config.h @@ -13,4 +13,4 @@ #define MYPAINT_MAX_MIPMAP_LEVEL 4 #endif -/* Start generated config */ +#endif /* MYPAINTCONFIG_H */ diff --git a/mypaint-config.h.bottom b/mypaint-config.h.bottom deleted file mode 100644 index d2ec418e..00000000 --- a/mypaint-config.h.bottom +++ /dev/null @@ -1,3 +0,0 @@ -/* End generated config */ - -#endif /* MYPAINTCONFIG_H */ diff --git a/mypaint-fixed-tiled-surface.c b/mypaint-fixed-tiled-surface.c index 0371474c..71839b9f 100644 --- a/mypaint-fixed-tiled-surface.c +++ b/mypaint-fixed-tiled-surface.c @@ -4,6 +4,12 @@ #include #include +#include + +#if MYPAINT_CONFIG_USE_GLIB +#include +#endif + #include diff --git a/mypaint-fixed-tiled-surface.h b/mypaint-fixed-tiled-surface.h index 97f9197e..53445ff9 100644 --- a/mypaint-fixed-tiled-surface.h +++ b/mypaint-fixed-tiled-surface.h @@ -1,6 +1,7 @@ #ifndef MYPAINTFIXEDTILEDSURFACE_H #define MYPAINTFIXEDTILEDSURFACE_H +#include #include #include diff --git a/mypaint-glib-compat.h b/mypaint-glib-compat.h index 10bd579e..bded620b 100644 --- a/mypaint-glib-compat.h +++ b/mypaint-glib-compat.h @@ -3,13 +3,7 @@ #include -#if MYPAINT_CONFIG_USE_GLIB - -#include - -#else // not MYPAINT_CONFIG_USE_GLIB - -#ifndef __G_LIB_H_ +#ifndef __G_LIB_H__ /* From $INCLUDEPATH/glib-2.0/glib/gmacros.h */ #ifdef __cplusplus @@ -33,8 +27,6 @@ typedef gint gboolean; /* From $LIBPATH/glib-2.0/include/glibconfig.h */ typedef unsigned short guint16; -#endif // __G_LIB_H_ - -#endif // MYPAINT_CONFIG_USE_GLIB +#endif // __G_LIB_H__ #endif // MYPAINTGLIBCOMPAT_H diff --git a/mypaint-mapping.c b/mypaint-mapping.c index 1baca868..ddfdd5df 100644 --- a/mypaint-mapping.c +++ b/mypaint-mapping.c @@ -17,9 +17,15 @@ #ifndef MAPPING_C #define MAPPING_C +#include + #include #include +#if MYPAINT_CONFIG_USE_GLIB +#include +#endif + #include "mypaint-mapping.h" #include "helpers.h" diff --git a/mypaint-mapping.h b/mypaint-mapping.h index 3af55871..a58e5d10 100644 --- a/mypaint-mapping.h +++ b/mypaint-mapping.h @@ -1,6 +1,7 @@ #ifndef MAPPING_H #define MAPPING_H +#include #include G_BEGIN_DECLS diff --git a/mypaint-rectangle.c b/mypaint-rectangle.c index 6c63acf9..83b23e31 100644 --- a/mypaint-rectangle.c +++ b/mypaint-rectangle.c @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include #include diff --git a/mypaint-rectangle.h b/mypaint-rectangle.h index f88df6e6..e08c68e2 100644 --- a/mypaint-rectangle.h +++ b/mypaint-rectangle.h @@ -18,6 +18,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include G_BEGIN_DECLS diff --git a/mypaint-surface.c b/mypaint-surface.c index 7c9dc884..8756b3c4 100644 --- a/mypaint-surface.c +++ b/mypaint-surface.c @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include "mypaint-surface.h" diff --git a/mypaint-surface.h b/mypaint-surface.h index e56340da..1217a76c 100644 --- a/mypaint-surface.h +++ b/mypaint-surface.h @@ -18,7 +18,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include #include G_BEGIN_DECLS diff --git a/mypaint-tiled-surface.c b/mypaint-tiled-surface.c index e4ae505a..4b6e82ea 100644 --- a/mypaint-tiled-surface.c +++ b/mypaint-tiled-surface.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include #include @@ -23,6 +25,7 @@ #include #endif +#include "mypaint-config.h" #include "mypaint-tiled-surface.h" #include "tiled-surface-private.h" #include "helpers.h" diff --git a/mypaint.c b/mypaint.c index 45f38e00..d19414a1 100644 --- a/mypaint.c +++ b/mypaint.c @@ -1,4 +1,5 @@ +#include #include #ifdef _OPENMP diff --git a/operationqueue.c b/operationqueue.c index 3e585c5f..a702a3f8 100644 --- a/operationqueue.c +++ b/operationqueue.c @@ -14,11 +14,17 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include +#if MYPAINT_CONFIG_USE_GLIB +#include +#else // not MYPAINT_CONFIG_USE_GLIB #include +#endif + #include "operationqueue.h" #include "fifo.h" diff --git a/rng-double.c b/rng-double.c index 9169b720..bbdcd71d 100644 --- a/rng-double.c +++ b/rng-double.c @@ -21,6 +21,8 @@ * independent generator objects. All changes made to this file are considered * to be in the public domain. */ +#include + #include "rng-double.h" #include diff --git a/rng-double.h b/rng-double.h index 9f0dd5f9..0572659b 100644 --- a/rng-double.h +++ b/rng-double.h @@ -1,7 +1,14 @@ #ifndef RNGDOUBLE_H #define RNGDOUBLE_H +#include "mypaint-config.h" + +#if MYPAINT_CONFIG_USE_GLIB +#include +#else // not MYPAINT_CONFIG_USE_GLIB #include +#endif + G_BEGIN_DECLS diff --git a/tests/mypaint-benchmark.c b/tests/mypaint-benchmark.c index 73dbd389..991f68bf 100644 --- a/tests/mypaint-benchmark.c +++ b/tests/mypaint-benchmark.c @@ -15,7 +15,12 @@ */ #include "mypaint-benchmark.h" + +#if MYPAINT_CONFIG_USE_GLIB +#include +#else // not MYPAINT_CONFIG_USE_GLIB #include +#endif #include #include diff --git a/tests/test-details.c b/tests/test-details.c index 8b91758c..9f34251a 100644 --- a/tests/test-details.c +++ b/tests/test-details.c @@ -1,3 +1,4 @@ +#include "mypaint-config.h" #include #include diff --git a/tilemap.c b/tilemap.c index 42e22d90..ece44992 100644 --- a/tilemap.c +++ b/tilemap.c @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include diff --git a/tilemap.h b/tilemap.h index a5627674..2eb816cd 100644 --- a/tilemap.h +++ b/tilemap.h @@ -17,7 +17,11 @@ #ifndef TILEMAP_H #define TILEMAP_H +#if MYPAINT_CONFIG_USE_GLIB +#include +#else // not MYPAINT_CONFIG_USE_GLIB #include +#endif G_BEGIN_DECLS diff --git a/utils.c b/utils.c index d8a02597..06b48555 100644 --- a/utils.c +++ b/utils.c @@ -1,5 +1,8 @@ /* Utilities which might become part of public API in the future */ +#include + +#include "mypaint-config.h" #include "mypaint-tiled-surface.h" #include "mypaint-fixed-tiled-surface.h"