summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2016-03-18 18:18:01 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2016-03-18 18:18:01 +0800
commitbc71638fd6bfe27c33cce948d0fbb64292dbc109 (patch)
tree48332c7408a3abe96f5d2b2883958ecd8b36ebcf /build
parentb13dc3f35e0920137984fe9313d21bd50b081ff6 (diff)
downloadgobject-introspection-bc71638fd6bfe27c33cce948d0fbb64292dbc109.tar.gz
MSVC builds: Generate the .pc files
Generate the .pc files as part of the build of the Visual Studio projects, and "install" them to $(CopyDir)\lib\pkgconfig, so that it would make it easier for packages building introspection to find the .pc files for g-i for Visual Studio builds.
Diffstat (limited to 'build')
-rw-r--r--build/win32/Makefile.am2
-rw-r--r--build/win32/gipc.py42
-rw-r--r--build/win32/pc_base.py107
-rw-r--r--build/win32/vs10/Makefile.am1
-rw-r--r--build/win32/vs10/gi-install.propsin18
-rw-r--r--build/win32/vs10/gi-install.vcxproj18
-rw-r--r--build/win32/vs10/gi-install.vcxproj.filters13
-rw-r--r--build/win32/vs9/gi-install.vcproj50
-rw-r--r--build/win32/vs9/gi-install.vspropsin12
9 files changed, 258 insertions, 5 deletions
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 6e4e593f..756df3a1 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -14,6 +14,8 @@ EXTRA_DIST = \
gi_msvc_build_utils.py \
gi-setenv-msvc.mak \
gi-tests-msvc.mak \
+ gipc.py \
introspection-msvc.mak \
+ pc_base.py \
replace.py
diff --git a/build/win32/gipc.py b/build/win32/gipc.py
new file mode 100644
index 00000000..281f07f8
--- /dev/null
+++ b/build/win32/gipc.py
@@ -0,0 +1,42 @@
+#!/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 = {'@bindir@': '${exec_prefix}/bin',
+ '@datarootdir@': '${exec_prefix}/share',
+ '@datadir@': '${datarootdir}',
+ '@EXEEXT@': '.exe',
+ '@FFI_PC_CFLAGS@': '',
+ '@FFI_PC_PACKAGES@': '',
+ '@FFI_PC_LIBS@': '',
+ '${bindir}/g-ir-scanner': 'python ${bindir}/g-ir-scanner'}
+
+ pkg_replace_items.update(base_pc.base_replace_items)
+
+ # Generate gobject-introspection-1.0.pc
+ replace_multi(base_pc.top_srcdir + '/gobject-introspection-1.0.pc.in',
+ base_pc.srcdir + '/gobject-introspection-1.0.pc',
+ pkg_replace_items)
+
+ # Generate gobject-introspection-no-export-1.0.pc
+ replace_multi(base_pc.top_srcdir + '/gobject-introspection-no-export-1.0.pc.in',
+ base_pc.srcdir + '/gobject-introspection-no-export-1.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 00000000..80f98840
--- /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/vs10/Makefile.am b/build/win32/vs10/Makefile.am
index 30ba26bd..95f6e137 100644
--- a/build/win32/vs10/Makefile.am
+++ b/build/win32/vs10/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_DIST = \
_giscanner.vcxproj \
_giscanner.vcxproj.filters \
gi-install.vcxproj \
+ gi-install.vcxproj.filters \
gi-introspect.vcxproj \
README.txt \
$(GENERATED_ITEMS)
diff --git a/build/win32/vs10/gi-install.propsin b/build/win32/vs10/gi-install.propsin
index c463a6c4..1b112988 100644
--- a/build/win32/vs10/gi-install.propsin
+++ b/build/win32/vs10/gi-install.propsin
@@ -69,7 +69,14 @@ copy ..\GModule-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)
copy ..\GObject-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)
copy ..\libxml2-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)
copy ..\win32-1.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)
-</GIDoInstall>
+
+mkdir $(CopyDir)\lib\pkgconfig
+copy ..\gobject-introspection-1.0.pc $(CopyDir)\lib\pkgconfig
+copy ..\gobject-introspection-no-export-1.0.pc $(CopyDir)\lib\pkgconfig
+ </GIDoInstall>
+ <GIPCFiles>..\gobject-introspection-1.0.pc;..\gobject-introspection-no-export-1.0.pc</GIPCFiles>
+ <GIGenPC>$(PythonDir)\python.exe ..\gipc.py --version=$(GIVersion) --prefix=$(CopyDir)</GIGenPC>
+ <GIGenPCX64>$(PythonDirX64)\python.exe ..\gipc.py --version=$(GIVersion) --prefix=$(CopyDir)</GIGenPCX64>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>giinstallprops</_PropertySheetDisplayName>
@@ -81,5 +88,14 @@ copy ..\win32-1.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)
<BuildMacro Include="GIDoInstall">
<Value>$(GIDoInstall)</Value>
</BuildMacro>
+ <BuildMacro Include="GIPCFiles">
+ <Value>$(GIPCFiles)</Value>
+ </BuildMacro>
+ <BuildMacro Include="GIGenPC">
+ <Value>$(GIGenPC)</Value>
+ </BuildMacro>
+ <BuildMacro Include="GIGenPCX64">
+ <Value>$(GIGenPCX64)</Value>
+ </BuildMacro>
</ItemGroup>
</Project>
diff --git a/build/win32/vs10/gi-install.vcxproj b/build/win32/vs10/gi-install.vcxproj
index 04f214fd..b9ac72cc 100644
--- a/build/win32/vs10/gi-install.vcxproj
+++ b/build/win32/vs10/gi-install.vcxproj
@@ -87,18 +87,36 @@
<ItemGroup>
<CustomBuild Include="..\..\..\config.h.win32">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GIPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GIDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">some_random_file;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GIPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GIDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">some_random_file;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GIPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GIDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">some_random_file;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GIPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GIDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">some_random_file;%(Outputs)</Outputs>
</CustomBuild>
+ <CustomBuild Include="..\gipc.py">
+ <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating .pc files...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GIGenPC)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GIPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating .pc files...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GIGenPCX64)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GIPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating .pc files...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GIGenPC)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GIPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating .pc files...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GIGenPCX64)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GIPCFiles);%(Outputs)</Outputs>
+ </CustomBuild>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="g-ir-compiler.vcxproj">
diff --git a/build/win32/vs10/gi-install.vcxproj.filters b/build/win32/vs10/gi-install.vcxproj.filters
new file mode 100644
index 00000000..6725a63f
--- /dev/null
+++ b/build/win32/vs10/gi-install.vcxproj.filters
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\..\config.h.win32"><Filter>Resource Files</Filter></CustomBuild>
+ <CustomBuild Include="..\gipc.py"><Filter>Resource Files</Filter></CustomBuild>
+ </ItemGroup>
+</Project>
diff --git a/build/win32/vs9/gi-install.vcproj b/build/win32/vs9/gi-install.vcproj
index 58ad177b..212bf54c 100644
--- a/build/win32/vs9/gi-install.vcproj
+++ b/build/win32/vs9/gi-install.vcproj
@@ -28,7 +28,7 @@
DeleteExtensionsOnClean=""
>
<Tool
- Name="VCPreBuildEventTool"
+ Name="VCPostBuildEventTool"
CommandLine="$(GIDoInstall)"
/>
</Configuration>
@@ -41,7 +41,7 @@
DeleteExtensionsOnClean=""
>
<Tool
- Name="VCPreBuildEventTool"
+ Name="VCPostBuildEventTool"
CommandLine="$(GIDoInstall)"
/>
</Configuration>
@@ -55,7 +55,7 @@
DeleteExtensionsOnClean=""
>
<Tool
- Name="VCPreBuildEventTool"
+ Name="VCPostBuildEventTool"
CommandLine="$(GIDoInstall)"
/>
</Configuration>
@@ -69,9 +69,51 @@
DeleteExtensionsOnClean=""
>
<Tool
- Name="VCPreBuildEventTool"
+ Name="VCPostBuildEventTool"
CommandLine="$(GIDoInstall)"
/>
</Configuration>
</Configurations>
+ <Files>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File RelativePath="..\gipc.py">
+ <FileConfiguration Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating .pc files..."
+ CommandLine="$(GIGenPC)"
+ Outputs="..\gobject-introspection-1.0.pc;..\gobject-introspection-no-export-1.0.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating .pc files..."
+ CommandLine="$(GIGenPC)"
+ Outputs="..\gobject-introspection-1.0.pc;..\gobject-introspection-no-export-1.0.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Debug|x64">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating .pc files..."
+ CommandLine="$(GIGenPCX64)"
+ Outputs="..\gobject-introspection-1.0.pc;..\gobject-introspection-no-export-1.0.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Release|x64">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating .pc files..."
+ CommandLine="$(GIGenPCX64)"
+ Outputs="..\gobject-introspection-1.0.pc;..\gobject-introspection-no-export-1.0.pc"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
</VisualStudioProject>
diff --git a/build/win32/vs9/gi-install.vspropsin b/build/win32/vs9/gi-install.vspropsin
index 0f6f28df..b67b20ae 100644
--- a/build/win32/vs9/gi-install.vspropsin
+++ b/build/win32/vs9/gi-install.vspropsin
@@ -71,6 +71,18 @@ copy ..\GModule-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)&#x0D;&#x0A
copy ..\GObject-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)&#x0D;&#x0A;
copy ..\libxml2-2.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)&#x0D;&#x0A;
copy ..\win32-1.0.typelib $(CopyDir)\lib\girepository-$(ApiVersion)&#x0D;&#x0A;
+
+mkdir $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
+copy ..\gobject-introspection-1.0.pc $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
+copy ..\gobject-introspection-no-export-1.0.pc $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
"
/>
+ <UserMacro
+ Name="GIGenPc"
+ Value="$(PythonDir)\python ..\gipc.py --version=$(GIVersion) --prefix=$(CopyDir)"
+ />
+ <UserMacro
+ Name="GIGenPcX64"
+ Value="$(PythonDirX64)\python ..\gipc.py --version=$(GIVersion) --prefix=$(CopyDir)"
+ />
</VisualStudioPropertySheet>