From 3df0e78d4aaf9c3bf8a86632598914e97f89bde2 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 31 Jul 2019 16:59:13 +0800 Subject: [PATCH] MSVC introspection: Do not rely on autotools We now have the g-ir-scanner command line written in here, and so we do not need to rely on 'make dist' to generate the command lines that we need to build introspection for MSVC builds. This will enable us to clean some things up form the autotools build files. Clean up introspection-msvc.mak a bit as we could now use config-msvc.mak(.in) to get some of the configurable items from there. --- build/win32/gtk-introspection-msvc.mak | 57 +++++++++++++++++++++++++- build/win32/introspection-msvc.mak | 12 ------ 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/build/win32/gtk-introspection-msvc.mak b/build/win32/gtk-introspection-msvc.mak index 74a97e1e72..2a150c57e8 100644 --- a/build/win32/gtk-introspection-msvc.mak +++ b/build/win32/gtk-introspection-msvc.mak @@ -1,6 +1,8 @@ # NMake Makefile to build Introspection Files for GTK+ !include detectenv-msvc.mak +!include config-msvc.mak + !include ..\..\gdk\Makefile.inc !include ..\..\gtk\a11y\Makefile.inc !include ..\..\gtk\deprecated\Makefile.inc @@ -55,7 +57,59 @@ gtk-introspect-list: ..\..\gtk\Makefile.inc @$(PYTHON) -c "import re;srcs='$(a11y_c_sources: =) $(gtk_deprecated_c_sources: =) $(inspector_c_sources: =) $(gtk_base_c_sources_base: =)';filter=re.compile('(.*)win32.c');result=[l for l in srcs.replace('/','\\').split() if not filter.match(l)];result[0]='\n..\\..\\gtk\\' + result[0];f=open('$@', 'a');f.write('\n..\\..\\gtk\\'.join(result));f.close()" @$(PYTHON) -c "srcs='gtkprintoperation-unix.c gtktypebuiltins.h gtktypebuiltins.c';result=srcs.replace('/','\\').split();result[0]='\n..\\..\\gtk\\' + result[0];f=open('$@', 'a');f.write('\n..\\..\\gtk\\'.join(result));f.close()" -!include introspection.body.mak +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-$(APIVERSION).gir: vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk-$(APIVERSION).lib gdk-introspect-list + @echo Generating $@... + $(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool \ + --namespace=Gdk --nsversion=$(APIVERSION) --library=gdk-$(APIVERSION) \ + --add-include-path=./$(@D:\=/) --add-include-path=$(G_IR_INCLUDEDIR) \ + --include=Gio-2.0 --include=GdkPixbuf-2.0 --include=Pango-1.0 --include=cairo-1.0 \ + --pkg-export=gdk-$(APIVERSION) \ + --cflags-begin \ + $(GDK_PREPROCESSOR_FLAGS) \ + --cflags-end \ + --c-include=gdk/gdk.h --filelist=gdk-introspect-list \ + -L.\$(@D) \ + -o $@ + +vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).gir: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.gir gdk-win32-introspect-list + @echo Generating $@... + $(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool \ + --namespace=GdkWin32 --nsversion=$(APIVERSION) \ + --library=gdk-$(APIVERSION) \ + --add-include-path=./$(@D:\=/) --add-include-path=$(G_IR_INCLUDEDIR) \ + --cflags-begin \ + $(GDK_PREPROCESSOR_FLAGS) \ + --cflags-end \ + --identifier-prefix=Gdk --c-include=gdk/gdkwin32.h --include-uninstalled=./$(@D:\=/)/Gdk-3.0.gir \ + --filelist=gdk-win32-introspect-list \ + -L.\$(@D) \ + -o $@ + +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-3.0.gir: vs$(VSVER)\$(CFG)\$(PLAT)\bin\gtk-3.0.lib vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.gir gtk-introspect-list + @echo Generating $@... + $(PYTHON) $(G_IR_SCANNER) --verbose -no-libtool \ + --namespace=Gtk --nsversion=$(APIVERSION) \ + --library=gtk-$(APIVERSION) --library=gdk-$(APIVERSION) \ + --add-include-path=./$(@D:\=/) --add-include-path=$(G_IR_INCLUDEDIR) \ + --include=Atk-1.0 \ + --pkg-export=gtk+-$(APIVERSION) \ + --cflags-begin \ + -DG_LOG_USE_STRUCTURED=1 $(GTK_PREPROCESSOR_FLAGS:\"=\\\") \ + --cflags-end \ + --warn-all --include-uninstalled=./$(@D:\=/)/Gdk-3.0.gir \ + --filelist=gtk-introspect-list \ + -L.\$(@D) \ + -o $@ + +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.typelib: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.gir +vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-3.0.typelib: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.typelib vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-3.0.gir +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-3.0.typelib: vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.typelib vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-3.0.gir + +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gdk-3.0.typelib \ +vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-3.0.typelib \ +vs$(VSVER)\$(CFG)\$(PLAT)\bin\Gtk-3.0.typelib: + @-echo Compiling $@... + $(G_IR_COMPILER) --includedir=$(@D:\=/) --debug --verbose $(@R:\=/).gir -o $@ install-introspection: all @-copy vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir "$(G_IR_INCLUDEDIR)" @@ -69,3 +123,4 @@ all: clean: @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.typelib @-del /f/q vs$(VSVER)\$(CFG)\$(PLAT)\bin\*.gir + @-del /f/q *-list diff --git a/build/win32/introspection-msvc.mak b/build/win32/introspection-msvc.mak index 8739844210..a033043a86 100644 --- a/build/win32/introspection-msvc.mak +++ b/build/win32/introspection-msvc.mak @@ -7,10 +7,6 @@ # You will need to have built gobject-introspection for this to work. # Change or pass in or set the following to suit your environment -!if "$(PREFIX)" == "" -PREFIX = ..\..\..\vs$(VSVER)\$(PLAT) -!endif - !if ![setlocal] && \ ![set PFX=$(PREFIX)] && \ ![for %P in (%PFX%) do @echo PREFIX_FULL=%~dpnfP > pfx.x] @@ -33,14 +29,6 @@ PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig;$(PKG_CONFIG_PATH) # This is required, and gobject-introspection needs to be built # before this can be successfully run. -!if "$(PYTHON)" == "" -PYTHON=python -!endif - -# Path to the pkg-config tool, if not already in the PATH -!if "$(PKG_CONFIG)" == "" -PKG_CONFIG=pkg-config -!endif # Don't change anything following this line!