From dba45ced3614ab3775694aaa49eb4dbd467e81b9 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 14 Jun 2022 10:47:12 +0200 Subject: [PATCH] Build android lib in the correct directory --- .github/scripts/common.py | 19 ++++++++++++++++++- kiwixbuild/buildenv.py | 2 ++ kiwixbuild/platforms/android.py | 4 ++++ kiwixbuild/platforms/base.py | 1 + kiwixbuild/versions.py | 2 +- 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/scripts/common.py b/.github/scripts/common.py index 2a2e529..a683c21 100644 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -52,6 +52,13 @@ PLATFORM_TO_RELEASE = { "android_x86_64": "android-x86_64", } +LIB_PREFIX = { + "android_arm": "arm-linux-androideabi", + "android_arm64": "aarch64-linux-android", + "android_x86": "i686-linux-android", + "android_x86_64": "x86_64-linux-android", +} + FLATPAK_HTTP_GIT_REMOTE = "https://github.com/flathub/org.kiwix.desktop.git" FLATPAK_GIT_REMOTE = "git@github.com:flathub/org.kiwix.desktop.git" @@ -100,7 +107,17 @@ EXPORT_FILES = { "libkiwix": ( INSTALL_DIR, ( - "lib/libkiwix.so", + "lib/{libprefix}/libkiwix.so".format( + libprefix=LIB_PREFIX.get(PLATFORM_TARGET, "x86_64-linux-gnu"), + ), + "lib/{libprefix}/libkiwix.so.{version}".format( + libprefix=LIB_PREFIX.get(PLATFORM_TARGET, "x86_64-linux-gnu"), + version=main_project_versions["libkiwix"] + ), + "lib/{libprefix}/libkiwix.so.{version}".format( + libprefix=LIB_PREFIX.get(PLATFORM_TARGET, "x86_64-linux-gnu"), + version=main_project_versions["libkiwix"][0] + ), "include/kiwix/**/*.h" ), ), diff --git a/kiwixbuild/buildenv.py b/kiwixbuild/buildenv.py index 8348118..7575d10 100644 --- a/kiwixbuild/buildenv.py +++ b/kiwixbuild/buildenv.py @@ -102,6 +102,8 @@ class BuildEnv: return os.path.isfile('/etc/debian_version') def _detect_libdir(self): + if self.platformInfo.libdir is not None: + return self.platformInfo.libdir if self._is_debianlike(): try: pc = subprocess.Popen(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], diff --git a/kiwixbuild/platforms/android.py b/kiwixbuild/platforms/android.py index 178896c..43e3a4f 100644 --- a/kiwixbuild/platforms/android.py +++ b/kiwixbuild/platforms/android.py @@ -12,6 +12,10 @@ class AndroidPlatformInfo(PlatformInfo): def __str__(self): return "android" + @property + def libdir(self): + return 'lib/{}'.format(self.arch_full) + @property def binaries_name(self): arch_full = self.arch_full diff --git a/kiwixbuild/platforms/base.py b/kiwixbuild/platforms/base.py index 93009db..2163881 100644 --- a/kiwixbuild/platforms/base.py +++ b/kiwixbuild/platforms/base.py @@ -24,6 +24,7 @@ class PlatformInfo(metaclass=_MetaPlatform): all_running_platforms = {} toolchain_names = [] configure_option = "" + libdir = None @classmethod def get_platform(cls, name, targets=None): diff --git a/kiwixbuild/versions.py b/kiwixbuild/versions.py index 95ca887..223ae53 100644 --- a/kiwixbuild/versions.py +++ b/kiwixbuild/versions.py @@ -39,7 +39,7 @@ release_versions = { # This is the "version" of the whole base_deps_versions dict. # Change this when you change base_deps_versions. -base_deps_meta_version = '76' +base_deps_meta_version = '77' base_deps_versions = { 'zlib' : '1.2.12',