diff --git a/build.pro b/build.pro index f931617..36138e9 100644 --- a/build.pro +++ b/build.pro @@ -4,27 +4,7 @@ ROOT_DIR=$$PWD/.. DEPLOY_DIR=$$PWD/deploy CORE_ROOT_DIR=$$ROOT_DIR/core -include($$CORE_ROOT_DIR/Common/base.pri) - -MAKEFILE=makefiles/build.makefile_$$CORE_BUILDS_PLATFORM_PREFIX -PRO_SUFFIX=$$CORE_BUILDS_PLATFORM_PREFIX - -core_debug { - MAKEFILE=$$join(MAKEFILE, , , "_debug_") - PRO_SUFFIX=$$join(PRO_SUFFIX, , , "_debug_") -} -build_xp { - MAKEFILE=$$join(MAKEFILE, , , "_xp") - PRO_SUFFIX=$$join(PRO_SUFFIX, , , "_xp") -} -OO_BRANDING_SUFFIX = $$(OO_BRANDING) -!isEmpty(OO_BRANDING_SUFFIX) { - PRO_SUFFIX=$$join(PRO_SUFFIX, , , "$$OO_BRANDING_SUFFIX") - MAKEFILE=$$join(MAKEFILE, , , "$$OO_BRANDING_SUFFIX") -} - -message(current_makefile) -message($$MAKEFILE) +include($$PWD/common.pri) CONFIG += ordered @@ -48,50 +28,6 @@ core_android { CONFIG += no_tests } -defineTest(removeFile) { - file = $$1 - win32:file ~= s,/,\\,g - core_windows { - system(if exist $$shell_quote($$file) $$QMAKE_DEL_FILE $$shell_quote($$file) $$escape_expand(\\n\\t)) - } else { - system($$QMAKE_DEL_FILE $$shell_quote($$file) $$escape_expand(\\n\\t)) - } -} -defineTest(qmakeClear) { - dir = $$1 - name = $$2 - removeFile($$1/Makefile.$$2$$PRO_SUFFIX) - removeFile($$1/.qmake.stash) -} - -# addSubProject() - adds project to SUBDIRS, creates variables associated with the project(file, makefile, depends) -# Arg1 - Project name -# Arg2 - Qmake file of project -# Arg3(optional) - Project dependencies -defineTest(addSubProject) { - pro_name = $$1 - pro_file = $$2 - pro_depends = $$3 - isEmpty(pro_name):error(Sub-project name is not defined.) - isEmpty(pro_file):error(Qmake file of sub-project \'$$pro_name\' is not defined.) - !exists($$pro_file):error(Sub-project qmake file \'$$pro_file\' is not exists.) - path = $$section(pro_file, /, 0, -2) - ext_name = $$section(pro_file, /, -1, -1) - name = $$section(ext_name, ., 0, 0) - SUBDIRS += $$pro_name - export(SUBDIRS) - $${pro_name}.file = $$pro_file - export($${pro_name}.file) - $${pro_name}.makefile = $$path/Makefile.$$name$$PRO_SUFFIX - export($${pro_name}.makefile) - !isEmpty(pro_depends) { - $${pro_name}.depends = $$pro_depends - export($${pro_name}.depends) - } - # remove makefile - qmakeClear(path, name) -} - addSubProject(cryptopp, $$CORE_ROOT_DIR/Common/3dParty/cryptopp/project/cryptopp.pro) addSubProject(kernel, $$CORE_ROOT_DIR/Common/kernel.pro,\ cryptopp) diff --git a/common.pri b/common.pri new file mode 100644 index 0000000..d32d30f --- /dev/null +++ b/common.pri @@ -0,0 +1,69 @@ +# must setup CORE_ROOT_DIR before including + +include($$CORE_ROOT_DIR/Common/base.pri) + +MAKEFILE=makefiles/build.makefile_$$CORE_BUILDS_PLATFORM_PREFIX +PRO_SUFFIX=$$CORE_BUILDS_PLATFORM_PREFIX + +core_debug { + MAKEFILE=$$join(MAKEFILE, , , "_debug_") + PRO_SUFFIX=$$join(PRO_SUFFIX, , , "_debug_") +} +build_xp { + MAKEFILE=$$join(MAKEFILE, , , "_xp") + PRO_SUFFIX=$$join(PRO_SUFFIX, , , "_xp") +} +OO_BRANDING_SUFFIX = $$(OO_BRANDING) +!isEmpty(OO_BRANDING_SUFFIX) { + PRO_SUFFIX=$$join(PRO_SUFFIX, , , "$$OO_BRANDING_SUFFIX") + MAKEFILE=$$join(MAKEFILE, , , "$$OO_BRANDING_SUFFIX") +} + +message(current_makefile) +message($$MAKEFILE) + +CONFIG += ordered + +defineTest(removeFile) { + file = $$1 + win32:file ~= s,/,\\,g + core_windows { + system(if exist $$shell_quote($$file) $$QMAKE_DEL_FILE $$shell_quote($$file) $$escape_expand(\\n\\t)) + } else { + system($$QMAKE_DEL_FILE $$shell_quote($$file) $$escape_expand(\\n\\t)) + } +} +defineTest(qmakeClear) { + dir = $$1 + name = $$2 + removeFile($$1/Makefile.$$2$$PRO_SUFFIX) + removeFile($$1/.qmake.stash) +} + +# addSubProject() - adds project to SUBDIRS, creates variables associated with the project(file, makefile, depends) +# Arg1 - Project name +# Arg2 - Qmake file of project +# Arg3(optional) - Project dependencies +defineTest(addSubProject) { + pro_name = $$1 + pro_file = $$2 + pro_depends = $$3 + isEmpty(pro_name):error(Sub-project name is not defined.) + isEmpty(pro_file):error(Qmake file of sub-project \'$$pro_name\' is not defined.) + !exists($$pro_file):error(Sub-project qmake file \'$$pro_file\' is not exists.) + path = $$section(pro_file, /, 0, -2) + ext_name = $$section(pro_file, /, -1, -1) + name = $$section(ext_name, ., 0, 0) + SUBDIRS += $$pro_name + export(SUBDIRS) + $${pro_name}.file = $$pro_file + export($${pro_name}.file) + $${pro_name}.makefile = $$path/Makefile.$$name$$PRO_SUFFIX + export($${pro_name}.makefile) + !isEmpty(pro_depends) { + $${pro_name}.depends = $$pro_depends + export($${pro_name}.depends) + } + # remove makefile + qmakeClear(path, name) +} diff --git a/scripts/base.py b/scripts/base.py index acdabfa..54d6740 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -97,6 +97,14 @@ def copy_file(src, dst): return return shutil.copy2(get_path(src), get_path(dst)) +def move_file(src, dst): + if is_file(dst): + delete_file(dst) + if not is_file(src): + print("move warning [file not exist]: " + src) + return + return shutil.move(get_path(src), get_path(dst)) + def copy_files(src, dst, override=True): for file in glob.glob(src): file_name = os.path.basename(file) @@ -111,6 +119,20 @@ def copy_files(src, dst, override=True): copy_files(file + "/*", dst + "/" + file_name, override) return +def move_files(src, dst, override=True): + for file in glob.glob(src): + file_name = os.path.basename(file) + if is_file(file): + if override and is_file(dst + "/" + file_name): + delete_file(dst + "/" + file_name) + if not is_file(dst + "/" + file_name): + move_file(file, dst) + elif is_dir(file): + if not is_dir(dst + "/" + file_name): + create_dir(dst + "/" + file_name) + move_files(file + "/*", dst + "/" + file_name, override) + return + def copy_dir_content(src, dst, filterInclude = "", filterExclude = ""): src_folder = src if ("/" != src[-1:]): @@ -440,8 +462,20 @@ def get_repositories(): if (config.check_option("module", "server") or config.check_option("platform", "ios")): result["core-fonts"] = [False, False] + + get_branding_repositories(result) return result +def get_branding_repositories(checker): + modules = ["core", "server", "mobile", "desktop", "builder"] + for mod in modules: + name = "repositories_" + mod + repos = config.option(name).rsplit(", ") + for repo in repos: + if (repo != ""): + checker[repo] = [False, False] + return + def create_pull_request(branches_to, repo, is_no_errors=False, is_current_dir=False): print("[git] create pull request: " + repo) url = "https://github.com/ONLYOFFICE/" + repo + ".git" @@ -537,7 +571,16 @@ def qt_copy_lib(lib, dir): else: copy_lib(qt_dir, dir, lib + "d") else: - copy_file(qt_dir + "/../lib/lib" + lib + ".so." + qt_version(), dir + "/lib" + lib + ".so." + qt_major_version()) + src_file = qt_dir + "/../lib/lib" + lib + ".so." + qt_version() + if (is_file(src_file)): + copy_file(src_file, dir + "/lib" + lib + ".so." + qt_major_version()) + else: + libFramework = lib + libFramework = libFramework.replace("Qt5", "Qt") + libFramework = libFramework.replace("Qt6", "Qt") + libFramework += ".framework" + if (is_dir(qt_dir + "/../lib/" + libFramework)): + copy_dir(qt_dir + "/../lib/" + libFramework, dir + "/" + libFramework) return def _check_icu_common(dir, out): diff --git a/scripts/build_js.py b/scripts/build_js.py index 0e6624a..a88edd9 100644 --- a/scripts/build_js.py +++ b/scripts/build_js.py @@ -102,9 +102,12 @@ def build_interface(directory): return def get_build_param(minimize=True): + minimize_scripts = minimize + if config.check_option("jsminimize", "0"): + minimize_scripts = False beta = "true" if config.check_option("beta", "1") else "false" params = ["--beta=" + beta] - return params + (["--level=ADVANCED"] if minimize else ["--level=WHITESPACE_ONLY", "--formatting=PRETTY_PRINT"]) + return params + (["--level=ADVANCED"] if minimize_scripts else ["--level=WHITESPACE_ONLY", "--formatting=PRETTY_PRINT"]) def build_sdk_desktop(directory): #_run_npm_cli(directory) diff --git a/scripts/deploy_mobile.py b/scripts/deploy_mobile.py index 67766b9..50dd89b 100644 --- a/scripts/deploy_mobile.py +++ b/scripts/deploy_mobile.py @@ -45,7 +45,11 @@ def make(): base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "doctrenderer") base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "Fb2File") base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "EpubFile") - base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "x2t") + + if (0 == platform.find("win") or 0 == platform.find("linux") or 0 == platform.find("mac")): + base.copy_exe(core_build_dir + "/bin/" + platform_postfix, root_dir, "x2t") + else: + base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "x2t") # icu if (0 == platform.find("win")):