diff --git a/build.pro b/build.pro deleted file mode 100644 index c2ad71cf..00000000 --- a/build.pro +++ /dev/null @@ -1,149 +0,0 @@ -TEMPLATE = subdirs - -ROOT_DIR=$$PWD/.. -DEPLOY_DIR=$$PWD/deploy -CORE_ROOT_DIR=$$ROOT_DIR/core - -include($$PWD/common.pri) - -CONFIG += ordered - -core:CONFIG += core_libraries -builder:CONFIG += core_libraries -desktop:CONFIG += core_libraries -server:CONFIG += core_libraries -mobile:CONFIG += core_libraries - -!core_libraries:CONFIG += no_x2t -!core_libraries:CONFIG += no_use_common_binary -!core_libraries:CONFIG += no_tests - -core_windows { - desktop:CONFIG += core_and_multimedia -} -core_linux { - desktop:CONFIG += core_and_multimedia -} -core_mac { - CONFIG += no_desktop_apps -} -core_ios { - CONFIG += no_use_common_binary - CONFIG += no_desktop_apps - CONFIG += no_tests -} -core_android { - CONFIG += no_use_common_binary - CONFIG += no_desktop_apps - CONFIG += no_tests -} - -core_libraries { - addSubProject(cryptopp, $$CORE_ROOT_DIR/Common/3dParty/cryptopp/project/cryptopp.pro) - addSubProject(cfcpp, $$CORE_ROOT_DIR/Common/cfcpp/cfcpp.pro) - addSubProject(unicodeconverter, $$CORE_ROOT_DIR/UnicodeConverter/UnicodeConverter.pro,\ - cryptopp) - addSubProject(kernel, $$CORE_ROOT_DIR/Common/kernel.pro,\ - unicodeconverter) - addSubProject(network, $$CORE_ROOT_DIR/Common/Network/network.pro,\ - kernel unicodeconverter) - addSubProject(graphics, $$CORE_ROOT_DIR/DesktopEditor/graphics/pro/graphics.pro,\ - kernel unicodeconverter) - addSubProject(pdffile, $$CORE_ROOT_DIR/PdfFile/PdfFile.pro,\ - kernel unicodeconverter graphics) - addSubProject(djvufile, $$CORE_ROOT_DIR/DjVuFile/DjVuFile.pro,\ - kernel unicodeconverter graphics pdffile) - addSubProject(xpsfile, $$CORE_ROOT_DIR/XpsFile/XpsFile.pro,\ - kernel unicodeconverter graphics pdffile) - addSubProject(htmlrenderer, $$CORE_ROOT_DIR/HtmlRenderer/htmlrenderer.pro,\ - kernel unicodeconverter graphics) - addSubProject(docxrenderer, $$CORE_ROOT_DIR/DocxRenderer/DocxRenderer.pro,\ - kernel unicodeconverter graphics) - addSubProject(htmlfile2, $$CORE_ROOT_DIR/HtmlFile2/HtmlFile2.pro,\ - kernel unicodeconverter graphics network) - addSubProject(doctrenderer, $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/doctrenderer.pro,\ - kernel unicodeconverter graphics) - addSubProject(fb2file, $$CORE_ROOT_DIR/Fb2File/Fb2File.pro,\ - kernel unicodeconverter graphics) - addSubProject(epubfile, $$CORE_ROOT_DIR/EpubFile/CEpubFile.pro,\ - kernel unicodeconverter graphics htmlfile2) -} -!no_x2t { - addSubProject(docxformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro) - addSubProject(pptxformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro) - addSubProject(xlsbformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro) - - addSubProject(docformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/DocFormatLib/Linux/DocFormatLib.pro) - addSubProject(pptformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro) - addSubProject(xlsformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro) - addSubProject(vbaformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/VbaFormatLib/Linux/VbaFormatLib.pro) - - addSubProject(txtxmlformat, $$CORE_ROOT_DIR/TxtFile/Projects/Linux/TxtXmlFormatLib.pro) - addSubProject(rtfformat, $$CORE_ROOT_DIR/RtfFile/Projects/Linux/RtfFormatLib.pro) - addSubProject(odffile, $$CORE_ROOT_DIR/OdfFile/Projects/Linux/OdfFormatLib.pro) - - addSubProject(bindocument, $$CORE_ROOT_DIR/OOXML/Projects/Linux/BinDocument/BinDocument.pro) - - addSubProject(x2t, $$CORE_ROOT_DIR/X2tConverter/build/Qt/X2tConverter.pro,\ - docxformat pptxformat xlsbformat docformat pptformat xlsformat vbaformat txtxmlformat rtfformat odffile cfcpp bindocument fb2file epubfile docxrenderer) -} - -!no_use_common_binary { - addSubProject(allfontsgen, $$CORE_ROOT_DIR/DesktopEditor/AllFontsGen/AllFontsGen.pro,\ - kernel unicodeconverter graphics) - addSubProject(allthemesgen, $$CORE_ROOT_DIR/DesktopEditor/allthemesgen/allthemesgen.pro,\ - kernel unicodeconverter graphics) - addSubProject(docbuilder, $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/app_builder/docbuilder.pro,\ - kernel unicodeconverter graphics doctrenderer) - addSubProject(pluginsmanager, $$CORE_ROOT_DIR/DesktopEditor/pluginsmanager/pluginsmanager.pro,\ - kernel) - addSubProject(vboxtester, $$CORE_ROOT_DIR/DesktopEditor/vboxtester/vboxtester.pro,\ - kernel) -} - -!no_tests { - addSubProject(standardtester, $$CORE_ROOT_DIR/Test/Applications/StandardTester/standardtester.pro) - addSubProject(x2ttester, $$CORE_ROOT_DIR/Test/Applications/x2tTester/x2ttester.pro) - addSubProject(metafiletester, $$CORE_ROOT_DIR/Test/Applications/MetafileTester/MetafileTester.pro) - - #TODO: - !linux_arm64:addSubProject(ooxml_crypt, $$CORE_ROOT_DIR/OfficeCryptReader/ooxml_crypt/ooxml_crypt.pro) -} - -core_and_multimedia { - addSubProject(videoplayer, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/videoplayerlib/videoplayerlib.pro,\ - kernel unicodeconverter graphics) -} -desktop { - message(desktop) - addSubProject(hunspell, $$CORE_ROOT_DIR/Common/3dParty/hunspell/qt/hunspell.pro) - addSubProject(ooxmlsignature, $$CORE_ROOT_DIR/DesktopEditor/xmlsec/src/ooxmlsignature.pro,\ - kernel unicodeconverter graphics) - addSubProject(documentscore, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore.pro,\ - kernel unicodeconverter graphics hunspell ooxmlsignature htmlrenderer pdffile djvufile xpsfile) - addSubProject(documentscore_helper, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore_helper.pro,\ - documentscore) - !core_mac { - addSubProject(qtdocumentscore, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/lib/qt_wrapper/qtascdocumentscore.pro,\ - documentscore) - } - - !no_desktop_apps { - core_windows:addSubProject(projicons, $$ROOT_DIR/desktop-apps/win-linux/extras/projicons/ProjIcons.pro,\ - documentscore videoplayer) - core_windows:!build_xp:addSubProject(updatedaemon, $$ROOT_DIR/desktop-apps/win-linux/extras/update-daemon/UpdateDaemon.pro) - addSubProject(desktopapp, $$ROOT_DIR/desktop-apps/win-linux/ASCDocumentEditor.pro,\ - documentscore videoplayer) - } -} - -mobile { - message(mobile) - !desktop { - addSubProject(hunspell, $$CORE_ROOT_DIR/Common/3dParty/hunspell/qt/hunspell.pro) - } -} - -osign { - addSubProject(osign, $$CORE_ROOT_DIR/DesktopEditor/xmlsec/src/osign/lib/osign.pro) -} diff --git a/develop/README.md b/develop/README.md index d924a375..e8b6a3ef 100644 --- a/develop/README.md +++ b/develop/README.md @@ -45,7 +45,7 @@ instruction show how to use docker without sudo. ```bash cd build_tools/develop docker pull onlyoffice/documentserver -docker build -t documentserver-develop . +docker build --no-cache -t documentserver-develop . ``` **Note**: The dot at the end is required. diff --git a/make.py b/make.py index fe5b5728..9c528008 100755 --- a/make.py +++ b/make.py @@ -1,19 +1,32 @@ #!/usr/bin/env python +import os import sys -sys.path.append('scripts') -sys.path.append('scripts/develop') -sys.path.append('scripts/develop/vendor') -sys.path.append('scripts/core_common') -sys.path.append('scripts/core_common/modules') +__dir__name__ = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(__dir__name__ + '/scripts') +sys.path.append(__dir__name__ + '/scripts/develop') +sys.path.append(__dir__name__ + '/scripts/develop/vendor') +sys.path.append(__dir__name__ + '/scripts/core_common') +sys.path.append(__dir__name__ + '/scripts/core_common/modules') +sys.path.append(__dir__name__ + '/scripts/core_common/modules/android') import config import base -import build +import build_sln import build_js import build_server import deploy import make_common import develop +import argparse + +base.check_python() + +parser = argparse.ArgumentParser(description="options") +parser.add_argument("--build-only-branding", action="store_true") +args = parser.parse_args() + +if (args.build_only_branding): + base.set_env("OO_BUILD_ONLY_BRANDING", "1") # parse configuration config.parse() @@ -59,13 +72,15 @@ base.configure_common_apps() # developing... -develop.make(); +develop.make() # check only js builds if ("1" == base.get_env("OO_ONLY_BUILD_JS")): build_js.make() exit(0) +#base.check_tools() + # core 3rdParty make_common.make() @@ -79,7 +94,7 @@ base.set_env("DESKTOP_URL_UPDATES_DEV_CHANNEL", "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/appcastdev.json") # build -build.make() +build_sln.make() # js build_js.make() diff --git a/make_package.py b/make_package.py index 42e16b53..c65cc864 100755 --- a/make_package.py +++ b/make_package.py @@ -68,9 +68,11 @@ if "core" in common.targets: package_core.make() if "closuremaps_opensource" in common.targets: - package_core.deploy_closuremaps("opensource") + package_core.deploy_closuremaps_sdkjs("opensource") + package_core.deploy_closuremaps_webapps("opensource") if "closuremaps_commercial" in common.targets: - package_core.deploy_closuremaps("commercial") + package_core.deploy_closuremaps_sdkjs("commercial") + package_core.deploy_closuremaps_webapps("commercial") if "desktop" in common.targets: package_desktop.make() if "builder" in common.targets: diff --git a/scripts/base.py b/scripts/base.py index 249b2979..777b5d1c 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -250,6 +250,9 @@ def copy_lib(src, dst, name): create_dir(dst + "/simulator") copy_dir(src + "/simulator/" + name + ".framework", dst + "/simulator/" + name + ".framework") + if is_dir(dst + "/" + name + ".xcframework"): + delete_dir(dst + "/" + name + ".xcframework") + cmd("xcodebuild", ["-create-xcframework", "-framework", dst + "/" + name + ".framework", "-framework", dst + "/simulator/" + name + ".framework", @@ -697,6 +700,22 @@ def check_congig_option_with_platfom(platform, option_name): return True return False +def correct_makefile_after_qmake(platform, file): + if (0 == platform.find("android")): + if ("android_arm64_v8a" == platform): + replaceInFile(file, "_arm64-v8a.a", ".a") + replaceInFile(file, "_arm64-v8a.so", ".so") + if ("android_armv7" == platform): + replaceInFile(file, "_armeabi-v7a.a", ".a") + replaceInFile(file, "_armeabi-v7a.so", ".so") + if ("android_x86_64" == platform): + replaceInFile(file, "_x86_64.a", ".a") + replaceInFile(file, "_x86_64.so", ".so") + if ("android_x86" == platform): + replaceInFile(file, "_x86.a", ".a") + replaceInFile(file, "_x86.so", ".so") + return + def qt_config_platform_addon(platform): config_addon = "" if (0 == platform.find("win")): @@ -751,6 +770,21 @@ def qt_major_version(): qt_dir = qt_version() return qt_dir.split(".")[0] +def qt_version_decimal(): + qt_dir = qt_version() + return 10 * int(qt_dir.split(".")[0]) + int(qt_dir.split(".")[1]) + +def qt_config_as_param(value): + qt_version = qt_version_decimal() + ret_params = [] + if (66 > qt_version): + ret_params.append("CONFIG+=" + value) + else: + params = value.split() + for name in params: + ret_params.append("CONFIG+=" + name) + return ret_params + def qt_copy_lib(lib, dir): qt_dir = get_env("QT_DEPLOY") if ("windows" == host_platform()): @@ -1190,6 +1224,8 @@ def mac_correct_rpath_docbuilder(dir): cmd("chmod", ["-v", "+x", "./docbuilder"]) cmd("install_name_tool", ["-add_rpath", "@executable_path", "./docbuilder"], True) mac_correct_rpath_binary("./docbuilder", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"]) + mac_correct_rpath_library("docbuilder.c", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer"]) + cmd("install_name_tool", ["-add_rpath", "@loader_path", "libdocbuilder.c.dylib"], True) os.chdir(cur_dir) return @@ -1225,6 +1261,19 @@ def mac_correct_rpath_desktop(dir): os.chdir(cur_dir) return +def linux_set_origin_rpath_libraries(dir, libs): + tools_dir = get_script_dir() + "/../tools/linux/elf/" + cur_dir = os.getcwd() + os.chdir(dir) + for lib in libs: + cmd(tools_dir + "patchelf", ["--set-rpath", "\\$ORIGIN", "lib" + lib], True) + os.chdir(cur_dir) + return + +def linux_correct_rpath_docbuilder(dir): + linux_set_origin_rpath_libraries(dir, ["docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so"]) + return + def common_check_version(name, good_version, clean_func): version_good = name + "_version_" + good_version version_path = "./" + name + ".data" @@ -1672,3 +1721,25 @@ def check_module_version(actual_version, clear_func): writeFile(module_file, actual_version) clear_func() return + +def check_python(): + if ("linux" != host_platform()): + return + directory = __file__script__path__ + "/../tools/linux" + directory_bin = __file__script__path__ + "/../tools/linux/python3/bin" + + if not is_dir(directory + "/python3"): + cmd("tar", ["xfz", directory + "/python3.tar.gz", "-C", directory]) + cmd("ln", ["-s", directory_bin + "/python3", directory_bin + "/python"]) + directory_bin = directory_bin.replace(" ", "\\ ") + os.environ["PATH"] = directory_bin + os.pathsep + os.environ["PATH"] + return + +def check_tools(): + if ("linux" == host_platform()): + directory = __file__script__path__ + "/../tools/linux" + if not is_os_arm() and config.check_option("platform", "linux_arm64"): + if not is_dir(directory + "/qt"): + create_dir(directory + "/qt") + cmd("python", [directory + "/arm/build_qt.py", "--arch", "arm64", directory + "/qt/arm64"]) + return diff --git a/scripts/build.py b/scripts/build.py deleted file mode 100644 index a473eab5..00000000 --- a/scripts/build.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python - -import config -import base -import os -import multiprocessing - -def make_pro_file(makefiles_dir, pro_file, qmake_config_addon=""): - platforms = config.option("platform").split() - for platform in platforms: - if not platform in config.platforms: - continue - - print("------------------------------------------") - print("BUILD_PLATFORM: " + platform) - print("------------------------------------------") - old_env = dict(os.environ) - - # 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) - base.set_env("ANDROID_NDK_PLATFORM", "android-21") - - 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) - if ("" != qmake_config_addon): - config_param += (" " + qmake_config_addon) - - # qmake ADDON - qmake_addon = [] - if ("" != config.option("qmake_addon")): - qmake_addon = config.option("qmake_addon").split() - - 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 base.is_file(makefiles_dir + "/build.makefile_" + file_suff): - base.delete_file(makefiles_dir + "/build.makefile_" + file_suff) - print("make file: " + makefiles_dir + "/build.makefile_" + file_suff) - base.cmd(qt_dir + "/bin/qmake", ["-nocache", pro_file, "CONFIG+=" + config_param] + qmake_addon) - if ("1" == config.option("clean")): - base.cmd_and_return_cwd(base.app_make(), ["clean", "-f", makefiles_dir + "/build.makefile_" + file_suff], True) - base.cmd_and_return_cwd(base.app_make(), ["distclean", "-f", makefiles_dir + "/build.makefile_" + file_suff], True) - base.cmd(qt_dir + "/bin/qmake", ["-nocache", pro_file, "CONFIG+=" + config_param] + qmake_addon) - if not base.is_file(pro_file): - base.cmd(qt_dir + "/bin/qmake", ["-nocache", pro_file, "CONFIG+=" + config_param] + qmake_addon) - if ("0" != config.option("multiprocess")): - base.cmd_and_return_cwd(base.app_make(), ["-f", makefiles_dir + "/build.makefile_" + file_suff, "-j" + str(multiprocessing.cpu_count())]) - else: - base.cmd_and_return_cwd(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")) - qmake_bat.append("if exist ./" + makefiles_dir + "/build.makefile_" + file_suff + " del /F ./" + makefiles_dir + "/build.makefile_" + file_suff) - qmake_addon_string = "" - if ("" != config.option("qmake_addon")): - qmake_addon_string = " " + (" ").join(["\"" + addon + "\"" for addon in qmake_addon]) - qmake_bat.append("call \"" + qt_dir + "/bin/qmake\" -nocache " + pro_file + " \"CONFIG+=" + config_param + "\"" + qmake_addon_string) - 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_bat.append("call \"" + qt_dir + "/bin/qmake\" -nocache " + pro_file + " \"CONFIG+=" + config_param + "\"" + qmake_addon_string) - if ("0" != config.option("multiprocess")): - qmake_bat.append("set CL=/MP") - qmake_bat.append("call nmake -f " + makefiles_dir + "/build.makefile_" + file_suff) - base.run_as_bat(qmake_bat) - - os.environ.clear() - os.environ.update(old_env) - - base.delete_file(".qmake.stash") - -# make build.pro -def make(): - make_pro_file("makefiles", "build.pro") - if config.check_option("platform", "ios") and config.check_option("config", "bundle_xcframeworks"): - make_pro_file("makefiles", "build.pro", "xcframework_platform_ios_simulator") - - if config.check_option("module", "builder") and base.is_windows() and "onlyoffice" == config.branding(): - # check replace - new_replace_path = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/src/docbuilder.h") - if ("2019" == config.option("vs-version")): - base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com_2019.sln") - if (True): - new_path_net = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.net/src/docbuilder.net.cpp") - base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.net/src", "docbuilder.net.sln") - base.restorePathForBuilder(new_path_net) - else: - base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com.sln") - base.restorePathForBuilder(new_replace_path) - return diff --git a/scripts/build_js.py b/scripts/build_js.py index fc320fae..0b24fa3d 100644 --- a/scripts/build_js.py +++ b/scripts/build_js.py @@ -77,7 +77,6 @@ def make(): prefix_js = [ vendor_dir_src + "xregexp/xregexp-all-min.js", - vendor_dir_src + "underscore/underscore-min.js", base_dir + "/../sdkjs/common/Native/native.js", base_dir + "/../sdkjs-native/common/common.js", base_dir + "/../sdkjs/common/Native/jquery_native.js" diff --git a/scripts/build_js_native.py b/scripts/build_js_native.py index dc83c584..4237d273 100644 --- a/scripts/build_js_native.py +++ b/scripts/build_js_native.py @@ -59,7 +59,6 @@ def write_version_files(output_dir): prefix_js = [ vendor_dir_src + "xregexp/xregexp-all-min.js", - vendor_dir_src + "underscore/underscore-min.js", base_dir + "/../sdkjs/common/Native/native.js", base_dir + "/../sdkjs-native/common/common.js", base_dir + "/../sdkjs/common/Native/jquery_native.js" diff --git a/scripts/build_sln.py b/scripts/build_sln.py new file mode 100644 index 00000000..69074369 --- /dev/null +++ b/scripts/build_sln.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import config +import base +import os +import sys +sys.path.append(os.path.dirname(__file__) + "/..") +import sln +import qmake + +# make solution +def make(solution=""): + platforms = config.option("platform").split() + for platform in platforms: + if not platform in config.platforms: + continue + + print("------------------------------------------") + print("BUILD_PLATFORM: " + platform) + print("------------------------------------------") + + if ("" == solution): + solution = "./sln.json" + projects = sln.get_projects(solution, platform) + + for pro in projects: + qmake_main_addon = "" + if (0 == platform.find("android")) and (-1 != pro.find("X2tConverter.pro")): + if config.check_option("config", "debug") and not config.check_option("config", "disable_x2t_debug_strip"): + print("[WARNING:] temporary enable strip for x2t library in debug") + qmake_main_addon += "build_strip_debug" + + qmake.make(platform, pro, qmake_main_addon) + if config.check_option("platform", "ios") and config.check_option("config", "bundle_xcframeworks"): + qmake.make(platform, pro, "xcframework_platform_ios_simulator") + + if config.check_option("module", "builder") and base.is_windows() and "onlyoffice" == config.branding(): + # check replace + new_replace_path = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/src/docbuilder.h") + if ("2019" == config.option("vs-version")): + base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com_2019.sln") + if (True): + new_path_net = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.net/src/docbuilder.net.cpp") + base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.net/src", "docbuilder.net.sln") + base.restorePathForBuilder(new_path_net) + else: + base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com.sln") + base.restorePathForBuilder(new_replace_path) + return diff --git a/scripts/core_common/make_common.py b/scripts/core_common/make_common.py index 997f7f44..7527aad8 100755 --- a/scripts/core_common/make_common.py +++ b/scripts/core_common/make_common.py @@ -13,7 +13,7 @@ import icu import openssl import curl -import websocket +import websocket_all import v8 import html2 import hunspell @@ -54,5 +54,5 @@ def make(): if config.check_option("module", "mobile"): if (config.check_option("platform", "android")): curl.make() - websocket.make() + websocket_all.make() return diff --git a/scripts/core_common/modules/android/android_ndk.py b/scripts/core_common/modules/android/android_ndk.py new file mode 100755 index 00000000..b73acdd5 --- /dev/null +++ b/scripts/core_common/modules/android/android_ndk.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python + +import sys +sys.path.append('../../../scripts') +import base +import os +import re + +def get_android_ndk_version(): + env_val = base.get_env("ANDROID_NDK_ROOT") + if (env_val == ""): + env_val = "21.1.6352462" + return env_val.strip("/").split("/")[-1] + +def get_android_ndk_version_major(): + val = get_android_ndk_version().split(".")[0] + val = re.sub("[^0-9]", "", val) + return int(val) + +def get_sdk_api(): + if (23 > get_android_ndk_version_major()): + return "21" + return "23" + +global archs +archs = ["arm64", "arm", "x86_64", "x86"] + +global platforms +platforms = { + "arm64" : { + "abi" : "arm64-v8a", + "target" : "aarch64-linux-android", + "dst" : "arm64_v8a", + "api" : get_sdk_api(), + "old" : "aarch64-linux-android" + }, + "arm" : { + "abi" : "armeabi-v7a", + "target" : "armv7a-linux-androideabi", + "dst" : "armv7", + "api" : get_sdk_api(), + "old" : "arm-linux-android" + }, + "x86_64" : { + "arch" : "x86_64", + "target" : "x86_64-linux-android", + "dst" : "x86_64", + "api" : get_sdk_api(), + "old" : "x86_64-linux-android" + }, + "x86" : { + "arch" : "x86", + "target" : "i686-linux-android", + "dst" : "x86", + "api" : get_sdk_api(), + "old" : "i686-linux-android" + } +} + +# todo: check arm host! +global host + +if ("linux" == base.host_platform()): + host = { + "name" : "linux", + "arch" : "linux-x86_64" + } +else: + host = { + "name" : "darwin", + "arch" : "darwin-x86_64" + } + +def get_android_ndk_version(): + #return "26.2.11394342" + return "21.1.6352462" + +def get_android_ndk_version_major(): + return int(get_android_ndk_version().split(".")[0]) + +def get_options_dict_as_array(opts): + value = [] + for key in opts: + value.append(key + "=" + opts[key]) + return value + +def get_options_array_as_string(opts): + return " ".join(opts) + +def ndk_dir(): + return base.get_env("ANDROID_NDK_ROOT") + +def sdk_dir(): + ndk_path = ndk_dir() + if (-1 != ndk_path.find("/ndk/")): + return ndk_path + "/../.." + return ndk_path + "/.." + +def toolchain_dir(): + return ndk_dir() + "/toolchains/llvm/prebuilt/" + host["arch"] + +def prepare_platform(arch, cpp_standard=11): + target = platforms[arch]["target"] + api = platforms[arch]["api"] + + ndk_directory = ndk_dir() + toolchain = toolchain_dir() + + base.set_env("TARGET", target) + base.set_env("TOOLCHAIN", toolchain) + base.set_env("NDK_STANDARD_ROOT", toolchain) + base.set_env("ANDROIDVER", api) + base.set_env("ANDROID_API", api) + + base.set_env("AR", toolchain + "/bin/llvm-ar") + base.set_env("AS", toolchain + "/bin/llvm-as") + base.set_env("LD", toolchain + "/bin/ld") + base.set_env("RANLIB", toolchain + "/bin/llvm-ranlib") + base.set_env("STRIP", toolchain + "/bin/llvm-strip") + + base.set_env("CC", target + api + "-clang") + base.set_env("CXX", target + api + "-clang++") + + ld_flags = "-Wl,--gc-sections,-rpath-link=" + toolchain + "/sysroot/usr/lib/" + if (23 > get_android_ndk_version_major()): + ld_flags += (" -L" + toolchain + "/" + platforms[arch]["old"] + "/lib") + ld_flags += (" -L" + toolchain + "/sysroot/usr/lib/" + platforms[arch]["old"] + "/" + api) + + base.set_env("LDFLAGS", ld_flags) + base.set_env("PATH", toolchain + "/bin" + os.pathsep + base.get_env("PATH")) + + cflags = [ + "-Os", + "-ffunction-sections", + "-fdata-sections", + "-fvisibility=hidden", + + "-Wno-unused-function", + + "-fPIC", + + "-I" + toolchain + "/sysroot/usr/include", + + "-D__ANDROID_API__=" + api, + "-DANDROID" + ] + + cflags_string = " ".join(cflags) + cppflags_string = cflags_string + + if (cpp_standard >= 11): + cppflags_string += " -std=c++11" + + base.set_env("CFLAGS", cflags_string) + base.set_env("CXXFLAGS", cppflags_string) + base.set_env("CPPPLAGS", cflags_string) + return + +def extend_cflags(params): + base.set_env("CFLAGS", base.get_env("CFLAGS") + " " + params) + base.set_env("CPPFLAGS", base.get_env("CFLAGS")) + return + +def extend_cxxflags(params): + base.set_env("CXXFLAGS", base.get_env("CXXFLAGS") + " " + params) + return + +def extend_ldflags(params): + base.set_env("LDFLAGS", base.get_env("LDFLAGS") + " " + params) + return diff --git a/scripts/core_common/modules/android/curl_android.py b/scripts/core_common/modules/android/curl_android.py new file mode 100755 index 00000000..cb4674ce --- /dev/null +++ b/scripts/core_common/modules/android/curl_android.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +import sys +sys.path.append('../../../scripts') +import base +import os +import android_ndk + +current_dir = base.get_script_dir() + "/../../core/Common/3dParty/curl" +current_dir = os.path.abspath(current_dir) +if not current_dir.endswith("/"): + current_dir += "/" + +lib_version = "curl-7_68_0" +lib_name = "curl-7.68.0" + +def fetch(): + if not base.is_dir(current_dir + lib_name): + base.cmd("curl", ["-L", "-s", "-o", current_dir + lib_name + ".tar.gz", + "https://github.com/curl/curl/releases/download/" + lib_version + "/" + lib_name + ".tar.gz"]) + base.cmd("tar", ["xfz", current_dir + lib_name + ".tar.gz", "-C", current_dir]) + return + +def build_host(): + return + +def build_arch(arch): + dst_dir = current_dir + "build/android/" + android_ndk.platforms[arch]["dst"] + if base.is_dir(dst_dir): + return + + android_ndk.prepare_platform(arch) + + ndk_dir = android_ndk.ndk_dir() + toolchain = android_ndk.toolchain_dir() + + base.set_env("ANDROID_NDK_HOME", ndk_dir) + base.set_env("ANDROID_NDK", ndk_dir) + + arch_build_dir = os.path.abspath(current_dir + "build/android/tmp") + base.create_dir(arch_build_dir) + + old_cur = os.getcwd() + os.chdir(current_dir + lib_name) + + params = [] + if ("arm64" == arch): + params.append("--host=aarch64-linux-android") + elif ("arm" == arch): + params.append("--host=arm-linux-androideabi") + elif ("x86_64" == arch): + params.append("--host=x86_64-linux-android") + elif ("x86" == arch): + params.append("--host=i686-linux-android") + + openssl_dir = os.path.abspath(current_dir + "../openssl/build/android/" + android_ndk.platforms[arch]["dst"]) + + params.append("--enable-ipv6") + params.append("--enable-static") + params.append("--disable-shared") + params.append("--prefix=" + arch_build_dir) + params.append("--with-ssl=" + openssl_dir) + + base.cmd("./configure", params) + + base.cmd("make", ["clean"]) + base.cmd("make", ["-j4"]) + base.cmd("make", ["install"]) + + os.chdir(old_cur) + + base.create_dir(dst_dir) + base.copy_file(arch_build_dir + "/lib/libcurl.a", dst_dir) + base.copy_dir(arch_build_dir + "/include", current_dir + "build/android/include") + + base.delete_dir(arch_build_dir) + return + +def make(): + old_env = dict(os.environ) + + fetch() + + build_host() + + for arch in android_ndk.archs: + build_arch(arch) + + os.environ.clear() + os.environ.update(old_env) + return + +if __name__ == "__main__": + make() diff --git a/scripts/core_common/modules/android/icu_android.py b/scripts/core_common/modules/android/icu_android.py new file mode 100755 index 00000000..6394aa7c --- /dev/null +++ b/scripts/core_common/modules/android/icu_android.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + +import sys +sys.path.append('../../../scripts') +import base +import os +import android_ndk + +current_dir = base.get_script_dir() + "/../../core/Common/3dParty/icu/android" +current_dir = os.path.abspath(current_dir) +if not current_dir.endswith("/"): + current_dir += "/" + +icu_major = "58" +icu_minor = "3" + +options = { + "--enable-strict" : "no", + "--enable-extras" : "no", + "--enable-draft" : "yes", + "--enable-samples" : "no", + "--enable-tests" : "no", + "--enable-renaming" : "yes", + "--enable-icuio" : "no", + "--enable-layoutex" : "no", + "--with-library-bits" : "nochange", + "--with-library-suffix" : "", + "--enable-static" : "yes", + "--enable-shared" : "no", + "--with-data-packaging" : "archive" +} + +cpp_flags_base = [ + "-Os", + "-ffunction-sections", + "-fdata-sections", + "-fvisibility=hidden", + "-fPIC" +] + +cpp_flags = [ + "-fno-short-wchar", + "-fno-short-enums", + + "-DU_USING_ICU_NAMESPACE=0", + "-DU_HAVE_NL_LANGINFO_CODESET=0", + "-DU_TIMEZONE=0", + "-DU_DISABLE_RENAMING=0", + + "-DUCONFIG_NO_COLLATION=0", + "-DUCONFIG_NO_FORMATTING=0", + "-DUCONFIG_NO_LEGACY_CONVERSION=1", + "-DUCONFIG_NO_REGULAR_EXPRESSIONS=0", + "-DUCONFIG_NO_TRANSLITERATION=0", + + "-DU_STATIC_IMPLEMENTATION" +] + +def fetch_icu(): + if not base.is_dir(current_dir + "icu"): + base.cmd("git", ["clone", "--depth", "1", "--branch", "maint/maint-" + icu_major, "https://github.com/unicode-org/icu.git", current_dir + "icu2"]) + base.copy_dir(current_dir + "icu2/icu4c", current_dir + "icu") + base.delete_dir_with_access_error(current_dir + "icu2") + + if ("linux" == base.host_platform()): + base.replaceInFile(current_dir + "/icu/source/i18n/digitlst.cpp", "xlocale", "locale") + if False and ("mac" == base.host_platform()): + base.replaceInFile(current_dir + "/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\",") + return + +def build_host(): + cross_build_dir = os.path.abspath(current_dir + "icu/cross_build") + if not base.is_dir(cross_build_dir): + base.create_dir(cross_build_dir) + os.chdir(cross_build_dir) + + ld_flags = "-pthread" + if ("linux" == base.host_platform()): + ld_flags += " -Wl,--gc-sections" + else: + # gcc on OSX does not support --gc-sections + ld_flags += " -Wl,-dead_strip" + + base.set_env("LDFLAGS", ld_flags) + base.set_env("CPPFLAGS", android_ndk.get_options_array_as_string(cpp_flags_base + cpp_flags)) + + host_type = "Linux" + if ("mac" == base.host_platform()): + host_type = "MacOSX/GCC" + + base.cmd("../source/runConfigureICU", [host_type, "--prefix=" + cross_build_dir] + android_ndk.get_options_dict_as_array(options)) + base.cmd("make", ["-j4"]) + base.cmd("make", ["install"], True) + + base.create_dir(current_dir + "build") + base.copy_dir(cross_build_dir + "/include", current_dir + "build/include") + + os.chdir(current_dir) + return + +def build_arch(arch): + dst_dir = current_dir + "build/" + android_ndk.platforms[arch]["dst"] + if base.is_dir(dst_dir): + return + + android_ndk.prepare_platform(arch) + android_ndk.extend_cflags(" ".join(cpp_flags)) + + ndk_dir = android_ndk.ndk_dir() + toolchain = android_ndk.toolchain_dir() + + cross_build_dir = os.path.abspath(current_dir + "icu/cross_build") + arch_build_dir = os.path.abspath(current_dir + "build/tmp") + base.create_dir(arch_build_dir) + + os.chdir(arch_build_dir) + base.cmd("./../../icu/source/configure", ["--with-cross-build=" + cross_build_dir] + + android_ndk.get_options_dict_as_array(options) + ["--host=" + android_ndk.platforms[arch]["target"], "--prefix=" + arch_build_dir]) + base.cmd("make", ["-j4"]) + os.chdir(current_dir) + + base.create_dir(dst_dir) + base.copy_file(arch_build_dir + "/lib/libicuuc.a", dst_dir) + base.copy_file(arch_build_dir + "/stubdata/libicudata.a", dst_dir) + base.copy_file(arch_build_dir + "/data/out/icudt" + icu_major + "l.dat", dst_dir) + + base.delete_dir(arch_build_dir) + return + +def make(): + if not base.is_dir(current_dir): + base.create_dir(current_dir) + + old_env = dict(os.environ) + + fetch_icu() + + build_host() + + for arch in android_ndk.archs: + build_arch(arch) + + os.environ.clear() + os.environ.update(old_env) + return + +if __name__ == "__main__": + make() diff --git a/scripts/core_common/modules/android/openssl_android.py b/scripts/core_common/modules/android/openssl_android.py new file mode 100755 index 00000000..1a76ff5a --- /dev/null +++ b/scripts/core_common/modules/android/openssl_android.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +import sys +sys.path.append('../../../scripts') +import base +import os +import android_ndk + +current_dir = base.get_script_dir() + "/../../core/Common/3dParty/openssl" +current_dir = os.path.abspath(current_dir) +if not current_dir.endswith("/"): + current_dir += "/" + +lib_name="openssl-1.1.1t" + +options = [ + "no-shared", + "no-tests", + "enable-ssl3", + "enable-ssl3-method", + "enable-md2", + "no-asm" +] + +def fetch(): + if not base.is_dir(current_dir + lib_name): + base.cmd("curl", ["-L", "-s", "-o", current_dir + lib_name + ".tar.gz", + "https://www.openssl.org/source/" + lib_name + ".tar.gz"]) + base.cmd("tar", ["xfz", current_dir + lib_name + ".tar.gz", "-C", current_dir]) + return + +def build_host(): + # not needed, just create directories + if not base.is_dir(current_dir + "/build"): + base.create_dir(current_dir + "/build") + if not base.is_dir(current_dir + "/build/android"): + base.create_dir(current_dir + "/build/android") + return + +def build_arch(arch): + dst_dir = current_dir + "build/android/" + android_ndk.platforms[arch]["dst"] + if base.is_dir(dst_dir): + return + + android_ndk.prepare_platform(arch) + + ndk_dir = android_ndk.ndk_dir() + toolchain = android_ndk.toolchain_dir() + + base.set_env("ANDROID_NDK_HOME", ndk_dir) + base.set_env("ANDROID_NDK", ndk_dir) + + arch_build_dir = os.path.abspath(current_dir + "build/android/tmp") + base.create_dir(arch_build_dir) + + old_cur = os.getcwd() + os.chdir(current_dir + lib_name) + + base.cmd("./Configure", ["android-" + arch, "--prefix=" + arch_build_dir, "-D__ANDROID_API__=" + android_ndk.platforms[arch]["api"]] + options) + + base.replaceInFile("./Makefile", "LIB_CFLAGS=", "LIB_CFLAGS=-fvisibility=hidden ") + base.replaceInFile("./Makefile", "LIB_CXXFLAGS=", "LIB_CXXFLAGS=-fvisibility=hidden ") + + base.cmd("make", ["clean"]) + base.cmd("make", ["-j4"]) + base.cmd("make", ["install"]) + + os.chdir(old_cur) + + base.create_dir(dst_dir) + base.create_dir(dst_dir + "/lib") + base.copy_file(arch_build_dir + "/lib/libcrypto.a", dst_dir + "/lib") + base.copy_file(arch_build_dir + "/lib/libssl.a", dst_dir + "/lib") + base.copy_dir(arch_build_dir + "/include", dst_dir + "/include") + + base.delete_dir(arch_build_dir) + return + +def make(): + old_env = dict(os.environ) + + fetch() + + build_host() + + for arch in android_ndk.archs: + build_arch(arch) + + os.environ.clear() + os.environ.update(old_env) + return + +if __name__ == "__main__": + make() diff --git a/scripts/core_common/modules/boost_android.py b/scripts/core_common/modules/boost_android.py deleted file mode 100644 index a4fdcfc8..00000000 --- a/scripts/core_common/modules/boost_android.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append('../..') -import config -import base -import os - -platforms = { - "arm64_v8a" : { - "name" : "arm64-v8a", - "toolset" : "arm64v8a", - "clang_triple" : "aarch64-linux-android21", - "tool_triple" : "aarch64-linux-android", - "abi" : "aapcs", - "arch" : "arm", - "address_model" : "64", - "compiler_flags" : "", - "linker_flags" : "" - }, - "armv7" : { - "name" : "armeabi-v7a", - "toolset" : "armeabiv7a", - "clang_triple" : "armv7a-linux-androideabi16", - "tool_triple" : "arm-linux-androideabi", - "abi" : "aapcs", - "arch" : "arm", - "address_model" : "32", - "compiler_flags" : "-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp", - "linker_flags" : "-Wl,--fix-cortex-a8" - }, - "x86" : { - "name" : "x86", - "toolset" : "x86", - "clang_triple" : "i686-linux-android16", - "tool_triple" : "i686-linux-android", - "abi" : "sysv", - "arch" : "x86", - "address_model" : "32", - "compiler_flags" : "", - "linker_flags" : "" - }, - "x86_64" : { - "name" : "x86_64", - "toolset" : "x8664", - "clang_triple" : "x86_64-linux-android21", - "tool_triple" : "x86_64-linux-android", - "abi" : "sysv", - "arch" : "x86", - "address_model" : "64", - "compiler_flags" : "", - "linker_flags" : "" - } -} - -base_dir = base.get_script_dir() - -def make(platform): - tmp_build_dir = base_dir + "/core_common/modules/boost" - if (base.is_dir(tmp_build_dir)): - base.delete_dir(tmp_build_dir) - base.copy_dir(base_dir + "/../tools/android/boost", tmp_build_dir) - - current_platform = platforms[platform] - - if (base.host_platform() == "mac"): - source = "prebuilt/linux-x86_64" - dest = "prebuilt/darwin-x86_64" - base.replaceInFile(tmp_build_dir + "/user-config.jam", source, dest) - base.replaceInFile(tmp_build_dir + "/bin/hide/as", source, dest) - base.replaceInFile(tmp_build_dir + "/bin/hide/strip", source, dest) - base.replaceInFile(tmp_build_dir + "/bin/ar", source, dest) - base.replaceInFile(tmp_build_dir + "/bin/clang++", source, dest) - base.replaceInFile(tmp_build_dir + "/bin/ranlib", source, dest) - - build_dir_tmp = tmp_build_dir + "/tmp" - - base.cmd("./bootstrap.sh", ["--with-libraries=filesystem,system,date_time,regex", "--prefix=../build/android_" + platform]) - base.cmd("./b2", ["headers"]) - base.cmd("./b2", ["--clean"]) - - old_path = base.get_env("PATH") - base.set_env("PATH", tmp_build_dir + "/bin:" + old_path) - base.set_env("NDK_DIR", base.get_env("ANDROID_NDK_ROOT")) - - base.set_env("BFA_CLANG_TRIPLE_FOR_ABI", current_platform["clang_triple"]) - base.set_env("BFA_TOOL_TRIPLE_FOR_ABI", current_platform["tool_triple"]) - base.set_env("BFA_COMPILER_FLAGS_FOR_ABI", current_platform["compiler_flags"]) - base.set_env("BFA_LINKER_FLAGS_FOR_ABI", current_platform["linker_flags"]) - - print(current_platform) - base.cmd("./b2", ["-q", "-j4", - "toolset=clang-" + current_platform["toolset"], - "binary-format=elf", - "address-model=" + current_platform["address_model"], - "architecture=" + current_platform["arch"], - "abi=" + current_platform["abi"], - "link=static", - "threading=multi", - "target-os=android", - "--user-config=" + tmp_build_dir + "/user-config.jam", - "--ignore-site-config", - "--layout=system", - "install"], True) - - base.set_env("PATH", old_path) - base.delete_dir(tmp_build_dir) - return diff --git a/scripts/core_common/modules/boost_qt.py b/scripts/core_common/modules/boost_qt.py index 35191ad3..2a1a44dc 100644 --- a/scripts/core_common/modules/boost_qt.py +++ b/scripts/core_common/modules/boost_qt.py @@ -5,7 +5,7 @@ import config import base import os -import build +import qmake def make(src_dir, modules, build_platform="android", qmake_addon=""): old_cur = os.getcwd() @@ -23,17 +23,13 @@ def make(src_dir, modules, build_platform="android", qmake_addon=""): pro_file_content.append("TARGET = boost_" + module) pro_file_content.append("TEMPLATE = lib") pro_file_content.append("CONFIG += staticlib") + if (build_platform == "android"): + pro_file_content.append("DEFINES += \"_HAS_AUTO_PTR_ETC=0\"") pro_file_content.append("") pro_file_content.append("CORE_ROOT_DIR = $$PWD/../../../../../..") pro_file_content.append("PWD_ROOT_DIR = $$PWD") pro_file_content.append("include($$PWD/../../../../../base.pri)") pro_file_content.append("") - pro_file_content.append("MAKEFILE=$$PWD/build.makefile_$$CORE_BUILDS_PLATFORM_PREFIX") - pro_file_content.append("core_debug:MAKEFILE=$$join(MAKEFILE, MAKEFILE, \"\", \"_debug_\")") - pro_file_content.append("build_xp:MAKEFILE=$$join(MAKEFILE, MAKEFILE, \"\", \"_xp\")") - pro_file_content.append("OO_BRANDING_SUFFIX = $$(OO_BRANDING)") - pro_file_content.append("!isEmpty(OO_BRANDING_SUFFIX):MAKEFILE=$$join(MAKEFILE, MAKEFILE, \"\", \"$$OO_BRANDING_SUFFIX\")") - pro_file_content.append("") pro_file_content.append("BOOST_SOURCES=$$PWD/../..") pro_file_content.append("INCLUDEPATH += $$BOOST_SOURCES") pro_file_content.append("INCLUDEPATH += $$PWD/include") @@ -43,7 +39,7 @@ def make(src_dir, modules, build_platform="android", qmake_addon=""): pro_file_content.append("DESTDIR = $$BOOST_SOURCES/../build/" + build_platform + "/lib/$$CORE_BUILDS_PLATFORM_PREFIX") base.save_as_script(module_dir + "/" + module + ".pro", pro_file_content) os.chdir(module_dir) - build.make_pro_file("./", module + ".pro", qmake_addon) + qmake.make_all_platforms(module_dir + "/" + module + ".pro", qmake_addon) os.chdir(old_cur) return diff --git a/scripts/core_common/modules/curl.py b/scripts/core_common/modules/curl.py index 219b3adb..2dcb0394 100644 --- a/scripts/core_common/modules/curl.py +++ b/scripts/core_common/modules/curl.py @@ -2,21 +2,19 @@ import sys sys.path.append('../..') +sys.path.append('android') import config import subprocess import os import base +import curl_android def make(): path = base.get_script_dir() + "/../../core/Common/3dParty/curl" old_cur = os.getcwd() os.chdir(path) if (-1 != config.option("platform").find("android")): - if base.is_dir(path + "/build/android"): - os.chdir(old_cur) - return - subprocess.call(["./build-android-curl.sh"]) - + curl_android.make() elif (-1 != config.option("platform").find("ios")): if base.is_dir(path + "/build/ios"): os.chdir(old_cur) diff --git a/scripts/core_common/modules/icu.py b/scripts/core_common/modules/icu.py index 7864024e..77aa06f3 100755 --- a/scripts/core_common/modules/icu.py +++ b/scripts/core_common/modules/icu.py @@ -2,6 +2,7 @@ import sys sys.path.append('../..') +sys.path.append('android') import config import base import os @@ -38,6 +39,8 @@ def make(): if (-1 != config.option("platform").find("android")): icu_android.make() + os.chdir(base_dir) + icu_major = "58" icu_minor = "3" diff --git a/scripts/core_common/modules/icu_android.py b/scripts/core_common/modules/icu_android.py deleted file mode 100755 index 6b743bbe..00000000 --- a/scripts/core_common/modules/icu_android.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append('../..') -import base -import os - -def fetch_icu(major, minor): - base.cmd("git", ["clone", "--depth", "1", "--branch", "maint/maint-" + major, "https://github.com/unicode-org/icu.git", "./icu2"]) - base.copy_dir("./icu2/icu4c", "./icu") - base.delete_dir_with_access_error("icu2") - #base.cmd("svn", ["export", "https://github.com/unicode-org/icu/tags/release-" + icu_major + "-" + icu_minor + "/icu4c", "./icu", "--non-interactive", "--trust-server-cert"]) - return - -current_dir = base.get_script_dir() + "/../../core/Common/3dParty/icu/android" - -toolshains_dir = current_dir + "/toolchains" -icu_major = "58" -icu_minor = "3" -icu_is_shared = False - -current_path = base.get_env("PATH") - -platforms = { - "arm64" : { - "arch" : "aarch64-linux-android", - "bin" : "aarch64-linux-android" - }, - "arm" : { - "arch" : "arm-linux-androideabi", - "bin" : "arm-linux-androideabi" - }, - "x86_64" : { - "arch" : "x86_64-linux-android", - "bin" : "x86_64-linux-android" - }, - "x86" : { - "arch" : "x86-linux-android", - "bin" : "i686-linux-android" - } -} - -def build_arch(arch, api_version): - print("icu build: " + arch + " ----------------------------------------") - - if base.is_dir(current_dir + "/icu/" + arch): - base.delete_dir(current_dir + "/icu/" + arch) - base.create_dir(current_dir + "/icu/" + arch) - os.chdir(current_dir + "/icu/" + arch) - - base.cmd(base.get_env("ANDROID_NDK_ROOT") + "/build/tools/make-standalone-toolchain.sh", [ - "--platform=android-" + api_version, - "--install-dir=" + current_dir + "/toolchain/" + arch, - "--toolchain=" + platforms[arch]["arch"], - "--force" - ]) - - base.set_env("PATH", current_dir + "/toolchain/" + arch + "/bin:" + current_path) - - command_args = "--prefix=" + current_dir + "/build_tmp/" + arch + " --host=!!!MASK!!! --with-cross-build=" + current_dir + "/icu/cross_build CFLAGS=-Os CXXFLAGS=--std=c++11 CC=!!!MASK!!!-clang CXX=!!!MASK!!!-clang++ AR=!!!MASK!!!-ar RANLIB=!!!MASK!!!-ranlib" - if not icu_is_shared: - command_args += " --enable-static --enable-shared=no --with-data-packaging=archive CFLAGS=-fPIC CXXFLAGS=-fPIC" - command_args = command_args.replace("!!!MASK!!!", platforms[arch]["bin"]) - - base.cmd("../source/configure", command_args.split()) - base.cmd("make", ["-j4"]) - base.cmd("make", ["install"]) - - base.set_env("PATH", current_path) - os.chdir(current_dir) - - return - -def make(): - if not base.is_dir(current_dir): - base.create_dir(current_dir) - - if base.is_dir(current_dir + "/build"): - return - - current_dir_old = os.getcwd() - - print("[fetch & build]: icu_android") - os.chdir(current_dir) - - if not base.is_dir("icu"): - fetch_icu(icu_major, icu_minor) - if ("linux" == base.host_platform()): - base.replaceInFile(current_dir + "/icu/source/i18n/digitlst.cpp", "xlocale", "locale") - if ("mac" == base.host_platform()): - base.replaceInFile(current_dir + "/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 not base.is_dir(current_dir + "/icu/cross_build"): - base.create_dir(current_dir + "/icu/cross_build") - os.chdir(current_dir + "/icu/cross_build") - base.cmd("../source/runConfigureICU", ["Linux" if "linux" == base.host_platform() else "MacOSX", - "--prefix=" + current_dir + "/icu/cross_build", "CFLAGS=-Os CXXFLAGS=--std=c++11"]) - base.cmd("make", ["-j4"]) - base.cmd("make", ["install"], True) - - os.chdir(current_dir) - - build_arch("arm64", "21") - build_arch("arm", "16") - build_arch("x86_64","21") - build_arch("x86", "16") - - os.chdir(current_dir) - - base.create_dir(current_dir + "/build") - base.copy_dir(current_dir + "/build_tmp/arm64/include", current_dir + "/build/include") - - if icu_is_shared: - base.create_dir(current_dir + "/build/arm64_v8a") - base.copy_file(current_dir + "/build_tmp/arm64/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/arm64_v8a/libicudata.so") - base.copy_file(current_dir + "/build_tmp/arm64/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/arm64_v8a/libicuuc.so") - - base.create_dir(current_dir + "/build/armv7") - base.copy_file(current_dir + "/build_tmp/arm/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/armv7/libicudata.so") - base.copy_file(current_dir + "/build_tmp/arm/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/armv7/libicuuc.so") - - base.create_dir(current_dir + "/build/x86_64") - base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/x86_64/libicudata.so") - base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/x86_64/libicuuc.so") - - base.create_dir(current_dir + "/build/x86") - base.copy_file(current_dir + "/build_tmp/x86/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/x86/libicudata.so") - base.copy_file(current_dir + "/build_tmp/x86/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/x86/libicuuc.so") - - # patch elf information - os.chdir(current_dir + "/build") - base.cmd("git", ["clone", "https://github.com/NixOS/patchelf.git"]) - os.chdir("./patchelf") - base.cmd("./bootstrap.sh") - base.cmd("./configure", ["--prefix=" + current_dir + "/build/patchelf/usr"]) - base.cmd("make") - base.cmd("make", ["install"]) - - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../arm64_v8a/libicudata.so"]) - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../arm64_v8a/libicuuc.so"]) - base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../arm64_v8a/libicuuc.so"]) - - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../armv7/libicudata.so"]) - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../armv7/libicuuc.so"]) - base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../armv7/libicuuc.so"]) - - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../x86_64/libicudata.so"]) - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../x86_64/libicuuc.so"]) - base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../x86_64/libicuuc.so"]) - - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../x86/libicudata.so"]) - base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../x86/libicuuc.so"]) - base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../x86/libicuuc.so"]) - - base.delete_dir(current_dir + "/build/patchelf") - - if not icu_is_shared: - base.create_dir(current_dir + "/build/arm64_v8a") - base.copy_file(current_dir + "/build_tmp/arm64/lib/libicudata.a", current_dir + "/build/arm64_v8a/libicudata.a") - base.copy_file(current_dir + "/build_tmp/arm64/lib/libicuuc.a", current_dir + "/build/arm64_v8a/libicuuc.a") - base.copy_file(current_dir + "/icu/arm64/data/out/icudt58l.dat", current_dir + "/build/arm64_v8a/icudt58l.dat") - - base.create_dir(current_dir + "/build/armv7") - base.copy_file(current_dir + "/build_tmp/arm/lib/libicudata.a", current_dir + "/build/armv7/libicudata.a") - base.copy_file(current_dir + "/build_tmp/arm/lib/libicuuc.a", current_dir + "/build/armv7/libicuuc.a") - base.copy_file(current_dir + "/icu/arm/data/out/icudt58l.dat", current_dir + "/build/armv7/icudt58l.dat") - - base.create_dir(current_dir + "/build/x86_64") - base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicudata.a", current_dir + "/build/x86_64/libicudata.a") - base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicuuc.a", current_dir + "/build/x86_64/libicuuc.a") - base.copy_file(current_dir + "/icu/x86_64/data/out/icudt58l.dat", current_dir + "/build/x86_64/icudt58l.dat") - - base.create_dir(current_dir + "/build/x86") - base.copy_file(current_dir + "/build_tmp/x86/lib/libicudata.a", current_dir + "/build/x86/libicudata.a") - base.copy_file(current_dir + "/build_tmp/x86/lib/libicuuc.a", current_dir + "/build/x86/libicuuc.a") - base.copy_file(current_dir + "/icu/x86/data/out/icudt58l.dat", current_dir + "/build/x86/icudt58l.dat") - - os.chdir(current_dir_old) - return diff --git a/scripts/core_common/modules/openssl_mobile.py b/scripts/core_common/modules/openssl_mobile.py index 6f1d52e1..7989c52c 100755 --- a/scripts/core_common/modules/openssl_mobile.py +++ b/scripts/core_common/modules/openssl_mobile.py @@ -1,18 +1,19 @@ #!/usr/bin/env python - +import sys +sys.path.append('../..') +sys.path.append('android') import base import config import os import subprocess +import openssl_android def make(): path = base.get_script_dir() + "/../../core/Common/3dParty/openssl" old_cur = os.getcwd() os.chdir(path) - base.set_env("ANDROID_HOME", base.get_android_sdk_home()) - - if (-1 != config.option("platform").find("android") and not base.is_dir("./build/android")): - subprocess.call(["./build-android-openssl.sh"]) + if (-1 != config.option("platform").find("android")): + openssl_android.make() if (-1 != config.option("platform").find("ios") and not base.is_dir("./build/ios")): subprocess.call(["./build-ios-openssl.sh"]) diff --git a/scripts/core_common/modules/websocket.py b/scripts/core_common/modules/websocket_all.py old mode 100755 new mode 100644 similarity index 60% rename from scripts/core_common/modules/websocket.py rename to scripts/core_common/modules/websocket_all.py index ffc9134e..6164f1f5 --- a/scripts/core_common/modules/websocket.py +++ b/scripts/core_common/modules/websocket_all.py @@ -4,12 +4,10 @@ sys.path.append('../..') import config import base -import ixwebsocket -import socketrocket +#import ixwebsocket +#import socketrocket import socket_io -config_file = base.get_script_dir() + "/../../core/Common/WebSocket/websocket.pri" - def make(): #ixwebsocket.make() #socketrocket.make() diff --git a/scripts/deploy_builder.py b/scripts/deploy_builder.py index 3f901205..808e7b55 100644 --- a/scripts/deploy_builder.py +++ b/scripts/deploy_builder.py @@ -76,6 +76,9 @@ def make(): if (0 == platform.find("win")): base.copy_file(core_build_dir + "/lib/" + platform_postfix + "/doctrenderer.lib", root_dir + "/doctrenderer.lib") base.copy_v8_files(core_dir, root_dir, platform, isWindowsXP) + base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "docbuilder.c") + + base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py", root_dir + "/docbuilder.py") # app base.copy_exe(core_build_dir + "/bin/" + platform_postfix, root_dir, "docbuilder") @@ -111,6 +114,9 @@ def make(): if ("ios" == platform): base.generate_plist(root_dir) + if (0 == platform.find("linux")): + base.linux_correct_rpath_docbuilder(root_dir) + if (0 == platform.find("mac")): base.mac_correct_rpath_x2t(root_dir) base.mac_correct_rpath_docbuilder(root_dir) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 87a6ef4b..ddebcde5 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -214,6 +214,8 @@ def make(): base.create_dir(root_dir + "/editors") base.copy_dir(base_dir + "/js/" + branding + "/desktop/sdkjs", root_dir + "/editors/sdkjs") base.copy_dir(base_dir + "/js/" + branding + "/desktop/web-apps", root_dir + "/editors/web-apps") + for file in glob.glob(root_dir + "/editors/web-apps/apps/*/*/*.js.map"): + base.delete_file(file) base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/resources/local", root_dir + "/editors/sdkjs/common/Images/local") base.create_dir(root_dir + "/editors/sdkjs-plugins") diff --git a/scripts/deploy_server.py b/scripts/deploy_server.py index e50adba4..c41e49e7 100644 --- a/scripts/deploy_server.py +++ b/scripts/deploy_server.py @@ -5,6 +5,7 @@ import re import shutil +import glob from tempfile import mkstemp def make(): @@ -113,6 +114,9 @@ def make(): js_dir = root_dir base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs") base.copy_dir(base_dir + "/js/" + branding + "/builder/web-apps", js_dir + "/web-apps") + for file in glob.glob(js_dir + "/web-apps/apps/*/*/*.js.map") \ + + glob.glob(js_dir + "/web-apps/apps/*/mobile/dist/js/*.js.map"): + base.delete_file(file) # add embed worker code base.cmd_in_dir(git_dir + "/sdkjs/common/embed", "python", ["make.py", js_dir + "/web-apps/apps/api/documents/api.js"]) diff --git a/scripts/develop/config_server.py b/scripts/develop/config_server.py index 624ae5b7..3439f942 100644 --- a/scripts/develop/config_server.py +++ b/scripts/develop/config_server.py @@ -66,6 +66,12 @@ def make(): if not base.is_dir(git_dir + "/sdkjs-plugins"): base.create_dir(git_dir + "/sdkjs-plugins") + if not base.is_dir(git_dir + "/sdkjs-plugins/v1"): + base.create_dir(git_dir + "/sdkjs-plugins/v1") + base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js", git_dir + "/sdkjs-plugins/v1/plugins.js") + base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js", git_dir + "/sdkjs-plugins/v1/plugins-ui.js") + base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css", git_dir + "/sdkjs-plugins/v1/plugins.css") + base.support_old_versions_plugins(git_dir + "/sdkjs-plugins") base.copy_marketplace_plugin(git_dir + "/sdkjs-plugins", False, False) diff --git a/scripts/license_checker/Readme.md b/scripts/license_checker/Readme.md index ffe97cfe..35972227 100644 --- a/scripts/license_checker/Readme.md +++ b/scripts/license_checker/Readme.md @@ -172,6 +172,18 @@ Possible array values: ] ``` + * `allowListFile` file paths to allow. It is needed if you ignore the directory, but there is a file in it that needs to be checked. + **For example:** + + ```json + "ignoreListDir": [ + "sdkjs/develop" + ], + "allowListFile": [ + "sdkjs/develop/awesomeFileToAllow.js", + ] + ``` + Any number of configurations can be specified, they can overlap if we need to check diff --git a/scripts/package_branding.py b/scripts/package_branding.py index 4aa21384..ec902e42 100644 --- a/scripts/package_branding.py +++ b/scripts/package_branding.py @@ -17,10 +17,7 @@ desktop_product_name = "Desktop Editors" desktop_product_name_s = desktop_product_name.replace(" ","") desktop_package_name = company_name + "-" + desktop_product_name_s - desktop_vcredist_list = ["2022"] desktop_changes_dir = "desktop-apps/win-linux/package/windows/update/changes" - desktop_changes_url = "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/changes" - desktop_updates_url = "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/updates" if utils.is_macos(): desktop_package_name = "ONLYOFFICE" diff --git a/scripts/package_builder.py b/scripts/package_builder.py index 243cbc18..d7beeeea 100644 --- a/scripts/package_builder.py +++ b/scripts/package_builder.py @@ -127,7 +127,7 @@ def make_macos(): if common.deploy and ret: utils.log_h2("builder deploy") - ret = s3_upload([builder_tar], "builder/mac/") + ret = s3_upload([builder_tar], "builder/mac/generic/") utils.set_summary("builder deploy", ret) utils.set_cwd(common.workspace_dir) diff --git a/scripts/package_core.py b/scripts/package_core.py index 1823adaf..8bf2e181 100644 --- a/scripts/package_core.py +++ b/scripts/package_core.py @@ -53,27 +53,53 @@ def make_core(): utils.set_summary("core deploy", ret) return -def deploy_closuremaps(license): +def deploy_closuremaps_sdkjs(license): if not common.deploy: return - utils.log_h1("CLOSURE MAPS") - utils.set_cwd(utils.get_path("sdkjs/build/maps")) + utils.log_h1("SDKJS CLOSURE MAPS") - maps = utils.glob_path("*.js.map") - if not maps: + maps = utils.glob_path("sdkjs/build/maps/*.js.map") + if maps: + for m in maps: utils.log("- " + m) + else: utils.log_err("files do not exist") - utils.set_summary("closure maps " + license + " deploy", False) + utils.set_summary("sdkjs closure maps %s deploy" % license, False) return - utils.log_h2("closure maps " + license + " deploy") + utils.log_h2("sdkjs closure maps %s deploy" % license) ret = True for f in maps: - key = "closure-maps/%s/%s/%s/%s" % (license, common.version, common.build, f) + base = utils.get_basename(f) + key = "closure-maps/sdkjs/%s/%s/%s/%s" % (license, common.version, common.build, base) upload = utils.s3_upload(f, "s3://" + branding.s3_bucket + "/" + key) ret &= upload if upload: utils.log("URL: " + branding.s3_base_url + "/" + key) utils.add_deploy_data(key) - utils.set_summary("closure maps " + license + " deploy", ret) + utils.set_summary("sdkjs closure maps %s deploy" % license, ret) + return + +def deploy_closuremaps_webapps(license): + if not common.deploy: return + utils.log_h1("WEB-APPS CLOSURE MAPS") - utils.set_cwd(common.workspace_dir) + maps = utils.glob_path("web-apps/deploy/web-apps/apps/*/*/*.js.map") \ + + utils.glob_path("web-apps/deploy/web-apps/apps/*/mobile/dist/js/*.js.map") + if maps: + for m in maps: utils.log("- " + m) + else: + utils.log_err("files do not exist") + utils.set_summary("web-apps closure maps %s deploy" % license, False) + return + + utils.log_h2("web-apps closure maps %s deploy" % license) + ret = True + for f in maps: + base = utils.get_relpath(f, "web-apps/deploy/web-apps/apps").replace("/", "_") + key = "closure-maps/web-apps/%s/%s/%s/%s" % (license, common.version, common.build, base) + upload = utils.s3_upload(f, "s3://" + branding.s3_bucket + "/" + key) + ret &= upload + if upload: + utils.log("URL: " + branding.s3_base_url + "/" + key) + utils.add_deploy_data(key) + utils.set_summary("web-apps closure maps %s deploy" % license, ret) return diff --git a/scripts/package_desktop.py b/scripts/package_desktop.py index a0eb4c88..5fc62370 100644 --- a/scripts/package_desktop.py +++ b/scripts/package_desktop.py @@ -36,171 +36,104 @@ def s3_upload(files, dst): # def make_windows(): - global package_version, arch_list, source_dir, branding_dir, desktop_dir, viewer_dir, \ - inno_file, inno_sa_file, inno_update_file, inno_update_file_new, advinst_file + global package_name, package_version, arch, xp, suffix utils.set_cwd("desktop-apps\\win-linux\\package\\windows") package_name = branding.desktop_package_name package_version = common.version + "." + common.build - arch_list = { + arch = { "windows_x64": "x64", "windows_x64_xp": "x64", "windows_x86": "x86", "windows_x86_xp": "x86" - } - suffix = arch_list[common.platform] - if common.platform.endswith("_xp"): suffix += "-xp" - inno_file = "%s-%s-%s.exe" % (package_name, package_version, suffix) - inno_sa_file = "%s-Standalone-%s-%s.exe" % (package_name, package_version, suffix) - inno_update_file = "update\\editors_update_%s.exe" % suffix.replace("-","_") - inno_update_file_new = "%s-Update-%s-%s.exe" % (package_name, package_version, suffix) - advinst_file = "%s-%s-%s.msi" % (package_name, package_version, suffix) - if branding.onlyoffice: - branding_dir = "." - else: - branding_dir = common.workspace_dir + "\\" + common.branding + "\\desktop-apps\\win-linux\\package\\windows" + }[common.platform] + xp = common.platform.endswith("_xp") + suffix = arch + ("-xp" if xp else "") if common.clean: utils.log_h2("desktop clean") - utils.delete_dir("build") - # utils.delete_dir("data\\vcredist") utils.delete_dir("DesktopEditors-cache") utils.delete_files("*.exe") utils.delete_files("*.msi") utils.delete_files("*.aic") utils.delete_files("*.tmp") utils.delete_files("*.zip") - utils.delete_files("update\\*.exe") - utils.delete_files("update\\*.xml") - utils.delete_files("update\\*.html") - - utils.log_h2("copy arifacts") - source_dir = "%s\\build_tools\\out\\%s\\%s" \ - % (common.workspace_dir, common.prefix, branding.company_name) - utils.create_dir("build") - desktop_dir = "build\\" + branding.desktop_product_name_s - utils.copy_dir(source_dir + "\\" + branding.desktop_product_name_s, desktop_dir) - if not branding.onlyoffice: - viewer_dir = "build\\" + branding.viewer_product_name_s - utils.copy_dir(source_dir + "\\" + branding.viewer_product_name_s, viewer_dir) + utils.delete_files("data\\*.exe") + make_prepare() make_zip() - - if not download_vcredist(): - utils.set_summary("desktop inno build", False) - utils.set_summary("desktop inno standalone build", False) - utils.set_summary("desktop inno update build", False) - utils.set_summary("desktop advinst build", False) - utils.set_cwd(common.workspace_dir) - return - make_inno() + make_advinst() - if common.platform == "windows_x64": - make_update_files() + utils.set_cwd(common.workspace_dir) + return - if common.platform in ["windows_x64", "windows_x86"]: - make_advinst() +def make_prepare(): + args = [ + "-Version", package_version, + "-Arch", arch + ] + if xp: + args += ["-Target", "xp"] + if common.sign: + args += ["-Sign"] - utils.set_cwd(common.workspace_dir) + utils.log_h2("desktop prepare") + ret = utils.ps1("make.ps1", args, verbose=True) + utils.set_summary("desktop prepare", ret) return def make_zip(): - utils.log_h2("desktop zip build") - + zip_file = "%s-%s-%s.zip" % (package_name, package_version, suffix) args = [ - "-Target", common.platform, - "-BuildDir", "build", - "-DesktopDir", branding.desktop_product_name_s + "-Version", package_version, + "-Arch", arch ] - if not branding.onlyoffice: - args += ["-MultimediaDir", branding.viewer_product_name_s] - args += ["-BrandingDir", branding_dir] - if branding.onlyoffice and not common.platform.endswith("_xp"): - args += ["-ExcludeHelp"] - if common.sign: - args += ["-Sign", "-CertName", branding.cert_name] + if xp: + args += ["-Target", "xp"] + # if common.sign: + # args += ["-Sign"] + + utils.log_h2("desktop zip build") ret = utils.ps1("make_zip.ps1", args, verbose=True) utils.set_summary("desktop zip build", ret) if common.deploy and ret: utils.log_h2("desktop zip deploy") - ret = s3_upload(utils.glob_path("*.zip"), "desktop/win/generic/") + ret = s3_upload([zip_file], "desktop/win/generic/") utils.set_summary("desktop zip deploy", ret) return -def download_vcredist(): - vcredist = { - # Microsoft Visual C++ 2015-2022 Redistributable - 14.38.33135 - "windows_x64": { - "url": "https://aka.ms/vs/17/release/vc_redist.x64.exe", - "md5": "a8a68bcc74b5022467f12587baf1ef93" - }, - "windows_x86": { - "url": "https://aka.ms/vs/17/release/vc_redist.x86.exe", - "md5": "9882a328c8414274555845fa6b542d1e" - }, - # Microsoft Visual C++ 2015-2019 Redistributable - 14.27.29114 - "windows_x64_xp": { - "url": "https://download.visualstudio.microsoft.com/download/pr/722d59e4-0671-477e-b9b1-b8da7d4bd60b/591CBE3A269AFBCC025681B968A29CD191DF3C6204712CBDC9BA1CB632BA6068/VC_redist.x64.exe", - "md5": "bc8e3e714b727b3bb18614bd6a51a3d3" - }, - "windows_x86_xp": { - "url": "https://download.visualstudio.microsoft.com/download/pr/c168313d-1754-40d4-8928-18632c2e2a71/D305BAA965C9CD1B44EBCD53635EE9ECC6D85B54210E2764C8836F4E9DEFA345/VC_redist.x86.exe", - "md5": "ec3bee79a85ae8e3581a8c181b336d1e" - } - } - vcredist_file = "data\\vcredist_%s.exe" % arch_list[common.platform] - - utils.log_h2("vcredist download " + vcredist_file) - ret = utils.download_file( - vcredist[common.platform]["url"], - vcredist_file, - vcredist[common.platform]["md5"], - verbose=True) - utils.set_summary("vcredist download", ret) - return ret - def make_inno(): - utils.log_h2("desktop inno build") - - inno_arch_list = { - "windows_x64": "64", - "windows_x86": "32", - "windows_x64_xp": "64", - "windows_x86_xp": "32" - } - iscc_args = [ - "/Qp", - "/DVERSION=" + package_version, - "/DsAppVersion=" + package_version, - "/DDEPLOY_PATH=" + desktop_dir, - "/DARCH=" + arch_list[common.platform], - "/D_ARCH=" + inno_arch_list[common.platform], + inno_file = "%s-%s-%s.exe" % (package_name, package_version, suffix) + inno_sa_file = "%s-Standalone-%s-%s.exe" % (package_name, package_version, suffix) + inno_update_file = "%s-Update-%s-%s.exe" % (package_name, package_version, suffix) + update_wrapper = not (hasattr(branding, 'desktop_updates_skip_iss_wrapper') and branding.desktop_updates_skip_iss_wrapper) + args = [ + "-Version", package_version, + "-Arch", arch ] - if branding.onlyoffice: - iscc_args.append("/D_ONLYOFFICE=1") - else: - iscc_args.append("/DsBrandingFolder=" + \ - utils.get_abspath(common.workspace_dir + "\\" + common.branding + "\\desktop-apps")) - if common.platform.endswith("_xp"): - iscc_args.append("/D_WIN_XP=1") if common.sign: - iscc_args.append("/DENABLE_SIGNING=1") - iscc_args.append("/Sbyparam=signtool.exe sign /a /v /n $q" + \ - branding.cert_name + "$q /t " + common.tsa_server + " $f") - args = ["iscc"] + iscc_args + ["common.iss"] - ret = utils.cmd(*args, creates=inno_file, verbose=True) + args += ["-Sign"] + + utils.log_h2("desktop inno build") + if xp: + ret = utils.ps1("make_inno.ps1", args + ["-Target", "xp"], verbose=True) + else: + ret = utils.ps1("make_inno.ps1", args, verbose=True) utils.set_summary("desktop inno build", ret) - if branding.onlyoffice and not common.platform.endswith("_xp"): - args = ["iscc"] + iscc_args + ["/DEMBED_HELP", "/DsPackageEdition=Standalone", "common.iss"] - ret = utils.cmd(*args, creates=inno_sa_file, verbose=True) + if branding.onlyoffice and not xp: + utils.log_h2("desktop inno standalone") + ret = utils.ps1("make_inno.ps1", args + ["-Target", "standalone"], verbose=True) utils.set_summary("desktop inno standalone build", ret) - if not (hasattr(branding, 'desktop_updates_skip_iss_wrapper') and branding.desktop_updates_skip_iss_wrapper): - args = ["iscc"] + iscc_args + ["/DTARGET_NAME=" + inno_file, "update_common.iss"] - ret = utils.cmd(*args, creates=inno_update_file, verbose=True) + if update_wrapper: + utils.log_h2("desktop inno update build") + if xp: + ret = utils.ps1("make_inno.ps1", args + ["-Target", "xp_update"], verbose=True) + else: + ret = utils.ps1("make_inno.ps1", args + ["-Target", "update"], verbose=True) utils.set_summary("desktop inno update build", ret) if common.deploy: @@ -208,127 +141,45 @@ def make_inno(): ret = s3_upload([inno_file], "desktop/win/inno/") utils.set_summary("desktop inno deploy", ret) - if branding.onlyoffice and not common.platform.endswith("_xp"): + if branding.onlyoffice and not xp: utils.log_h2("desktop inno standalone deploy") ret = s3_upload([inno_sa_file], "desktop/win/inno/") utils.set_summary("desktop inno standalone deploy", ret) utils.log_h2("desktop inno update deploy") if utils.is_file(inno_update_file): - ret = s3_upload( - [inno_update_file], "desktop/win/inno/" + inno_update_file_new) + ret = s3_upload([inno_update_file], "desktop/win/inno/") elif utils.is_file(inno_file): - ret = s3_upload( - [inno_file], "desktop/win/inno/" + inno_update_file_new) + ret = s3_upload([inno_file], "desktop/win/inno/" + inno_update_file) else: ret = False utils.set_summary("desktop inno update deploy", ret) - return - -def make_update_files(): - utils.log_h2("desktop update files build") - - changes_dir = common.workspace_dir + "\\" + utils.get_path(branding.desktop_changes_dir) + "\\" + common.version - if common.deploy and utils.glob_path(changes_dir + "\\*.html"): - utils.log_h2("desktop update files deploy") + changes_dir = common.workspace_dir + "\\" \ + + utils.get_path(branding.desktop_changes_dir) + "\\" + common.version + if common.platform == "windows_x64" and \ + common.deploy and \ + utils.glob_path(changes_dir + "\\*.html"): + utils.log_h2("desktop changelog deploy") ret = s3_upload( utils.glob_path(changes_dir + "\\*.html"), "desktop/win/update/%s/%s/" % (common.version, common.build)) - utils.set_summary("desktop update files deploy", ret) + utils.set_summary("desktop changelog deploy", ret) return def make_advinst(): - utils.log_h2("desktop advinst build") - - msi_build = { - "windows_x64": "MsiBuild64", - "windows_x86": "MsiBuild32" - }[common.platform] - - if not branding.onlyoffice: - multimedia_dir = common.workspace_dir + "\\" + common.branding + "\\multimedia" - utils.copy_file(branding_dir + "\\dictionary.ail", "dictionary.ail") - utils.copy_dir_content(branding_dir + "\\data", "data", ".bmp") - utils.copy_dir_content(branding_dir + "\\data", "data", ".png") - utils.copy_dir_content( - branding_dir + "\\..\\..\\extras\\projicons\\res", - "..\\..\\extras\\projicons\\res", - ".ico") - utils.copy_file( - branding_dir + "\\..\\..\\..\\common\\package\\license\\eula_" + common.branding + ".rtf", - "..\\..\\..\\common\\package\\license\\agpl-3.0.rtf") - utils.copy_file( - multimedia_dir + "\\imageviewer\\icons\\ico\\" + common.branding + ".ico", - "..\\..\\extras\\projicons\\res\\icons\\gallery.ico") - utils.copy_file( - multimedia_dir + "\\videoplayer\\icons\\" + common.branding + ".ico", - "..\\..\\extras\\projicons\\res\\icons\\media.ico") - - utils.write_file(desktop_dir + "\\converter\\package.config", "package=msi") - - aic_content = [";aic"] - if not common.sign: - aic_content += [ - "ResetSig" - ] - if branding.onlyoffice: - for path in utils.glob_path(desktop_dir + "\\editors\\web-apps\\apps\\*\\main\\resources\\help"): - utils.delete_dir(path) - aic_content += [ - "DelFolder CUSTOM_PATH" - ] - else: - aic_content += [ - "SetProperty UpgradeCode=\"" + branding.desktop_upgrade_code + "\"", - "AddUpgradeCode {47EEF706-B0E4-4C43-944B-E5F914B92B79} \ - -min_ver 7.1.1 -include_min_ver \ - -max_ver 7.2.2 -include_max_ver \ - -include_lang 1049 \ - -property_name UPGRADE_2 -enable_migrate", - "DelLanguage 1029 -buildname " + msi_build, - "DelLanguage 1031 -buildname " + msi_build, - "DelLanguage 1041 -buildname " + msi_build, - "DelLanguage 1046 -buildname " + msi_build, - "DelLanguage 2070 -buildname " + msi_build, - "DelLanguage 1060 -buildname " + msi_build, - "DelLanguage 1036 -buildname " + msi_build, - "DelLanguage 3082 -buildname " + msi_build, - "DelLanguage 1033 -buildname " + msi_build, - "SetCurrentFeature ExtendedFeature", - "NewSync CUSTOM_PATH " + viewer_dir, - "UpdateFile CUSTOM_PATH\\ImageViewer.exe " + viewer_dir + "\\ImageViewer.exe", - "UpdateFile CUSTOM_PATH\\VideoPlayer.exe " + viewer_dir + "\\VideoPlayer.exe", - "SetProperty ProductName=\"" + branding.desktop_product_name_full + "\"", - "SetProperty ASCC_REG_PREFIX=" + branding.ascc_reg_prefix - ] - if common.platform == "windows_x86": - aic_content += [ - "SetComponentAttribute -feature_name ExtendedFeature -unset -64bit_component" - ] - if common.platform == "windows_x86": - aic_content += [ - "SetComponentAttribute -feature_name MainFeature -unset -64bit_component", - "SetComponentAttribute -feature_name FileProgIds -unset -64bit_component", - "SetComponentAttribute -feature_name FileOpenWith -unset -64bit_component", - "SetComponentAttribute -feature_name FileProgramCapatibilities -unset -64bit_component", - "SetComponentAttribute -feature_name FileTypeAssociations -unset -64bit_component", - "SetComponentAttribute -feature_name FileNewTemplates -unset -64bit_component" - ] - aic_content += [ - "SetCurrentFeature MainFeature", - "NewSync APPDIR " + desktop_dir, - "UpdateFile APPDIR\\DesktopEditors.exe " + desktop_dir + "\\DesktopEditors.exe", - "UpdateFile APPDIR\\updatesvc.exe " + desktop_dir + "\\updatesvc.exe", - "SetProperty VERSION=\"" + package_version + "\"", - "SetProperty VERSION_SHORT=\"" + re.sub(r"^(\d+\.\d+).+", "\\1", package_version) + "\"", - "SetVersion " + package_version, - "SetPackageName " + advinst_file + " -buildname " + msi_build, - "Rebuild -buildslist " + msi_build + if not common.platform in ["windows_x64", "windows_x86"]: + return + advinst_file = "%s-%s-%s.msi" % (package_name, package_version, suffix) + args = [ + "-Version", package_version, + "-Arch", arch ] - utils.write_file("DesktopEditors.aic", "\r\n".join(aic_content), "utf-8-sig") - ret = utils.cmd("AdvancedInstaller.com", "/execute", \ - "DesktopEditors.aip", "DesktopEditors.aic", verbose=True) + if common.sign: + args += ["-Sign"] + + utils.log_h2("desktop advinst build") + ret = utils.ps1("make_advinst.ps1", args, verbose=True) utils.set_summary("desktop advinst build", ret) if common.deploy and ret: @@ -460,17 +311,6 @@ def make_sparkle_updates(): ) utils.set_summary("desktop sparkle files build", ret) - utils.log("") - utils.log_h3("generate checksums") - utils.sh( - "md5 *.zip *.delta > md5sums.txt", - chdir="build/update", verbose=True - ) - utils.sh( - "shasum -a 256 *.zip *.delta > sha256sums.txt", - chdir="build/update", verbose=True - ) - if common.deploy: utils.log_h2("desktop sparkle files deploy") ret = s3_upload( diff --git a/scripts/package_mobile.py b/scripts/package_mobile.py index 256729bc..f1fb6eb8 100644 --- a/scripts/package_mobile.py +++ b/scripts/package_mobile.py @@ -22,7 +22,7 @@ def make_mobile(): utils.sh("rm -rfv *.zip", verbose=True) utils.log_h2("mobile build") - ret = utils.sh("zip -r " + zip_file + " ./android* ./js", verbose=True) + ret = utils.sh("zip -r " + zip_file + " ./android ./ios", verbose=True) utils.set_summary("mobile build", ret) if common.deploy: diff --git a/scripts/package_utils.py b/scripts/package_utils.py index ac9f7921..75c7b6fc 100644 --- a/scripts/package_utils.py +++ b/scripts/package_utils.py @@ -12,7 +12,6 @@ import sys import time import package_common as common -import base def host_platform(): return platform.system().lower() @@ -73,6 +72,9 @@ def get_path(path): return path.replace("/", "\\") return path +def get_relpath(path, rel_path): + return os.path.relpath(get_path(path), get_path(rel_path)) + def get_abspath(path): return os.path.abspath(get_path(path)) @@ -199,13 +201,12 @@ def copy_files(src, dst, override=True, verbose=True): copy_files(file + "/*", dst + "/" + file_name, override) return -def copy_dir(src, dst, override=True, verbose=True): +def copy_dir(src, dst, verbose=True): if verbose: log("- copy_dir:") log(" src: " + src) log(" dst: " + dst) - log(" override: " + str(override)) - base.copy_dir(src, dst) + shutil.copytree(src, dst) return def copy_dir_content(src, dst, filter_include = "", filter_exclude = "", verbose=True): @@ -215,20 +216,18 @@ def copy_dir_content(src, dst, filter_include = "", filter_exclude = "", verbose log(" dst: " + dst) log(" include: " + filter_include) log(" exclude: " + filter_exclude) - src_folder = src - if ("/" != src[-1:]): - src_folder += "/" - src_folder += "*" - for file in glob.glob(src_folder): - basename = os.path.basename(file) - if ("" != filter_include) and (-1 == basename.find(filter_include)): + for item in os.listdir(src): + s = os.path.join(src, item) + d = os.path.join(dst, item) + if ("" != filter_include) and (-1 == item.find(filter_include)): continue - if ("" != filter_exclude) and (-1 != basename.find(filter_exclude)): + if ("" != filter_exclude) and (-1 != item.find(filter_exclude)): continue - if is_file(file): - copy_file(file, dst, verbose=False) - elif is_dir(file): - copy_dir(file, dst + "/" + basename, verbose=False) + if os.path.isdir(s): + shutil.copytree(s, d) + else: + shutil.copy2(s, d) + log(item) return def delete_file(path, verbose=True): @@ -323,33 +322,11 @@ def ps1(file, args=[], **kwargs): if kwargs.get("creates") and is_exist(kwargs["creates"]): return True ret = subprocess.call( - ["powershell", "-File", file] + args, stderr=subprocess.STDOUT, shell=True + ["powershell", "-ExecutionPolicy", "ByPass", "-File", file] + args, + stderr=subprocess.STDOUT, shell=True ) == 0 return ret -def download_file(url, path, md5, verbose=False): - if verbose: - log("- download_file:") - log(" url: " + path) - log(" path: " + url) - log(" md5: " + md5) - if is_file(path): - if get_hash_md5(path) == md5: - log_err("file already exist (match checksum)") - return True - else: - log_err("wrong checksum (%s), delete" % md5) - os.remove(path) - ret = powershell( - "(New-Object System.Net.WebClient).DownloadFile('%s','%s')" % (url, path), - verbose=True - ) - md5_new = get_hash_md5(path) - if md5 != md5_new: - log_err("checksum didn't match (%s != %s)" % (md5, md5_new)) - return False - return ret - def sh(command, **kwargs): if kwargs.get("verbose"): log("- sh:") diff --git a/scripts/qmake.py b/scripts/qmake.py new file mode 100644 index 00000000..def7bc1b --- /dev/null +++ b/scripts/qmake.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python + +import os +import sys + +__dir__name__ = os.path.dirname(__file__) +sys.path.append(__dir__name__ + '/core_common/modules/android') + +import base +import config +import android_ndk +import multiprocessing + +def get_make_file_suffix(platform): + suffix = platform + if config.check_option("config", "debug"): + suffix += "_debug_" + suffix += config.option("branding") + return suffix + +def get_j_num(): + if ("0" != config.option("multiprocess")): + return ["-j" + str(multiprocessing.cpu_count())] + return [] + +def check_support_platform(platform): + qt_dir = base.qt_setup(platform) + if not base.is_file(qt_dir + "/bin/qmake") and not base.is_file(qt_dir + "/bin/qmake.exe"): + return False + return True + +def make(platform, project, qmake_config_addon=""): + # check platform + if not check_support_platform(platform): + print("THIS PLATFORM IS NOT SUPPORTED") + return + + old_env = dict(os.environ) + + # qt + qt_dir = base.qt_setup(platform) + base.set_env("OS_DEPLOY", platform) + + # pro & makefile + file_pro = os.path.abspath(project) + + pro_dir = os.path.dirname(file_pro) + if (pro_dir.endswith("/.")): + pro_dir = pro_dir[:-2] + if (pro_dir.endswith("/")): + pro_dir = pro_dir[:-1] + + makefile_name = "Makefile." + get_make_file_suffix(platform) + makefile = pro_dir + "/" + makefile_name + stash_file = pro_dir + "/.qmake.stash" + + old_cur = os.getcwd() + os.chdir(pro_dir) + + if (base.is_file(stash_file)): + base.delete_file(stash_file) + if (base.is_file(makefile)): + base.delete_file(makefile) + + base.set_env("DEST_MAKEFILE_NAME", "./" + makefile_name) + + # setup android env + if (-1 != platform.find("android")): + base.set_env("ANDROID_NDK_HOST", android_ndk.host["arch"]) + base.set_env("ANDROID_NDK_PLATFORM", "android-" + android_ndk.get_sdk_api()) + base.set_env("PATH", qt_dir + "/bin:" + android_ndk.toolchain_dir() + "/bin:" + base.get_env("PATH")) + + # setup ios env + if (-1 != platform.find("ios")): + base.hack_xcode_ios() + + if base.is_file(makefile): + base.delete_file(makefile) + + config_param = base.qt_config(platform) + if ("" != qmake_config_addon): + config_param += (" " + qmake_config_addon) + + # qmake ADDON + qmake_addon = [] + if ("" != config.option("qmake_addon")): + qmake_addon = config.option("qmake_addon").split() + + clean_params = ["clean", "-f", makefile] + distclean_params = ["distclean", "-f", makefile] + build_params = ["-nocache", file_pro] + base.qt_config_as_param(config_param) + qmake_addon + + qmake_app = qt_dir + "/bin/qmake" + # non windows platform + if not base.is_windows(): + base.cmd(qmake_app, build_params) + base.correct_makefile_after_qmake(platform, makefile) + if ("1" == config.option("clean")): + base.cmd_and_return_cwd("make", clean_params, True) + base.cmd_and_return_cwd("make", distclean_params, True) + base.cmd(qmake_app, build_params) + base.correct_makefile_after_qmake(platform, makefile) + base.cmd_and_return_cwd("make", ["-f", makefile] + get_j_num()) + else: + config_params_array = base.qt_config_as_param(config_param) + config_params_string = "" + for item in config_params_array: + config_params_string += (" \"" + item + "\"") + qmake_addon_string = " ".join(qmake_addon) + if ("" != qmake_addon_string): + qmake_addon_string = " " + qmake_addon_string + + qmake_bat = [] + qmake_bat.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ("x86" if base.platform_is_32(platform) else "x64")) + qmake_addon_string = "" + if ("" != config.option("qmake_addon")): + qmake_addon_string = " " + (" ").join(["\"" + addon + "\"" for addon in qmake_addon]) + qmake_bat.append("call \"" + qmake_app + "\" -nocache " + file_pro + config_params_string + qmake_addon_string) + if ("1" == config.option("clean")): + qmake_bat.append("call nmake " + " ".join(clean_params)) + qmake_bat.append("call nmake " + " ".join(distclean_params)) + qmake_bat.append("call \"" + qmake_app + "\" -nocache " + file_pro + config_params_string + qmake_addon_string) + if ("0" != config.option("multiprocess")): + qmake_bat.append("set CL=/MP") + qmake_bat.append("call nmake -f " + makefile) + base.run_as_bat(qmake_bat) + + if (base.is_file(stash_file)): + base.delete_file(stash_file) + + os.chdir(old_cur) + + os.environ.clear() + os.environ.update(old_env) + return + +def make_all_platforms(project, qmake_config_addon=""): + platforms = config.option("platform").split() + for platform in platforms: + if not platform in config.platforms: + continue + + print("------------------------------------------") + print("BUILD_PLATFORM: " + platform) + print("------------------------------------------") + make(platform, project, qmake_config_addon) + return diff --git a/scripts/sln.py b/scripts/sln.py new file mode 100644 index 00000000..fc7e10a9 --- /dev/null +++ b/scripts/sln.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python + +import sys +sys.path.append('scripts') +import config +import json +import os + +is_log = False + +def is_exist_in_array(projects, proj): + for p in projects: + if p == proj: + return True + return False + +def adjust_project_params(params): + ret_params = params + + # check aliases + all_windows = [] + all_windows_xp = [] + all_linux = [] + all_mac = [] + all_android = [] + + for i in config.platforms: + if (0 == i.find("win")): + all_windows.append(i) + if (-1 != i.find("xp")): + all_windows_xp.append(i) + elif (0 == i.find("linux")): + all_linux.append(i) + elif (0 == i.find("mac")): + all_mac.append(i) + elif (0 == i.find("android")): + all_android.append(i) + + if is_exist_in_array(params, "win"): + ret_params += all_windows + if is_exist_in_array(params, "!win"): + ret_params += ["!" + x for x in all_windows] + + if is_exist_in_array(params, "win_xp"): + ret_params += all_windows_xp + if is_exist_in_array(params, "!win_xp"): + ret_params += ["!" + x for x in all_windows_xp] + + if is_exist_in_array(params, "linux"): + ret_params += all_linux + if is_exist_in_array(params, "!linux"): + ret_params += ["!" + x for x in all_linux] + + if is_exist_in_array(params, "mac"): + ret_params += all_mac + if is_exist_in_array(params, "!mac"): + ret_params += ["!" + x for x in all_mac] + + if is_exist_in_array(params, "android"): + ret_params += all_android + if is_exist_in_array(params, "!android"): + ret_params += ["!" + x for x in all_android] + + return ret_params + +def get_projects(pro_json_path, platform): + json_path = os.path.abspath(pro_json_path) + data = json.load(open(json_path)) + + root_dir_json = "../" + if ("root" in data): + root_dir_json = data["root"] + + root_dir = os.path.dirname(json_path) + if ("/" != root_dir[-1] and "\\" != root_dir[-1]): + root_dir += "/" + root_dir += root_dir_json + + result = [] + modules = config.option("module").split(" ") + for module in modules: + if (module == ""): + continue + if not module in data: + continue + + # check aliases to modules + records_src = data[module] + records = [] + + for rec in records_src: + if rec in data: + records += data[rec] + else: + records.append(rec) + + for rec in records: + params = [] + record = rec + if (0 == rec.find("[")): + pos = rec.find("]") + if (-1 == pos): + continue + record = rec[pos+1:] + header = rec[1:pos].replace(" ", "") + params_tmp = rec[1:pos].split(",") + for par in params_tmp: + if (par != ""): + params.append(par) + + params = adjust_project_params(params) + + if is_exist_in_array(result, record): + continue + + if is_log: + print("params: " + ",".join(params)) + print("file: " + record) + + if is_exist_in_array(params, "!" + platform): + continue + + platform_records = [] + platform_records += config.platforms + platform_records += ["win", "win_xp", "linux", "mac", "android"] + + # if one platform exists => all needed must exists + is_needed_platform_exist = False + for pl in platform_records: + if is_exist_in_array(params, pl): + is_needed_platform_exist = True; + break + + # if one config exists => all needed must exists + is_needed_config_exist = False + for item in params: + if (0 == item.find("!")): + continue + if is_exist_in_array(platform_records, item): + continue + is_needed_config_exist = True + break; + + if is_needed_platform_exist: + if not is_exist_in_array(params, platform): + continue + + config_params = config.option("config").split(" ") + config.option("features").split(" ") + config_params = [x for x in config_params if x] + + is_append = True + for conf in config_params: + if is_exist_in_array(params, "!" + conf): + is_append = False + break + if is_needed_config_exist and not is_exist_in_array(params, conf): + is_append = False + break + if is_append: + result.append(root_dir + record) + + if is_log: + print(result) + return result + +# test example +if __name__ == '__main__': + # test + config.parse() + + is_log = True + projects = get_projects("./../sln.json", "win_64") diff --git a/sln.json b/sln.json new file mode 100644 index 00000000..ecd3f438 --- /dev/null +++ b/sln.json @@ -0,0 +1,101 @@ +{ + "root" : "../", + + "core" : [ + + "core/Common/3dParty/cryptopp/project/cryptopp.pro", + "core/Common/cfcpp/cfcpp.pro", + + "core/UnicodeConverter/UnicodeConverter.pro", + "core/Common/kernel.pro", + "core/Common/Network/network.pro", + + "core/DesktopEditor/graphics/pro/graphics.pro", + + "core/PdfFile/PdfFile.pro", + "core/DjVuFile/DjVuFile.pro", + "core/XpsFile/XpsFile.pro", + "core/HtmlFile2/HtmlFile2.pro", + "core/Fb2File/Fb2File.pro", + "core/EpubFile/CEpubFile.pro", + + "core/HtmlRenderer/htmlrenderer.pro", + "core/DocxRenderer/DocxRenderer.pro", + + "core/DesktopEditor/doctrenderer/doctrenderer.pro", + "core/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder_func_lib.pro", + + "[!no_x2t]core/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro", + "[!no_x2t]core/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro", + "[!no_x2t]core/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro", + + "[!no_x2t]core/MsBinaryFile/Projects/DocFormatLib/Linux/DocFormatLib.pro", + "[!no_x2t]core/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro", + "[!no_x2t]core/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro", + "[!no_x2t]core/MsBinaryFile/Projects/VbaFormatLib/Linux/VbaFormatLib.pro", + + "[!no_x2t]core/TxtFile/Projects/Linux/TxtXmlFormatLib.pro", + "[!no_x2t]core/RtfFile/Projects/Linux/RtfFormatLib.pro", + "[!no_x2t]core/OdfFile/Projects/Linux/OdfFormatLib.pro", + + "[!no_x2t]core/OOXML/Projects/Linux/BinDocument/BinDocument.pro", + + "[!no_x2t]core/X2tConverter/build/Qt/X2tConverter.pro", + + "[win,linux,mac]core/DesktopEditor/AllFontsGen/AllFontsGen.pro", + "[win,linux,mac]core/DesktopEditor/allthemesgen/allthemesgen.pro", + + "[win,linux,mac]core/DesktopEditor/doctrenderer/app_builder/docbuilder.pro", + + "[win,linux,mac]core/DesktopEditor/pluginsmanager/pluginsmanager.pro", + + "[win,linux,mac,!linux_arm64]core/OfficeCryptReader/ooxml_crypt/ooxml_crypt.pro", + + "[win,linux,mac,!no_tests]core/DesktopEditor/vboxtester/vboxtester.pro", + "[win,linux,mac,!no_tests]core/Test/Applications/StandardTester/standardtester.pro", + "[win,linux,mac,!no_tests]core/Test/Applications/x2tTester/x2ttester.pro", + "[win,linux,mac,!no_tests]core/Test/Applications/MetafileTester/MetafileTester.pro" + + ], + + "builder" : [ + "core" + ], + + "server" : [ + "core" + ], + + "multimedia" : [ + "[win,linux]desktop-sdk/ChromiumBasedEditors/videoplayerlib/videoplayerlib.pro" + ], + + "spell" : [ + "[win,linux,mac]core/Common/3dParty/hunspell/qt/hunspell.pro" + ], + + "desktop" : [ + "core", + "spell", + "multimedia", + + "core/DesktopEditor/xmlsec/src/ooxmlsignature.pro", + + "desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore.pro", + "desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore_helper.pro", + + "[win,linux]desktop-sdk/ChromiumBasedEditors/lib/qt_wrapper/qtascdocumentscore.pro", + "[win,linux]desktop-apps/win-linux/ASCDocumentEditor.pro", + + "[win]desktop-apps/win-linux/extras/projicons/ProjIcons.pro", + "[win,!win_xp]desktop-apps/win-linux/extras/update-daemon/UpdateDaemon.pro" + ], + + "mobile" : [ + "core" + ], + + "osign" : [ + "[win,linux,mac]core/DesktopEditor/xmlsec/src/osign/lib/osign.pro" + ] +} diff --git a/tools/linux/arm/arm32/Dockerfile b/tools/linux/arm/arm32/Dockerfile new file mode 100644 index 00000000..acd0d694 --- /dev/null +++ b/tools/linux/arm/arm32/Dockerfile @@ -0,0 +1,38 @@ +FROM arm32v7/ubuntu:16.04 + +# basic dependencies +RUN apt-get -y update && \ + apt-get -y install wget xz-utils + +# qt source +RUN mkdir /source && cd /source && \ + wget -q https://download.qt.io/new_archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz && \ + tar -xf qt-everywhere-opensource-src-5.9.9.tar.xz + +# build dependencies +RUN apt-get -y install \ + build-essential \ + glib-2.0-dev \ + libglu1-mesa-dev \ + libgtk-3-dev \ + libpulse-dev \ + libasound2-dev \ + libatspi2.0-dev \ + libcups2-dev \ + libdbus-1-dev \ + libicu-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libx11-xcb-dev \ + libxcb* \ + libxi-dev \ + libxrender-dev \ + libxss-dev + +# increase or decrease CORES value to change the number of parallel jobs while building qt +ENV CORES=4 + +CMD cd /source/qt-everywhere-opensource-src-5.9.9 && \ + ./configure -opensource -confirm-license -release -shared -accessibility -prefix /build -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 && \ + make -j$CORES && \ + make install diff --git a/tools/linux/arm/arm64/Dockerfile b/tools/linux/arm/arm64/Dockerfile new file mode 100644 index 00000000..86940687 --- /dev/null +++ b/tools/linux/arm/arm64/Dockerfile @@ -0,0 +1,38 @@ +FROM arm64v8/ubuntu:16.04 + +# basic dependencies +RUN apt-get -y update && \ + apt-get -y install wget xz-utils + +# qt source +RUN mkdir /source && cd /source && \ + wget -q https://download.qt.io/new_archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz && \ + tar -xf qt-everywhere-opensource-src-5.9.9.tar.xz + +# build dependencies +RUN apt-get -y install \ + build-essential \ + glib-2.0-dev \ + libglu1-mesa-dev \ + libgtk-3-dev \ + libpulse-dev \ + libasound2-dev \ + libatspi2.0-dev \ + libcups2-dev \ + libdbus-1-dev \ + libicu-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libx11-xcb-dev \ + libxcb* \ + libxi-dev \ + libxrender-dev \ + libxss-dev + +# increase or decrease CORES value to change the number of parallel jobs while building qt +ENV CORES=4 + +CMD cd /source/qt-everywhere-opensource-src-5.9.9 && \ + ./configure -opensource -confirm-license -release -shared -accessibility -prefix /build -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 && \ + make -j$CORES && \ + make install diff --git a/tools/linux/arm/build_qt.py b/tools/linux/arm/build_qt.py new file mode 100755 index 00000000..741af691 --- /dev/null +++ b/tools/linux/arm/build_qt.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import sys +import os +import argparse + +__dir__name__ = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(__dir__name__ + '/../../../scripts') +import base + +def docker_build(image_name, dockerfile_dir, build_dir): + base.cmd("docker", ["build", "-t", image_name, dockerfile_dir]) + base.cmd("docker", ["run", "--rm", "-v", build_dir + ":/build", image_name]) + base.cmd("docker", ["image", "rm", image_name]) + return + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Build qt for linux arm architecture') + parser.add_argument('build_dir', help='the path to build directory (directory may not exist)') + parser.add_argument('-a', '--arch', action='store', help='target architecture (arm32 or arm64)', choices=['arm32', 'arm64'], required=True) + args = parser.parse_args() + + build_dir = args.build_dir + if base.is_dir(build_dir): + base.delete_dir(build_dir) + base.create_dir(build_dir) + + abs_build_path = os.path.abspath(build_dir) + arch = args.arch + docker_build('qt-' + arch, __dir__name__ + "/" + arch, abs_build_path) diff --git a/tools/linux/deps.py b/tools/linux/deps.py index 85fe805a..6a69bd44 100755 --- a/tools/linux/deps.py +++ b/tools/linux/deps.py @@ -54,17 +54,10 @@ def install_deps(): print("Installed Node.js version: " + str(nodejs_cur_version_major) + "." + str(nodejs_cur_version_minor)) except: nodejs_cur = 1 - if (nodejs_cur < 14000): - print("Node.js version cannot be less 14") + if (nodejs_cur < 16000): + print("Node.js version cannot be less 16") print("Reinstall") - if (base.is_dir("./node_js_setup_14.x")): - base.delete_dir("./node_js_setup_14.x") - base.cmd("sudo", ["apt-get", "remove", "--purge", "-y", "nodejs"]) - base.download("https://deb.nodesource.com/setup_14.x", "./node_js_setup_14.x") - base.cmd('curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -') - base.cmd("sudo", ["bash", "./node_js_setup_14.x"]) - base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) - base.cmd("sudo", ["npm", "install", "-g", "npm@6"]) + base.run_as_bat(["curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&sudo apt-get install -y nodejs"]) else: print("OK") base.cmd("sudo", ["apt-get", "-y", "install", "npm", "yarn"], True) diff --git a/tools/linux/python3.tar.gz b/tools/linux/python3.tar.gz new file mode 100644 index 00000000..813cf169 Binary files /dev/null and b/tools/linux/python3.tar.gz differ diff --git a/version b/version index cd1d2e94..8104cabd 100644 --- a/version +++ b/version @@ -1 +1 @@ -8.0.1 +8.1.0