Windows port: g-ir-scanner: Accept -m flags
authorDieter Verfaillie <dieterv@optionexplicit.be>
Mon, 5 Sep 2011 19:54:18 +0000 (21:54 +0200)
committerDieter Verfaillie <dieterv@optionexplicit.be>
Wed, 7 Sep 2011 20:01:56 +0000 (22:01 +0200)
Some pkgconfig files contain these flags on Windows, for example
gtk+-3.0.pc has -mms-bitfields in it's Cflags. Nothing is done yet
with these though, we only accept these flags for now...

https://bugzilla.gnome.org/show_bug.cgi?id=620566

giscanner/scannermain.py

index 3c1386a..6dc56ef 100755 (executable)
@@ -56,6 +56,14 @@ def get_preprocessor_option_group(parser):
     group.add_option("-p", dest="", help="Ignored")
     return group
 
+def get_windows_option_group(parser):
+    group = optparse.OptionGroup(parser, "Machine Dependent Options")
+    group.add_option("-m", help="some machine dependent option",
+                     action="append", dest='m_option',
+                     default=[])
+
+    return group
+
 def _get_option_parser():
     parser = optparse.OptionParser('%prog [options] sources')
     parser.add_option('', "--quiet",
@@ -151,6 +159,10 @@ match the namespace prefix.""")
     group = get_preprocessor_option_group(parser)
     parser.add_option_group(group)
 
+    if os.environ.get('MSYSTEM') == 'MINGW32':
+        group = get_windows_option_group(parser)
+        parser.add_option_group(group)
+
     # Private options
     parser.add_option('', "--generate-typelib-tests",
                       action="store", dest="test_codegen", default=None,