mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
experimental ARM Linux packaged build
This commit is contained in:
parent
ed5273fae7
commit
d87383a2d5
7 changed files with 91 additions and 11 deletions
|
@ -15,6 +15,9 @@ rustflags = ["-C", "link-args=-Wl,-export-dynamic"]
|
||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
rustflags = ["-C", "link-args=-Wl,-export-dynamic"]
|
rustflags = ["-C", "link-args=-Wl,-export-dynamic"]
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
rustflags = ["-C", "link-args=-Wl,-export-dynamic"]
|
||||||
|
|
||||||
[target.aarch64-apple-darwin]
|
[target.aarch64-apple-darwin]
|
||||||
rustflags = ["-C", "link-args=-rdynamic"]
|
rustflags = ["-C", "link-args=-rdynamic"]
|
||||||
|
|
||||||
|
|
12
qt/package/Cargo.lock
generated
12
qt/package/Cargo.lock
generated
|
@ -345,7 +345,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyembed"
|
name = "pyembed"
|
||||||
version = "0.20.0-pre"
|
version = "0.20.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dunce",
|
"dunce",
|
||||||
|
@ -410,7 +410,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-oxidized-importer"
|
name = "python-oxidized-importer"
|
||||||
version = "0.5.0-pre"
|
version = "0.5.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"memmap",
|
"memmap",
|
||||||
|
@ -426,7 +426,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-packaging"
|
name = "python-packaging"
|
||||||
version = "0.12.0-pre"
|
version = "0.12.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@ -445,7 +445,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-packed-resources"
|
name = "python-packed-resources"
|
||||||
version = "0.9.0-pre"
|
version = "0.9.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@ -555,12 +555,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tugger-file-manifest"
|
name = "tugger-file-manifest"
|
||||||
version = "0.7.0-pre"
|
version = "0.7.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tugger-licensing"
|
name = "tugger-licensing"
|
||||||
version = "0.6.0-pre"
|
version = "0.6.0-pre"
|
||||||
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=200fbd25894e9000451b0c562085bf70b8b9f6c1#200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
source = "git+https://github.com/ankitects/PyOxidizer.git?rev=eb26dd7cd1290de6503869f3d719eabcec45e139#eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"spdx",
|
"spdx",
|
||||||
|
|
|
@ -11,7 +11,7 @@ libc-stdhandle = "=0.1.0"
|
||||||
|
|
||||||
[dependencies.pyembed]
|
[dependencies.pyembed]
|
||||||
git = "https://github.com/ankitects/PyOxidizer.git"
|
git = "https://github.com/ankitects/PyOxidizer.git"
|
||||||
rev = "200fbd25894e9000451b0c562085bf70b8b9f6c1"
|
rev = "eb26dd7cd1290de6503869f3d719eabcec45e139"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.jemallocator]
|
[dependencies.jemallocator]
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# Copyright: Ankitects Pty Ltd and contributors
|
# Copyright: Ankitects Pty Ltd and contributors
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
@ -38,7 +41,9 @@ os.environ["CARGO_TARGET_DIR"] = str(cargo_target)
|
||||||
|
|
||||||
# OS-specific things
|
# OS-specific things
|
||||||
pyqt5_folder_name = "pyqt515"
|
pyqt5_folder_name = "pyqt515"
|
||||||
|
pyqt6_folder_path = bazel_external / "pyqt6" / "PyQt6"
|
||||||
is_lin = False
|
is_lin = False
|
||||||
|
arm64_linux = False
|
||||||
if is_win:
|
if is_win:
|
||||||
os.environ["TARGET"] = "x86_64-pc-windows-msvc"
|
os.environ["TARGET"] = "x86_64-pc-windows-msvc"
|
||||||
elif sys.platform.startswith("darwin"):
|
elif sys.platform.startswith("darwin"):
|
||||||
|
@ -56,7 +61,12 @@ else:
|
||||||
os.environ["TARGET"] = "x86_64-unknown-linux-gnu"
|
os.environ["TARGET"] = "x86_64-unknown-linux-gnu"
|
||||||
else:
|
else:
|
||||||
os.environ["TARGET"] = "aarch64-unknown-linux-gnu"
|
os.environ["TARGET"] = "aarch64-unknown-linux-gnu"
|
||||||
raise Exception("building on this architecture is not currently supported")
|
pyqt5_folder_name = None
|
||||||
|
arm64_linux = True
|
||||||
|
# path to a custom-built/prepared PyQt5 folder
|
||||||
|
# must be provided
|
||||||
|
pyqt6_folder_path = os.getenv("PREPARED_QT_PATH")
|
||||||
|
assert pyqt6_folder_path
|
||||||
|
|
||||||
|
|
||||||
python = python_bin_folder / "python"
|
python = python_bin_folder / "python"
|
||||||
|
@ -80,7 +90,7 @@ def build_pyoxidizer():
|
||||||
"https://github.com/ankitects/PyOxidizer.git",
|
"https://github.com/ankitects/PyOxidizer.git",
|
||||||
"--rev",
|
"--rev",
|
||||||
# when updating, make sure Cargo.toml updated too
|
# when updating, make sure Cargo.toml updated too
|
||||||
"200fbd25894e9000451b0c562085bf70b8b9f6c1",
|
"eb26dd7cd1290de6503869f3d719eabcec45e139",
|
||||||
"pyoxidizer",
|
"pyoxidizer",
|
||||||
],
|
],
|
||||||
check=True,
|
check=True,
|
||||||
|
@ -117,6 +127,10 @@ def install_wheels_into_venv():
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[pip, "install", "--force-reinstall", "--no-deps", protobuf], check=True
|
[pip, "install", "--force-reinstall", "--no-deps", protobuf], check=True
|
||||||
)
|
)
|
||||||
|
if arm64_linux:
|
||||||
|
# orjson doesn't get packaged correctly; remove it and we'll
|
||||||
|
# copy a copy in later
|
||||||
|
subprocess.run([pip, "uninstall", "-y", "orjson"], check=True)
|
||||||
|
|
||||||
|
|
||||||
def build_artifacts():
|
def build_artifacts():
|
||||||
|
@ -225,6 +239,25 @@ def merge_into_dist(output_folder: Path, pyqt_src_path: Path):
|
||||||
],
|
],
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
|
# Linux ARM workarounds
|
||||||
|
if arm64_linux:
|
||||||
|
with open(output_folder / "qt.conf", "w") as file:
|
||||||
|
file.write(
|
||||||
|
"""[Paths]
|
||||||
|
Prefix = lib/PyQt5/Qt5
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# copy orjson ends up broken; copy from venv
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
"rsync",
|
||||||
|
"-a",
|
||||||
|
"--delete",
|
||||||
|
os.path.expanduser("~/orjson"),
|
||||||
|
output_folder / "lib/",
|
||||||
|
],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
# Ensure all files are world-readable
|
# Ensure all files are world-readable
|
||||||
if not is_win:
|
if not is_win:
|
||||||
subprocess.run(["chmod", "-R", "a+r", output_folder])
|
subprocess.run(["chmod", "-R", "a+r", output_folder])
|
||||||
|
@ -234,6 +267,6 @@ build_pyoxidizer()
|
||||||
install_wheels_into_venv()
|
install_wheels_into_venv()
|
||||||
build_artifacts()
|
build_artifacts()
|
||||||
build_pkg()
|
build_pkg()
|
||||||
merge_into_dist(dist_folder / "std", bazel_external / "pyqt6" / "PyQt6")
|
merge_into_dist(dist_folder / "std", pyqt6_folder_path)
|
||||||
if pyqt5_folder_name:
|
if pyqt5_folder_name:
|
||||||
merge_into_dist(dist_folder / "alt", bazel_external / pyqt5_folder_name / "PyQt5")
|
merge_into_dist(dist_folder / "alt", bazel_external / pyqt5_folder_name / "PyQt5")
|
||||||
|
|
39
qt/package/prepare-system-pyqt.sh
Normal file
39
qt/package/prepare-system-pyqt.sh
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script copies a system-installed PyQt. Written for Debian Bullseye;
|
||||||
|
# will need adjusting for other platforms.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo apt install -y python3-pyqt5.{qtwebengine,qtmultimedia} patchelf
|
||||||
|
|
||||||
|
pyqtBase=/usr/lib/python3/dist-packages/PyQt5
|
||||||
|
qtData=/usr/share/qt5
|
||||||
|
qtLibBase=/usr/lib/aarch64-linux-gnu
|
||||||
|
qtLibExtra=$qtLibBase/qt5
|
||||||
|
|
||||||
|
outDir=~/PyQtPrepared/PyQt5/
|
||||||
|
qtOutputBase=$outDir/Qt5
|
||||||
|
rm -rf $outDir
|
||||||
|
mkdir -p $qtOutputBase
|
||||||
|
|
||||||
|
# pyqt
|
||||||
|
rsync -ai --exclude-from=qt.exclude --exclude Qt5 \
|
||||||
|
$pyqtBase/ $outDir/
|
||||||
|
patchelf --set-rpath '$ORIGIN/Qt5/lib' $outDir/*.so
|
||||||
|
|
||||||
|
# qt libs
|
||||||
|
rsync -ai $qtLibBase/libQt5* $qtOutputBase/lib/
|
||||||
|
patchelf --set-rpath '$ORIGIN' $qtOutputBase/lib/*.so.*
|
||||||
|
|
||||||
|
# qt libexec/plugins
|
||||||
|
rsync -ai --exclude=qml $qtLibExtra/ $qtOutputBase/
|
||||||
|
patchelf --set-rpath '$ORIGIN/../../lib' $qtOutputBase/plugins/*/*.so
|
||||||
|
patchelf --set-rpath '$ORIGIN/../lib' $qtOutputBase/libexec/QtWebEngineProcess
|
||||||
|
cat > $qtOutputBase/libexec/qt.conf <<EOF
|
||||||
|
[Paths]
|
||||||
|
Prefix = ..
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# qt translations/resources
|
||||||
|
rsync -ai $qtData/ $qtOutputBase/
|
|
@ -90,7 +90,11 @@ def handle_resource(policy, resource):
|
||||||
|
|
||||||
def make_exe():
|
def make_exe():
|
||||||
if BUILD_TARGET_TRIPLE == "aarch64-unknown-linux-gnu":
|
if BUILD_TARGET_TRIPLE == "aarch64-unknown-linux-gnu":
|
||||||
fail("arm64 is not currently supported")
|
dist = PythonDistribution(
|
||||||
|
url = "https://github.com/ankitects/python-build-standalone/releases/download/anki-2021-10-15/cpython-3.9.7-aarch64-unknown-linux-gnu-pgo-20211013T1538.tar.zst",
|
||||||
|
sha256 = "d25de2da9dc1b988350570c0ade9a79587cafeaad9ba1965fcec12c4ecaa9d98",
|
||||||
|
)
|
||||||
|
|
||||||
elif BUILD_TARGET_TRIPLE == "x86_64-unknown-linux-gnu":
|
elif BUILD_TARGET_TRIPLE == "x86_64-unknown-linux-gnu":
|
||||||
dist = PythonDistribution(
|
dist = PythonDistribution(
|
||||||
url = "https://github.com/ankitects/python-build-standalone/releases/download/anki-2021-10-15/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211013T1538.tar.zst",
|
url = "https://github.com/ankitects/python-build-standalone/releases/download/anki-2021-10-15/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211013T1538.tar.zst",
|
||||||
|
|
|
@ -7,3 +7,4 @@ qsci
|
||||||
*.pyi
|
*.pyi
|
||||||
*.sip
|
*.sip
|
||||||
py.typed
|
py.typed
|
||||||
|
__pycache__
|
||||||
|
|
Loading…
Reference in a new issue