def install_deps(): # dependencies packages = [ "apt-transport-https", "autoconf2.13", "build-essential", "ca-certificates", "cmake", "curl", "git", "glib-2.0-dev", "libglu1-mesa-dev", "libgtk-3-dev", "libpulse-dev", "libtool", "p7zip-full", "subversion", "gzip", "libasound2-dev", "libatspi2.0-dev", "libcups2-dev", "libdbus-1-dev", "libicu-dev", "libglu1-mesa-dev", "libgstreamer1.0-dev", "libgstreamer-plugins-base1.0-dev", "libx11-xcb-dev", "libxcb*", "libxi-dev", "libxrender-dev", "libxss1" ] base.cmd("sudo", ["apt-get", "install", "-y"] + packages) # nodejs if not base.is_file("./node_js_setup_10.x"): if "ppc64le" not in platform.machine(): base.download("https://deb.nodesource.com/setup_10.x", "./node_js_setup_10.x") base.cmd("sudo", ["bash", "./node_js_setup_10.x"]) base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) base.cmd("sudo", ["npm", "install", "-g", "npm"]) base.cmd("sudo", ["npm", "install", "-g", "grunt-cli"]) base.cmd("sudo", ["npm", "install", "-g", "pkg"]) # java base.cmd("sudo", ["apt-get", "-y", "install", "software-properties-common"]) base.cmd("sudo", ["add-apt-repository", "-y", "ppa:openjdk-r/ppa"]) base.cmd("sudo", ["apt-get", "update"]) base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"]) base.cmd("sudo", ["update-alternatives", "--config", "java"]) base.cmd("sudo", ["update-alternatives", "--config", "javac"]) return
def uninstallProgram(sName): base.print_info("Uninstalling all versions " + sName + "...") info = '' code = 0 if (host_platform == 'windows'): unInfo = get_programUninstalls(sName) for info in unInfo: info = info.replace('"', '') if (base.is_file(info) == False): info = info.replace('/I', '/x').replace('/i', '/x') + ' /qn' else: if (sName in uninstall_params): info = '"' + info + '" ' + uninstall_params[sName] else: info = '"' + info + '" /S' elif (host_platform == 'linux'): if (sName in uninstall_special): code = uninstall_special[sName]() else: info = 'sudo apt-get remove --purge ' + sName + '* -y && ' + 'sudo apt-get autoremove -y && ' + 'sudo apt-get autoclean' if (info != ''): print("Uninstalling " + sName + "...") print(info) popen = subprocess.Popen(info, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) popen.communicate() code = popen.wait() if (code != 0): print("Uninstalling was failed!") return False return True
def parse_defaults(): defaults_path = base.get_script_dir() + "/../defaults" if ("" != option("branding")): defaults_path_branding = base.get_script_dir() + "/../../" + option( "branding") + "/build_tools/defaults" if base.is_file(defaults_path_branding): defaults_path = defaults_path_branding defaults_file = open(defaults_path, "r") defaults_options = {} for line in defaults_file: name, value = line.partition("=")[::2] k = name.strip() v = value.strip(" '\"\r\n") if ("true" == v.lower()): v = "1" if ("false" == v.lower()): v = "0" defaults_options[k] = v for name in defaults_options: if name in options: options[name] = options[name].replace("default", defaults_options[name]) else: options[name] = defaults_options[name] return
def install_qt(): # qt if not base.is_file("./qt_source_5.9.9.tar.xz"): base.download( "https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz", "./qt_source_5.9.9.tar.xz") if not base.is_dir("./qt-everywhere-opensource-src-5.9.9"): base.cmd("tar", ["-xf", "./qt_source_5.9.9.tar.xz"]) qt_params = [ "-opensource", "-confirm-license", "-release", "-shared", "-accessibility", "-prefix", "./../qt_build/Qt-5.9.9/gcc_64", "-qt-zlib", "-qt-libpng", "-qt-libjpeg", "-qt-xcb", "-qt-pcre", "-no-sql-sqlite", "-no-qml-debug", "-gstreamer", "1.0", "-nomake", "examples", "-nomake", "tests", "-skip", "qtenginio", "-skip", "qtlocation", "-skip", "qtserialport", "-skip", "qtsensors", "-skip", "qtxmlpatterns", "-skip", "qt3d", "-skip", "qtwebview", "-skip", "qtwebengine" ] base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "./configure", qt_params) base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["-j", "4"]) base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["install"]) return
def make(): is_no_brandind_build = base.is_file("config") make_pro_file("makefiles", "build.pro") 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 find_last_version(arr_input, base_directory): arr = [] for arr_rec in arr_input: if base.is_file(base_directory + "/" + arr_rec + "/bin/cmake"): arr.append(arr_rec) res = arr[0] for version in arr: if (LooseVersion(version) > LooseVersion(res)): res = version return res
def check_mysqlServer(): base.print_info('Check MySQL Server') dependence = CDependencies() mysqlLoginSrt = get_mysqlLoginSrting() connectionString = mysqlLoginSrt + ' -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"' if (host_platform != 'windows'): result = os.system(mysqlLoginSrt + ' -e "exit"') if (result == 0): connectionResult = base.run_command(connectionString)['stdout'] if (connectionResult.find('port') != -1 and connectionResult.find( install_params['MySQLServer']['port']) != -1): print('MySQL configuration is valid') dependence.sqlPath = 'mysql' return dependence print('Valid MySQL Server not found') dependence.append_install('MySQLServer') dependence.append_uninstall('mysql-server') return dependence arrInfo = get_mysqlServersInfo() for info in arrInfo: if (base.is_dir(info['Location']) == False): continue mysql_full_name = 'MySQL Server ' + info['Version'] + ' ' connectionResult = base.run_command_in_dir( get_mysql_path_to_bin(info['Location']), connectionString)['stdout'] if (connectionResult.find('port') != -1 and connectionResult.find( install_params['MySQLServer']['port']) != -1): print(mysql_full_name + 'configuration is valid') dependence.sqlPath = info['Location'] return dependence print(mysql_full_name + 'configuration is not valid') print('Valid MySQL Server not found') dependence.append_uninstall('MySQL Server') dependence.append_uninstall('MySQL Installer') dependence.append_install('MySQLInstaller') dependence.append_install('MySQLServer') MySQLData = os.environ['ProgramData'] + '\\MySQL\\' if base.is_exist(MySQLData) == False: return dependence dir = os.listdir(MySQLData) for path in dir: if (path.find('MySQL Server') != -1) and (base.is_file(MySQLData + path) == False): dependence.append_removepath(MySQLData + path) return dependence
def move_debug_libs_windows(dir): base.create_dir(dir + "/debug") for file in glob.glob(dir + "/*"): file_name = os.path.basename(file) if not base.is_file(file): continue if (0 != file_name.find("libboost_")): continue base.copy_file(file, dir + "/debug/" + file_name) base.delete_file(file) return
def make(): if ("windows" == 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") if not base.is_file("Makefile"): base.cmd("./config", ["no-shared", "no-asm"]) if base.is_file("./libssl.a") and base.is_file("./libcrypto.a"): os.chdir(old_cur) return if ("linux" == base.host_platform()): 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", ["build_libs"]) os.chdir(old_cur) return
def make(): if ("1" != config.option("develop")): return if not dependence.check_dependencies(): exit(1) build_server.build_server_develop() build_js.build_js_develop(base_dir + "/../../..") develop_config_server.make() if ("" != config.option("branding")): branding_develop_script_dir = base_dir + "/../../../" + config.option( "branding") + "/build_tools/scripts" if base.is_file(branding_develop_script_dir + "/develop.py"): base.cmd_in_dir(branding_develop_script_dir, "python", ["develop.py"], True) exit(0)
def make(): is_no_brandind_build = base.is_file("config") make_pro_file("makefiles", "build.pro") if config.check_option("module", "builder") and base.is_windows() and is_no_brandind_build: # check replace replace_path_lib = "" replace_path_lib_file = os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/docbuilder.h" if (config.branding() != ""): replace_path_lib = "../../../build/" + config.branding() + "/lib/" # replace if (replace_path_lib != ""): base.replaceInFile(replace_path_lib_file, "../../../build/lib/", replace_path_lib) base.bash("../core/DesktopEditor/doctrenderer/docbuilder.com/build") # restore if (replace_path_lib != ""): base.replaceInFile(replace_path_lib_file, replace_path_lib, "../../../build/lib/") return
def uninstallProgram(sName): base.print_info("Uninstalling all versions " + sName + "...") unInfo = get_programUninstalls(sName) for info in unInfo: if (base.is_file(info) == False): info = info.replace('/I', '/x').replace('/i', '/x') + ' /qn' else: info = '"' + info + '" /S' print("Uninstalling " + sName + "...") print(info) if (os.system(info) != 0): print("Uninstalling was failed!") return False return True
def make(): git_dir = base.get_script_dir() + "/../.." old_cur = os.getcwd() work_dir = git_dir + "/server/FileConverter/bin" if not base.is_dir(work_dir): base.create_dir(work_dir) os.chdir(work_dir) arch = "x64" arch2 = "_64" if ("windows" == base.host_platform()) and not base.host_platform_is64(): arch = "x86" arch2 = "_32" url = get_core_url(arch, config.option("branch")) data_url = base.get_file_last_modified_url(url) if (data_url == "" and config.option("branch") != "develop"): url = get_core_url(arch, "develop") data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./core.7z.data") if (data_url != "" and old_data_url != data_url): print("-----------------------------------------------------------") print("Downloading core last version... --------------------------") print("-----------------------------------------------------------") if (base.is_file("./core.7z")): base.delete_file("./core.7z") if (base.is_dir("./core")): base.delete_dir("./core") base.download(url, "./core.7z") print("-----------------------------------------------------------") print("Extracting core last version... ---------------------------") print("-----------------------------------------------------------") base.extract("./core.7z", "./") base.writeFile("./core.7z.data", data_url) platform = "" if ("windows" == base.host_platform()): platform = "win" + arch2 else: platform = base.host_platform() + arch2 base.copy_files("./core/*", "./") else: print("-----------------------------------------------------------") print("Core is up to date. ---------------------------------------") print("-----------------------------------------------------------") base.generate_doctrenderer_config("./DoctRenderer.config", "../../../sdkjs/deploy/", "server", "../../../web-apps/vendor/") base.support_old_versions_plugins(git_dir + "/sdkjs-plugins") if base.is_dir(git_dir + "/fonts"): base.delete_dir(git_dir + "/fonts") base.create_dir(git_dir + "/fonts") if ("mac" == base.host_platform()): base.mac_correct_rpath_x2t("./") print("-----------------------------------------------------------") print("All fonts generation... -----------------------------------") print("-----------------------------------------------------------") base.cmd_exe("./allfontsgen", [ "--input=../../../core-fonts", "--allfonts-web=../../../sdkjs/common/AllFonts.js", "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images", "--selection=./font_selection.bin", "--use-system=true", "--output-web=../../../fonts" ]) print("All presentation themes generation... ---------------------") print("-----------------------------------------------------------") base.cmd_exe("./allthemesgen", [ "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"" ]) #print("- allthemesgen (ios) --------------------------------------") #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=ios", "--params=280,224"]) # android #print("- allthemesgen (android) ----------------------------------") #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=android", "--params=280,224"]) # add directories to open directories addon_base_path = "../../../" server_config = {} static_content = {} sql = {} server_addons = [] if (config.option("server-addons") != ""): server_addons = config.option("server-addons").rsplit(", ") if ("server-lockstorage" in server_addons): server_config["editorDataStorage"] = "editorDataRedis" sdkjs_addons = [] if (config.option("sdkjs-addons") != ""): sdkjs_addons = config.option("sdkjs-addons").rsplit(", ") for addon in sdkjs_addons: static_content["/" + addon] = {"path": addon_base_path + addon} web_apps_addons = [] if (config.option("web-apps-addons") != ""): web_apps_addons = config.option("web-apps-addons").rsplit(", ") for addon in web_apps_addons: static_content["/" + addon] = {"path": addon_base_path + addon} if (config.option("external-folder") != ""): external_folder = config.option("external-folder") static_content["/sdkjs"] = { "path": addon_base_path + external_folder + "/sdkjs" } static_content["/web-apps"] = { "path": addon_base_path + external_folder + "/web-apps" } if (config.option("sql-type") != ""): sql["type"] = config.option("sql-type") if (config.option("db-port") != ""): sql["dbPort"] = config.option("db-port") if (config.option("db-user") != ""): sql["dbUser"] = config.option("db-user") if (config.option("db-pass") != ""): sql["dbPass"] = config.option("db-pass") server_config["static_content"] = static_content json_file = git_dir + "/server/Common/config/local-development-" + base.host_platform( ) + ".json" base.writeFile( json_file, json.dumps( { "services": { "CoAuthoring": { "server": server_config, "sql": sql } } }, indent=2)) os.chdir(old_cur) return
def install_deps(): if base.is_file("./packages_complete"): return # dependencies packages = [ "apt-transport-https", "autoconf2.13", "build-essential", "ca-certificates", "cmake", "curl", "git", "glib-2.0-dev", "libglu1-mesa-dev", "libgtk-3-dev", "libpulse-dev", "libtool", "p7zip-full", "subversion", "gzip", "libasound2-dev", "libatspi2.0-dev", "libcups2-dev", "libdbus-1-dev", "libicu-dev", "libglu1-mesa-dev", "libgstreamer1.0-dev", "libgstreamer-plugins-base1.0-dev", "libx11-xcb-dev", "libxcb*", "libxi-dev", "libxrender-dev", "libxss1", "libncurses5" ] base.cmd("sudo", ["apt-get", "install", "-y"] + packages) # nodejs base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) nodejs_cur = 0 try: nodejs_version = base.run_command('node -v')['stdout'] nodejs_cur_version_major = int(nodejs_version.split('.')[0][1:]) nodejs_cur_version_minor = int(nodejs_version.split('.')[1]) nodejs_cur = nodejs_cur_version_major * 1000 + nodejs_cur_version_minor print("Installed Node.js version: " + str(nodejs_cur_version_major) + "." + str(nodejs_cur_version_minor)) except: nodejs_cur = 1 if (nodejs_cur < 10020): print("Node.js version cannot be less 10.20") print("Reinstall") if (base.is_dir("./node_js_setup_10.x")): base.delete_dir("./node_js_setup_10.x") base.cmd("sudo", ["apt-get", "remove", "--purge", "-y", "nodejs"]) base.download("https://deb.nodesource.com/setup_10.x", "./node_js_setup_10.x") base.cmd( 'curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -' ) base.cmd("sudo", ["bash", "./node_js_setup_10.x"]) base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) base.cmd("sudo", ["npm", "install", "-g", "npm@6"]) else: print("OK") base.cmd("sudo", ["apt-get", "-y", "install", "npm", "yarn"], True) base.cmd("sudo", ["npm", "install", "-g", "grunt-cli"]) base.cmd("sudo", ["npm", "install", "-g", "pkg"]) # java java_error = base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-11-jdk"], True) if (0 != java_error): java_error = base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"], True) if (0 != java_error): base.cmd("sudo", ["apt-get", "-y", "install", "software-properties-common"]) base.cmd("sudo", ["add-apt-repository", "-y", "ppa:openjdk-r/ppa"]) base.cmd("sudo", ["apt-get", "update"]) base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"]) base.cmd("sudo", ["update-alternatives", "--config", "java"]) base.cmd("sudo", ["update-alternatives", "--config", "javac"]) base.writeFile("./packages_complete", "complete") return
"examples", "-nomake", "tests", "-skip", "qtenginio", "-skip", "qtlocation", "-skip", "qtserialport", "-skip", "qtsensors", "-skip", "qtxmlpatterns", "-skip", "qt3d", "-skip", "qtwebview", "-skip", "qtwebengine" ] base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "./configure", qt_params) base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["-j", "4"]) base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["install"]) return if not base.is_file("./node_js_setup_10.x"): print("install dependencies...") install_deps() if not base.is_dir("./qt_build"): print("install qt...") install_qt() branch = get_branch_name("../..") array_args = sys.argv[1:] array_modules = [] config = {} for arg in array_args: if (0 == arg.find("--")):
def make(): if ("1" == base.get_env("OO_NO_BUILD_JS")): return base_dir = base.get_script_dir() + "/.." out_dir = base_dir + "/out/js/" branding = config.option("branding-name") if ("" == branding): branding = "onlyoffice" out_dir += branding base.create_dir(out_dir) # builder build_interface(base_dir + "/../web-apps/build") build_sdk_builder(base_dir + "/../sdkjs/build") base.create_dir(out_dir + "/builder") base.copy_dir(base_dir + "/../web-apps/deploy/web-apps", out_dir + "/builder/web-apps") base.copy_dir(base_dir + "/../sdkjs/deploy/sdkjs", out_dir + "/builder/sdkjs") # desktop if config.check_option("module", "desktop"): build_sdk_desktop(base_dir + "/../sdkjs/build") base.create_dir(out_dir + "/desktop") base.copy_dir(base_dir + "/../sdkjs/deploy/sdkjs", out_dir + "/desktop/sdkjs") base.copy_dir(base_dir + "/../web-apps/deploy/web-apps", out_dir + "/desktop/web-apps") if not base.is_file(out_dir + "/desktop/sdkjs/common/AllFonts.js"): base.copy_file( base_dir + "/../sdkjs/common/HtmlFileInternal/AllFonts.js", out_dir + "/desktop/sdkjs/common/AllFonts.js") base.delete_dir(out_dir + "/desktop/web-apps/apps/documenteditor/embed") base.delete_dir(out_dir + "/desktop/web-apps/apps/documenteditor/mobile") base.delete_dir(out_dir + "/desktop/web-apps/apps/presentationeditor/embed") base.delete_dir(out_dir + "/desktop/web-apps/apps/presentationeditor/mobile") base.delete_dir(out_dir + "/desktop/web-apps/apps/spreadsheeteditor/embed") base.delete_dir(out_dir + "/desktop/web-apps/apps/spreadsheeteditor/mobile") base.copy_file( base_dir + "/../web-apps/apps/api/documents/index.html.desktop", out_dir + "/desktop/web-apps/apps/api/documents/index.html") build_interface(base_dir + "/../desktop-apps/common/loginpage/build") base.copy_file( base_dir + "/../desktop-apps/common/loginpage/deploy/index.html", out_dir + "/desktop/index.html") # mobile if config.check_option("module", "mobile"): build_sdk_native(base_dir + "/../sdkjs/build") base.create_dir(out_dir + "/mobile") base.create_dir(out_dir + "/mobile/sdkjs") vendor_dir_src = base_dir + "/../web-apps/vendor/" sdk_dir_src = base_dir + "/../sdkjs/deploy/sdkjs/" # banners base.join_scripts([ vendor_dir_src + "xregexp/xregexp-all-min.js", vendor_dir_src + "underscore/underscore-min.js", sdk_dir_src + "common/Native/native.js", sdk_dir_src + "../../common/Native/Wrappers/common.js", sdk_dir_src + "common/Native/jquery_native.js" ], out_dir + "/mobile/sdkjs/banners.js") base.create_dir(out_dir + "/mobile/sdkjs/word") base.join_scripts([ out_dir + "/mobile/sdkjs/banners.js", sdk_dir_src + "word/sdk-all-min.js", sdk_dir_src + "word/sdk-all.js" ], out_dir + "/mobile/sdkjs/word/script.bin") base.create_dir(out_dir + "/mobile/sdkjs/cell") base.join_scripts([ out_dir + "/mobile/sdkjs/banners.js", sdk_dir_src + "cell/sdk-all-min.js", sdk_dir_src + "cell/sdk-all.js" ], out_dir + "/mobile/sdkjs/cell/script.bin") base.create_dir(out_dir + "/mobile/sdkjs/slide") base.join_scripts([ out_dir + "/mobile/sdkjs/banners.js", sdk_dir_src + "slide/sdk-all-min.js", sdk_dir_src + "slide/sdk-all.js" ], out_dir + "/mobile/sdkjs/slide/script.bin") base.delete_file(out_dir + "/mobile/sdkjs/banners.js") return
if not base.is_dir(branding_dir): is_exist = False base.cmd( "git", ["clone", config.option("branding-url"), branding_dir]) base.cmd_in_dir(branding_dir, "git", ["fetch"], True) if not is_exist or ("1" != config.option("update-light")): base.cmd_in_dir( branding_dir, "git", ["checkout", "-f", config.option("branch")]) base.cmd_in_dir(branding_dir, "git", ["pull"], True) if base.is_file(branding_dir + "/build_tools/make.py"): base.check_build_version(branding_dir + "/build_tools") base.set_env("OO_RUNNING_BRANDING", "1") base.set_env("OO_BRANDING", config.option("branding")) base.cmd_in_dir(branding_dir + "/build_tools", "python", ["make.py"]) exit(0) # correct defaults (the branding repo is already updated) config.parse_defaults() base.check_build_version(base_dir) # update if ("1" == config.option("update")): base.git_update("core") base.git_update("sdkjs")
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
"_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("-I./wasm/src") compiler_flags.append( "-DWIN32 -DNDEBUG -DHUNSPELL_STATIC -DBUILDING_LIBHUNSPELL -DHUNSPELL_WASM_MODULE" )
def make(): base_dir = base.get_script_dir() + "/../out" git_dir = base.get_script_dir() + "/../.." core_dir = git_dir + "/core" core_build_dir = core_dir + "/build" branding = config.branding() if ("" != config.option("branding")): core_build_dir += ("/" + config.option("branding")) platforms = config.option("platform").split() for native_platform in platforms: if not native_platform in config.platforms: continue archive_dir = base_dir + ("/" + native_platform + "/" + branding + "/core") if (base.is_dir(archive_dir)): base.delete_dir(archive_dir) base.create_dir(archive_dir) platform = native_platform base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "kernel") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "graphics") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "doctrenderer") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "HtmlRenderer") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "DjVuFile") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "XpsFile") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "PdfReader") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "PdfWriter") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "HtmlFile2") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "UnicodeConverter") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "Fb2File") base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "EpubFile") base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "x2t") base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", archive_dir + "/sdkjs") base.create_dir(archive_dir + "/sdkjs/vendor") base.copy_dir( base_dir + "/js/" + branding + "/builder/web-apps/vendor/jquery", archive_dir + "/sdkjs/vendor/jquery") base.copy_dir( base_dir + "/js/" + branding + "/builder/web-apps/vendor/xregexp", archive_dir + "/sdkjs/vendor/xregexp") if ("windows" == base.host_platform()): base.copy_files( core_dir + "/Common/3dParty/icu/" + platform + "/build/*.dll", archive_dir + "/") base.copy_files( core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/release/icudt*.dat", archive_dir + "/") else: base.copy_files( core_dir + "/Common/3dParty/icu/" + platform + "/build/*", archive_dir + "/") base.copy_file( core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/icudtl.dat", archive_dir + "/") base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "allfontsgen") base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "allthemesgen") base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "standardtester") if base.is_file(archive_dir + "/core.7z"): base.delete_file(archive_dir + "/core.7z") base.archive_folder(archive_dir, archive_dir + "/core.7z") return
def make(): if not is_main_platform(): make_xp() return if ("ios" == config.option("platform")): return print("[fetch & build]: v8") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8" 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("v8/out.gn"): clean() if not base.is_dir("depot_tools"): base.cmd("git", [ "clone", "https://chromium.googlesource.com/chromium/tools/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"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"] if not base.is_dir("v8/out.gn"): base.cmd("gclient") # -------------------------------------------------------------------------- # fetch if not base.is_dir("v8"): base.cmd("./depot_tools/fetch", ["v8"], True) os.chdir(base_dir + "/v8") base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True) os.chdir(base_dir) # -------------------------------------------------------------------------- # correct if not base.is_dir("v8/out.gn"): base.cmd("gclient", ["sync"], True) if ("linux" == base.host_platform()): if base.is_dir("v8/third_party/binutils/Linux_x64/Release"): base.delete_dir("v8/third_party/binutils/Linux_x64/Release") if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"): base.delete_dir("v8/third_party/binutils/Linux_ia32/Release") base.cmd("gclient", ["sync", "--no-history"]) if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"): for file in os.listdir( "v8/third_party/binutils/Linux_x64/Release/bin"): name = file.split("/")[-1] if ("ld.gold" != name): base.cmd("mv", [ "v8/third_party/binutils/Linux_x64/Release/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/old_" + name ]) base.cmd("ln", [ "-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/" + name ]) if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"): for file in os.listdir( "v8/third_party/binutils/Linux_ia32/Release/bin"): name = file.split("/")[-1] if ("ld.gold" != name): base.cmd("mv", [ "v8/third_party/binutils/Linux_ia32/Release/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/old_" + name ]) base.cmd("ln", [ "-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/" + name ]) if ("windows" == base.host_platform()): base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt", ":dynamic_crt") if ("mac" == base.host_platform()): base.replaceInFile( "v8/build/config/mac/mac_sdk.gni", "if (mac_sdk_version != mac_sdk_min_build_override", "if (false && mac_sdk_version != mac_sdk_min_build_override") # -------------------------------------------------------------------------- # build os.chdir("v8") base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false" base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false" if config.check_option("platform", "linux_64"): base.cmd2("gn", [ "gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=false use_sysroot=false\"" ]) base.cmd("ninja", ["-C", "out.gn/linux_64"]) if config.check_option("platform", "linux_32"): base.cmd2("gn", [ "gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=false use_sysroot=false\"" ]) base.cmd("ninja", ["-C", "out.gn/linux_32"]) if config.check_option("platform", "mac_64"): base.cmd2("gn", [ "gen", "out.gn/mac_64", "--args=\"is_debug=false " + base_args64 + "\"" ]) base.cmd("ninja", ["-C", "out.gn/mac_64"]) if config.check_option("platform", "win_64"): if (-1 != config.option("config").lower().find("debug")): base.cmd2("gn", [ "gen", "out.gn/win_64/debug", "--args=\"is_debug=true " + base_args64 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_64/debug"]) base.cmd2("gn", [ "gen", "out.gn/win_64/release", "--args=\"is_debug=false " + base_args64 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_64/release"]) if config.check_option("platform", "win_32"): if (-1 != config.option("config").lower().find("debug")): base.cmd2("gn", [ "gen", "out.gn/win_32/debug", "--args=\"is_debug=true " + base_args32 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_32/debug"]) base.cmd2("gn", [ "gen", "out.gn/win_32/release", "--args=\"is_debug=false " + base_args32 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_32/release"]) os.chdir(old_cur) make_xp() 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
parser.add_option("--package", action="store", type="string", dest="package", default="", help="defines packages") (options, args) = parser.parse_args(sys.argv[1:]) configOptions = vars(options) branding = configOptions["branding"] product = configOptions["product"] package_list = configOptions["package"] base_dir = base.get_script_dir(__file__) # branding if ("" != branding): branding_dir = base_dir + "/../" + branding if base.is_file(branding_dir + "/build_tools/make_packages.py"): base.check_build_version(branding_dir + "/build_tools") base.cmd_in_dir(branding_dir + "/build_tools", "python3", [ "make_packages.py", '--product', product, '--package', package_list ]) exit(0) base.check_build_version(base_dir) # build packages packages.make(product, package_list)
def make(): git_dir = base.get_script_dir() + "/../.." old_cur = os.getcwd() work_dir = git_dir + "/server/FileConverter/bin" if not base.is_dir(work_dir): base.create_dir(work_dir) os.chdir(work_dir) arch = "x64" arch2 = "_64" if ("windows" == base.host_platform()) and not base.host_platform_is64(): arch = "x86" arch2 = "_32" url = "http://repo-doc-onlyoffice-com.s3.amazonaws.com/" + base.host_platform( ) + "/core/" + config.option("branch") + "/latest/" + arch + "/core.7z" data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./core.7z.data") if (old_data_url != data_url): print("-----------------------------------------------------------") print("Downloading core last version... --------------------------") print("-----------------------------------------------------------") if (base.is_file("./core.7z")): base.delete_file("./core.7z") if (base.is_dir("./core")): base.delete_dir("./core") if (base.is_dir("./HtmlFileInternal")): base.delete_dir("./HtmlFileInternal") base.download(url, "./core.7z") print("-----------------------------------------------------------") print("Extracting core last version... ---------------------------") print("-----------------------------------------------------------") base.extract("./core.7z", "./") base.writeFile("./core.7z.data", data_url) platform = "" if ("windows" == base.host_platform()): platform = "win" + arch2 else: platform = base.host_platform() + arch2 base.copy_files("./core/*", "./") base.generate_doctrenderer_config("./DoctRenderer.config", "../../../sdkjs/deploy/", "server", "../../../web-apps/vendor/") base.support_old_versions_plugins(git_dir + "/sdkjs-plugins") if base.is_dir(git_dir + "/fonts"): base.delete_dir(git_dir + "/fonts") base.create_dir(git_dir + "/fonts") if ("mac" == base.host_platform()): base.mac_correct_rpath_x2t("./") print("-----------------------------------------------------------") print("All fonts generation... -----------------------------------") print("-----------------------------------------------------------") base.cmd_exe("./allfontsgen", [ "--input=../../../core-fonts", "--allfonts-web=../../../sdkjs/common/AllFonts.js", "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images", "--selection=./font_selection.bin", "--use-system=true", "--output-web=../../../fonts" ]) print("All presentation themes generation... ---------------------") print("-----------------------------------------------------------") base.cmd_exe("./allthemesgen", [ "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"" ]) # add directories to open directories data_local_devel = "{\n" data_local_devel += "\"services\": {\n" data_local_devel += "\"CoAuthoring\": {\n" data_local_devel += "\"server\": {\n" data_local_devel += "\"static_content\": {\n" is_exist_addons = False for addon in config.sdkjs_addons: data_local_devel += ("\"/" + config.sdkjs_addons[addon] + "\" : { \"path\": \"../../../" + config.sdkjs_addons[addon] + "\" },\n") is_exist_addons = True for addon in config.web_apps_addons: data_local_devel += ("\"/" + config.web_apps_addons[addon] + "\" : { \"path\": \"../../../" + config.web_apps_addons[addon] + "\" },\n") is_exist_addons = True if is_exist_addons: data_local_devel = data_local_devel[:-2] data_local_devel += "\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" base.writeFile( git_dir + "/server/Common/config/local-development-" + base.host_platform() + ".json", data_local_devel) os.chdir(old_cur) return
def make(): print("[fetch & build]: cef") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/cef" old_cur = os.getcwd() os.chdir(base_dir) platforms = ["win_64", "win_32", "win_64_xp", "win_32_xp", "linux_64", "linux_32", "mac_64"] url = "http://d2ettrnqo7v976.cloudfront.net/cef/3770/" for platform in platforms: if not config.check_option("platform", platform): continue url += (platform + "/cef_binary.7z") if not base.is_dir(platform): base.create_dir(platform) os.chdir(platform) data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./cef_binary.7z.data") if (data_url != old_data_url): if base.is_file("./cef_binary.7z"): base.delete_file("./cef_binary.7z") if base.is_dir("build"): base.delete_dir("build") if base.is_dir("build"): continue # download if not base.is_file("./cef_binary.7z"): base.download(url, "./cef_binary.7z") # extract base.extract("./cef_binary.7z", "./") base.delete_file("./cef_binary.7z.data") base.writeFile("./cef_binary.7z.data", data_url) base.create_dir("./build") # deploy if ("mac_64" != platform): base.copy_files("cef_binary/Release/*", "build/") base.copy_files("cef_binary/Resources/*", "build/") if (0 == platform.find("linux")): base.cmd("chmod", ["a+xr", "build/locales"]) if ("mac_64" == platform): base.cmd("mv", ["Chromium Embedded Framework.framework", "build/Chromium Embedded Framework.framework"]) os.chdir(base_dir) 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(): if not is_main_platform(): make_xp() return base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8" if ("ios" == config.option("platform")): return if (-1 != config.option("platform").find("android")): base.cmd_in_dir(base_dir + "/android", "python", ["./make.py"]) if (-1 == config.option("platform").find("linux")) and ( -1 == config.option("platform").find("mac")) and ( -1 == config.option("platform").find("win")): return print("[fetch & build]: v8") old_env = dict(os.environ) 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("v8/out.gn"): 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") if base.is_file("depot_tools/fetch_configs/v8.py"): base.replaceInFile("depot_tools/fetch_configs/v8.py", "https://chromium.googlesource.com/v8/v8.git", "https://gitee.com/mirrors/V8.git") os.environ[ "PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"] if not base.is_dir("v8/out.gn"): base.cmd("gclient") # -------------------------------------------------------------------------- # fetch if not base.is_dir("v8"): base.cmd("./depot_tools/fetch", ["v8"], True) os.chdir(base_dir + "/v8") base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True) os.chdir(base_dir) # -------------------------------------------------------------------------- # correct if not base.is_dir("v8/out.gn"): # windows hack (delete later) ---------------------- if ("windows" == base.host_platform()): base.delete_dir_with_access_error("v8/buildtools/win") base.cmd("git", ["config", "--system", "core.longpaths", "true"]) base.cmd("gclient", ["sync", "--force"], True) else: base.cmd("gclient", ["sync"], True) # normal version !!! #base.cmd("gclient", ["sync"], True) # -------------------------------------------------- if ("linux" == base.host_platform()): if base.is_dir("v8/third_party/binutils/Linux_x64/Release"): base.delete_dir("v8/third_party/binutils/Linux_x64/Release") if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"): base.delete_dir("v8/third_party/binutils/Linux_ia32/Release") base.cmd("gclient", ["sync", "--no-history"]) if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"): for file in os.listdir( "v8/third_party/binutils/Linux_x64/Release/bin"): name = file.split("/")[-1] if ("ld.gold" != name): base.cmd("mv", [ "v8/third_party/binutils/Linux_x64/Release/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/old_" + name ]) base.cmd("ln", [ "-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/" + name ]) if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"): for file in os.listdir( "v8/third_party/binutils/Linux_ia32/Release/bin"): name = file.split("/")[-1] if ("ld.gold" != name): base.cmd("mv", [ "v8/third_party/binutils/Linux_ia32/Release/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/old_" + name ]) base.cmd("ln", [ "-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/" + name ]) if ("windows" == base.host_platform()): base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt", ":dynamic_crt") if ("mac" == base.host_platform()): base.replaceInFile( "v8/build/config/mac/mac_sdk.gni", "if (mac_sdk_version != mac_sdk_min_build_override", "if (false && mac_sdk_version != mac_sdk_min_build_override") base.replaceInFile("v8/build/mac/find_sdk.py", "^MacOSX(10\\.\\d+)\\.sdk$", "^MacOSX(1\\d\\.\\d+)\\.sdk$") # -------------------------------------------------------------------------- # build os.chdir("v8") base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false" base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false" if config.check_option("platform", "linux_64"): base.cmd2("gn", [ "gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=" + is_use_clang() + " use_sysroot=false treat_warnings_as_errors=false\"" ]) base.cmd("ninja", ["-C", "out.gn/linux_64"]) if config.check_option("platform", "linux_32"): base.cmd2("gn", [ "gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=" + is_use_clang() + " use_sysroot=false treat_warnings_as_errors=false\"" ]) base.cmd("ninja", ["-C", "out.gn/linux_32"]) if config.check_option("platform", "mac_64"): base.cmd2("gn", [ "gen", "out.gn/mac_64", "--args=\"is_debug=false " + base_args64 + "\"" ]) base.cmd("ninja", ["-C", "out.gn/mac_64"]) if config.check_option("platform", "win_64"): if (-1 != config.option("config").lower().find("debug")): base.cmd2("gn", [ "gen", "out.gn/win_64/debug", "--args=\"is_debug=true " + base_args64 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_64/debug"]) base.cmd2("gn", [ "gen", "out.gn/win_64/release", "--args=\"is_debug=false " + base_args64 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_64/release"]) if config.check_option("platform", "win_32"): if (-1 != config.option("config").lower().find("debug")): base.cmd2("gn", [ "gen", "out.gn/win_32/debug", "--args=\"is_debug=true " + base_args32 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_32/debug"]) base.cmd2("gn", [ "gen", "out.gn/win_32/release", "--args=\"is_debug=false " + base_args32 + " is_clang=false\"" ]) base.cmd("ninja", ["-C", "out.gn/win_32/release"]) os.chdir(old_cur) os.environ.clear() os.environ.update(old_env) make_xp() 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("------------------------------------------") # 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_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")
import sys sys.path.append('./../../../../../build_tools/scripts') import base import os if ("linux" == base.host_platform()): if not base.is_dir("./build"): base.bash("./build") if ("mac" == base.host_platform()): if not base.is_file("./build.zip"): base.bash("./run_docker") if not base.is_dir("./build"): base.configure_common_apps( "./../../../../../build_tools/scripts/base.py") base.extract("./build.zip", "./") if not base.is_dir("v8"): if not base.is_dir("depot_tools"): base.cmd("git", [ "clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git" ]) old_cur = os.getcwd() os.environ[ "PATH"] = old_cur + "/depot_tools" + os.pathsep + os.environ["PATH"] base.cmd("./depot_tools/fetch", ["v8"], True) os.chdir(old_cur + "/v8") base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True) os.chdir(old_cur) base.cmd("gclient", ["sync"])