158 lines
6.3 KiB
Diff
158 lines
6.3 KiB
Diff
--- a/py2exe_setuptools.py
|
|
+++ b/py2exe_setuptools.py
|
|
@@ -109,6 +109,13 @@
|
|
else:
|
|
ext_path += ".dll"
|
|
|
|
+ if 'GCC' in sys.version:
|
|
+ if ext.name == "py2exe.run_ctypes_dll":
|
|
+ ext.export_symbols = [s.replace(",", " ") for s in ext.export_symbols]
|
|
+ ext.extra_link_args.append("-Wl,--enable-stdcall-fixup")
|
|
+ else:
|
|
+ ext.export_symbols = None
|
|
+
|
|
depends = sources + ext.depends
|
|
if not (self.force or newer_group(depends, ext_path, 'newer')):
|
|
log.debug("skipping '%s' extension (up-to-date)", ext.name)
|
|
@@ -130,7 +137,7 @@
|
|
# The environment variable should take precedence, and
|
|
# any sensible compiler will give precedence to later
|
|
# command line args. Hence we combine them in order:
|
|
- extra_args = ext.extra_compile_args or []
|
|
+ extra_compile_args = ext.extra_compile_args or []
|
|
|
|
macros = ext.define_macros[:]
|
|
for undef in ext.undef_macros:
|
|
@@ -141,7 +148,7 @@
|
|
macros=macros,
|
|
include_dirs=ext.include_dirs,
|
|
debug=self.debug,
|
|
- extra_postargs=extra_args,
|
|
+ extra_postargs=extra_compile_args,
|
|
depends=ext.depends)
|
|
|
|
# XXX -- this is a Vile HACK!
|
|
@@ -160,7 +167,7 @@
|
|
# that go into the mix.
|
|
if ext.extra_objects:
|
|
objects.extend(ext.extra_objects)
|
|
- extra_args = ext.extra_link_args or []
|
|
+ extra_link_args = ext.extra_link_args or []
|
|
|
|
# Detect target language, if not provided
|
|
## language = ext.language or self.compiler.detect_language(sources)
|
|
@@ -187,7 +194,7 @@
|
|
library_dirs=ext.library_dirs,
|
|
runtime_library_dirs=ext.runtime_library_dirs,
|
|
export_symbols=ext.export_symbols,
|
|
- extra_postargs=extra_args,
|
|
+ extra_postargs=extra_link_args,
|
|
debug=self.debug)
|
|
|
|
|
|
@@ -204,7 +211,7 @@
|
|
fnm = os.path.join(*ext_path)
|
|
if ext_path[-1] == "resources":
|
|
return fnm
|
|
- return '%s-py%s.%s-%s' % (fnm, sys.version_info[0], sys.version_info[1], get_platform())
|
|
+ return '%s-py%s%s-%s' % (fnm, sys.version_info[0], sys.version_info[1], get_platform())
|
|
|
|
|
|
def InstallSubCommands():
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -21,8 +21,8 @@
|
|
|
|
############################################################################
|
|
|
|
-python_dll_name = '\"python%d%d.dll\"' % sys.version_info[:2]
|
|
-python_dll_name_debug = '\"python%d%d_d.dll\"' % sys.version_info[:2]
|
|
+python_dll_name = '\"libpython%d.%d.dll\"' % sys.version_info[:2]
|
|
+python_dll_name_debug = '\"libpython%d.%d_d.dll\"' % sys.version_info[:2]
|
|
|
|
def _is_debug_build():
|
|
for ext in machinery.all_suffixes():
|
|
@@ -45,16 +45,11 @@
|
|
extra_compile_args = []
|
|
extra_link_args = []
|
|
|
|
-extra_compile_args.append("-IC:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include")
|
|
-extra_compile_args.append("-IC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include")
|
|
-extra_compile_args.append("-IC:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt")
|
|
-
|
|
-if 0:
|
|
- # enable this to debug a release build
|
|
- extra_compile_args.append("/Od")
|
|
- extra_compile_args.append("/Z7")
|
|
- extra_link_args.append("/DEBUG")
|
|
- macros.append(("VERBOSE", "1"))
|
|
+platname = []
|
|
+if '64 bit' in sys.version:
|
|
+ platname = ["-m64"]
|
|
+else:
|
|
+ platname = ["-m32"]
|
|
|
|
run_ctypes_dll = Interpreter("py2exe.run_ctypes_dll",
|
|
["source/run_ctypes_dll.c",
|
|
@@ -77,7 +71,7 @@
|
|
target_desc = "shared_library",
|
|
define_macros=macros,
|
|
extra_compile_args=extra_compile_args,
|
|
- extra_link_args=extra_link_args + ["/DLL"],
|
|
+ extra_link_args=extra_link_args + platname + ["-mwindows"],
|
|
)
|
|
|
|
run = Interpreter("py2exe.run",
|
|
@@ -95,7 +89,7 @@
|
|
libraries=["user32", "shell32"],
|
|
define_macros=macros,
|
|
extra_compile_args=extra_compile_args,
|
|
- extra_link_args=extra_link_args,
|
|
+ extra_link_args=extra_link_args + platname + ["-mconsole", "-municode"],
|
|
)
|
|
|
|
run_w = Interpreter("py2exe.run_w",
|
|
@@ -113,7 +107,7 @@
|
|
libraries=["user32", "shell32"],
|
|
define_macros=macros,
|
|
extra_compile_args=extra_compile_args,
|
|
- extra_link_args=extra_link_args,
|
|
+ extra_link_args=extra_link_args + platname + ["-mwindows"],
|
|
)
|
|
|
|
# The py2exe.resources name is special handled in BuildInterpreters;
|
|
@@ -129,7 +123,7 @@
|
|
["source/dll.c",
|
|
"source/icon.rc"],
|
|
target_desc = "shared_library",
|
|
- extra_link_args=["/DLL"],
|
|
+ extra_link_args=platname,
|
|
)
|
|
|
|
interpreters = [run, run_w, resource_dll,
|
|
--- a/setup_zipextimporter.py
|
|
+++ b/setup_zipextimporter.py
|
|
@@ -23,8 +23,8 @@
|
|
|
|
############################################################################
|
|
|
|
-python_dll_name = '\"python%d%d.dll\"' % sys.version_info[:2]
|
|
-python_dll_name_debug = '\"python%d%d_d.dll\"' % sys.version_info[:2]
|
|
+python_dll_name = '\"libpython%d.%d.dll\"' % sys.version_info[:2]
|
|
+python_dll_name_debug = '\"libpython%d.%d_d.dll\"' % sys.version_info[:2]
|
|
|
|
def _is_debug_build():
|
|
for ext in machinery.all_suffixes():
|
|
@@ -46,11 +46,6 @@
|
|
extra_compile_args = []
|
|
extra_link_args = []
|
|
|
|
-extra_compile_args.append("-IC:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include")
|
|
-extra_compile_args.append("-IC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include")
|
|
-extra_compile_args.append("-IC:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt")
|
|
-extra_compile_args.append("/DSTANDALONE")
|
|
-
|
|
if 0:
|
|
# enable this to debug a release build
|
|
extra_compile_args.append("/Od")
|