From 4e4a414561fdf869dca8a8b554b2d45d876ef14c Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 24 Jul 2015 12:47:31 +0800 Subject: MSVC .gir Builds: Allow More Flexibility for Cairo Allow one to pass in the cairo-gobject DLL filename for generating cairo-1.0.gir, as the DLL filename for Cairo-GObject may vary between different setups, if needed. Display a note telling the user that he/she needs to ensure that the DLL name used is correct so that programs and scripts using the cairo-1.0.typelib can run correctly. Also clean up the generation of cairo-1.0.gir a bit by directly generating the cairo-1.0.gir in build\ only during the build. --- build/gen-cairo-gir.py | 2 +- build/gi-introspection-msvc.mak | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/build/gen-cairo-gir.py b/build/gen-cairo-gir.py index 69630028..2fb365e2 100644 --- a/build/gen-cairo-gir.py +++ b/build/gen-cairo-gir.py @@ -51,7 +51,7 @@ def main(argv): # Set up variables in cairo-1.0.gir.in to produce cairo-1.0.gir setup_vars_cairo(os.path.join(preset_gir_path, 'cairo-1.0.gir.in'), - os.path.join(preset_gir_path, 'cairo-1.0.gir'), + 'cairo-1.0.gir', opt.dllname) if __name__ == '__main__': diff --git a/build/gi-introspection-msvc.mak b/build/gi-introspection-msvc.mak index d439ef44..2a7a5e3a 100644 --- a/build/gi-introspection-msvc.mak +++ b/build/gi-introspection-msvc.mak @@ -2,10 +2,12 @@ # Change or pass in as a variable/env var if needed # The main DLLs that are used to build introspection files that are "installed" +!if "$(CAIROGOBJECT_DLLNAME)" == "" !if "$(USE_LIBTOOL_NAME)" == "1" -CAIROGOBJECT_DLLNAME = libcairo-gobject-2 +CAIROGOBJECT_DLLNAME = libcairo-gobject-2.dll !else -CAIROGOBJECT_DLLNAME = cairo-gobject-vs$(VSVER) +CAIROGOBJECT_DLLNAME = cairo-gobject-vs$(VSVER).dll +!endif !endif # Please do not change anything after this line @@ -48,7 +50,7 @@ built_install_typelibs = \ GIRepository-$(GLIB_APIVERSION).typelib !if "$(BUILD_INTROSPECTION)" == "TRUE" -all: setgirbuildnev $(built_install_girs) $(built_install_typelibs) $(bundled_girs) $(bundled_typelibs) +all: setgirbuildnev $(built_install_girs) $(built_install_typelibs) $(bundled_girs) $(bundled_typelibs) msg_cairo !include gi-setenv-msvc.mak @@ -132,9 +134,8 @@ GIRepository-$(GLIB_APIVERSION).gir: gi_list GObject-$(GLIB_APIVERSION).gir # Bundled cairo-1.0.gir.in processing cairo-1.0.gir: ..\gir\cairo-1.0.gir.in - @-echo Generating and copying $@ from $*.gir.in... - @-if not exist ..\gir\$*.gir $(PYTHON2) gen-cairo-gir.py --dllname=$(CAIROGOBJECT_DLLNAME).dll - @-copy ..\gir\$*.gir $@ + @-echo Generating $@ from $*.gir.in... + @-$(PYTHON2) gen-cairo-gir.py --dllname=$(CAIROGOBJECT_DLLNAME) # Copy the .gir's bundled with G-I to this folder $(bundled_girs): ..\gir\win32-1.0.gir ..\gir\fontconfig-2.0.gir ..\gir\freetype2-2.0.gir ..\gir\GL-1.0.gir ..\gir\libxml2-2.0.gir @@ -151,6 +152,20 @@ $(bundled_typelibs): cairo-1.0.gir $(bundled_girs) @-echo Compiling the bundled $*.gir that came with the GobjectIntrospection package... @-$(G_IR_COMPILER_CURRENT) --includedir=. --debug --verbose $*.gir -o $@ +msg_cairo: + @-echo. + @-echo ************* Note *********************************** + @-echo The cairo-1.0.gir links to $(CAIROGOBJECT_DLLNAME), + @-echo please ensure that this is the correct DLL where the + @-echo cairo-gobject symbols can be loaded, which needs to + @-echo be in your PATH when running programs or scripts + @-echo using cairo-1.0.typelib. + @-echo. + @-echo If not, please clean the build and redo the build + @-echo specifying the correct DLL by passing in + @-echo CAIROGOBJECT_DLLNAME^=^ when + @-echo invoking this NMake Makefile + install-introspection: setgirbuildnev $(built_install_girs) $(built_install_typelibs) $(bundled_girs) cairo-1.0.gir $(bundled_typelibs) @-mkdir $(G_IR_INCLUDEDIR) @-mkdir $(G_IR_TYPELIBDIR) @@ -168,7 +183,6 @@ install-introspection: !endif clean: - @-del /f/q ..\gir\cairo-$(GI_APIVERSION).gir @-del /f/q *.typelib @-del /f/q *.gir @-del /f/q gi_list -- cgit v1.2.1