From b3468451f5450afb353831b4ca7db5d0d9b291f5 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 20 Mar 2019 12:48:05 -0400 Subject: [PATCH] Linux: Load additional binaries from DIR_ASSETS (fixes issue #1936) This adds *.pak, locales/*.pak , chrome-sandbox, libGLESv2.so, libEGL.so and swiftshader/*.so to the list of binaries that will be loaded from the libcef.so directory instead of the executable directory by default. --- libcef/common/main_delegate.cc | 7 +++-- patch/patch.cfg | 5 ++++ patch/patches/linux_assets_path_1936.patch | 35 ++++++++++++++++++++++ tools/distrib/linux/README.standard.txt | 8 ++--- 4 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 patch/patches/linux_assets_path_1936.patch diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 7ba200fb6..f10146aaa 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -139,7 +139,7 @@ void OverrideChildProcessPath() { base::FilePath GetResourcesFilePath() { base::FilePath pak_dir; - base::PathService::Get(base::DIR_MODULE, &pak_dir); + base::PathService::Get(base::DIR_ASSETS, &pak_dir); return pak_dir; } @@ -265,8 +265,9 @@ bool IsScaleFactorSupported(ui::ScaleFactor scale_factor) { } #if defined(OS_LINUX) -// Look for the *.dat and *.bin files next to libcef instead of the exe on -// Linux. This is already the default on Windows. +// Look for binary files (*.bin, *.dat, *.pak, chrome-sandbox, libGLESv2.so, +// libEGL.so, locales/*.pak, swiftshader/*.so) next to libcef instead of the exe +// on Linux. This is already the default on Windows. void OverrideAssetPath() { Dl_info dl_info; if (dladdr(reinterpret_cast(&OverrideAssetPath), &dl_info)) { diff --git a/patch/patch.cfg b/patch/patch.cfg index 4005a1184..7b215dc02 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -418,6 +418,11 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issues/2495 'name': 'message_pump_mac_2495', }, + { + # Linux: Load binaries from DIR_ASSETS. + # https://bitbucket.org/chromiumembedded/cef/issues/1936 + 'name': 'linux_assets_path_1936', + }, { # Windows: Fix jumbo build error in AccessibilityTreeFormatterWin # https://bugs.chromium.org/p/chromium/issues/detail?id=939668 diff --git a/patch/patches/linux_assets_path_1936.patch b/patch/patches/linux_assets_path_1936.patch new file mode 100644 index 000000000..39fde5688 --- /dev/null +++ b/patch/patches/linux_assets_path_1936.patch @@ -0,0 +1,35 @@ +diff --git sandbox/linux/suid/client/setuid_sandbox_host.cc sandbox/linux/suid/client/setuid_sandbox_host.cc +index 7a103bf7f13c..cd3167ebed09 100644 +--- sandbox/linux/suid/client/setuid_sandbox_host.cc ++++ sandbox/linux/suid/client/setuid_sandbox_host.cc +@@ -120,7 +120,7 @@ bool SetuidSandboxHost::IsDisabledViaEnvironment() { + base::FilePath SetuidSandboxHost::GetSandboxBinaryPath() { + base::FilePath sandbox_binary; + base::FilePath exe_dir; +- if (base::PathService::Get(base::DIR_EXE, &exe_dir)) { ++ if (base::PathService::Get(base::DIR_ASSETS, &exe_dir)) { + base::FilePath sandbox_candidate = exe_dir.AppendASCII("chrome-sandbox"); + if (base::PathExists(sandbox_candidate)) + sandbox_binary = sandbox_candidate; +diff --git ui/gl/init/gl_initializer_x11.cc ui/gl/init/gl_initializer_x11.cc +index e3c481b97d89..5fde4a0bb388 100644 +--- ui/gl/init/gl_initializer_x11.cc ++++ ui/gl/init/gl_initializer_x11.cc +@@ -88,7 +88,7 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) { + if (implementation == kGLImplementationSwiftShaderGL) { + #if BUILDFLAG(ENABLE_SWIFTSHADER) + base::FilePath module_path; +- if (!base::PathService::Get(base::DIR_MODULE, &module_path)) ++ if (!base::PathService::Get(base::DIR_ASSETS, &module_path)) + return false; + module_path = module_path.Append("swiftshader/"); + +@@ -100,7 +100,7 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) { + } else if (cmd->GetSwitchValueASCII(switches::kUseGL) == + kGLImplementationANGLEName) { + base::FilePath module_path; +- if (!base::PathService::Get(base::DIR_MODULE, &module_path)) ++ if (!base::PathService::Get(base::DIR_ASSETS, &module_path)) + return false; + + glesv2_path = module_path.Append(kGLESv2ANGLELibraryName); diff --git a/tools/distrib/linux/README.standard.txt b/tools/distrib/linux/README.standard.txt index c433e1499..24c48dab8 100644 --- a/tools/distrib/linux/README.standard.txt +++ b/tools/distrib/linux/README.standard.txt @@ -5,8 +5,8 @@ cmake Contains CMake configuration files shared by all targets. Debug Contains libcef.so and other components required to run the debug version of CEF-based applications. By default these files should be - placed in the same directory as the executable and will be copied - there as part of the build process. + placed in the same directory as libcef.so and will be copied there + as part of the build process. include Contains all required CEF header files. @@ -15,8 +15,8 @@ libcef_dll Contains the source code for the libcef_dll_wrapper static library Release Contains libcef.so and other components required to run the release version of CEF-based applications. By default these files should be - placed in the same directory as the executable and will be copied - there as part of the build process. + placed in the same directory as libcef.so and will be copied there + as part of the build process. Resources Contains resources required by libcef.so. By default these files should be placed in the same directory as libcef.so and will be