def make_xp(): if not is_xp_platform(): return print("[fetch & build]: v8_xp") old_env = dict(os.environ) base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8/v8_xp" old_cur = os.getcwd() os.chdir(base_dir) if ("windows" == base.host_platform()): base.set_env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0") base.set_env("GYP_MSVS_VERSION", "2015") base.common_check_version("v8", "1", clean) if not base.is_dir("win_64") and not base.is_dir("win_32"): clean() if not base.is_dir("depot_tools"): base.cmd( "git", ["clone", "http://120.92.49.206:3232/chromiumsrc/depot_tools.git"]) if ("windows" == base.host_platform()): # hack for 32 bit system!!! if base.is_file("depot_tools/cipd.ps1"): base.replaceInFile("depot_tools/cipd.ps1", "windows-386", "windows-amd64") os.environ["PATH"] = os.pathsep.join([ base_dir + "/depot_tools", base_dir + "/depot_tools/win_tools-2_7_13_chromium7_bin/python/bin", config.option("vs-path") + "/../Common7/IDE", os.environ["PATH"] ]) # -------------------------------------------------------------------------- # fetch if not base.is_dir("v8"): base.cmd("./depot_tools/fetch", ["v8"], True) base.cmd("./depot_tools/gclient", ["sync", "-r", "4.10.253"], True) base.delete_dir_with_access_error("v8/buildtools/win") base.cmd("git", ["config", "--system", "core.longpaths", "true"]) base.cmd("gclient", ["sync", "--force"], True) # save common py script base.save_as_script("v8/build/common_xp.py", [ "import os", "def replaceInFile(path, text, textReplace):", " filedata = '';", " with open(path, 'r') as file:", " filedata = file.read()", " filedata = filedata.replace(text, textReplace)", " os.remove(path)", " with open(path, 'w') as file:", " file.write(filedata)", " return", "", "projects = ['v8/tools/gyp/v8_base_0.vcxproj', 'v8/tools/gyp/v8_base_1.vcxproj', 'v8/tools/gyp/v8_base_2.vcxproj', 'v8/tools/gyp/v8_base_3.vcxproj',", "'v8/tools/gyp/v8_libbase.vcxproj', 'v8/tools/gyp/v8_libplatform.vcxproj', 'v8/tools/gyp/v8_nosnapshot.vcxproj', 'v8/tools/gyp/mksnapshot.vcxproj',", "'v8/third_party/icu/icui18n.vcxproj', 'v8/third_party/icu/icuuc.vcxproj']", "", "for file in projects:", " replaceInFile(file, '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')", " replaceInFile(file, '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>', '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')", ]) if config.check_option("platform", "win_64_xp"): if not base.is_dir("win_64/release"): base.run_as_bat([ "call python v8/build/gyp_v8 -Dtarget_arch=x64", "call python v8/build/common_xp.py", "call devenv v8/tools/gyp/v8.sln /Rebuild Release" ]) base.create_dir("win_64/release") base.copy_files("v8/build/Release/lib/*", "win_64/release/") base.copy_file("v8/build/Release/icudt.dll", "win_64/release/icudt.dll") if (-1 != config.option("config").lower().find("debug") ) and not base.is_dir("win_64/debug"): base.run_as_bat([ "call python v8/build/gyp_v8 -Dtarget_arch=x64", "call python v8/build/common_xp.py", "call devenv v8/tools/gyp/v8.sln /Rebuild Debug" ]) base.create_dir("win_64/debug") base.copy_files("v8/build/Debug/lib/*", "win_64/debug/") base.copy_file("v8/build/Debug/icudt.dll", "win_64/debug/icudt.dll") if config.check_option("platform", "win_32_xp"): if not base.is_dir("win_32/release"): base.run_as_bat([ "call python v8/build/gyp_v8", "call python v8/build/common_xp.py", "call devenv v8/tools/gyp/v8.sln /Rebuild Release" ]) base.create_dir("win_32/release") base.copy_files("v8/build/Release/lib/*", "win_32/release/") base.copy_file("v8/build/Release/icudt.dll", "win_32/release/icudt.dll") if (-1 != config.option("config").lower().find("debug") ) and not base.is_dir("win_32/debug"): base.run_as_bat([ "call python v8/build/gyp_v8", "call python v8/build/common_xp.py", "call devenv v8/tools/gyp/v8.sln /Rebuild Debug" ]) base.create_dir("win_32/debug") base.copy_files("v8/build/Debug/lib/*", "win_32/debug/") base.copy_file("v8/build/Debug/icudt.dll", "win_32/debug/icudt.dll") os.chdir(old_cur) os.environ.clear() os.environ.update(old_env) return
def make_pro_file(makefiles_dir, pro_file): platforms = config.option("platform").split() for platform in platforms: if not platform in config.platforms: continue print("------------------------------------------") print("BUILD_PLATFORM: " + platform) print("------------------------------------------") old_env = os.environ.copy() # if you need change output libraries path - set the env variable # base.set_env("DESTDIR_BUILD_OVERRIDE", os.getcwd() + "/out/android/" + config.branding() + "/mobile") isAndroid = False if (-1 == platform.find("android")) else True if isAndroid: toolchain_platform = "linux-x86_64" if ("mac" == base.host_platform()): toolchain_platform = "darwin-x86_64" base.set_env("ANDROID_NDK_HOST", toolchain_platform) old_path = base.get_env("PATH") new_path = base.qt_setup(platform) + "/bin:" new_path += (base.get_env("ANDROID_NDK_ROOT") + "/toolchains/llvm/prebuilt/" + toolchain_platform + "/bin:") new_path += old_path base.set_env("PATH", new_path) if ("android_arm64_v8a" == platform): base.set_env("ANDROID_NDK_PLATFORM", "android-21") else: base.set_env("ANDROID_NDK_PLATFORM", "android-16") if (-1 != platform.find("ios")): base.hack_xcode_ios() # makefile suffix file_suff = platform if (config.check_option("config", "debug")): file_suff += "_debug_" file_suff += config.option("branding") # setup qt qt_dir = base.qt_setup(platform) base.set_env("OS_DEPLOY", platform) # qmake CONFIG+=... config_param = base.qt_config(platform) # qmake ADDON qmake_addon = [] if ("" != config.option("qmake_addon")): qmake_addon.append(config.option("qmake_addon")) if not base.is_file(qt_dir + "/bin/qmake") and not base.is_file( qt_dir + "/bin/qmake.exe"): print("THIS PLATFORM IS NOT SUPPORTED") continue # non windows platform if not base.is_windows(): if ("1" == config.option("clean")): base.cmd(base.app_make(), [ "clean", "-f", makefiles_dir + "/build.makefile_" + file_suff ], True) base.cmd(base.app_make(), [ "distclean", "-f", makefiles_dir + "/build.makefile_" + file_suff ], True) if base.is_file(makefiles_dir + "/build.makefile_" + file_suff): base.delete_file(makefiles_dir + "/build.makefile_" + file_suff) base.cmd(qt_dir + "/bin/qmake", ["-nocache", pro_file, "CONFIG+=" + config_param] + qmake_addon) base.cmd(base.app_make(), ["-f", makefiles_dir + "/build.makefile_" + file_suff]) else: qmake_bat = [] qmake_bat.append( "call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64")) if ("1" == config.option("clean")): qmake_bat.append("call nmake clean -f " + makefiles_dir + "/build.makefile_" + file_suff) qmake_bat.append("call nmake distclean -f " + makefiles_dir + "/build.makefile_" + file_suff) qmake_addon_string = "" if ("" != config.option("qmake_addon")): qmake_addon_string = " \"" + config.option( "qmake_addon") + "\"" qmake_bat.append("if exist ./" + makefiles_dir + "/build.makefile_" + file_suff + " del /F ./" + makefiles_dir + "/build.makefile_" + file_suff) qmake_bat.append("call \"" + qt_dir + "/bin/qmake\" -nocache " + pro_file + " \"CONFIG+=" + config_param + "\"" + qmake_addon_string) qmake_bat.append("call nmake -f " + makefiles_dir + "/build.makefile_" + file_suff) base.run_as_bat(qmake_bat) os.environ = old_env.copy() base.delete_file(".qmake.stash")
def make(): if ("android" == base.host_platform() or "ios" == config.option("platform")): return print("[fetch & build]: openssl") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/openssl" old_cur = os.getcwd() os.chdir(base_dir) base.common_check_version("openssl", "3", clean) if not base.is_dir("openssl"): base.cmd("git", [ "clone", "--depth=1", "--branch", "OpenSSL_1_1_1f", "https://github.com/openssl/openssl.git" ]) os.chdir(base_dir + "/openssl") old_cur_dir = base_dir.replace(" ", "\\ ") if ("windows" == base.host_platform()): old_cur_dir = base_dir.replace(" ", "\\ ") if (-1 != config.option("platform").find("win_64") ) and not base.is_dir("../build/win_64"): base.create_dir("./../build/win_64") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x64") qmake_bat.append("perl Configure VC-WIN64A --prefix=" + old_cur_dir + "\\build\\win_64 --openssldir=" + old_cur_dir + "\\build\\win_64 no-shared no-asm") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) if (-1 != config.option("platform").find("win_32") ) and not base.is_dir("../build/win_32"): base.create_dir("./../build/win_32") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x86") qmake_bat.append("perl Configure VC-WIN32 --prefix=" + old_cur_dir + "\\build\\win_32 --openssldir=" + old_cur_dir + "\\build\\win_32 no-shared no-asm") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) os.chdir(old_cur) # xp ---------------------------------------------------------------------------------------------------- os.chdir(base_dir + "/openssl") base.replaceInFile(base_dir + "/openssl/crypto/rand/rand_win.c", "define USE_BCRYPTGENRANDOM", "define USE_BCRYPTGENRANDOM_FIX") old_cur_dir = base_dir.replace(" ", "\\ ") if (-1 != config.option("platform").find("win_64_xp") ) and not base.is_dir("../build/win_64_xp"): base.create_dir("./../build/win_64_xp") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x64") qmake_bat.append("perl Configure VC-WIN64A --prefix=" + old_cur_dir + "\\build\\win_64_xp --openssldir=" + old_cur_dir + "\\build\\win_64_xp no-shared no-asm no-async") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) if (-1 != config.option("platform").find("win_32_xp") ) and not base.is_dir("../build/win_32_xp"): base.create_dir("./../build/win_32_xp") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x86") qmake_bat.append("perl Configure VC-WIN32 --prefix=" + old_cur_dir + "\\build\\win_32_xp --openssldir=" + old_cur_dir + "\\build\\win_32_xp no-shared no-asm no-async") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) os.chdir(old_cur) # ------------------------------------------------------------------------------------------------------- return if (-1 != config.option("platform").find("linux") ) and not base.is_dir("../build/linux_64"): base.cmd("./config", [ "no-shared", "no-asm", "--prefix=" + old_cur_dir + "/build/linux_64", "--openssldir=" + old_cur_dir + "/build/linux_64" ]) base.replaceInFile("./Makefile", "CFLAGS=-Wall -O3", "CFLAGS=-Wall -O3 -fvisibility=hidden") base.replaceInFile("./Makefile", "CXXFLAGS=-Wall -O3", "CXXFLAGS=-Wall -O3 -fvisibility=hidden") base.cmd("make") base.cmd("make", ["install"]) # TODO: support x86 if (-1 != config.option("platform").find("mac") ) and not base.is_dir("../build/mac_64"): base.cmd("./Configure", [ "no-shared", "no-asm", "darwin64-x86_64-cc", "--prefix=" + old_cur_dir + "/build/mac_64", "--openssldir=" + old_cur_dir + "/build/mac_64", "-mmacosx-version-min=10.11" ]) base.cmd("make", ["build_libs", "install"]) if (-1 != config.option("platform").find("mac") ) and not base.is_dir("../build/mac_arm64"): os.chdir(base_dir) base.cmd("git", [ "clone", "--depth=1", "--branch", "OpenSSL_1_1_1f", "https://github.com/openssl/openssl.git", "openssl2" ]) os.chdir(base_dir + "/openssl2") replace1 = "\"darwin64-x86_64-cc\" => {" replace2 = "\"darwin64-arm64-cc\" => {\n\ inherit_from => [ \"darwin-common\", asm(\"aarch64_asm\") ],\n\ CFLAGS => add(\"-Wall\"),\n\ cflags => add(\"-arch arm64 -isysroot " + base.find_mac_sdk( ) + "\"),\n\ lib_cppflags => add(\"-DL_ENDIAN\"),\n\ bn_ops => \"SIXTY_FOUR_BIT_LONG\",\n\ perlasm_scheme => \"macosx\",\n\ },\n\ \"darwin64-x86_64-cc\" => {" base.replaceInFile(base_dir + "/openssl2/Configurations/10-main.conf", replace1, replace2) base.cmd("./Configure", [ "no-shared", "no-asm", "darwin64-arm64-cc", "--prefix=" + old_cur_dir + "/build/mac_arm64", "--openssldir=" + old_cur_dir + "/build/mac_arm64" ]) base.cmd("make", ["build_libs", "install"]) os.chdir(old_cur) return
arguments = arguments[:-1] arguments += "]\" " for item in sources: arguments += (item + " ") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_js_content = base.readFile( "./../../license/header.license") + "\n" + engine_base_js_content.replace( "//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell.js", engine_js_content)
def make(): is_no_brandind_build = base.is_file("config") platforms = config.option("platform").split() for platform in platforms: if not platform in config.platforms: continue print("------------------------------------------") print("BUILD_PLATFORM: " + platform) print("------------------------------------------") # makefile suffix file_suff = platform if (config.check_option("config", "debug")): file_suff += "_debug_" file_suff += config.option("branding") # setup qt qt_dir = base.qt_setup(platform) base.set_env("OS_DEPLOY", platform) # qmake CONFIG+=... config_param = base.qt_config(platform) # qmake ADDON qmake_addon = [] if ("" != config.option("qmake_addon")): qmake_addon.append(config.option("qmake_addon")) # non windows platform if not base.is_windows(): if ("1" == config.option("clean")): base.cmd(base.app_make(), [ "clean", "all", "-f", "makefiles/build.makefile_" + file_suff ], True) base.cmd(base.app_make(), [ "distclean", "-f", "makefiles/build.makefile_" + file_suff ], True) if base.is_file("makefiles/build.makefile_" + file_suff): base.delete_file("makefiles/build.makefile_" + file_suff) base.cmd(qt_dir + "/bin/qmake", ["-nocache", "build.pro", "CONFIG+=" + config_param] + qmake_addon) base.cmd(base.app_make(), ["-f", "makefiles/build.makefile_" + file_suff]) else: old_env = os.environ.copy() qmake_bat = [] qmake_bat.append( "call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64")) if ("1" == config.option("clean")): qmake_bat.append( "call nmake clean all -f makefiles/build.makefile_" + file_suff) qmake_bat.append( "call nmake distclean -f makefiles/build.makefile_" + file_suff) qmake_addon_string = "" if ("" != config.option("qmake_addon")): qmake_addon_string = " \"" + config.option( "qmake_addon") + "\"" qmake_bat.append("if exist ./makefiles/build.makefile_" + file_suff + " del /F ./makefiles/build.makefile_" + file_suff) qmake_bat.append("call \"" + qt_dir + "/bin/qmake\" -nocache build.pro \"CONFIG+=" + config_param + "\"" + qmake_addon_string) qmake_bat.append("call nmake -f makefiles/build.makefile_" + file_suff) base.run_as_bat(qmake_bat) os.environ = old_env.copy() base.delete_file(".qmake.stash") if config.check_option( "module", "builder") and base.is_windows() and is_no_brandind_build: base.bash("../core/DesktopEditor/doctrenderer/docbuilder.com/build") return
def make(): if ("android" == base.host_platform() or "ios" == config.option("platform")): return print("[fetch & build]: openssl") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/openssl" old_cur = os.getcwd() os.chdir(base_dir) base.common_check_version("openssl", "1", clean) if not base.is_dir("openssl"): base.cmd("git", [ "clone", "--depth=1", "--branch", "OpenSSL_1_1_1f", "https://github.com/openssl/openssl.git" ]) os.chdir(base_dir + "/openssl") old_cur_dir = base_dir.replace(" ", "\\ ") if ("windows" == base.host_platform()): old_cur_dir = base_dir.replace(" ", "\\ ") if (-1 != config.option("platform").find("win_64") ) and not base.is_dir("../build/win_64"): base.create_dir("./../build/win_64") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x64") qmake_bat.append("perl Configure VC-WIN64A --prefix=" + old_cur_dir + "\\build\\win_64 --openssldir=" + old_cur_dir + "\\build\\win_64 no-shared no-asm") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) if (-1 != config.option("platform").find("win_32") ) and not base.is_dir("../build/win_32"): base.create_dir("./../build/win_32") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x86") qmake_bat.append("perl Configure VC-WIN32 --prefix=" + old_cur_dir + "\\build\\win_32 --openssldir=" + old_cur_dir + "\\build\\win_32 no-shared no-asm") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) os.chdir(old_cur) # xp ---------------------------------------------------------------------------------------------------- os.chdir(base_dir + "/openssl") base.replaceInFile(base_dir + "/openssl/crypto/rand/rand_win.c", "define USE_BCRYPTGENRANDOM", "define USE_BCRYPTGENRANDOM_FIX") old_cur_dir = base_dir.replace(" ", "\\ ") if (-1 != config.option("platform").find("win_64_xp") ) and not base.is_dir("../build/win_64_xp"): base.create_dir("./../build/win_64_xp") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x64") qmake_bat.append("perl Configure VC-WIN64A --prefix=" + old_cur_dir + "\\build\\win_64_xp --openssldir=" + old_cur_dir + "\\build\\win_64_xp no-shared no-asm no-async") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) if (-1 != config.option("platform").find("win_32_xp") ) and not base.is_dir("../build/win_32_xp"): base.create_dir("./../build/win_32_xp") qmake_bat = [] qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" x86") qmake_bat.append("perl Configure VC-WIN32 --prefix=" + old_cur_dir + "\\build\\win_32_xp --openssldir=" + old_cur_dir + "\\build\\win_32_xp no-shared no-asm no-async") qmake_bat.append("call nmake clean") qmake_bat.append("call nmake build_libs install") base.run_as_bat(qmake_bat, True) os.chdir(old_cur) # ------------------------------------------------------------------------------------------------------- return if (-1 != config.option("platform").find("linux") ) and not base.is_dir("../build/linux_64"): base.cmd("./config", [ "no-shared", "no-asm", "--prefix=" + old_cur_dir + "/build/linux_64", "--openssldir=" + old_cur_dir + "/build/linux_64" ]) base.replaceInFile("./Makefile", "CFLAGS=-Wall -O3", "CFLAGS=-Wall -O3 -fvisibility=hidden") base.replaceInFile("./Makefile", "CXXFLAGS=-Wall -O3", "CXXFLAGS=-Wall -O3 -fvisibility=hidden") base.cmd("make") base.cmd("make", ["install"]) # TODO: support x86 if (-1 != config.option("platform").find("mac") ) and not base.is_dir("../build/mac_64"): base.cmd("./config", [ "no-shared", "no-asm", "--prefix=" + old_cur_dir + "/build/mac_64", "--openssldir=" + old_cur_dir + "/build/mac_64" ]) base.cmd("make", ["build_libs", "install"]) os.chdir(old_cur) return
def make(build_js = True): old_cur_dir = os.getcwd() #fetch libhunspell print("[fetch & build]: hunspell") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/hunspell" os.chdir(base_dir) if not base.is_dir("hunspell"): last_stable_commit = "8a2fdfe5a6bb1cbafc04b0c8486abcefd17ad903" repo_path = "https://github.com/hunspell/hunspell.git" base.cmd("git", ["clone", repo_path]) os.chdir("hunspell") base.cmd("git", ["checkout", last_stable_commit]) base.replaceInFile("./src/hunspell/filemgr.hxx", "FileMgr& operator=(const FileMgr&);", "FileMgr& operator=(const FileMgr&); \n" +" #ifdef HUNSPELL_WASM_MODULE \n char* memory;size_t index;size_t size; \n #endif") #custon filemgr support watch filemgr_wrapper_new.cxx os.chdir("../") if not build_js: os.chdir(old_cur_dir) return base.configure_common_apps() # remove previous version if base.is_dir("./deploy"): base.delete_dir("./deploy") base.create_dir("./deploy") base.create_dir("./deploy/spell") # fetch emsdk command_prefix = "" if ("windows" == base.host_platform()) else "./" if not base.is_dir("emsdk"): base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"]) os.chdir("emsdk") base.cmd(command_prefix + "emsdk", ["install", "latest"]) base.cmd(command_prefix + "emsdk", ["activate", "latest"]) os.chdir("../") # compile compiler_flags = ["-o spell.js", "-O3", "-fno-exceptions", "-fno-rtti", "-s WASM=1", "-s ALLOW_MEMORY_GROWTH=1", "-s FILESYSTEM=0", "-s ENVIRONMENT='web,worker'"] exported_functions = ["_malloc", "_free", "_Spellchecker_Malloc", "_Spellchecker_Free", "_Spellchecker_Create", "_Spellchecker_Destroy", "_Spellchecker_AddDictionary", "_Spellchecker_RemoveDicrionary", "_Spellchecker_Load", "_Spellchecker_Spell", "_Spellchecker_Suggest", "_Spellchecker_RemoveEngine", "_Spellchecker_TotalAllocatedMemory"] version_hunspell = 17 libhunspell_src_path = "./hunspell/src/hunspell" input_sources = ["affentry.cxx", "affixmgr.cxx", "csutil.cxx", "dictmgr.cxx", "hashmgr.cxx", "hunspell.cxx", "hunzip.cxx", "phonet.cxx", "replist.cxx", "suggestmgr.cxx"] sources = [] for item in input_sources: if base.is_file(libhunspell_src_path + "/" + item): sources.append(libhunspell_src_path + "/" + item) if (13 == version_hunspell): sources.append("./wasm/src/filemgr_wrapper.cxx") else: sources.append("./wasm/src/filemgr_wrapper_new.cxx") sources.append("./wasm/src/base.cpp") compiler_flags.append("-I" + libhunspell_src_path) compiler_flags.append("-DWIN32 -DNDEBUG -DHUNSPELL_STATIC -DBUILDING_LIBHUNSPELL -DHUNSPELL_WASM_MODULE") # arguments arguments = "" for item in compiler_flags: arguments += (item + " ") arguments += "-s EXPORTED_FUNCTIONS=\"[" for item in exported_functions: arguments += ("'" + item + "',") arguments = arguments[:-1] arguments += "]\" " for item in sources: arguments += (item + " ") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_js_content = engine_base_js_content.replace("//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell.js", engine_js_content) base.copy_file("spell.wasm", "./deploy/spell/spell.wasm") # ie asm version arguments = arguments.replace("WASM=1", "WASM=0") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_base_js_polyfill = base.readFile("./wasm/js/polyfill.js") engine_js_content = engine_base_js_polyfill + "\n\n" + engine_base_js_content.replace("//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell_ie.js", engine_js_content) base.copy_file("spell.js.mem", "./deploy/spell/spell.js.mem") base.copy_file("./wasm/js/code.js", "./deploy/spell.js") base.copy_file("./wasm/js/index.html", "./deploy/index.html") base.delete_file("spell.js") base.delete_file("spell.js.mem") os.chdir(old_cur_dir)
def make(): print("[fetch & build]: icu") if (-1 != config.option("platform").find("android")): icu_android.make() base_dir = base.get_script_dir() + "/../../core/Common/3dParty/icu" old_cur = os.getcwd() os.chdir(base_dir) icu_major = "58" icu_minor = "2" if not base.is_dir("icu"): base.cmd("svn", [ "export", "https://github.com/unicode-org/icu/tags/release-" + icu_major + "-" + icu_minor + "/icu4c", "./icu", "--non-interactive", "--trust-server-cert" ]) if ("windows" == base.host_platform()): need_platforms = [] if (-1 != config.option("platform").find("win_64")): need_platforms.append("win_64") if (-1 != config.option("platform").find("win_32")): need_platforms.append("win_32") for platform in need_platforms: if not config.check_option("platform", platform) and not config.check_option( "platform", platform + "_xp"): continue if not base.is_dir(platform + "/build"): base.create_dir(platform) compile_bat = [] compile_bat.append("setlocal") compile_bat.append( "call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64")) compile_bat.append( "call MSBuild.exe icu/source/allinone/allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform=" + ("Win32" if base.platform_is_32(platform) else "X64")) compile_bat.append("endlocal") base.run_as_bat(compile_bat) #base.vcvarsall_start("x64" if ("win_64" == platform) else "x86") #base.cmd("MSBuild.exe", ["icu/source/allinone/allinone.sln", "/p:Configuration=Release", "/p:PlatformToolset=v140", "/p:Platform=" + ("X64" if ("win_64" == platform) else "Win32")]) #base.vcvarsall_end() bin_dir = "icu/bin64/" if ("win_64" == platform) else "icu/bin/" lib_dir = "icu/lib64/" if ("win_64" == platform) else "icu/lib/" base.create_dir(platform + "/build") base.copy_file(bin_dir + "icudt" + icu_major + ".dll", platform + "/build/") base.copy_file(bin_dir + "icuuc" + icu_major + ".dll", platform + "/build/") base.copy_file(lib_dir + "icudt.lib", platform + "/build/") base.copy_file(lib_dir + "icuuc.lib", platform + "/build/") os.chdir(old_cur) return platform = "" if ("linux" == base.host_platform()): platform = "linux_64" if not base.is_dir(platform + "/build"): base.replaceInFile("./icu/source/i18n/digitlst.cpp", "xlocale", "locale") if ("mac" == base.host_platform()): platform = "mac_64" if not base.is_dir(platform + "/build"): base.replaceInFile("./icu/source/tools/pkgdata/pkgdata.cpp", "cmd, \"%s %s -o %s%s %s %s%s %s %s\",", "cmd, \"%s %s -o %s%s %s %s %s %s %s\",") if (-1 != config.option("platform").find("ios")): if not base.is_dir("build"): base.bash("./icu_ios") elif ("" != platform) and not base.is_dir(platform + "/build"): base.create_dir(platform) os.chdir("icu/source") base.cmd("./runConfigureICU", ["Linux" if "linux" == base.host_platform() else "MacOSX"]) old_dest_dir = base.get_env("DESTDIR") base.set_env("DESTDIR", base_dir + "/" + platform) base.cmd("make", ["install"]) if ("" == old_dest_dir): os.environ.pop("DESTDIR") else: base.set_env("DEST_DIR", old_dest_dir) os.chdir("../..") base.create_dir(platform + "/build") if ("linux_64" == platform): base.copy_file( "icu/source/lib/libicudata.so." + icu_major + "." + icu_minor, platform + "/build/libicudata.so." + icu_major) base.copy_file( "icu/source/lib/libicuuc.so." + icu_major + "." + icu_minor, platform + "/build/libicuuc.so." + icu_major) elif ("mac_64" == platform): base.copy_file( "icu/source/lib/libicudata." + icu_major + "." + icu_minor + ".dylib", platform + "/build/libicudata." + icu_major + ".dylib") base.copy_file( "icu/source/lib/libicuuc." + icu_major + "." + icu_minor + ".dylib", platform + "/build/libicuuc." + icu_major + ".dylib") os.chdir(old_cur) return
def make(): is_no_brandind_build = base.is_file("config") platforms = config.option("platform").split() for platform in platforms: if not platform in config.platforms: continue print("------------------------------------------") print("BUILD_PLATFORM: " + platform) print("------------------------------------------") old_env = os.environ.copy() isAndroid = False if (-1 == platform.find("android")) else True if isAndroid: toolchain_platform = "linux-x86_64" if ("mac" == base.host_platform()): toolchain_platform = "darwin-x86_64" base.set_env("ANDROID_NDK_HOST", toolchain_platform) old_path = base.get_env("PATH") new_path = base.qt_setup(platform) + "/bin:" new_path += (base.get_env("ANDROID_NDK_ROOT") + "/toolchains/llvm/prebuilt/" + toolchain_platform + "/bin:") new_path += old_path base.set_env("PATH", new_path) if ("android_arm64_v8a" == platform): base.set_env("ANDROID_NDK_PLATFORM", "android-21") else: base.set_env("ANDROID_NDK_PLATFORM", "android-16") # makefile suffix file_suff = platform if (config.check_option("config", "debug")): file_suff += "_debug_" file_suff += config.option("branding") # setup qt qt_dir = base.qt_setup(platform) base.set_env("OS_DEPLOY", platform) # qmake CONFIG+=... config_param = base.qt_config(platform) # qmake ADDON qmake_addon = [] if ("" != config.option("qmake_addon")): qmake_addon.append(config.option("qmake_addon")) # non windows platform if not base.is_windows(): if ("1" == config.option("clean")): base.cmd( base.app_make(), ["clean", "-f", "makefiles/build.makefile_" + file_suff], True) base.cmd(base.app_make(), [ "distclean", "-f", "makefiles/build.makefile_" + file_suff ], True) if base.is_file("makefiles/build.makefile_" + file_suff): base.delete_file("makefiles/build.makefile_" + file_suff) base.cmd(qt_dir + "/bin/qmake", ["-nocache", "build.pro", "CONFIG+=" + config_param] + qmake_addon) base.cmd(base.app_make(), ["-f", "makefiles/build.makefile_" + file_suff]) else: qmake_bat = [] qmake_bat.append( "call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64")) if ("1" == config.option("clean")): qmake_bat.append( "call nmake clean -f makefiles/build.makefile_" + file_suff) qmake_bat.append( "call nmake distclean -f makefiles/build.makefile_" + file_suff) qmake_addon_string = "" if ("" != config.option("qmake_addon")): qmake_addon_string = " \"" + config.option( "qmake_addon") + "\"" qmake_bat.append("if exist ./makefiles/build.makefile_" + file_suff + " del /F ./makefiles/build.makefile_" + file_suff) qmake_bat.append("call \"" + qt_dir + "/bin/qmake\" -nocache build.pro \"CONFIG+=" + config_param + "\"" + qmake_addon_string) qmake_bat.append("call nmake -f makefiles/build.makefile_" + file_suff) base.run_as_bat(qmake_bat) os.environ = old_env.copy() base.delete_file(".qmake.stash") if config.check_option( "module", "builder") and base.is_windows() and is_no_brandind_build: base.bash("../core/DesktopEditor/doctrenderer/docbuilder.com/build") return