--- cefpython-66.0/tools/build_cpp_projects.py.orig 2019-04-02 16:58:20.961263518 +0200 +++ cefpython-66.0/tools/build_cpp_projects.py 2019-03-09 16:32:28.031876000 +0100 @@ -1,4 +1,4 @@ -# Copyright (c) 2017 CEF Python, see the Authors file. +# Copyright (c) 2017 CEF Python, see the Authors file # All rights reserved. Licensed under BSD 3-clause license. # Project website: https://github.com/cztomczak/cefpython @@ -46,16 +46,19 @@ # Compiler args COMPILER_ARGS = [ - "/EHsc", + #"/EHsc", ] subprocess_COMPILER_ARGS = [ - "/MT", + #"/MT", + "-pthread", ] # Linker args subprocess_LINKER_ARGS = [ - "/MANIFEST:NO", - "/LARGEADDRESSAWARE", + #"/MANIFEST:NO", + #"/LARGEADDRESSAWARE", + "-fstack-protector-all", + "-Wl,--subsystem,windows" ] # Command line args @@ -110,11 +112,11 @@ def get_compiler(static=False): # NOTES: # - VS2008 and VS2010 are both using distutils/msvc9compiler.py - compiler = new_compiler() + compiler = new_compiler(verbose = True) # Must initialize so that "compile_options" and others are available - compiler.initialize() + #compiler.initialize() if static: - compiler.compile_options.remove("/MD") + #compiler.compile_options.remove("/MD") # Overwrite function that adds /MANIFESTFILE, as for subprocess # manifest is disabled. Otherwise warning LNK4075 is generated. if hasattr(compiler, "manifest_setup_ldargs"): @@ -179,11 +181,13 @@ output_progname="subprocess", output_dir=BUILD_SUBPROCESS, libraries=["libcef", - "libcef_dll_wrapper_MT"], + "cef_dll_wrapper", + "libcef"], library_dirs=[lib_dir, lib_dir_vs], # TODO linker flags for Linux/Mac extra_preargs=None, - extra_postargs=subprocess_LINKER_ARGS) + extra_postargs=subprocess_LINKER_ARGS, + target_lang="c++") else: print("[build_cpp_projects.py] Executable is up-to-date: subprocess") --- cefpython-66.0/tools/cython_setup.py.orig 2019-04-02 16:58:31.753618071 +0200 +++ cefpython-66.0/tools/cython_setup.py 2019-03-09 16:53:19.516724000 +0100 @@ -129,6 +129,7 @@ r"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Lib", # Visual Studio 2008 installation r"C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Lib", + r"C:\\msys64\\mingw32\\lib" ] elif ARCH64: winsdk_libs = [ @@ -180,8 +181,37 @@ # # The above warning LNK4217 is caused by the warning below which occurs # when building the client_handler.lib static library: - extra_compile_args.extend(["/EHsc", "/wd4305"]) - extra_link_args.extend(["/ignore:4217"]) + #extra_compile_args.extend(["/EHsc", "/wd4305"]) + #extra_link_args.extend(["/ignore:4217"]) + if FAST_FLAG: + extra_compile_args.append("-O0") + else: + extra_compile_args.append("-O3") + + extra_compile_args.extend([ + "-DNDEBUG", + "-std=gnu++11", + ]) + os.environ["CC"] = "g++" + os.environ["CXX"] = "g++" + extra_compile_args.extend(["-std=gnu++11"]) + + # Fix "ImportError ... undefined symbol ..." caused by CEF's + # include/base/ headers by adding the -flto flag (Issue #230). + # Unfortunately -flto prolongs compilation time significantly. + # More on the other flags: https://stackoverflow.com/questions/ + # 6687630/ . + + if FAST_FLAG: + extra_compile_args.extend(["-flto"]) + extra_link_args.extend(["-flto"]) + else: + extra_compile_args.extend(["-flto", + "-fdata-sections", + "-ffunction-sections"]) + extra_link_args.extend(["-flto", + "-Wl,--gc-sections"]) + extra_link_args.extend(["-fstack-protector-all"]) if LINUX or MAC: # Compiler flags @@ -365,12 +395,13 @@ libraries = list() if WINDOWS: libraries.extend([ + "cef_dll_wrapper", "libcef", - "libcef_dll_wrapper_MD", "User32", "cefpython_app", "cpp_utils", "client_handler", + "gdi32" ]) elif MAC: libraries.extend([ --- cefpython-66.0/src/subprocess/main.cpp.orig 2019-04-02 20:36:34.016395754 +0200 +++ cefpython-66.0/src/subprocess/main.cpp 2019-04-02 20:39:33.491183098 +0200 @@ -7,10 +7,10 @@ #if defined(OS_WIN) #include -int APIENTRY wWinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPTSTR lpCmdLine, - int nCmdShow) +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); --- cefpython-66.0/tools/make_installer.py.orig 2018-08-20 19:51:17.000000000 +0200 +++ cefpython-66.0/tools/make_installer.py 2019-04-02 20:59:22.372933492 +0200 @@ -102,7 +102,7 @@ create_empty_log_file(os.path.join(PKG_DIR, "debug.log")) create_empty_log_file(os.path.join(PKG_DIR, "examples/debug.log")) - copy_cpp_extension_dependencies_issue359(PKG_DIR) + #copy_cpp_extension_dependencies_issue359(PKG_DIR) print("[make_installer.py] Done. Installer package created: {setup_dir}" .format(setup_dir=SETUP_DIR)) --- cefpython-66.0/tools/build.py.orig 2019-04-02 16:58:17.137138263 +0200 +++ cefpython-66.0/tools/build.py 2019-04-12 21:32:28.414197037 +0200 @@ -79,6 +79,7 @@ # Command line args variables SYS_ARGV_ORIGINAL = None VERSION = "" +NO_RUN_TESTS = False NO_RUN_EXAMPLES = False DEBUG_FLAG = False FAST_FLAG = False @@ -125,7 +126,7 @@ def command_line_args(): global DEBUG_FLAG, FAST_FLAG, CLEAN_FLAG, KIVY_FLAG, HELLO_WORLD_FLAG, \ - REBUILD_CPP, VERSION, NO_RUN_EXAMPLES + REBUILD_CPP, VERSION, NO_RUN_TESTS, NO_RUN_EXAMPLES VERSION = get_version_from_command_line_args(__file__) # Other scripts called by this script expect that version number @@ -140,6 +141,11 @@ global SYS_ARGV_ORIGINAL SYS_ARGV_ORIGINAL = copy.copy(sys.argv) + if "--no-run-tests" in sys.argv: + NO_RUN_TESTS = True + print("[build.py] Running tests disabled (--no-run-tests)") + sys.argv.remove("--no-run-tests") + if "--no-run-examples" in sys.argv: NO_RUN_EXAMPLES = True print("[build.py] Running examples disabled (--no-run-examples)") @@ -820,8 +826,8 @@ sys.exit(1) # Move the cefpython module - module_pattern = MODULE_NAME_TEMPLATE.format(pyversion=PYVERSION+"*", - ext=MODULE_EXT) + module_pattern = "cefpython_py{pyversion}-cpython-{pyversion}m.dll".\ + format(pyversion=PYVERSION+"*", ext=MODULE_EXT) module_pattern = "./build/lib*/" + module_pattern move_file_by_pattern(module_pattern, os.path.join(CEFPYTHON_BINARY, MODULE_NAME)) @@ -902,15 +908,16 @@ delete_directory_reliably(setup_installer_dir) # Run unittests - print("[build.py] Run unittests") - test_runner = os.path.join(UNITTESTS_DIR, "_test_runner.py") - command = ("\"{python}\" {test_runner}" - .format(python=sys.executable, - test_runner=test_runner)) - ret = os.system(command) - if ret != 0: - print("[build.py] ERROR while running unit tests") - sys.exit(1) + if not NO_RUN_TESTS: + print("[build.py] Run unittests") + test_runner = os.path.join(UNITTESTS_DIR, "_test_runner.py") + command = ("\"{python}\" {test_runner}" + .format(python=sys.executable, + test_runner=test_runner)) + ret = os.system(command) + if ret != 0: + print("[build.py] ERROR while running unit tests") + sys.exit(1) # Run examples if not NO_RUN_EXAMPLES: