detectenv-msvc.mak \
introspection-msvc.mak \
atk-introspection-msvc.mak \
+ atkpc.py \
+ pc_base.py \
+ replace.py \
$(GENERATED_ITEMS)
--- /dev/null
+#!/usr/bin/python
+#
+# Utility script to generate .pc files for ATK
+# for Visual Studio builds, to be used for
+# building introspection files
+
+# Author: Fan, Chun-wei
+# Date: April 20, 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 = {'@GLIB_PACKAGES@': 'gobject-2.0,glib-2.0',
+ '@ATK_API_VERSION@': '1.0'}
+
+ pkg_replace_items.update(base_pc.base_replace_items)
+
+ # Generate atk.pc
+ replace_multi(base_pc.top_srcdir + '/atk.pc.in',
+ base_pc.srcdir + '/atk.pc',
+ pkg_replace_items)
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
--- /dev/null
+#!/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})
--- /dev/null
+#!/usr/bin/python
+#
+# Simple utility script to manipulate
+# certain types of strings in a file
+
+# This can be used in various projects where
+# there is the need to replace strings in files,
+# and is copied from GLib's $(srcroot)/build/win32
+
+# Author: Fan, Chun-wei
+# Date: September 03, 2014
+
+import os
+import sys
+import re
+import string
+import argparse
+
+valid_actions = ['remove-prefix',
+ 'replace-var',
+ '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):
+ replace_item = {instring: outstring}
+ replace_multi(src, dest, replace_item)
+
+def check_required_args(args, params):
+ for param in params:
+ if getattr(args, param, None) is None:
+ raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
+
+def warn_ignored_args(args, params):
+ for param in params:
+ if getattr(args, param, None) is not None:
+ print('%s: warning: --%s argument is ignored' % (__file__, param))
+
+def main(argv):
+
+ parser = argparse.ArgumentParser(description='Process strings in a file.')
+ parser.add_argument('-a',
+ '--action',
+ help='Action to carry out. Can be one of:\n'
+ 'remove-prefix\n'
+ 'replace-var\n'
+ 'replace-str\n'
+ 'remove-str',
+ choices=valid_actions)
+ parser.add_argument('-i', '--input', help='Input file')
+ parser.add_argument('-o', '--output', help='Output file')
+ parser.add_argument('--instring', help='String to replace or remove')
+ parser.add_argument('--var', help='Autotools variable name to replace')
+ parser.add_argument('--outstring',
+ help='New String to replace specified string or variable')
+ parser.add_argument('--removeprefix', help='Prefix of string to remove')
+
+ args = parser.parse_args()
+
+ input_string = ''
+ output_string = ''
+
+ # We must have action, input, output for all operations
+ check_required_args(args, ['action','input','output'])
+
+ # Build the arguments by the operation that is to be done,
+ # to be fed into replace()
+
+ # Get rid of prefixes from a string
+ if args.action == 'remove-prefix':
+ check_required_args(args, ['instring','removeprefix'])
+ warn_ignored_args(args, ['outstring','var'])
+ input_string = args.removeprefix + args.instring
+ output_string = args.instring
+
+ # Replace an m4-style variable (those surrounded by @...@)
+ if args.action == 'replace-var':
+ check_required_args(args, ['var','outstring'])
+ warn_ignored_args(args, ['instring','removeprefix'])
+ input_string = '@' + args.var + '@'
+ output_string = args.outstring
+
+ # Replace a string
+ if args.action == 'replace-str':
+ check_required_args(args, ['instring','outstring'])
+ warn_ignored_args(args, ['var','removeprefix'])
+ input_string = args.instring
+ output_string = args.outstring
+
+ # Remove a string
+ if args.action == 'remove-str':
+ check_required_args(args, ['instring'])
+ warn_ignored_args(args, ['var','outstring','removeprefix'])
+ input_string = args.instring
+ output_string = ''
+
+ replace(args.input, args.output, input_string, output_string)
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
atk.vcxprojin \
atk.vcxproj.filtersin \
atk-install.vcxproj \
+ atk-install.vcxproj.filters \
atk-build-defines.props \
atk-gen-src.props \
atk-install.propsin \
copy $(BinDir)\atk-$(ApiVersion).lib $(CopyDir)\lib
mkdir $(CopyDir)\include\atk-$(ApiVersion)\atk
-
#include "atk.vs10.headers"
+
+if exist ..\atk.pc (mkdir $(CopyDir)\lib\pkgconfig & copy ..\atk.pc $(CopyDir)\lib\pkgconfig)
</AtkDoInstall>
+ <AtkGenPC>if exist $(PythonPath)\python.exe $(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPC>
+ <AtkGenPCX64>if exist $(PythonPathX64)\python.exe $(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPCX64>
+ <AtkPCFiles>..\atk.pc</AtkPCFiles>
</PropertyGroup>
<ItemGroup>
<BuildMacro Include="BinDir">
<BuildMacro Include="AtkDoInstall">
<Value>$(AtkDoInstall)</Value>
</BuildMacro>
+ <BuildMacro Include="AtkPCFiles">
+ <Value>$(AtkPCFiles)</Value>
+ </BuildMacro>
</ItemGroup>
</Project>
<ItemGroup>
<CustomBuild Include="..\..\..\config.h.win32">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(AtkPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(AtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InstalledDlls);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(AtkPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(AtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(InstalledDlls);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(AtkPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(AtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InstalledDlls);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(AtkPCFiles)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(AtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(InstalledDlls);%(Outputs)</Outputs>
</CustomBuild>
+ <CustomBuild Include="..\..\..\atk.pc.in">
+ <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating atk.pc...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(AtkGenPC)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(AtkPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating atk.pc...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(AtkGenPCX64)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(AtkPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating atk.pc...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(AtkGenPC)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(AtkPCFiles);%(Outputs)</Outputs>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating atk.pc...</Message>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(AtkGenPCX64)</Command>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(AtkPCFiles);%(Outputs)</Outputs>
+ </CustomBuild>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="atk.vcxproj">
--- /dev/null
+<?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="..\..\..\atk.pc.in"><Filter>Resource Files</Filter></CustomBuild>
+ </ItemGroup>
+</Project>
<AtkSeparateVSDllSuffix>-1-vs$(VSVer)</AtkSeparateVSDllSuffix>
<AtkDllPrefix>$(AtkSeparateVSDllPrefix)</AtkDllPrefix>
<AtkDllSuffix>$(AtkSeparateVSDllSuffix)</AtkDllSuffix>
+ <PythonPath>c:\python34</PythonPath>
+ <PythonPathX64>$(PythonPath).x64</PythonPathX64>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>atkversionpathsprops</_PropertySheetDisplayName>
<BuildMacro Include="AtkDllSuffix">
<Value>$(AtkDllSuffix)</Value>
</BuildMacro>
+ <BuildMacro Include="PythonPath">
+ <Value>$(PythonPath)</Value>
+ </BuildMacro>
+ <BuildMacro Include="PythonPathX64">
+ <Value>$(PythonPathX64)</Value>
+ </BuildMacro>
</ItemGroup>
</Project>
atk.vcxproj \
atk.vcxproj.filters \
atk-install.vcxproj \
+ atk-install.vcxproj.filters \
atk-build-defines.props \
atk-install.props \
atk-version-paths.props \
atk.vcxproj \
atk.vcxproj.filters \
atk-install.vcxproj \
+ atk-install.vcxproj.filters \
atk-build-defines.props \
atk-install.props \
atk-version-paths.props \
atk.vcxproj \
atk.vcxproj.filters \
atk-install.vcxproj \
+ atk-install.vcxproj.filters \
atk-build-defines.props \
atk-install.props \
atk-version-paths.props \
<References>
</References>
<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="..\..\..\atk.pc.in">
+ <FileConfiguration Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating atk.pc..."
+ CommandLine="$(AtkGenPC)"
+ Outputs="..\atk.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating atk.pc..."
+ CommandLine="$(AtkGenPC)"
+ Outputs="..\atk.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Debug|x64">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating atk.pc..."
+ CommandLine="$(AtkGenPCX64)"
+ Outputs="..\atk.pc"
+ />
+ </FileConfiguration>
+ <FileConfiguration Name="Release|x64">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating atk.pc..."
+ CommandLine="$(AtkGenPCX64)"
+ Outputs="..\atk.pc"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
mkdir $(CopyDir)\include\atk-$(ApiVersion)\atk

#include "atk.headers"
+
+if exist ..\atk.pc (mkdir $(CopyDir)\lib\pkgconfig & copy ..\atk.pc $(CopyDir)\lib\pkgconfig)

"
/>
+ <UserMacro
+ Name="AtkGenPC"
+ Value="if exist $(PythonPath)\python.exe $(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
+ />
+ <UserMacro
+ Name="AtkGenPCX64"
+ Value="if exist $(PythonPathX64)\python.exe $(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
+ />
</VisualStudioPropertySheet>
Name="AtkDllSuffix"
Value="$(AtkSeparateVSDllSuffix)"
/>
+ <UserMacro
+ Name="PythonPath"
+ Value="c:\python27"
+ />
+ <UserMacro
+ Name="PythonPathX64"
+ Value="$(PythonPath).x64"
+ />
</VisualStudioPropertySheet>