gir generation is broken on windows
I build gobject-introspection on windows using meson to be able to generate GIR files for projects like GStreamer etc.
When updating gobject-introspection, this broke for me, and the failure looked like this:
[131/1250] Generating Gst-1.0.gir with a custom command.
FAILED: gstreamer/gst/Gst-1.0.gir
"C:/Program" "Files (x86)/Microsoft Visual Studio/Shared/Python36_64/python.exe" "C:/Pexip/mcu/.build/windows-amd64/__install__/bin/g-ir-scanner" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/include/gobject-introspection-1.0" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/include" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/include/glib-2.0" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/lib/glib-2.0/include" "--no-libtool" "--namespace=Gst" "--nsversion=1.0" "--warn-all" "--output" "./gstreamer/gst/Gst-1.0.gir" "--add-init-section=extern void gst_init(gint*,gchar**);g_setenv(\"GST_REGISTRY_DISABLE\", \"yes\", TRUE);g_setenv(\"GST_REGISTRY_1.0\", \"/no/way/this/exists.reg\", TRUE);g_setenv(\"GST_PLUGIN_PATH_1_0\", \"\", TRUE);g_setenv(\"GST_PLUGIN_SYSTEM_PATH_1_0\", \"\", TRUE);gst_init(NULL,NULL);" "--c-include=gst/gst.h" "--cflags-begin" "-IC:/Pexip/mcu/external/gstreamer/./gstreamer/gst/.." "-IC:/Pexip/mcu/.build/windows-amd64/__build__/external/gstreamer/./gstreamer/gst/.." "--cflags-end" "-IC:/Pexip/mcu/external/gstreamer/./gstreamer/gst" "-IC:/Pexip/mcu/.build/windows-amd64/__build__/external/gstreamer/./gstreamer/gst" "-I././gstreamer/." "-I../../../../../external/gstreamer/./gstreamer/." "-I././gstreamer/gst/parse" "-I../../../../../external/gstreamer/./gstreamer/gst/parse" "--filelist=C:/Pexip/mcu/.build/windows-amd64/__build__/external/gstreamer/./gstreamer/gst/.@gstreamer@gst@@gstreamer-1.0@sha/Gst_1.0_gir_filelist" "--include=GLib-2.0" "--include=GObject-2.0" "--include=GModule-2.0" "--symbol-prefix=gst" "--identifier-prefix=Gst" "--pkg-export=gstreamer-1.0" "--cflags-begin" "-DG_DISABLE_DEPRECATED" "-DG_DISABLE_CAST_CHECKS" "-DG_DISABLE_ASSERT" "-DG_DISABLE_CHECKS" "-I././gstreamer/." "-I../../../../../external/gstreamer/./gstreamer/." "-I././gstreamer/gst/parse" "-I../../../../../external/gstreamer/./gstreamer/gst/parse" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/include" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/include/glib-2.0" "-IC:/Pexip/mcu/.build/windows-amd64/__install__/lib/glib-2.0/include" "--cflags-end" "-LC:/Pexip/mcu/.build/windows-amd64/__build__/external/gstreamer/./gstreamer/gst/printf" "--library" "gstreamer-1.0" "-LC:/Pexip/mcu/.build/windows-amd64/__build__/external/gstreamer/./gstreamer/gst" "-LC:/Pexip/mcu/.build/windows-amd64/__install__/lib"
CreateProcess failed: The system cannot find the file specified.
Notice how the path to the python.exe has been broken in two: "C:/Program" and "Files (x86)/Microsoft Visual Studio/Shared/Python36_64/python.exe"
Bisecting found this to be the offending commit: 2c6b3b9a
Discussing this with nirbheek, he said:
The shebang parsing goes like this: everything before the first space is the interpreter, everything after that is a single argument to that interpreter
So in meson, if the interpreter in the shebang is env
, we ignore it and slurp the rest as the actual interpreter and parse it with shell syntax to handle spaces correctly
This is my proposed fix: https://github.com/pexip/gobject-introspection/commit/f6ea5caf177f0b61250d0843ffbc636fb009e74d as this makes GIR generation work again on windows.