kiwix-build/.github/scripts/build_projects.py

63 lines
2.0 KiB
Python
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
from common import (
run_kiwix_build,
make_archive,
create_desktop_image,
fix_macos_rpath,
upload_archive,
OS_NAME,
PLATFORM_TARGET,
DEV_BRANCH,
)
def select_build_target():
from common import (
PLATFORM_TARGET,
DESKTOP,
OS_NAME
)
if (PLATFORM_TARGET.startswith("android_")
or PLATFORM_TARGET.startswith("iOS")
or PLATFORM_TARGET.startswith("macOS")):
return ("libzim", "libkiwix")
elif PLATFORM_TARGET.startswith("native_"):
if OS_NAME == "bionic":
# PLATFORM_TARGET should always be "native_mixed" from CI jobs
return ("libzim", )
elif OS_NAME == "osx":
if PLATFORM_TARGET.endswith("_mixed"):
return ("libzim", "libkiwix")
else:
return ("zim-tools", )
else:
if DESKTOP:
return ("kiwix-desktop",)
elif PLATFORM_TARGET == "native_mixed":
return ("libzim", "libkiwix")
else:
return ("zim-tools", "kiwix-tools")
elif PLATFORM_TARGET in ("win32_static", "armhf_static", "armhf_dyn", "aarch64_static", "aarch64_dyn", "i586_static"):
return ("zim-tools", "kiwix-tools")
elif PLATFORM_TARGET == "flatpak":
return ("kiwix-desktop",)
elif PLATFORM_TARGET in ("wasm", "armhf_mixed", "aarch64_mixed"):
return ("libzim", )
else:
return ("libzim", "zim-tools", "libkiwix", "kiwix-tools")
TARGETS = select_build_target()
for target in TARGETS:
run_kiwix_build(target, platform=PLATFORM_TARGET)
if target == "kiwix-desktop":
archive = create_desktop_image(make_release=False)
else:
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
fix_macos_rpath(target)
archive = make_archive(target, make_release=False)
if archive and DEV_BRANCH:
upload_archive(archive, target, make_release=False, dev_branch=DEV_BRANCH)