From 62172b7ff1bbb4cb1c3d45e6647e78124622e1c2 Mon Sep 17 00:00:00 2001 From: Martin Fouilleul Date: Tue, 5 Nov 2024 11:50:58 +0100 Subject: [PATCH] fix libfribidi install name on macOS --- .gitignore | 1 + scripts/dev.py | 21 ++++++++++++++++++++- src/tool/bundle.c | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 68d78037..4ec918ec 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ scripts/files /ext src/ext/angle src/ext/harfbuzz +src/ext/fribidi sketches/*/bin diff --git a/scripts/dev.py b/scripts/dev.py index a6281b5b..e821b286 100644 --- a/scripts/dev.py +++ b/scripts/dev.py @@ -579,6 +579,15 @@ def build_fribidi(release=False): "make" ], check=True) + # fix install name for macOS + if platform.system() == "Darwin": + subprocess.run([ + "install_name_tool", + "-id", "libfribidi.dylib", + "lib/.libs/libfribidi.dylib", + ], check=True) + + # build wasm source_files = glob.glob("lib/*.c"); @@ -1105,6 +1114,8 @@ def build_platform_layer_lib_win(release): "/DELAYLOAD:webgpu.dll", "libharfbuzz.dll.lib", "/DELAYLOAD:libharfbuzz.dll", + "libfribidi.dll.lib", + "/DELAYLOAD:libfribidi.dll", ] debug_flags = ["/O2", "/Zi"] if release else ["/Zi", "/DOC_DEBUG", "/DOC_LOG_COMPILE_DEBUG"] @@ -1175,7 +1186,7 @@ def build_platform_layer_lib_mac(release): "build/orca_c.o", "build/orca_objc.o", "-Lbuild/bin", "-lc", "-lc++", "-framework", "Carbon", "-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore", - "-weak-lEGL", "-weak-lGLESv2", "-weak-lwebgpu", "-weak-lharfbuzz" + "-weak-lEGL", "-weak-lGLESv2", "-weak-lwebgpu", "-weak-lharfbuzz", "-weak-lfribidi", ], check=True) # change dependent libs path to @rpath @@ -1196,6 +1207,12 @@ def build_platform_layer_lib_mac(release): "build/bin/liborca.dylib", ], check=True) + subprocess.run([ + "install_name_tool", + "-change", "libfribidi.dylib", "@rpath/libfribidi.dylib", + "build/bin/liborca.dylib", + ], check=True) + # add executable path to rpath. Client executable can still add its own # rpaths if needed, e.g. @executable_path/libs/ etc. subprocess.run([ @@ -1611,6 +1628,7 @@ def package_sdk_internal(dest, target): shutil.copy(os.path.join("build", "bin", "libGLESv2.dll"), bin_dir) shutil.copy(os.path.join("build", "bin", "webgpu.dll"), bin_dir) shutil.copy(os.path.join("build", "bin", "libharfbuzz.dll"), bin_dir) + shutil.copy(os.path.join("build", "bin", "libfribidi.dll"), bin_dir) else: shutil.copy(os.path.join("build", "bin", "orca"), bin_dir) shutil.copy(os.path.join("build", "bin", "orca_runtime"), bin_dir) @@ -1620,6 +1638,7 @@ def package_sdk_internal(dest, target): shutil.copy(os.path.join("build", "bin", "libGLESv2.dylib"), bin_dir) shutil.copy(os.path.join("build", "bin", "libwebgpu.dylib"), bin_dir) shutil.copy(os.path.join("build", "bin", "libharfbuzz.dylib"), bin_dir) + shutil.copy(os.path.join("build", "bin", "libfribidi.dylib"), bin_dir) shutil.copytree(os.path.join("build", "orca-libc"), libc_dir, dirs_exist_ok=True) shutil.copytree("resources", res_dir, dirs_exist_ok=True) diff --git a/src/tool/bundle.c b/src/tool/bundle.c index 1e7f8c62..1a23d15b 100644 --- a/src/tool/bundle.c +++ b/src/tool/bundle.c @@ -195,12 +195,14 @@ int winBundle( oc_str8 eglLib = oc_path_append(a, sdkDir, OC_STR8("bin/libEGL.dll")); oc_str8 wgpuLib = oc_path_append(a, sdkDir, OC_STR8("bin/webgpu.dll")); oc_str8 harfbuzzLib = oc_path_append(a, sdkDir, OC_STR8("bin/libharfbuzz.dll")); + oc_str8 fribidiLib = oc_path_append(a, sdkDir, OC_STR8("bin/libhfribidi.dll")); TRY(oc_sys_copy(orcaLib, exeDir)); TRY(oc_sys_copy(glesLib, exeDir)); TRY(oc_sys_copy(eglLib, exeDir)); TRY(oc_sys_copy(wgpuLib, exeDir)); TRY(oc_sys_copy(harfbuzzLib, exeDir)); + TRY(oc_sys_copy(fribidiLib, exeDir)); //----------------------------------------------------------- //NOTE: copy wasm module and data @@ -297,6 +299,7 @@ int macBundle( oc_str8 eglLib = oc_path_append(a, sdkDir, OC_STR8("bin/libEGL.dylib")); oc_str8 wgpu_lib = oc_path_append(a, sdkDir, OC_STR8("bin/libwebgpu.dylib")); oc_str8 harfbuzz_lib = oc_path_append(a, sdkDir, OC_STR8("bin/libharfbuzz.dylib")); + oc_str8 fribidi_lib = oc_path_append(a, sdkDir, OC_STR8("bin/libfribidi.dylib")); TRY(oc_sys_copy(orcaExe, exeDir)); TRY(oc_sys_copy(orcaLib, exeDir)); @@ -304,6 +307,7 @@ int macBundle( TRY(oc_sys_copy(eglLib, exeDir)); TRY(oc_sys_copy(wgpu_lib, exeDir)); TRY(oc_sys_copy(harfbuzz_lib, exeDir)); + TRY(oc_sys_copy(fribidi_lib, exeDir)); //----------------------------------------------------------- //NOTE: copy wasm module and data