Browse Source

cxfreeze now also works on windows builds

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.1
falkTX 1 year ago
parent
commit
152b4fcdb5
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 106 additions and 8 deletions
  1. +3
    -8
      bootstrap-carla.sh
  2. +88
    -0
      patches/cx_Freeze/win32/01_pawpaw-setup.patch
  3. +13
    -0
      patches/cx_Freeze/win32/02_include-lowercase.patch
  4. +1
    -0
      patches/cx_Freeze/win64
  5. +1
    -0
      setup/versions.sh

+ 3
- 8
bootstrap-carla.sh View File

@@ -278,11 +278,6 @@ if [ "${CROSS_COMPILING}" -eq 1 ]; then
unset PKG_CONFIG_SYSROOT_DIR
fi

# TODO: finish this
if [ "${WIN32}" -eq 1 ]; then
exit 0
fi

# ---------------------------------------------------------------------------------------------------------------------
# cython (optional)

@@ -300,13 +295,13 @@ if [ "${WIN32}" -eq 1 ]; then
export LDSHARED="${TARGET_CXX}"
fi

# export LINK="${TARGET_CXX}"
# export LINKER="${TARGET_CXX}"

download pyliblo "${PYLIBLO_VERSION}" "http://das.nasophon.de/download"
build_python pyliblo "${PYLIBLO_VERSION}"

if [ "${WIN32}" -eq 1 ]; then
if [ "${CROSS_COMPILING}" -eq 1 ] && [ ! -e "${PAWPAW_PREFIX}/lib/python3.8/liblo.pyd" ]; then
ln -sv "${PAWPAW_PREFIX}/lib/python3.8/site-packages"/pyliblo-*.egg/*.so "${PAWPAW_PREFIX}/lib/python3.8/liblo.pyd"
fi
unset LDSHARED
fi



+ 88
- 0
patches/cx_Freeze/win32/01_pawpaw-setup.patch View File

@@ -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)

+ 13
- 0
patches/cx_Freeze/win32/02_include-lowercase.patch View File

@@ -0,0 +1,13 @@
diff --git a/source/util.c b/source/util.c
index 6c9077b..f6397a9 100644
--- a/source/util.c
+++ b/source/util.c
@@ -8,7 +8,7 @@
#ifdef MS_WINDOWS
#include <windows.h>
#include <imagehlp.h>
-#include <Shlwapi.h>
+#include <shlwapi.h>
#pragma pack(2)

+ 1
- 0
patches/cx_Freeze/win64 View File

@@ -0,0 +1 @@
win32

+ 1
- 0
setup/versions.sh View File

@@ -75,6 +75,7 @@ if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
TOML_VERSION=0.10.2
ZIPP_VERSION=3.4.0
elif [ "${WIN32}" -eq 1 ]; then
CXFREEZE_VERSION=6.1
PYTHON_VERSION=3.8.7
PYLIBLO_VERSION=0.9.2
PYQT5_VERSION=5.13.1


Loading…
Cancel
Save