summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-22 21:24:47 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-22 21:24:47 +0000
commitd1fd7fbea2949f3e90d75342c26459578bab50d8 (patch)
tree45a57edc255c91eb5521e78d97a430b4da859e24
parentda26182ec67f950157e8c72efc06770a7b5f1bf5 (diff)
downloadgobject-introspection-d1fd7fbea2949f3e90d75342c26459578bab50d8.tar.gz
Send in undefs/defines via writing it directly to stdin of cpp instead of
2008-08-22 Johan Dahlin <johan@gnome.org> * gir/Makefile.am: * giscanner/sourcescanner.py: Send in undefs/defines via writing it directly to stdin of cpp instead of via arguments. svn path=/trunk/; revision=463
-rw-r--r--ChangeLog7
-rw-r--r--gir/Makefile.am2
-rw-r--r--giscanner/sourcescanner.py27
3 files changed, 23 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 66305e58..1d4447c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-22 Johan Dahlin <johan@gnome.org>
+
+ * gir/Makefile.am:
+ * giscanner/sourcescanner.py:
+ Send in undefs/defines via writing it directly to stdin
+ of cpp instead of via arguments.
+
2008-08-22 Colin Walters <walters@verbum.org>
* tools/generate.c, tools/compiler.c: Default
diff --git a/gir/Makefile.am b/gir/Makefile.am
index 14be0521..e5e92396 100644
--- a/gir/Makefile.am
+++ b/gir/Makefile.am
@@ -66,7 +66,7 @@ girdir=$(datadir)/gir
dist_gir_DATA = $(BUILT_SOURCES)
%.typelib: %.gir
- $(top_builddir)/tools/g-ir-compiler $< --raw -o $@
+ $(top_builddir)/tools/g-ir-compiler $< -o $@
typelibsdir = $(datadir)/gitypelibs
typelibs_DATA = GLib.typelib GObject.typelib Gio.typelib
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 092fda31..4315cdca 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -223,20 +223,18 @@ class SourceScanner(object):
if not filenames:
return
- cpp_args = [
- 'cpp',
- '-C',
- '-U__GNUC__',
- '-D__GI_SCANNER__',
- # libintl.h has no types we care about and breaks
- # cpp on some systems
- '-D_LIBINTL_H',
- '-I.',
- ]
+ defines = ['__GI_SCANNER__']
+ undefs = ['__GNUC__']
+ cpp_args = ['cpp', '-C', '-I.']
+
+ # libintl.h has no types we care about and breaks
+ # cpp on some systems
+ defines.append('_LIBINTL_H')
# Do not parse the normal glibconfig.h, use the
# one we provide instead
- cpp_args.append('-D__G_LIBCONFIG_H__')
+ defines.append('__G_LIBCONFIG_H__')
+
dirname = os.path.dirname(os.path.abspath(__file__))
includedir = os.path.join(dirname, '..', 'giscanner')
if not os.path.exists(includedir):
@@ -247,7 +245,12 @@ class SourceScanner(object):
proc = subprocess.Popen(cpp_args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
-
+ for define in defines:
+ proc.stdin.write('#ifndef %s\n' % (define, ))
+ proc.stdin.write('# define %s\n' % (define, ))
+ proc.stdin.write('#endif\n')
+ for undef in undefs:
+ proc.stdin.write('#undef %s\n' % (undef, ))
for filename in filenames:
filename = os.path.abspath(filename)
proc.stdin.write('#include <%s>\n' % (filename, ))