mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Merge pull request #1429 from ankitects/apple-arm
Initial aarch64-apple support
This commit is contained in:
commit
b87c4ee946
31 changed files with 70 additions and 3 deletions
|
@ -25,6 +25,7 @@ targets = [
|
|||
"x86_64-apple-ios",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-apple-ios",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
]
|
||||
|
|
|
@ -88,6 +88,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(not(target_arch = "wasm32"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
2
cargo/remote/BUILD.ahash-0.7.4.bazel
vendored
2
cargo/remote/BUILD.ahash-0.7.4.bazel
vendored
|
@ -60,6 +60,7 @@ cargo_build_script(
|
|||
] + selects.with_or({
|
||||
# cfg(any(target_os = "linux", target_os = "android", target_os = "windows", target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "dragonfly", target_os = "solaris", target_os = "illumos", target_os = "fuchsia", target_os = "redox", target_os = "cloudabi", target_os = "haiku", target_os = "vxworks", target_os = "emscripten", target_os = "wasi"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
@ -101,6 +102,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(any(target_os = "linux", target_os = "android", target_os = "windows", target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "dragonfly", target_os = "solaris", target_os = "illumos", target_os = "fuchsia", target_os = "redox", target_os = "cloudabi", target_os = "haiku", target_os = "vxworks", target_os = "emscripten", target_os = "wasi"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.atty-0.2.14.bazel
vendored
1
cargo/remote/BUILD.atty-0.2.14.bazel
vendored
|
@ -56,6 +56,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.coarsetime-0.1.19.bazel
vendored
1
cargo/remote/BUILD.coarsetime-0.1.19.bazel
vendored
|
@ -55,6 +55,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(not(target_os = "wasi"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.dirs-sys-next-0.1.2.bazel
vendored
1
cargo/remote/BUILD.dirs-sys-next-0.1.2.bazel
vendored
|
@ -54,6 +54,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
2
cargo/remote/BUILD.getrandom-0.1.16.bazel
vendored
2
cargo/remote/BUILD.getrandom-0.1.16.bazel
vendored
|
@ -60,6 +60,7 @@ cargo_build_script(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
@ -100,6 +101,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.getrandom-0.2.3.bazel
vendored
1
cargo/remote/BUILD.getrandom-0.2.3.bazel
vendored
|
@ -58,6 +58,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.hyper-0.14.13.bazel
vendored
1
cargo/remote/BUILD.hyper-0.14.13.bazel
vendored
|
@ -122,6 +122,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(any(target_os = "linux", target_os = "macos"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
|
||||
|
|
1
cargo/remote/BUILD.mio-0.7.13.bazel
vendored
1
cargo/remote/BUILD.mio-0.7.13.bazel
vendored
|
@ -67,6 +67,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
2
cargo/remote/BUILD.native-tls-0.2.8.bazel
vendored
2
cargo/remote/BUILD.native-tls-0.2.8.bazel
vendored
|
@ -59,6 +59,7 @@ cargo_build_script(
|
|||
] + selects.with_or({
|
||||
# cfg(any(target_os = "macos", target_os = "ios"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
"@rules_rust//rust/platform:x86_64-apple-ios",
|
||||
|
@ -114,6 +115,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(any(target_os = "macos", target_os = "ios"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
"@rules_rust//rust/platform:x86_64-apple-ios",
|
||||
|
|
1
cargo/remote/BUILD.num-format-0.4.0.bazel
vendored
1
cargo/remote/BUILD.num-format-0.4.0.bazel
vendored
|
@ -58,6 +58,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
|
@ -59,6 +59,7 @@ cargo_build_script(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
@ -105,6 +106,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.rand-0.7.3.bazel
vendored
1
cargo/remote/BUILD.rand-0.7.3.bazel
vendored
|
@ -79,6 +79,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.rand-0.8.4.bazel
vendored
1
cargo/remote/BUILD.rand-0.8.4.bazel
vendored
|
@ -65,6 +65,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.reqwest-0.11.3.bazel
vendored
1
cargo/remote/BUILD.reqwest-0.11.3.bazel
vendored
|
@ -98,6 +98,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(not(target_arch = "wasm32"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
2
cargo/remote/BUILD.ring-0.16.20.bazel
vendored
2
cargo/remote/BUILD.ring-0.16.20.bazel
vendored
|
@ -84,6 +84,7 @@ cargo_build_script(
|
|||
}) + selects.with_or({
|
||||
# cfg(any(unix, windows))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
@ -156,6 +157,7 @@ rust_library(
|
|||
}) + selects.with_or({
|
||||
# cfg(any(unix, windows))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
|
@ -70,6 +70,7 @@ rust_library(
|
|||
}) + selects.with_or({
|
||||
# cfg(target_os = "macos")
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
): [
|
||||
"@raze__security_framework__2_4_2//:security_framework",
|
||||
|
|
1
cargo/remote/BUILD.socket2-0.4.2.bazel
vendored
1
cargo/remote/BUILD.socket2-0.4.2.bazel
vendored
|
@ -54,6 +54,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
1
cargo/remote/BUILD.tempfile-3.2.0.bazel
vendored
1
cargo/remote/BUILD.tempfile-3.2.0.bazel
vendored
|
@ -57,6 +57,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
2
cargo/remote/BUILD.tokio-1.12.0.bazel
vendored
2
cargo/remote/BUILD.tokio-1.12.0.bazel
vendored
|
@ -76,6 +76,7 @@ cargo_build_script(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
@ -143,6 +144,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
|
@ -68,6 +68,7 @@ rust_library(
|
|||
}) + selects.with_or({
|
||||
# cfg(any(target_os = "macos", target_os = "ios"))
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
"@rules_rust//rust/platform:x86_64-apple-ios",
|
||||
|
|
1
cargo/remote/BUILD.utime-0.3.1.bazel
vendored
1
cargo/remote/BUILD.utime-0.3.1.bazel
vendored
|
@ -54,6 +54,7 @@ rust_library(
|
|||
] + selects.with_or({
|
||||
# cfg(unix)
|
||||
(
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-ios",
|
||||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
|
|
5
defs.bzl
5
defs.bzl
|
@ -49,7 +49,10 @@ def setup_deps():
|
|||
python_runtime = "@python//:python",
|
||||
)
|
||||
|
||||
node_repositories(package_json = ["@ankidesktop//:package.json"])
|
||||
node_repositories(
|
||||
package_json = ["@ankidesktop//:package.json"],
|
||||
node_version = "16.10.0",
|
||||
)
|
||||
|
||||
yarn_install(
|
||||
name = "npm",
|
||||
|
|
|
@ -8,6 +8,7 @@ import re
|
|||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import platform
|
||||
|
||||
from pip._internal.commands import create_command
|
||||
|
||||
|
@ -71,6 +72,10 @@ def merge_files(root, source):
|
|||
else:
|
||||
shutil.copy2(source_path, target_path)
|
||||
|
||||
def fix_webengine_codesigning(base: str):
|
||||
"Fix a codesigning issue in the 6.2.0 release."
|
||||
path = os.path.join(base, "PyQt6/Qt6/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess")
|
||||
subprocess.run(["codesign", "-s", "-", path], check=True)
|
||||
|
||||
def main():
|
||||
base = sys.argv[1]
|
||||
|
@ -100,10 +105,20 @@ def main():
|
|||
("pyqt6-sip", "pyqt6_sip==13.1.0"),
|
||||
]
|
||||
|
||||
arm_darwin = sys.platform.startswith("darwin") and platform.machine() == "arm64"
|
||||
|
||||
for (name, with_version) in packages:
|
||||
# install package in subfolder
|
||||
folder = os.path.join(base, "temp")
|
||||
pip_args = []
|
||||
if arm_darwin:
|
||||
if name in ("pyqt6-qt6", "pyqt6-webengine-qt6"):
|
||||
# pyqt messed up the architecture tags
|
||||
pip_args.extend(
|
||||
[
|
||||
"--platform=macosx_10_14_arm64",
|
||||
"--only-binary=:all:",
|
||||
])
|
||||
install_package(with_version, folder, pip_args)
|
||||
# merge into parent
|
||||
merge_files(base, folder)
|
||||
|
@ -112,6 +127,9 @@ def main():
|
|||
with open(os.path.join(base, "__init__.py"), "w") as file:
|
||||
file.write("__path__ = __import__('pkgutil').extend_path(__path__, __name__)")
|
||||
|
||||
if arm_darwin:
|
||||
fix_webengine_codesigning(base)
|
||||
|
||||
# add missing py.typed file
|
||||
with open(os.path.join(base, "py.typed"), "w") as file:
|
||||
pass
|
||||
|
|
|
@ -30,6 +30,10 @@ types-protobuf
|
|||
types-requests
|
||||
types-waitress
|
||||
|
||||
# transitive dependency of black; pinned due to broken wheel
|
||||
# https://bitbucket.org/mrabarnett/mrab-regex/issues/399/missing-wheel-for-macosx-and-the-new-m1
|
||||
regex==2021.9.30
|
||||
|
||||
# windows only
|
||||
psutil; sys.platform == "win32"
|
||||
pywin32; sys.platform == "win32"
|
||||
|
|
|
@ -113,8 +113,10 @@ pytoml==0.1.21
|
|||
# via compare-locales
|
||||
pywin32==302 ; sys_platform == "win32"
|
||||
# via -r requirements.in
|
||||
regex==2021.10.8
|
||||
# via black
|
||||
regex==2021.9.30
|
||||
# via
|
||||
# -r requirements.in
|
||||
# black
|
||||
requests==2.26.0
|
||||
# via -r requirements.in
|
||||
send2trash==1.8.0
|
||||
|
|
|
@ -16,6 +16,14 @@ config_setting(
|
|||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "macos_arm64",
|
||||
constraint_values = [
|
||||
"@platforms//os:macos",
|
||||
"@platforms//cpu:aarch64",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "linux_x86_64",
|
||||
constraint_values = [
|
||||
|
|
|
@ -15,6 +15,7 @@ alias(
|
|||
name = "clang_format",
|
||||
actual = select({
|
||||
"@ankidesktop//platforms:windows_x86_64": "@clang_format_windows_x86_64//:clang-format.exe",
|
||||
"@ankidesktop//platforms:macos_arm64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:macos_x86_64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:linux_x86_64": "@clang_format_linux_x86_64//:clang-format",
|
||||
}),
|
||||
|
|
|
@ -13,6 +13,7 @@ alias(
|
|||
name = "protoc",
|
||||
actual = select({
|
||||
"@ankidesktop//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe",
|
||||
"@ankidesktop//platforms:macos_arm64": "@protoc_bin_macos//:bin/protoc",
|
||||
"@ankidesktop//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc",
|
||||
"@ankidesktop//platforms:linux_x86_64": "@protoc_bin_linux_x86_64//:bin/protoc",
|
||||
"@ankidesktop//platforms:linux_arm64": "@protoc_bin_linux_arm64//:bin/protoc"
|
||||
|
|
|
@ -21,6 +21,7 @@ rust_library(
|
|||
rustc_flags = selects.with_or({
|
||||
(
|
||||
"@rules_rust//rust/platform:x86_64-apple-darwin",
|
||||
"@rules_rust//rust/platform:aarch64-apple-darwin",
|
||||
): [
|
||||
"-Clink-arg=-undefined",
|
||||
"-Clink-arg=dynamic_lookup",
|
||||
|
|
Loading…
Reference in a new issue