Skip to content

Commit 5e68f90

Browse files
author
Jehan
committed
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.
1 parent ae76bd4 commit 5e68f90

34 files changed

+82
-35
lines changed

Makefile.am

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
ACLOCAL_AMFLAGS = -I m4macros
22

3+
if WITH_GLIB
34
libmypaint_glib = glib/mypaint-brush.h
5+
endif
46

57
## GObject introspection ##
68

@@ -98,6 +100,7 @@ nobase_libmypaint_public_HEADERS = \
98100

99101
LIBMYPAINT_SOURCES = \
100102
brushmodes.c \
103+
config.h \
101104
fifo.c \
102105
helpers.c \
103106
mypaint-mapping.c \
@@ -116,14 +119,7 @@ LIBMYPAINT_SOURCES = \
116119

117120
libmypaint_la_SOURCES = $(libmypaint_public_HEADERS) $(LIBMYPAINT_SOURCES)
118121

119-
# Force generated source files to be built first.
120-
# Automatic dependency tracking does not always work as expected. See:
121-
# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html
122-
BUILT_SOURCES = mypaint-config.h
123-
DISTCLEANFILES = mypaint-config.h MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@[email protected]
124-
125-
mypaint-config.h: mypaint-config.h.top config.h mypaint-config.h.bottom
126-
cat $^ >$@
122+
DISTCLEANFILES = MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@[email protected]
127123

128124
EXTRA_DIST = \
129125
brushsettings.json \
@@ -138,8 +134,6 @@ EXTRA_DIST = \
138134
generate.py \
139135
helpers.h \
140136
libmypaint.c \
141-
mypaint-config.h.bottom \
142-
mypaint-config.h.top \
143137
operationqueue.h \
144138
rng-double.h \
145139
tiled-surface-private.h \

brushmodes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*/
1616

17+
#include <config.h>
18+
1719
#include <stdint.h>
1820
#include <assert.h>
1921

fifo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*
1616
*/
1717

18+
#include <config.h>
19+
1820
#include <stdlib.h>
1921
#include "fifo.h"
2022

gegl/mypaint-gegl-surface.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*/
1616

17+
#include <config.h>
18+
1719
#include <stdlib.h>
1820
#include <assert.h>
1921

gegl/mypaint-gegl-surface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
G_BEGIN_DECLS
2323

24+
#include <mypaint-config.h>
2425
#include <glib/mypaint-gegl-glib.h>
2526
#include <mypaint-tiled-surface.h>
2627

glib/mypaint-brush.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <mypaint-config.h>
55

6-
#if MYPAINT_CONFIG_USE_GLIB
76
#include <glib-object.h>
87

98
#define MYPAINT_TYPE_BRUSH (mypaint_brush_get_type ())
@@ -22,6 +21,4 @@ GType mypaint_fixed_tiled_surface_get_type(void);
2221
#define MYPAINT_VALUE_HOLDS_RECTANGLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_TYPE_RECTANGLE))
2322
GType mypaint_rectangle_get_type(void);
2423

25-
#endif
26-
2724
#endif // MYPAINTBRUSHGLIB_H

glib/mypaint-gegl-glib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <config.h>
12
#include <mypaint-config.h>
23

34
#if MYPAINT_CONFIG_USE_GLIB

glib/mypaint-gegl-glib.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33

44
#include <mypaint-config.h>
55

6-
#if MYPAINT_CONFIG_USE_GLIB
7-
86
#include <glib-object.h>
97
#define MYPAINT_GEGL_TYPE_TILED_SURFACE (mypaint_gegl_tiled_surface_get_type ())
108
#define MYPAINT_GEGL_VALUE_HOLDS_TILED_SURFACE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_GEGL_TYPE_TILED_SURFACE))
119
GType mypaint_gegl_tiled_surface_get_type(void);
1210

13-
#endif
14-
1511
#endif // MYPAINTGEGLGLIB_H

helpers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef HELPERS_C
1818
#define HELPERS_C
1919

20+
#include <config.h>
21+
2022
#include <assert.h>
2123
#include <stdint.h>
2224
#include <math.h>

mypaint-brush-settings.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*/
1616

17+
#include <config.h>
18+
1719
#include "mypaint-brush-settings.h"
1820

1921
#include <string.h>

0 commit comments

Comments
 (0)