summaryrefslogtreecommitdiffstats
path: root/dsextras.py
diff options
context:
space:
mode:
authorNaofumi Yasufuku <naofumi@yasufuku.net>2003-07-02 13:39:44 +0000
committerJames Henstridge <jamesh@src.gnome.org>2003-07-02 13:39:44 +0000
commit993a9b00c23390b8a2fad7302f9d20fc29989494 (patch)
tree61298e6e9ca760009b0cb0fc545a9c41865555a8 /dsextras.py
parent8dd59919825bb1d8586941dd6f48b917d957551a (diff)
downloadpygobject-993a9b00c23390b8a2fad7302f9d20fc29989494.tar.gz
pygobject-993a9b00c23390b8a2fad7302f9d20fc29989494.tar.xz
pygobject-993a9b00c23390b8a2fad7302f9d20fc29989494.zip
Bug #110619:
2003-05-03 Naofumi Yasufuku <naofumi@yasufuku.net> Bug #110619: * dsextras.py (InstallLib.prepare): Fixed self.prefix initialization for win32. (BuildExt.init_extra_compile_args, BuildExt.build_extensions) (BuildExt.build_extension): On win32, add MinGW GCC option for MSVC compatible struct packing (gcc2: -fnative-struct, gcc3: -mms-bitfields). (BuildExt.modify_compiler, BuildExt.build_extensions): On win32, remove '-static' linker option to prevent MinGW ld from trying to link with MSVC import libraries. * setup.py: Changed list_files('codegen/*.py') to list_files(os.path.join('codegen', '*.py')) for win32. Fixed pygtk.h installation directory. 2003-07-02 James Henstridge <james@daa.com.au> * dsextras.py (pkgc_version_check): remove "self.", fixing bug 111002 (pointed out by Seth Nickell).
Diffstat (limited to 'dsextras.py')
-rw-r--r--dsextras.py43
1 files changed, 41 insertions, 2 deletions
diff --git a/dsextras.py b/dsextras.py
index 22faa68..c547ece 100644
--- a/dsextras.py
+++ b/dsextras.py
@@ -76,15 +76,49 @@ def pkgc_version_check(name, longname, req_version):
else:
print "Warning: Too old version of %s" % longname
print " Need %s, but %s is installed" % \
- (self.pkc_version, orig_version)
+ (pkc_version, orig_version)
self.can_build_ok = 0
return 0
class BuildExt(build_ext):
+ def init_extra_compile_args(self):
+ self.extra_compile_args = []
+ if sys.platform == 'win32' and \
+ self.compiler.compiler_type == 'mingw32':
+ # MSVC compatible struct packing is required.
+ # Note gcc2 uses -fnative-struct while gcc3
+ # uses -mms-bitfields. Based on the version
+ # the proper flag is used below.
+ msnative_struct = { '2' : '-fnative-struct',
+ '3' : '-mms-bitfields' }
+ gcc_version = getoutput('gcc -dumpversion')
+ print 'using MinGW GCC version %s with %s option' % \
+ (gcc_version, msnative_struct[gcc_version[0]])
+ self.extra_compile_args.append(msnative_struct[gcc_version[0]])
+
+ def modify_compiler(self):
+ if sys.platform == 'win32' and \
+ self.compiler.compiler_type == 'mingw32':
+ # Remove '-static' linker option to prevent MinGW ld
+ # from trying to link with MSVC import libraries.
+ if self.compiler.linker_so.count('-static'):
+ self.compiler.linker_so.remove('-static')
+
+ def build_extensions(self):
+ # Init self.extra_compile_args
+ self.init_extra_compile_args()
+ # Modify default compiler settings
+ self.modify_compiler()
+ # Invoke base build_extensions()
+ build_ext.build_extensions(self)
+
def build_extension(self, ext):
+ # Add self.extra_compile_args to ext.extra_compile_args
+ ext.extra_compile_args += self.extra_compile_args
# Generate eventual templates before building
if hasattr(ext, 'generate'):
ext.generate()
+ # Invoke base build_extension()
build_ext.build_extension(self, ext)
class InstallLib(install_lib):
@@ -92,7 +126,12 @@ class InstallLib(install_lib):
local_inputs = []
template_options = {}
def prepare(self):
- self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-4])
+ if os.name == "nt":
+ self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-3])
+ else:
+ # default: os.name == "posix"
+ self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-4])
+
self.exec_prefix = os.path.join(self.prefix, 'bin')
self.includedir = os.path.join(self.prefix, 'include')
self.libdir = os.path.join(self.prefix, 'lib')