summaryrefslogtreecommitdiff
path: root/Makefile-gir.am
blob: 9aca664290c87acdcf9f31f00b492a8218c9b146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
BUILT_GIRSOURCES =
SUBSTITUTED_GIRSOURCES =

STATIC_GIRSOURCES =                 \
        gir/DBus-1.0.gir            \
        gir/DBusGLib-1.0.gir        \
        gir/fontconfig-2.0.gir      \
        gir/freetype2-2.0.gir       \
        gir/GL-1.0.gir              \
        gir/libxml2-2.0.gir         \
        gir/xft-2.0.gir             \
        gir/xlib-2.0.gir            \
        gir/xfixes-4.0.gir          \
        gir/xrandr-1.3.gir          \
        gir/win32-1.0.gir
EXTRA_DIST += $(STATIC_GIRSOURCES)

gir/cairo-1.0.gir: gir/cairo-1.0.gir.in Makefile
	[ -d $(@D) ] || $(mkdir_p) $(@D) ; \
	sed \
	-e s,%CAIRO_SHARED_LIBRARY%,$(CAIRO_SHARED_LIBRARY), \
	-e s,%CAIRO_GIR_PACKAGE%,$(CAIRO_GIR_PACKAGE), \
	< $< > $@.tmp && mv $@.tmp $@
BUILT_SOURCES += gir/cairo-1.0.gir
SUBSTITUTED_GIRSOURCES += gir/cairo-1.0.gir
CLEANFILES += gir/cairo-1.0.gir
EXTRA_DIST += gir/cairo-1.0.gir.in

# Doesn't seem to work to do gir/%.typelib =(
gir/cairo-1.0.typelib: g-ir-compiler$(EXEEXT)
gir/DBus-1.0.typelib: g-ir-compiler$(EXEEXT)
gir/DBusGLib-1.0.typelib: g-ir-compiler$(EXEEXT)
gir/fontconfig-2.0.typelib: g-ir-compiler$(EXEEXT)
gir/freetype2-2.0.typelib: g-ir-compiler$(EXEEXT)
gir/GL-1.0.typelib: g-ir-compiler$(EXEEXT)
gir/libxml2-2.0.typelib: g-ir-compiler$(EXEEXT)
gir/xft-2.0.typelib: g-ir-compiler$(EXEEXT)
gir/xlib-2.0.typelib: g-ir-compiler$(EXEEXT)
gir/xfixes-4.0.typelib: g-ir-compiler$(EXEEXT)
gir/xrandr-1.3.typelib: g-ir-compiler$(EXEEXT)
gir/win32-1.0.typelib: g-ir-compiler$(EXEEXT)

# glib with source (to enable documentation)
if WITH_GLIBSRC
     GLib_2_0_gir_DOCSRC = $(GLIBSRC)/glib/*.c
     GObject_2_0_gir_DOCSRC = $(GLIBSRC)/gobject/*.c
     GModule_2_0_gir_DOCSRC = $(GLIBSRC)/gmodule/*.c
     Gio_2_0_gir_DOCSRC = $(GLIBSRC)/gio/*.c
else
    GLib_2_0_gir_DOCSRC = 
    GObject_2_0_gir_DOCSRC = 
    GModule_2_0_gir_DOCSRC = 
    Gio_2_0_gir_DOCSRC = 

endif

# glib
GLIB_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir glib-2.0)/glib-2.0
GLIB_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir glib-2.0)

GLIB_LIBRARY=glib-2.0

GLib_2_0_gir_LIBS = $(GLIB_LIBRARY) $(GOBJECT_LIBRARY)
GLib_2_0_gir_SCANNERFLAGS = \
            --external-library \
            --reparse-validate \
            --identifier-prefix=G \
            --symbol-prefix=g \
            --symbol-prefix=glib \
            --c-include="glib.h" \
            $(GLib_2_0_gir_DOCSRC)
GLib_2_0_gir_PACKAGES = glib-2.0
GLib_2_0_gir_CFLAGS = \
            -I$(GLIB_INCLUDEDIR) \
            -I$(GLIB_LIBDIR)/glib-2.0/include \
            -DGETTEXT_PACKAGE=Dummy \
            -DGLIB_COMPILATION \
            -D__G_I18N_LIB_H__
GLib_2_0_gir_FILES =  \
                $(GLIB_LIBDIR)/glib-2.0/include/glibconfig.h \
		$(GLIB_INCLUDEDIR)/glib/*.h \
		$(GLIB_INCLUDEDIR)/gobject/glib-types.h \
                gir/glib-2.0.c
if HAVE_GIO_UNIX
GLib_2_0_gir_FILES += $(GLIB_INCLUDEDIR)/glib-unix.h
endif

BUILT_GIRSOURCES += GLib-2.0.gir

GLib-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT)

gir/DBusGLib-1.0.typelib: GObject-2.0.gir

# gobject
GOBJECT_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gobject-2.0)/glib-2.0
GOBJECT_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gobject-2.0)

GOBJECT_LIBRARY=gobject-2.0

GObject-2.0.gir: GLib-2.0.gir
GObject_2_0_gir_LIBS = $(GOBJECT_LIBRARY)
GObject_2_0_gir_SCANNERFLAGS = \
            --external-library \
            --reparse-validate \
            --identifier-prefix=G \
            --c-include="glib-object.h" \
            --add-include-path=. \
            $(GObject_2_0_gir_DOCSRC)

GObject_2_0_gir_PACKAGES = gobject-2.0
GObject_2_0_gir_INCLUDES = GLib-2.0
GObject_2_0_gir_CFLAGS = \
            -DGOBJECT_COMPILATION \
            -I$(GOBJECT_INCLUDEDIR) \
            -I$(GOBJECT_LIBDIR)/glib-2.0/include
GObject_2_0_gir_FILES = \
	$(filter-out $(GOBJECT_INCLUDEDIR)/gobject/glib-types.h, $(wildcard $(GOBJECT_INCLUDEDIR)/gobject/*.h)) \
	gir/gobject-2.0.c

BUILT_GIRSOURCES += GObject-2.0.gir

# gmodule
GMODULE_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gmodule-2.0)/glib-2.0
GMODULE_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gmodule-2.0)

GMODULE_LIBRARY=gmodule-2.0

GModule-2.0.gir: GLib-2.0.gir

GModule_2_0_gir_LIBS = $(GMODULE_LIBRARY)
GModule_2_0_gir_SCANNERFLAGS = \
            --external-library \
            --identifier-prefix=G \
            --c-include="gmodule.h" \
            --add-include-path=. \
            $(GModule_2_0_gir_DOCSRC)

GModule_2_0_gir_PACKAGES = gmodule-2.0
GModule_2_0_gir_INCLUDES = GLib-2.0
GModule_2_0_gir_CFLAGS = \
            -I$(GMODULE_INCLUDEDIR) \
            -I$(GMODULE_LIBDIR)/glib-2.0/include
GModule_2_0_gir_FILES = $(GLIB_INCLUDEDIR)/gmodule.h \
            gir/gmodule-2.0.c

BUILT_GIRSOURCES += GModule-2.0.gir

# gio
GIO_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gio-2.0)/glib-2.0
GIO_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gio-2.0)

GIO_LIBRARY=gio-2.0

if HAVE_GIO_UNIX
GIO_UNIX_HDRS=$(shell "${PKG_CONFIG}" --variable=includedir gio-unix-2.0)/gio-unix-2.0/gio/*.h
GIO_UNIX_PACKAGES = gio-unix-2.0
else
GIO_UNIX_HDRS=
GIO_UNIX_PACKAGES =
endif
GIO_CINCLUDES=$(patsubst %,--c-include='%',$(shell echo $(GIO_UNIX_HDRS)))

Gio-2.0.gir: GObject-2.0.gir

Gio_2_0_gir_LIBS = $(GIO_LIBRARY)
Gio_2_0_gir_SCANNERFLAGS = \
            --external-library \
            --reparse-validate \
            --warn-all \
            --identifier-prefix=G \
            --c-include="gio/gio.h" \
            $(GIO_CINCLUDES) \
            --add-include-path=. \
            $(Gio_2_0_gir_DOCSRC)

Gio_2_0_gir_PACKAGES = gio-2.0 $(GIO_UNIX_PACKAGES)
Gio_2_0_gir_INCLUDES = GObject-2.0
Gio_2_0_gir_CFLAGS = \
            -DGIO_COMPILATION \
            -I$(GIO_LIBDIR)/glib-2.0/include
Gio_2_0_gir_FILES = \
            $(GIO_UNIX_HDRS) \
            $(filter-out %/gsettingsbackend.h, $(shell echo $(GIO_INCLUDEDIR)/gio/*.h)) \
            gir/gio-2.0.c

BUILT_GIRSOURCES += Gio-2.0.gir
EXTRA_DIST += gir/glib-2.0.c gir/gmodule-2.0.c gir/gobject-2.0.c gir/gio-2.0.c

# girepository
GIRepository-2.0.gir: GObject-2.0.gir libgirepository-1.0.la

GIRepository_2_0_gir_LIBS = libgirepository-1.0.la
GIRepository_2_0_gir_SCANNERFLAGS = \
	--warn-all \
        --identifier-prefix=GI \
        --symbol-prefix=g \
        --c-include="girepository.h" \
        --add-include-path=.
GIRepository_2_0_gir_PACKAGES = gobject-2.0
GIRepository_2_0_gir_INCLUDES = GObject-2.0
GIRepository_2_0_gir_EXPORT_PACKAGES = gobject-introspection-1.0
GIRepository_2_0_gir_CFLAGS = \
    -I$(top_srcdir)/girepository -I$(top_srcdir) \
    -DGI_COMPILATION
GIRepository_2_0_gir_FILES = \
        $(top_srcdir)/girepository/girepository.h   \
        $(top_srcdir)/girepository/girepository.c   \
        $(top_srcdir)/girepository/gi*info.c	    \
        $(top_srcdir)/girepository/gi*info.h	    \
        $(top_srcdir)/girepository/gitypelib.h	    \
        $(top_srcdir)/girepository/gitypes.h

BUILT_GIRSOURCES += GIRepository-2.0.gir

CLEANFILES += $(BUILT_GIRSOURCES)

INTROSPECTION_GIRS += $(BUILT_GIRSOURCES)

girdir = $(GIR_DIR)
gir_DATA = $(STATIC_GIRSOURCES) $(SUBSTITUTED_GIRSOURCES) $(BUILT_GIRSOURCES)

typelibsdir = $(libdir)/girepository-1.0
typelibs_DATA = $(gir_DATA:.gir=.typelib)

CLEANFILES += $(typelibs_DATA)