|
@@ -0,0 +1,88 @@ |
|
|
|
|
|
diff --git a/setup.py b/setup.py |
|
|
|
|
|
index af6689f..d7c84a1 100755 |
|
|
|
|
|
--- a/setup.py |
|
|
|
|
|
+++ b/setup.py |
|
|
|
|
|
@@ -8,6 +8,7 @@ import distutils.command.install_data |
|
|
|
|
|
import distutils.sysconfig |
|
|
|
|
|
import os |
|
|
|
|
|
import sys |
|
|
|
|
|
+from subprocess import getoutput |
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info < (3, 5): |
|
|
|
|
|
sys.exit("Sorry, Python < 3.5 is not supported. Use cx_Freeze 5 for " |
|
|
|
|
|
@@ -22,11 +23,6 @@ except ImportError: |
|
|
|
|
|
class build_ext(distutils.command.build_ext.build_ext): |
|
|
|
|
|
|
|
|
|
|
|
def build_extension(self, ext): |
|
|
|
|
|
- if "bases" not in ext.name: |
|
|
|
|
|
- distutils.command.build_ext.build_ext.build_extension(self, ext) |
|
|
|
|
|
- return |
|
|
|
|
|
- if sys.platform == "win32" and self.compiler.compiler_type == "mingw32": |
|
|
|
|
|
- ext.sources.append("source/bases/manifest.rc") |
|
|
|
|
|
os.environ["LD_RUN_PATH"] = "${ORIGIN}/../lib:${ORIGIN}/lib" |
|
|
|
|
|
objects = self.compiler.compile(ext.sources, |
|
|
|
|
|
output_dir = self.build_temp, |
|
|
|
|
|
@@ -41,34 +37,15 @@ class build_ext(distutils.command.build_ext.build_ext): |
|
|
|
|
|
libraryDirs = ext.library_dirs or [] |
|
|
|
|
|
libraries = self.get_libraries(ext) |
|
|
|
|
|
extraArgs = ext.extra_link_args or [] |
|
|
|
|
|
- if sys.platform == "win32": |
|
|
|
|
|
- compiler_type = self.compiler.compiler_type |
|
|
|
|
|
- if compiler_type == "msvc": |
|
|
|
|
|
- extraArgs.append("/MANIFEST") |
|
|
|
|
|
- elif compiler_type == "mingw32": |
|
|
|
|
|
- if "Win32GUI" in ext.name: |
|
|
|
|
|
- extraArgs.append("-mwindows") |
|
|
|
|
|
- else: |
|
|
|
|
|
- extraArgs.append("-mconsole") |
|
|
|
|
|
- if sys.version_info[0] == 3: |
|
|
|
|
|
- extraArgs.append("-municode") |
|
|
|
|
|
+ compiler_type = self.compiler.compiler_type |
|
|
|
|
|
+ if "Win32GUI" in ext.name: |
|
|
|
|
|
+ extraArgs.append("-mwindows") |
|
|
|
|
|
else: |
|
|
|
|
|
- vars = distutils.sysconfig.get_config_vars() |
|
|
|
|
|
- libraryDirs.append(vars["LIBPL"]) |
|
|
|
|
|
- abiflags = getattr(sys, "abiflags", "") |
|
|
|
|
|
- libraries.append("python%s.%s%s" % \ |
|
|
|
|
|
- (sys.version_info[0], sys.version_info[1], abiflags)) |
|
|
|
|
|
- if vars["LINKFORSHARED"] and sys.platform != "darwin": |
|
|
|
|
|
- extraArgs.extend(vars["LINKFORSHARED"].split()) |
|
|
|
|
|
- if vars["LIBS"]: |
|
|
|
|
|
- extraArgs.extend(vars["LIBS"].split()) |
|
|
|
|
|
- if vars["LIBM"]: |
|
|
|
|
|
- extraArgs.append(vars["LIBM"]) |
|
|
|
|
|
- if vars["BASEMODLIBS"]: |
|
|
|
|
|
- extraArgs.extend(vars["BASEMODLIBS"].split()) |
|
|
|
|
|
- if vars["LOCALMODLIBS"]: |
|
|
|
|
|
- extraArgs.extend(vars["LOCALMODLIBS"].split()) |
|
|
|
|
|
- extraArgs.append("-s") |
|
|
|
|
|
+ extraArgs.append("-mconsole") |
|
|
|
|
|
+ if sys.version_info[0] == 3: |
|
|
|
|
|
+ extraArgs.append("-municode") |
|
|
|
|
|
+ extraArgs += getoutput("pkg-config --libs python3").split() |
|
|
|
|
|
+ extraArgs += os.getenv("LDFLAGS", "").split() |
|
|
|
|
|
self.compiler.link_executable(objects, fullName, |
|
|
|
|
|
libraries = libraries, |
|
|
|
|
|
library_dirs = libraryDirs, |
|
|
|
|
|
@@ -103,10 +80,7 @@ def find_cx_Logging(): |
|
|
|
|
|
commandClasses = dict(build_ext=build_ext) |
|
|
|
|
|
|
|
|
|
|
|
# build utility module |
|
|
|
|
|
-if sys.platform == "win32": |
|
|
|
|
|
- libraries = ["imagehlp", "Shlwapi"] |
|
|
|
|
|
-else: |
|
|
|
|
|
- libraries = [] |
|
|
|
|
|
+libraries = ["imagehlp", "shlwapi"] |
|
|
|
|
|
utilModule = Extension("cx_Freeze.util", ["source/util.c"], |
|
|
|
|
|
libraries = libraries) |
|
|
|
|
|
|
|
|
|
|
|
@@ -117,7 +91,7 @@ depends = ["source/bases/Common.c"] |
|
|
|
|
|
console = Extension("cx_Freeze.bases.Console", ["source/bases/Console.c"], |
|
|
|
|
|
depends = depends, libraries = libraries) |
|
|
|
|
|
extensions = [utilModule, console] |
|
|
|
|
|
-if sys.platform == "win32": |
|
|
|
|
|
+if sys.platform == "win32" or True: |
|
|
|
|
|
gui = Extension("cx_Freeze.bases.Win32GUI", ["source/bases/Win32GUI.c"], |
|
|
|
|
|
depends = depends, libraries = libraries + ["user32"]) |
|
|
|
|
|
extensions.append(gui) |