android: switch to monolibtic mode (#12576)

We can get rid of the `libs` and `sdcv` symlink in application files.

Depend on koreader/koreader-base#1920.

Close #12348.
This commit is contained in:
Benoit Pierre
2024-10-02 09:19:57 +02:00
committed by GitHub
parent e45119453e
commit 120d418b7e
3 changed files with 13 additions and 6 deletions

2
base

Submodule base updated: bca8dc25ac...168d001c3b

View File

@@ -26,6 +26,7 @@ local util = require("util")
local _ = require("gettext")
local Input = Device.input
local T = ffiUtil.template
local android = Device:isAndroid() and require("android")
-- We'll store the list of available dictionaries as a module local
-- so we only have to look for them on the first :init()
@@ -785,7 +786,14 @@ function ReaderDictionary:rawSdcv(words, dict_names, fuzzy_search, lookup_progre
break -- don't do any more lookup on additional dict_dirs
end
local args = {"./sdcv", "--utf8-input", "--utf8-output", "--json-output", "--non-interactive", "--data-dir", dict_dir}
local args = {
android and (android.nativeLibraryDir .. "/libsdcv.so") or "./sdcv",
"--utf8-input",
"--utf8-output",
"--json-output",
"--non-interactive",
"--data-dir", dict_dir,
}
if not fuzzy_search then
table.insert(args, "--exact-search")
end
@@ -820,11 +828,11 @@ function ReaderDictionary:rawSdcv(words, dict_names, fuzzy_search, lookup_progre
cmd = cmd .. "; echo"
-- NOTE: Bionic doesn't support rpath, but does honor LD_LIBRARY_PATH...
-- Give it a shove so it can actually find the STL.
if Device:isAndroid() then
C.setenv("LD_LIBRARY_PATH", "./libs", 1)
if android then
C.setenv("LD_LIBRARY_PATH", android.nativeLibraryDir, 1)
end
local completed, results_str = Trapper:dismissablePopen(cmd, lookup_progress_msg)
if Device:isAndroid() then
if android then
-- NOTE: It's unset by default, so this is perfectly fine.
C.unsetenv("LD_LIBRARY_PATH")
end

View File

@@ -83,7 +83,6 @@ update: all
# binaries are stored as shared libraries to prevent W^X exception on Android 10+
# https://developer.android.com/about/versions/10/behavior-changes-10#execute-permission
llvm-strip --strip-unneeded $(INSTALL_DIR)/koreader/sdcv -o $(ANDROID_LIBS)/libsdcv.so
printf '%s\n' 'libs .' 'sdcv libsdcv.so' >$(ANDROID_ASSETS)/module/map.txt
# assets are compressed manually and stored inside the APK.
cd $(INSTALL_DIR)/koreader && \
./tools/mk7z.sh \