diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 70a8534d8..5c2dac8ed 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -7,6 +7,8 @@ SUBDIRS = \
vs14
EXTRA_DIST = \
+ glibpc.py \
make.msc \
module.defs \
+ pc_base.py \
replace.py
diff --git a/build/win32/glibpc.py b/build/win32/glibpc.py
new file mode 100644
index 000000000..973db1a3f
--- /dev/null
+++ b/build/win32/glibpc.py
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+#
+# Utility script to generate .pc files for GLib
+# for Visual Studio builds, to be used for
+# building introspection files
+
+# Author: Fan, Chun-wei
+# Date: March 10, 2016
+
+import os
+import sys
+
+from replace import replace_multi
+from pc_base import BasePCItems
+
+def main(argv):
+ base_pc = BasePCItems()
+
+ base_pc.setup(argv)
+ pkg_replace_items = {'@G_THREAD_CFLAGS@': '',
+ '@G_THREAD_LIBS@': '',
+ '@CARBON_LIBS@': '',
+ '@COCOA_LIBS@': ''}
+
+ glib_replace_items = {'glib-genmarshal': '${exec_prefix}/bin/glib-genmarshal',
+ 'glib-mkenums': 'perl ${exec_prefix}/bin/glib-mkenums',
+ 'gobject-query': '${exec_prefix}/bin/gobject-query',
+ '@PCRE_REQUIRES@': '',
+ '@INTLLIBS@': '-lintl',
+ '@G_LIBS_EXTRA@': '',
+ '@PCRE_LIBS@': '',
+ '@ICONV_LIBS@': '-liconv',
+ '@GLIB_EXTRA_CFLAGS@': ''}
+
+ pkg_replace_items.update(base_pc.base_replace_items)
+
+ glib_replace_items.update(pkg_replace_items)
+
+ # Generate glib-2.0.pc
+ replace_multi(base_pc.top_srcdir + '/glib-2.0.pc.in',
+ base_pc.srcdir + '/glib-2.0.pc',
+ glib_replace_items)
+
+ # Generate gthread-2.0.pc
+ replace_multi(base_pc.top_srcdir + '/gthread-2.0.pc.in',
+ base_pc.srcdir + '/gthread-2.0.pc',
+ pkg_replace_items)
+
+ # Generate gmodule*-2.0.pc
+ gmodule_replace_items = {'@G_MODULE_SUPPORTED@': 'yes',
+ '@G_MODULE_LDFLAGS@': '',
+ '@G_MODULE_LIBS@': ''}
+ gmodule_replace_items.update(pkg_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gmodule-2.0.pc.in',
+ base_pc.srcdir + '/gmodule-2.0.pc',
+ gmodule_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gmodule-export-2.0.pc.in',
+ base_pc.srcdir + '/gmodule-export-2.0.pc',
+ gmodule_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gmodule-no-export-2.0.pc.in',
+ base_pc.srcdir + '/gmodule-no-export-2.0.pc',
+ gmodule_replace_items)
+
+ # Generate gobject-2.0.pc
+ gobject_replace_items = {'@LIBFFI_LIBS@': ''}
+ gobject_replace_items.update(pkg_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gobject-2.0.pc.in',
+ base_pc.srcdir + '/gobject-2.0.pc',
+ gobject_replace_items)
+
+ # Generate gio*-2.0.pc
+ gio_replace_items = {'@GIO_MODULE_DIR@': '${exec_prefix}/bin/gio/modules',
+ '@ZLIB_LIBS@': '-lzlib1',
+ '@NETWORK_LIBS@': '-lws2_32',
+ '@SELINUX_LIBS@': '',
+ 'glib-compile-schemas': '${exec_prefix}/bin/glib-compile-schemas',
+ 'glib-compile-resources': '${exec_prefix}/bin/glib-compile-resources',
+ 'gdbus-codegen': 'python ${exec_prefix}/bin/gdbus-codegen'}
+ gio_replace_items.update(pkg_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gio-2.0.pc.in',
+ base_pc.srcdir + '/gio-2.0.pc',
+ gio_replace_items)
+ replace_multi(base_pc.top_srcdir + '/gio-windows-2.0.pc.in',
+ base_pc.srcdir + '/gio-windows-2.0.pc',
+ pkg_replace_items)
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/build/win32/pc_base.py b/build/win32/pc_base.py
new file mode 100644
index 000000000..80f988407
--- /dev/null
+++ b/build/win32/pc_base.py
@@ -0,0 +1,107 @@
+#!/usr/bin/python
+#
+# Simple utility script to generate the basic info
+# needed in a .pc (pkg-config) file, used especially
+# for introspection purposes
+
+# This can be used in various projects where
+# there is the need to generate .pc files,
+# and is copied from GLib's $(srcroot)/build/win32
+
+# Author: Fan, Chun-wei
+# Date: March 10, 2016
+
+import os
+import sys
+import argparse
+
+class BasePCItems:
+ def __init__(self):
+ self.base_replace_items = {}
+ self.exec_prefix = ''
+ self.includedir = ''
+ self.libdir = ''
+ self.prefix = ''
+ self.srcdir = os.path.dirname(__file__)
+ self.top_srcdir = self.srcdir + '\\..\\..'
+ self.version = ''
+
+ def setup(self, argv):
+ parser = argparse.ArgumentParser(description='Setup basic .pc file info')
+ parser.add_argument('--prefix', help='prefix of the installed library',
+ required=True)
+ parser.add_argument('--exec-prefix',
+ help='prefix of the installed programs, \
+ if different from the prefix')
+ parser.add_argument('--includedir',
+ help='includedir of the installed library, \
+ if different from ${prefix}/include')
+ parser.add_argument('--libdir',
+ help='libdir of the installed library, \
+ if different from ${prefix}/lib')
+ parser.add_argument('--version', help='Version of the package',
+ required=True)
+ args = parser.parse_args()
+
+ self.version = args.version
+
+ # check whether the prefix and exec_prefix are valid
+ if not os.path.exists(args.prefix):
+ raise SystemExit('Specified prefix \'%s\' is invalid' % args.prefix)
+
+ # check and setup the exec_prefix
+ if getattr(args, 'exec_prefix', None) is None:
+ input_exec_prefix = args.prefix
+ else:
+ input_exec_prefix = args.exec_prefix
+ if not os.path.exists(input_exec_prefix):
+ raise SystemExit('Specified exec-prefix \'%s\' is invalid' %
+ input_exec_prefix)
+
+
+ # check and setup the includedir
+ if getattr(args, 'includedir', None) is None:
+ self.includedir = '${prefix}/include'
+ else:
+ if args.includedir.startswith('${prefix}'):
+ includedir_use_shorthand = True
+ input_includedir = args.prefix + args.includedir[len('${prefix}'):]
+ else:
+ includedir_use_shorthand = False
+ input_includedir = args.includedir
+ if not os.path.exists(input_includedir):
+ raise SystemExit('Specified includedir \'%s\' is invalid' %
+ args.includedir)
+ if includedir_use_shorthand is True:
+ self.includedir = args.includedir.replace('\\','/')
+ else:
+ self.includedir = os.path.abspath(input_includedir).replace('\\','/')
+
+ # check and setup the libdir
+ if getattr(args, 'libdir', None) is None:
+ self.libdir = '${prefix}/lib'
+ else:
+ if args.libdir.startswith('${prefix}'):
+ libdir_use_shorthand = True
+ input_libdir = args.prefix + args.libdir[len('${prefix}'):]
+ else:
+ libdir_use_shorthand = False
+ input_libdir = args.libdir
+ if not os.path.exists(input_libdir):
+ raise SystemExit('Specified libdir \'%s\' is invalid' %
+ args.libdir)
+ if libdir_use_shorthand is True:
+ self.libdir = args.libdir.replace('\\','/')
+ else:
+ self.libdir = os.path.abspath(input_libdir).replace('\\','/')
+
+ # use absolute paths for prefix and exec_prefix
+ self.prefix = os.path.abspath(args.prefix).replace('\\','/')
+ self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
+
+ # setup dictionary for replacing items in *.pc.in
+ self.base_replace_items.update({'@VERSION@': self.version})
+ self.base_replace_items.update({'@prefix@': self.prefix})
+ self.base_replace_items.update({'@exec_prefix@': self.exec_prefix})
+ self.base_replace_items.update({'@libdir@': self.libdir})
+ self.base_replace_items.update({'@includedir@': self.includedir})
diff --git a/build/win32/replace.py b/build/win32/replace.py
index 69ef417a2..7c64b7343 100644
--- a/build/win32/replace.py
+++ b/build/win32/replace.py
@@ -21,6 +21,16 @@ valid_actions = ['remove-prefix',
'replace-str',
'remove-str']
+def replace_multi(src, dest, replace_items):
+ with open(src, 'r') as s:
+ with open(dest, 'w') as d:
+ for line in s:
+ replace_dict = dict((re.escape(key), value) \
+ for key, value in replace_items.items())
+ replace_pattern = re.compile("|".join(replace_dict.keys()))
+ d.write(replace_pattern.sub(lambda m: \
+ replace_dict[re.escape(m.group(0))], line))
+
def replace(src, dest, instring, outstring):
with open(src, 'r') as s:
with open(dest, 'w') as d:
diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am
index 75b948391..096c9d00e 100644
--- a/build/win32/vs10/Makefile.am
+++ b/build/win32/vs10/Makefile.am
@@ -46,6 +46,7 @@ EXTRA_DIST = \
gdbus.vcxproj \
gdbus.vcxproj.filters \
glib-install.vcxproj \
+ glib-install.vcxproj.filters \
glib-build-defines.props \
glib-install.propsin \
glib-version-paths.props.in \
diff --git a/build/win32/vs10/glib-install.propsin b/build/win32/vs10/glib-install.propsin
index 484675cdd..81f5e6397 100644
--- a/build/win32/vs10/glib-install.propsin
+++ b/build/win32/vs10/glib-install.propsin
@@ -69,12 +69,24 @@ copy $(BinDir)\gmodule-$(ApiVersion).lib $(CopyDir)\lib
copy $(BinDir)\gobject-$(ApiVersion).lib $(CopyDir)\lib
copy $(BinDir)\gio-$(ApiVersion).lib $(CopyDir)\lib
+mkdir $(CopyDir)\lib\pkgconfig
+copy ..\gio-windows-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gio-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gobject-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-no-export-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-export-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gthread-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\glib-2.0.pc $(CopyDir)\lib\pkgconfig
+
mkdir $(CopyDir)\share\glib-$(ApiVersion)\schemas
copy ..\..\..\gio\gschema.dtd $(CopyDir)\share\glib-$(ApiVersion)\schemas
mkdir $(CopyDir)\share\glib-$(ApiVersion)\codegen
copy ..\..\..\gio\gdbus-2.0\codegen\*.py $(CopyDir)\share\glib-$(ApiVersion)\codegen
+ ..\gio-windows-2.0.pc;..\gio-2.0.pc;..\gobject-2.0.pc;..\gmodule-no-export-2.0.pc;..\gmodule-export-2.0.pc;..\gmodule-2.0.pc;..\gthread-2.0.pc;..\glib-2.0.pc
+ if exist $(PythonPath)\python.exe $(PythonPath)\python.exe ..\glibpc.py --prefix=$(CopyDir) --version=$(GlibVersion)
<_PropertySheetDisplayName>glibinstallprops
@@ -98,5 +110,11 @@ copy ..\..\..\gio\gdbus-2.0\codegen\*.py $(CopyDir)\share\glib-$(ApiVersion)\cod
$(GlibDoInstall)
+
+ $(GlibPCFiles)
+
+
+ $(GlibGenPC)
+
diff --git a/build/win32/vs10/glib-install.vcxproj b/build/win32/vs10/glib-install.vcxproj
index 2eb64e067..a298a5d01 100644
--- a/build/win32/vs10/glib-install.vcxproj
+++ b/build/win32/vs10/glib-install.vcxproj
@@ -85,17 +85,35 @@
+
+ Generating .pc files...
+ $(GlibGenPC)
+ $(GlibPCFiles);%(Outputs)
+ Generating .pc files...
+ $(GlibGenPC)
+ $(GlibPCFiles);%(Outputs)
+ Generating .pc files...
+ $(GlibGenPC)
+ $(GlibPCFiles);%(Outputs)
+ Generating .pc files...
+ $(GlibGenPC)
+ $(GlibPCFiles);%(Outputs)
+
Installing Build Results...
+ $(GlibPCFiles)
$(GlibDoInstall)
$(InstalledDlls);$(InstalledBins);$(InstalledWin32Bins);%(Outputs)
Installing Build Results...
+ $(GlibPCFiles)
$(GlibDoInstall)
$(InstalledDlls);$(InstalledBins);$(InstalledX64Bins);%(Outputs)
Installing Build Results...
+ $(GlibPCFiles)
$(GlibDoInstall)
$(InstalledDlls);$(InstalledBins);$(InstalledWin32Bins);%(Outputs)
Installing Build Results...
+ $(GlibPCFiles)
$(GlibDoInstall)
$(InstalledDlls);$(InstalledBins);$(InstalledX64Bins);%(Outputs)
diff --git a/build/win32/vs10/glib-install.vcxproj.filters b/build/win32/vs10/glib-install.vcxproj.filters
new file mode 100644
index 000000000..18ffe5f13
--- /dev/null
+++ b/build/win32/vs10/glib-install.vcxproj.filters
@@ -0,0 +1,13 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
+
+
+
+ Resource Files
+ Resource Files
+
+
diff --git a/build/win32/vs11/Makefile.am b/build/win32/vs11/Makefile.am
index f449c68a5..7900d7e41 100644
--- a/build/win32/vs11/Makefile.am
+++ b/build/win32/vs11/Makefile.am
@@ -30,6 +30,7 @@ EXTRA_DIST = \
gdbus.vcxproj \
gdbus.vcxproj.filters \
glib-install.vcxproj \
+ glib-install.vcxproj.filters \
glib-build-defines.props \
glib-install.props \
glib-version-paths.props \
diff --git a/build/win32/vs12/Makefile.am b/build/win32/vs12/Makefile.am
index 666caf799..b4a9f3562 100644
--- a/build/win32/vs12/Makefile.am
+++ b/build/win32/vs12/Makefile.am
@@ -30,6 +30,7 @@ EXTRA_DIST = \
gdbus.vcxproj \
gdbus.vcxproj.filters \
glib-install.vcxproj \
+ glib-install.vcxproj.filters \
glib-build-defines.props \
glib-install.props \
glib-version-paths.props \
diff --git a/build/win32/vs14/Makefile.am b/build/win32/vs14/Makefile.am
index 1c1d06d21..56f3110ba 100644
--- a/build/win32/vs14/Makefile.am
+++ b/build/win32/vs14/Makefile.am
@@ -30,6 +30,7 @@ EXTRA_DIST = \
gdbus.vcxproj \
gdbus.vcxproj.filters \
glib-install.vcxproj \
+ glib-install.vcxproj.filters \
glib-build-defines.props \
glib-install.props \
glib-version-paths.props \
diff --git a/build/win32/vs9/glib-install.vcproj b/build/win32/vs9/glib-install.vcproj
index e3a4ef6a1..7324f0f72 100644
--- a/build/win32/vs9/glib-install.vcproj
+++ b/build/win32/vs9/glib-install.vcproj
@@ -28,7 +28,7 @@
DeleteExtensionsOnClean=""
>
@@ -41,7 +41,7 @@
DeleteExtensionsOnClean=""
>
@@ -55,7 +55,7 @@
DeleteExtensionsOnClean=""
>
@@ -69,9 +69,51 @@
DeleteExtensionsOnClean=""
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/win32/vs9/glib-install.vspropsin b/build/win32/vs9/glib-install.vspropsin
index fb3f24088..24c96485b 100644
--- a/build/win32/vs9/glib-install.vspropsin
+++ b/build/win32/vs9/glib-install.vspropsin
@@ -66,6 +66,16 @@ copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gmodule-$(ApiVersion
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gobject-$(ApiVersion).lib $(CopyDir)\lib
copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\gio-$(ApiVersion).lib $(CopyDir)\lib
+mkdir $(CopyDir)\lib\pkgconfig
+copy ..\gio-windows-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gio-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gobject-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-no-export-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-export-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gmodule-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gthread-2.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\glib-2.0.pc $(CopyDir)\lib\pkgconfig
+
mkdir $(CopyDir)\share\glib-$(ApiVersion)\schemas
copy ..\..\..\gio\gschema.dtd $(CopyDir)\share\glib-$(ApiVersion)\schemas
@@ -73,4 +83,8 @@ mkdir $(CopyDir)\share\glib-$(ApiVersion)\codegen
copy ..\..\..\gio\gdbus-2.0\codegen\*.py $(CopyDir)\share\glib-$(ApiVersion)\codegen
"
/>
+