From 9817ffa521e6d085ecde6e4195e20f6c3630d5d2 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 30 Jan 2021 22:47:22 +0000 Subject: [PATCH] Fixup cxfreeze Signed-off-by: falkTX --- bootstrap-carla.sh | 9 ++++ patches/cx_Freeze/win32/01_pawpaw-setup.patch | 50 +++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/bootstrap-carla.sh b/bootstrap-carla.sh index 04be99b..a1fe2b7 100755 --- a/bootstrap-carla.sh +++ b/bootstrap-carla.sh @@ -347,4 +347,13 @@ if [ "${CXFREEZE_VERSION}" = "6.4.2" ]; then fi build_python cx_Freeze "${CXFREEZE_VERSION}" +if [ "${WIN32}" -eq 1 ] && [ "${CROSS_COMPILING}" -eq 1 ]; then + if [ ! -e "${PAWPAW_PREFIX}/lib/python3.8/cx_Freeze" ]; then + ln -sv "${PAWPAW_PREFIX}/lib/python3.8/site-packages"/cx_Freeze-*.egg/cx_Freeze "${PAWPAW_PREFIX}/lib/python3.8/cx_Freeze" + fi + if [ ! -e "${PAWPAW_PREFIX}/lib/python3.8/cx_Freeze/util.pyd" ]; then + ln -sv "$(realpath "${PAWPAW_PREFIX}/lib/python3.8/cx_Freeze"/util.*)" "${PAWPAW_PREFIX}/lib/python3.8/cx_Freeze/util.pyd" + fi +fi + # --------------------------------------------------------------------------------------------------------------------- diff --git a/patches/cx_Freeze/win32/01_pawpaw-setup.patch b/patches/cx_Freeze/win32/01_pawpaw-setup.patch index 6b47753..c919b3f 100644 --- a/patches/cx_Freeze/win32/01_pawpaw-setup.patch +++ b/patches/cx_Freeze/win32/01_pawpaw-setup.patch @@ -1,3 +1,16 @@ +diff --git a/cx_Freeze/hooks.py b/cx_Freeze/hooks.py +index 3474f3e..cd04a2a 100644 +--- a/cx_Freeze/hooks.py ++++ b/cx_Freeze/hooks.py +@@ -97,6 +97,8 @@ def load_cryptography_hazmat_bindings__padding(finder, module): + def load__ctypes(finder, module): + """In Windows, the _ctypes module in Python >= 3.8 requires an additional dll + libffi-7.dll to be present in the build directory.""" ++ # but not for PawPaw ++ return + if sys.platform == "win32" and sys.version_info >= (3, 8): + dll_name = "libffi-7.dll" + dll_path = os.path.join(sys.base_prefix, "DLLs", dll_name) diff --git a/setup.py b/setup.py index af6689f..d7c84a1 100755 --- a/setup.py @@ -86,3 +99,40 @@ index af6689f..d7c84a1 100755 gui = Extension("cx_Freeze.bases.Win32GUI", ["source/bases/Win32GUI.c"], depends = depends, libraries = libraries + ["user32"]) extensions.append(gui) +diff --git a/setup.py b/setup.py +index d7c84a1..e0fdcfc 100755 +--- a/setup.py ++++ b/setup.py +@@ -27,6 +27,7 @@ class build_ext(distutils.command.build_ext.build_ext): + objects = self.compiler.compile(ext.sources, + output_dir = self.build_temp, + include_dirs = ext.include_dirs, ++ extra_preargs = getoutput("pkg-config --cflags python3").split() + os.getenv("CFLAGS", "").split(), + debug = self.debug, + depends = ext.depends) + fileName = os.path.splitext(self.get_ext_filename(ext.name))[0] +@@ -37,13 +38,18 @@ 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 [] +- compiler_type = self.compiler.compiler_type +- if "Win32GUI" in ext.name: +- extraArgs.append("-mwindows") ++ if "bases" in ext.name: ++ if "Win32GUI" in ext.name: ++ extraArgs.append("-mwindows") ++ else: ++ extraArgs.append("-mconsole") ++ if sys.version_info[0] == 3: ++ extraArgs.append("-municode") ++ if not os.path.exists("build/manifest.o"): ++ os.system(os.getenv("WINDRES") + " source/bases/manifest.rc build/manifest.o") ++ extraArgs.append("build/manifest.o") + else: +- extraArgs.append("-mconsole") +- if sys.version_info[0] == 3: +- extraArgs.append("-municode") ++ extraArgs.append("-shared") + extraArgs += getoutput("pkg-config --libs python3").split() + extraArgs += os.getenv("LDFLAGS", "").split() + self.compiler.link_executable(objects, fullName,