aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorCosimo Lupo <cosimo.lupo@daltonmaag.com>2015-08-10 18:04:30 +0100
committerCosimo Lupo <cosimo.lupo@daltonmaag.com>2015-08-11 11:12:52 +0100
commit54baf43c700138518c678cee87c439d3a9335aa8 (patch)
tree9e6f6883d8abb71f241e9c8069b6daca348249ee /setup.py
parentc3540e2b7aff0f4632e1ea82cd2cfd55b1b11ff4 (diff)
downloadbrotli-54baf43c700138518c678cee87c439d3a9335aa8.zip
brotli-54baf43c700138518c678cee87c439d3a9335aa8.tar.gz
brotli-54baf43c700138518c678cee87c439d3a9335aa8.tar.bz2
[setup.py] support MINGW32 compiler: fix clashing 'hypot' definition; statically link libgcc and libstdc++
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index c78553e..8181205 100644
--- a/setup.py
+++ b/setup.py
@@ -74,6 +74,11 @@ class BuildExt(build_ext):
macros = ext.define_macros[:]
if platform.system() == "Darwin":
macros.append(("OS_MACOSX", "1"))
+ elif self.compiler.compiler_type == "mingw32":
+ # On Windows Python 2.7, pyconfig.h defines "hypot" as "_hypot",
+ # This clashes with GCC's cmath, and causes compilation errors when
+ # building under MinGW: http://bugs.python.org/issue11566
+ macros.append(("_hypot", "hypot"))
for undef in ext.undef_macros:
macros.append((undef,))
@@ -90,6 +95,10 @@ class BuildExt(build_ext):
if ext.extra_objects:
objects.extend(ext.extra_objects)
extra_args = ext.extra_link_args or []
+ # when using GCC on Windows, we statically link libgcc and libstdc++,
+ # so that we don't need to package extra DLLs
+ if self.compiler.compiler_type == "mingw32":
+ extra_args.extend(['-static-libgcc', '-static-libstdc++'])
ext_path = self.get_ext_fullpath(ext.name)
# Detect target language, if not provided