Package kiwix-desktop on Windows
This commit is contained in:
parent
1d93c35c50
commit
45ad41724c
|
@ -44,7 +44,11 @@ TOOLCHAIN_DIR = BASE_DIR / "TOOLCHAINS"
|
|||
INSTALL_DIR = BASE_DIR / "INSTALL"
|
||||
default_tmp_dir = os.getenv("TEMP") if platform.system() == "Windows" else "/tmp"
|
||||
TMP_DIR = Path(os.getenv("TMP_DIR", default_tmp_dir))
|
||||
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
|
||||
if platform.system() == "Windows":
|
||||
KBUILD_SOURCE_DIR = Path(_environ["GITHUB_WORKSPACE"])
|
||||
else:
|
||||
KBUILD_SOURCE_DIR = HOME / "kiwix-build"
|
||||
|
||||
|
||||
_ref = _environ.get("GITHUB_REF", "").split("/")[-1]
|
||||
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
|
||||
|
@ -480,11 +484,27 @@ def create_desktop_image(make_release):
|
|||
build_path = BASE_DIR / "org.kiwix.desktop.flatpak"
|
||||
app_name = "org.kiwix.desktop.{}.flatpak".format(postfix)
|
||||
print_message("archive is {}", build_path)
|
||||
elif platform.system() == "Windows":
|
||||
archive_basename = "Kiwix-{}-win-amd64".format(postfix)
|
||||
working_dir = INSTALL_DIR / archive_basename
|
||||
build_path = working_dir.with_suffix(".zip")
|
||||
app_name = build_path.name
|
||||
command = [
|
||||
"python",
|
||||
KBUILD_SOURCE_DIR / "scripts" / "package_kiwix-desktop_windows.py",
|
||||
str(INSTALL_DIR),
|
||||
str(working_dir),
|
||||
str(build_path),
|
||||
]
|
||||
if make_release:
|
||||
command += ["-s"]
|
||||
print_message("Package archive of kiwix-desktop")
|
||||
subprocess.check_call(command, cwd=str(HOME))
|
||||
else:
|
||||
build_path = HOME / "Kiwix-{}-x86_64.AppImage".format(postfix)
|
||||
app_name = "kiwix-desktop_x86_64_{}.appimage".format(postfix)
|
||||
command = [
|
||||
"kiwix-build/scripts/create_kiwix-desktop_appImage.sh",
|
||||
KBUILD_SOURCE_DIR / "scripts" / "create_kiwix-desktop_appImage.sh",
|
||||
str(INSTALL_DIR),
|
||||
str(src_dir),
|
||||
str(HOME / "AppDir"),
|
||||
|
|
|
@ -22,10 +22,10 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup python 3.8
|
||||
- name: Setup python 3.12
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.8'
|
||||
python-version: '3.12'
|
||||
- name: Install packages
|
||||
run: |
|
||||
choco.exe install pkgconfiglite ninja
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys, subprocess, shutil, argparse
|
||||
from pathlib import Path
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("install_dir")
|
||||
parser.add_argument("out_dir")
|
||||
parser.add_argument("--static_dir")
|
||||
parser.add_argument("archive_path", help="The full path of the archive to create")
|
||||
parser.add_argument("-s", "--sign", action="store_true")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
install_dir = Path(args.install_dir)
|
||||
if args.static_dir:
|
||||
static_dir = Path(args.static_dir)
|
||||
else:
|
||||
static_dir = install_dir
|
||||
|
||||
out_dir = Path(args.out_dir)
|
||||
archive_path = Path(args.archive_path)
|
||||
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
print(
|
||||
f"""Packaging kiwix-desktop
|
||||
- From {install_dir}
|
||||
- Static dir is {static_dir}
|
||||
- Working dir {out_dir}
|
||||
- Archive path is {archive_path}
|
||||
- Python version {sys.version}"""
|
||||
)
|
||||
|
||||
shutil.copy2(install_dir / "bin" / "kiwix-desktop.exe", out_dir)
|
||||
subprocess.run(["windeployqt", "--compiler-runtime", str(out_dir)], check=True)
|
||||
|
||||
|
||||
shutil.copy2(static_dir / "bin" / "aria2c.exe", out_dir)
|
||||
|
||||
for dll in (static_dir / "bin").glob("*.dll"):
|
||||
shutil.copy2(dll, out_dir)
|
||||
|
||||
|
||||
# Copy ssl stuff
|
||||
ssl_directory = Path("C:/") / "Program Files" / "OpenSSL"
|
||||
shutil.copy2(ssl_directory / "libcrypto-1_1-x64.dll", out_dir)
|
||||
shutil.copy2(ssl_directory / "libssl-1_1-x64.dll", out_dir)
|
||||
|
||||
# [TODO] Sign binary
|
||||
if args.sign:
|
||||
pass
|
||||
|
||||
print(
|
||||
f"""Create archive
|
||||
- {archive_path.with_suffix('')}
|
||||
- From {out_dir.parent}
|
||||
- With {out_dir.name}"""
|
||||
)
|
||||
shutil.make_archive(
|
||||
archive_path.with_suffix(""), "zip", root_dir=out_dir.parent, base_dir=out_dir.name
|
||||
)
|
Loading…
Reference in New Issue