diff options
-rw-r--r-- | build/win32/pc_base.py | 107 | ||||
-rw-r--r-- | build/win32/vs10/README.txt | 34 | ||||
-rw-r--r-- | build/win32/vs9/README.txt | 30 |
3 files changed, 143 insertions, 28 deletions
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/README.txt b/build/win32/vs10/README.txt index 54afd998..d3ff8b48 100644 --- a/build/win32/vs10/README.txt +++ b/build/win32/vs10/README.txt @@ -59,30 +59,34 @@ http://www.gtk.org/download/win32.php [32-bit] http://www.gtk.org/download/win64.php [64-bit]
*** Note! ***
-Please note that due to numerous possible configurations on Python, PKG_CONFIG_PATH,
-the build of G-I is now a 2-step process: one with the Visual Studio Projects that
-will build the libraries, tools, Python Module and test DLLs (except for the everything
-test), and the other one with NMake Makefiles for building the introspection files.
-Please note that if one needs to change the installation location
-of Python, one needs to change the values of PythonDir (for x86/Win32 builds) and/or
-PythonDirX64 (for x64 builds) in gi-extra-paths.props
+The build of G-I is now done within the project files, although it is still possible to
+do it in two stages by using the NMake Makefiles after building the projects.
+
+As there are numerous possible configurations on Python and PKG_CONFIG_PATH, note that:
+-For both methods PKG_CONFIG_PATH is by default $(PREFIX)\lib\pkgconfig, where $(PREFIX)
+ is by default <parent_dir_of_G-I_srcroot>\vs10\<PlatformName>. If searching from
+ more directories is desired, set the PKG_CONFIG_PATH environment variable before using
+ the NMake Makefile or opening the projects, but note that $(PREFIX)\lib\pkgconfig will
+ precede the set paths.
+-For the Python Path using the project files: check whether the directory settings in
+ gi-version-paths.vsprops under PythonDir (32-bit) or PythonDirX64 (x64) is correct.
+ If the projects have been loaded by Visual Studio, close the projects and re-open them.
+ You may need to delete all the *.suo, *.user and *.ncb files in this directory for
+ the changes to take effect.
+-For the Python Path using the NMake Makefiles: pass in PYTHON=<full_path_to_python> to
+ the NMake Makefile or set it in the environment. The bit-ness of your Python installation
+ must match the configuration that you are building for.
The use of Visual Studio Projects will no longer require the setting of environmental
variables, but the following environmental variables are needed (either by using "set xxx=yyy"
or by nmake -f gi-introspection-msvc.mak xxx=yyy) for building the introspection files (which
should be done after successfully building the Project Files):
-PYTHON: Full path to your Python 2.7.x/3.3.x+ interpretor (python.exe) if it is
- not in your PATH. Please note that only 2.7.x and 3.3.x and later works.
- You need to use an x64/amd64 version of Python for x64 builds, and a Win32/x86
- version of Python for Win32/x86 builds
-PKG_CONFIG_PATH: Location of the .pc (pkg-config) files, especially for the GLib .pc files.
-
Please see $(srcroot)\build\win32\gi-introspection-msvc.mak for more details. Doing
"nmake -f gi-introspection-msvc.mak (options omitted)" will build the various introspection files,
and "nmake -f gi-introspection-msvc.mak (options omitted) install-introspection" will copy the introspection
-files to <root>\vs10\<PlatformName>\share\gir-1.0 (.gir files) and
-<root>\vs10\<PlatformName>\lib\girepository-1.0 (.typelib files)
+files to <root>\vs10\<PlatformName>\share\gir-1.0 (.gir files) and <root>\vs10\<PlatformName>\lib\girepository-1.0
+(.typelib files)
*** End of Note! ***
diff --git a/build/win32/vs9/README.txt b/build/win32/vs9/README.txt index 2911fc17..05cfc912 100644 --- a/build/win32/vs9/README.txt +++ b/build/win32/vs9/README.txt @@ -59,25 +59,29 @@ http://www.gtk.org/download/win32.php [32-bit] http://www.gtk.org/download/win64.php [64-bit]
*** Note! ***
-Please note that due to numerous possible configurations on Python and PKG_CONFIG_PATH,
-the build of G-I is now a 2-step process: one with the Visual Studio Projects that
-will build the libraries, tools, Python Module and test DLLs (except for the everything
-test), and the other one with NMake Makefiles for building the introspection files.
-Please note that if one needs to change the installation location
-of Python, one needs to change the values of PythonDir (for x86/Win32 builds) and/or
-PythonDirX64 (for x64 builds) in gi-extra-paths.vsprops
+The build of G-I is now done within the project files, although it is still possible to
+do it in two stages by using the NMake Makefiles after building the projects.
+
+As there are numerous possible configurations on Python and PKG_CONFIG_PATH, note that:
+-For both methods PKG_CONFIG_PATH is by default $(PREFIX)\lib\pkgconfig, where $(PREFIX)
+ is by default <parent_dir_of_G-I_srcroot>\vs9\<PlatformName>. If searching from
+ more directories is desired, set the PKG_CONFIG_PATH environment variable before using
+ the NMake Makefile or opening the projects, but note that $(PREFIX)\lib\pkgconfig will
+ precede the set paths.
+-For the Python Path using the project files: check whether the directory settings in
+ gi-version-paths.vsprops under PythonDir (32-bit) or PythonDirX64 (x64) is correct.
+ If the projects have been loaded by Visual Studio, close the projects and re-open them.
+ You may need to delete all the *.suo, *.user and *.ncb files in this directory for
+ the changes to take effect.
+-For the Python Path using the NMake Makefiles: pass in PYTHON=<full_path_to_python> to
+ the NMake Makefile or set it in the environment. The bit-ness of your Python installation
+ must match the configuration that you are building for.
The use of Visual Studio Projects will no longer require the setting of environmental
variables, but the following environmental variables are needed (either by using "set xxx=yyy"
or by nmake -f gi-introspection-msvc.mak xxx=yyy) for building the introspection files (which
should be done after successfully building the Project Files):
-PYTHON: Full path to your Python 2.7.x/3.3.x+ interpretor (python.exe) if it is
- not in your PATH. Please note that only 2.7.x and 3.3.x and later works.
- You need to use an x64/amd64 version of Python for x64 builds, and a Win32/x86
- version of Python for Win32/x86 builds
-PKG_CONFIG_PATH: Location of the .pc (pkg-config) files, especially for the GLib .pc files.
-
Please see $(srcroot)\build\win32\gi-introspection-msvc.mak for more details. Doing
"nmake -f gi-introspection-msvc.mak (options omitted)" will build the various introspection files,
and "nmake -f gi-introspection-msvc.mak (options omitted) install-introspection" will copy the introspection
|