Skip to content

Commit 8beb8b3

Browse files
committed
Change deploy for desktop
1 parent 8cf076a commit 8beb8b3

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

scripts/base.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def git_get_base_url():
538538
if at_pos != -1 and colon_pos != -1:
539539
host = origin[at_pos+1:colon_pos]
540540
return f"https://{host}/"
541-
541+
542542
# Fallback to GitHub
543543
return "https://github.com/"
544544

@@ -1237,13 +1237,26 @@ def get_file_last_modified_url(url):
12371237

12381238
return retvalue
12391239

1240+
def mac_change_rpath_binary(bin, old, new):
1241+
cmd("install_name_tool", ["-change", old, new, bin], True)
1242+
1243+
def mac_change_rpath_library(lib_name, old, new):
1244+
# converts library name to actual library file name (dylib or binary file in framework)
1245+
def lib_name_to_file_name(lib_name):
1246+
if config.check_option("config", "bundle_dylibs"):
1247+
lib = lib_name + ".framework/" + lib_name
1248+
else:
1249+
lib = "lib" + lib_name + ".dylib"
1250+
return lib
1251+
mac_change_rpath_binary(lib_name_to_file_name(lib_name), old, new)
1252+
12401253
def mac_correct_rpath_binary(path, libs):
1241-
# if framework are built, do not change lib paths but add `@loader_path` to rpaths instead with `mac_add_loader_path_to_rpath()`
1254+
# if framework are built, instead of correcting lib paths add `@loader_path` to rpaths with `mac_add_loader_path_to_rpath()`
12421255
if config.check_option("config", "bundle_dylibs"):
12431256
return
12441257

12451258
for lib in libs:
1246-
cmd("install_name_tool", ["-change", "lib" + lib + ".dylib", "@rpath/lib" + lib + ".dylib", path], True)
1259+
mac_change_rpath_binary(path, "lib" + lib + ".dylib", "@rpath/lib" + lib + ".dylib")
12471260
return
12481261

12491262
def mac_correct_rpath_library(name, libs):
@@ -1320,7 +1333,7 @@ def mac_correct_rpath_desktop(dir):
13201333
mac_correct_rpath_library("hunspell", [])
13211334
mac_correct_rpath_library("ooxmlsignature", ["kernel"])
13221335
mac_correct_rpath_library("ascdocumentscore", ["UnicodeConverter", "kernel", "graphics", "kernel_network", "PdfFile", "XpsFile", "DjVuFile", "hunspell", "ooxmlsignature", "doctrenderer"])
1323-
cmd("install_name_tool", ["-change", "@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework", "@rpath/Chromium Embedded Framework.framework/Chromium Embedded Framework", "libascdocumentscore.dylib"])
1336+
mac_change_rpath_library("ascdocumentscore", "@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework", "@rpath/Chromium Embedded Framework.framework/Chromium Embedded Framework")
13241337
mac_correct_rpath_binary("./editors_helper.app/Contents/MacOS/editors_helper", ["ascdocumentscore", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "OFDFile", "DjVuFile", "hunspell", "ooxmlsignature", "doctrenderer"])
13251338
cmd("install_name_tool", ["-add_rpath", "@executable_path/../../../../Frameworks", "./editors_helper.app/Contents/MacOS/editors_helper"], True)
13261339
cmd("install_name_tool", ["-add_rpath", "@executable_path/../../../../Resources/converter", "./editors_helper.app/Contents/MacOS/editors_helper"], True)
@@ -1873,8 +1886,11 @@ def get_autobuild_version(product, platform="", branch="", build=""):
18731886
return "http://repo-doc-onlyoffice-com.s3.amazonaws.com/archive/" + download_addon
18741887

18751888
def create_x2t_js_cache(dir, product, platform):
1876-
if is_file(dir + "/libdoctrenderer.dylib") and (os.path.getsize(dir + "/libdoctrenderer.dylib") < 5*1024*1024):
1877-
return
1889+
# mac
1890+
if is_file(dir + "/libdoctrenderer.dylib") or is_dir(dir + "/doctrenderer.framework"):
1891+
doctrenderer_lib = "libdoctrenderer.dylib" if is_file(dir + "/libdoctrenderer.dylib") else "doctrenderer.framework/doctrenderer"
1892+
if os.path.getsize(dir + "/" + doctrenderer_lib) < 5*1024*1024:
1893+
return
18781894

18791895
if ((platform == "linux_arm64") and not is_os_arm()):
18801896
cmd_in_dir_qemu(platform, dir, "./x2t", ["-create-js-snapshots"], True)

scripts/deploy_desktop.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def copy_lib_with_links(src_dir, dst_dir, lib, version):
1212
lib_major_name = lib + "." + major_version
1313

1414
base.copy_file(src_dir + "/" + lib_full_name, dst_dir + "/" + lib_full_name)
15-
15+
1616
base.cmd_in_dir(dst_dir, "ln", ["-s", "./" + lib_full_name, "./" + lib_major_name])
1717
base.cmd_in_dir(dst_dir, "ln", ["-s", "./" + lib_major_name, "./" + lib])
1818

@@ -72,7 +72,7 @@ def make():
7272
base.copy_lib(build_libraries_path, root_dir + "/converter", "IWorkFile")
7373
base.copy_lib(build_libraries_path, root_dir + "/converter", "HWPFile")
7474
base.copy_lib(build_libraries_path, root_dir + "/converter", "DocxRenderer")
75-
75+
7676
if ("ios" == platform):
7777
base.copy_lib(build_libraries_path, root_dir + "/converter", "x2t")
7878
else:
@@ -91,15 +91,15 @@ def make():
9191
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.so.58", root_dir + "/converter/libicudata.so.58")
9292
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.so.58", root_dir + "/converter/libicuuc.so.58")
9393

94-
if (0 == platform.find("mac")):
94+
if (0 == platform.find("mac") and not config.check_option("config", "bundle_dylibs")):
9595
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.58.dylib", root_dir + "/converter/libicudata.58.dylib")
9696
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.58.dylib", root_dir + "/converter/libicuuc.58.dylib")
9797

9898
# doctrenderer
9999
if isWindowsXP:
100100
base.copy_lib(build_libraries_path + "/xp", root_dir + "/converter", "doctrenderer")
101101
else:
102-
base.copy_lib(build_libraries_path, root_dir + "/converter", "doctrenderer")
102+
base.copy_lib(build_libraries_path, root_dir + "/converter", "doctrenderer")
103103
base.copy_v8_files(core_dir, root_dir + "/converter", platform, isWindowsXP)
104104

105105
base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries")
@@ -117,7 +117,7 @@ def make():
117117
base.copy_file(git_dir + "/core-fonts/ASC.ttf", root_dir + "/fonts/ASC.ttf")
118118

119119
base.copy_file(git_dir + "/desktop-apps/common/package/license/3dparty/3DPARTYLICENSE", root_dir + "/3DPARTYLICENSE")
120-
120+
121121
# cef
122122
build_dir_name = "build"
123123
if (0 == platform.find("linux")) and (config.check_option("config", "cef_version_107")):
@@ -140,18 +140,18 @@ def make():
140140
base.copy_lib(build_libraries_path + ("/xp" if isWindowsXP else ""), root_dir, "ascdocumentscore")
141141
if (0 != platform.find("mac")):
142142
base.copy_lib(build_libraries_path + ("/xp" if isWindowsXP else ""), root_dir, "qtascdocumentscore")
143-
143+
144144
if (0 == platform.find("mac")):
145145
base.copy_dir(core_build_dir + "/bin/" + platform_postfix + "/editors_helper.app", root_dir + "/editors_helper.app")
146146
else:
147147
base.copy_exe(core_build_dir + "/bin/" + platform_postfix + ("/xp" if isWindowsXP else ""), root_dir, "editors_helper")
148-
148+
149149
if isUseQt:
150150
base.qt_copy_lib("Qt5Core", root_dir)
151151
base.qt_copy_lib("Qt5Gui", root_dir)
152152
base.qt_copy_lib("Qt5PrintSupport", root_dir)
153153
base.qt_copy_lib("Qt5Svg", root_dir)
154-
base.qt_copy_lib("Qt5Widgets", root_dir)
154+
base.qt_copy_lib("Qt5Widgets", root_dir)
155155
base.qt_copy_lib("Qt5Network", root_dir)
156156
base.qt_copy_lib("Qt5OpenGL", root_dir)
157157

@@ -160,7 +160,7 @@ def make():
160160
base.qt_copy_plugin("imageformats", root_dir)
161161
base.qt_copy_plugin("platforms", root_dir)
162162
base.qt_copy_plugin("platforminputcontexts", root_dir)
163-
base.qt_copy_plugin("printsupport", root_dir)
163+
base.qt_copy_plugin("printsupport", root_dir)
164164

165165
base.qt_copy_plugin("platformthemes", root_dir)
166166
base.qt_copy_plugin("xcbglintegrations", root_dir)
@@ -194,9 +194,9 @@ def make():
194194

195195
if base.check_congig_option_with_platfom(platform, "libvlc"):
196196
vlc_dir = git_dir + "/core/Common/3dParty/libvlc/build/" + platform + "/lib"
197-
197+
198198
if (0 == platform.find("win")):
199-
base.copy_dir(vlc_dir + "/plugins", root_dir + "/plugins")
199+
base.copy_dir(vlc_dir + "/plugins", root_dir + "/plugins")
200200
base.copy_files(vlc_dir + "/*.dll", root_dir)
201201
base.copy_file(vlc_dir + "/vlc-cache-gen.exe", root_dir + "/vlc-cache-gen.exe")
202202
elif (0 == platform.find("linux")):
@@ -242,7 +242,7 @@ def make():
242242
#base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/encrypt/ui/common/{14A8FC87-8E26-4216-B34E-F27F053B2EC4}", root_dir + "/editors/sdkjs-plugins/{14A8FC87-8E26-4216-B34E-F27F053B2EC4}")
243243
#base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/encrypt/ui/engine/database/{9AB4BBA8-A7E5-48D5-B683-ECE76A020BB1}", root_dir + "/editors/sdkjs-plugins/{9AB4BBA8-A7E5-48D5-B683-ECE76A020BB1}")
244244
base.copy_sdkjs_plugin(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins", root_dir + "/editors/sdkjs-plugins", "sendto", True)
245-
245+
246246
base.copy_file(base_dir + "/js/" + branding + "/desktop/index.html", root_dir + "/index.html")
247247
base.create_dir(root_dir + "/editors/webext")
248248
base.copy_file(base_dir + "/js/" + branding + "/desktop/noconnect.html", root_dir + "/editors/webext/noconnect.html")
@@ -255,7 +255,10 @@ def make():
255255

256256
isUseJSC = False
257257
if (0 == platform.find("mac")):
258-
file_size_doctrenderer = os.path.getsize(root_dir + "/converter/libdoctrenderer.dylib")
258+
doctrenderer_lib = "libdoctrenderer.dylib"
259+
if config.check_option("config", "bundle_dylibs"):
260+
doctrenderer_lib = "doctrenderer.framework/doctrenderer"
261+
file_size_doctrenderer = os.path.getsize(root_dir + "/converter/" + doctrenderer_lib)
259262
print("file_size_doctrenderer: " + str(file_size_doctrenderer))
260263
if (file_size_doctrenderer < 5*1024*1024):
261264
isUseJSC = True
@@ -303,4 +306,3 @@ def make():
303306
base.delete_file(root_dir + "/editors/sdkjs/slide/sdk-all.cache")
304307

305308
return
306-

0 commit comments

Comments
 (0)