diff --git a/kiwixbuild/buildenv.py b/kiwixbuild/buildenv.py index 2ae6ac2e..d08e597e 100644 --- a/kiwixbuild/buildenv.py +++ b/kiwixbuild/buildenv.py @@ -42,10 +42,10 @@ def __init__(self, dummy_run): def detect_platform(self): _platform = platform.system() self.distname = _platform + self.codename = "" if _platform == "Linux": self.distname = distro.id() - if self.distname == "ubuntu": - self.distname = "debian" + self.codename = distro.codename() def download(self, what, where=None): where = where or self.archive_dir diff --git a/kiwixbuild/builder.py b/kiwixbuild/builder.py index 587a3a7f..7b7adc36 100644 --- a/kiwixbuild/builder.py +++ b/kiwixbuild/builder.py @@ -125,15 +125,23 @@ def build(self): def _get_packages(self): packages_list = [] for config in ConfigInfo.all_running_configs.values(): + # get {host}_{config} packages mapper_name = "{host}_{config}".format( host=neutralEnv("distname"), config=config ) package_name_mapper = PACKAGE_NAME_MAPPERS.get(mapper_name, {}) packages_list += package_name_mapper.get("COMMON", []) + # get {host}_{codename}_{config} packages + mapper_name = "{host}_{codename}_{config}".format( + host=neutralEnv("distname"), codename=neutralEnv("codename"), config=config + ) + package_name_mapper = PACKAGE_NAME_MAPPERS.get(mapper_name, {}) + packages_list += package_name_mapper.get("COMMON", []) to_drop = [] for builderDef in self._targets: configName, builderName = builderDef + # get {host}_{config} packages mapper_name = "{host}_{config}".format( host=neutralEnv("distname"), config=configName ) @@ -144,6 +152,19 @@ def _get_packages(self): if packages is not True: # True means "assume the dependency is install but do not try to install anything for it" packages_list += packages + + # get {host}_{codename}_{config} packages + mapper_name = "{host}_{codename}_{config}".format( + host=neutralEnv("distname"), codename=neutralEnv("codename"), config=configName + ) + package_name_mapper = PACKAGE_NAME_MAPPERS.get(mapper_name, {}) + packages = package_name_mapper.get(builderName) + if packages: + to_drop.append(builderDef) + if packages is not True: + # True means "assume the dependency is install but do not try to install anything for it" + packages_list += packages + for dep in to_drop: del self._targets[dep] return packages_list @@ -160,7 +181,7 @@ def install_packages(self): if distname in ("fedora", "redhat", "centos"): package_installer = "sudo dnf install {}" package_checker = "rpm -q --quiet {}" - elif distname in ("debian", "Ubuntu"): + elif distname in ("debian", "ubuntu"): package_installer = "sudo apt-get install {}" package_checker = 'LANG=C dpkg -s {} 2>&1 | grep Status | grep "ok installed" 1>/dev/null 2>&1' elif distname == "Darwin": diff --git a/kiwixbuild/configs/android.py b/kiwixbuild/configs/android.py index b313ceec..4c102173 100644 --- a/kiwixbuild/configs/android.py +++ b/kiwixbuild/configs/android.py @@ -7,7 +7,7 @@ class AndroidConfigInfo(ConfigInfo): build = "android" static = True toolchain_names = ["android-ndk"] - compatible_hosts = ["fedora", "debian"] + compatible_hosts = ["fedora", "debian", "ubuntu"] def __str__(self): return "android" diff --git a/kiwixbuild/configs/armhf.py b/kiwixbuild/configs/armhf.py index 088183bc..6213da14 100644 --- a/kiwixbuild/configs/armhf.py +++ b/kiwixbuild/configs/armhf.py @@ -6,7 +6,7 @@ # Base config for arm class ArmConfigInfo(ConfigInfo): - compatible_hosts = ["fedora", "debian", "almalinux"] + compatible_hosts = ["fedora", "debian", "ubuntu", "almalinux"] def get_cross_config(self): return { diff --git a/kiwixbuild/configs/flatpak.py b/kiwixbuild/configs/flatpak.py index f481a5d8..3b41f4a3 100644 --- a/kiwixbuild/configs/flatpak.py +++ b/kiwixbuild/configs/flatpak.py @@ -8,7 +8,7 @@ class FlatpakConfigInfo(ConfigInfo): build = "flatpak" static = "" toolchain_names = ["org.kde", "io.qt.qtwebengine"] - compatible_hosts = ["debian", "fedora"] + compatible_hosts = ["debian", "ubuntu", "fedora"] def __str__(self): return "flatpak" diff --git a/kiwixbuild/configs/i586.py b/kiwixbuild/configs/i586.py index 8c402a30..8a7b36bd 100644 --- a/kiwixbuild/configs/i586.py +++ b/kiwixbuild/configs/i586.py @@ -7,7 +7,7 @@ class I586ConfigInfo(ConfigInfo): build = "i586" arch_full = "i586-linux-gnu" - compatible_hosts = ["fedora", "debian"] + compatible_hosts = ["fedora", "debian", "ubuntu"] def get_cross_config(self): return { diff --git a/kiwixbuild/configs/musl.py b/kiwixbuild/configs/musl.py index d6c3939c..6bd11e26 100644 --- a/kiwixbuild/configs/musl.py +++ b/kiwixbuild/configs/musl.py @@ -5,7 +5,7 @@ class MuslConfigInfo(ConfigInfo): - compatible_hosts = ["fedora", "debian"] + compatible_hosts = ["fedora", "debian", "ubuntu"] def get_cross_config(self): return { diff --git a/kiwixbuild/configs/native.py b/kiwixbuild/configs/native.py index 3da055a5..91d3f9e6 100644 --- a/kiwixbuild/configs/native.py +++ b/kiwixbuild/configs/native.py @@ -29,16 +29,16 @@ def arch_name(self): class NativeDyn(NativeConfigInfo): name = "native_dyn" static = False - compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"] + compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"] class NativeStatic(NativeConfigInfo): name = "native_static" static = True - compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"] + compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"] class NativeMixed(MixedMixin("native_static"), NativeConfigInfo): name = "native_mixed" static = False - compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"] + compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"] diff --git a/kiwixbuild/configs/neutral.py b/kiwixbuild/configs/neutral.py index f237c483..1fa7976d 100644 --- a/kiwixbuild/configs/neutral.py +++ b/kiwixbuild/configs/neutral.py @@ -5,7 +5,7 @@ class NeutralConfigInfo(ConfigInfo): name = "neutral" arch_name = "neutral" static = "" - compatible_hosts = ["fedora", "debian", "Darwin"] + compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin"] def __str__(self): return "neutral" diff --git a/kiwixbuild/configs/wasm.py b/kiwixbuild/configs/wasm.py index 1759eb3a..63b662be 100644 --- a/kiwixbuild/configs/wasm.py +++ b/kiwixbuild/configs/wasm.py @@ -12,7 +12,7 @@ class WasmConfigInfo(ConfigInfo): libdir = "lib" # arch_full = 'wasm64-linux' toolchain_names = ["emsdk"] - compatible_hosts = ["fedora", "debian"] + compatible_hosts = ["fedora", "debian", "ubuntu"] exe_wrapper_def = "" def get_cross_config(self): diff --git a/kiwixbuild/configs/win64.py b/kiwixbuild/configs/win64.py index 10f215a4..094185bd 100644 --- a/kiwixbuild/configs/win64.py +++ b/kiwixbuild/configs/win64.py @@ -18,7 +18,7 @@ class Win64ConfigInfo(ConfigInfo): "-lkernel32", ] build = "win64" - compatible_hosts = ["fedora", "debian"] + compatible_hosts = ["fedora", "debian", "ubuntu"] arch_full = "x86_64-w64-mingw32" def get_cross_config(self): diff --git a/kiwixbuild/packages.py b/kiwixbuild/packages.py index 10dcdd6a..4565c93f 100644 --- a/kiwixbuild/packages.py +++ b/kiwixbuild/packages.py @@ -91,6 +91,36 @@ "debian_android": { "COMMON": _debian_common, }, + "ubuntu_jammy_native_dyn": { + "COMMON": _debian_common, + "zlib": ["zlib1g-dev"], + "uuid": ["uuid-dev"], + "libmicrohttpd": ["libmicrohttpd-dev", "ccache"], + "qt": ["libqt5gui5", "qtbase5-dev", "libqt5svg5-dev", "qt5-image-formats-plugins"], + "qtwebengine": ["qtwebengine5-dev"], + "aria2": ["aria2"], + }, + "ubuntu_noble_native_dyn": { + "COMMON": _debian_common, + "zlib": ["zlib1g-dev"], + "uuid": ["uuid-dev"], + "libmicrohttpd": ["libmicrohttpd-dev", "ccache"], + "qt": ["qt6-base-dev", "qt6-base-dev-tools", "libqt6webenginecore6-bin", "libqt6svg6", "qtchooser"], + "qtwebengine": ["qt6-webengine-dev"], + "aria2": ["aria2"], + }, + "ubuntu_oracular_native_dyn": { + "COMMON": _debian_common, + "zlib": ["zlib1g-dev"], + "uuid": ["uuid-dev"], + "libmicrohttpd": ["libmicrohttpd-dev", "ccache"], + "qt": ["qt6-base-dev", "qt6-base-dev-tools", "libqt6webenginecore6-bin", "libqt6svg6", "qtchooser"], + "qtwebengine": ["qt6-webengine-dev"], + "aria2": ["aria2"], + }, + "ubuntu_native_static": { + "COMMON": _debian_common + ["libbz2-dev", "libmagic-dev"], + }, "Darwin_native_dyn": { "COMMON": ["autoconf", "automake", "libtool", "cmake", "pkg-config"], "file": ["libmagic"],