summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexBocken2022-05-28 21:05:19 +0200
committerAlexBocken2022-05-28 21:05:19 +0200
commitb6f99997d68caf20ea4d66deef317cef3e9eb431 (patch)
tree58b61139f072386d0590f0f6f29cf5d876354d18
downloadaur-b6f99997d68caf20ea4d66deef317cef3e9eb431.tar.gz
initial commit
-rw-r--r--.SRCINFO48
-rw-r--r--PKGBUILD113
-rw-r--r--force_qt5.patch19
-rw-r--r--inc_qt_timeout.patch11
-rw-r--r--no-update.patch11
5 files changed, 202 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..42dae750b226
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,48 @@
+pkgbase = anki-qt5
+ pkgdesc = Helps you remember facts (like words/phrases in a foreign language) - Qt5 Build
+ pkgver = 2.1.52
+ pkgrel = 1
+ url = https://apps.ankiweb.net/
+ arch = x86_64
+ license = AGPL3
+ makedepends = rsync
+ makedepends = git
+ makedepends = bazel
+ makedepends = clang
+ makedepends = python-pip
+ depends = python-beautifulsoup4
+ depends = python-requests
+ depends = python-wheel
+ depends = python-pysocks
+ depends = python-decorator
+ depends = python-protobuf
+ depends = python-orjson
+ depends = python-distro
+ depends = python-send2trash
+ depends = python-markdown
+ depends = python-jsonschema
+ depends = python-pyaudio
+ depends = python-pyqtwebengine
+ depends = python-flask
+ depends = python-flask-cors
+ depends = python-waitress
+ depends = python-pyqt5
+ optdepends = lame: record sound
+ optdepends = mpv: play sound. prefered over mplayer
+ optdepends = mplayer: play sound
+ provides = anki
+ conflicts = anki-bin
+ conflicts = anki-git
+ conflicts = anki-official-binary-bundle
+ conflicts = anki-qt6
+ options = !ccache
+ source = anki-qt5-2.1.52.tar.gz::https://github.com/ankitects/anki/archive/refs/tags/2.1.52.tar.gz
+ source = no-update.patch
+ source = inc_qt_timeout.patch
+ source = force_qt5.patch
+ sha256sums = e2df0055ee27a432b8e479ef180e02d30f1bb9674ce7305fd51d680160e936f8
+ sha256sums = 137827586d2a72adddaaf98599afa9fc80cdd73492d7f5cbcf4d2f6082e5f797
+ sha256sums = 281e12217f6b60ff64ad66e58aaf0cdb8bed16ffe2a3e6ab9e6ff5e773b4cabf
+ sha256sums = fc477627179cbc0f88190e05abe1256bf1e62367620331ddf574303356d21169
+
+pkgname = anki-qt5
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..387f4e36eb01
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,113 @@
+# Maintainer: Alexander Bocken <alexander@bocken.org>
+
+# Contributor: Posi <posi1981@gmail.com>
+# Contributor: Johannes Löthberg <johannes@kyriasis.com>
+# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Timm Preetz <timm@preetz.us>
+# Contributor: Michael 'manveru' Fellinger <m.fellinger@gmail.com>
+# Contributor: Dave Pretty <david dot pretty at gmail dot com>
+
+pkgname=anki-qt5
+pkgver=2.1.52
+pkgrel=1
+pkgdesc="Helps you remember facts (like words/phrases in a foreign language) - Qt5 Build"
+url="https://apps.ankiweb.net/"
+license=('AGPL3')
+arch=('x86_64')
+provides=('anki')
+conflicts=('anki-bin' 'anki-git' 'anki-official-binary-bundle' 'anki-qt6')
+options=('!ccache')
+depends=(
+ # anki and aqt
+ 'python-beautifulsoup4'
+ 'python-requests'
+ 'python-wheel'
+
+ # anki
+ 'python-pysocks' # requests[socks]
+ 'python-decorator'
+ 'python-protobuf'
+ 'python-orjson'
+ 'python-distro'
+
+ # aqt
+ 'python-send2trash'
+ 'python-markdown'
+ 'python-jsonschema'
+ 'python-pyaudio'
+ 'python-pyqtwebengine'
+ 'python-flask'
+ 'python-flask-cors'
+ 'python-waitress'
+ 'python-pyqt5'
+)
+makedepends=(
+ 'rsync'
+ 'git'
+
+ 'bazel'
+ 'clang'
+ 'python-pip'
+)
+optdepends=(
+ 'lame: record sound'
+ 'mpv: play sound. prefered over mplayer'
+ 'mplayer: play sound'
+)
+source=("$pkgname-$pkgver.tar.gz::https://github.com/ankitects/anki/archive/refs/tags/${pkgver}.tar.gz"
+"no-update.patch"
+"inc_qt_timeout.patch"
+"force_qt5.patch"
+)
+sha256sums=('e2df0055ee27a432b8e479ef180e02d30f1bb9674ce7305fd51d680160e936f8'
+'137827586d2a72adddaaf98599afa9fc80cdd73492d7f5cbcf4d2f6082e5f797'
+'281e12217f6b60ff64ad66e58aaf0cdb8bed16ffe2a3e6ab9e6ff5e773b4cabf'
+'fc477627179cbc0f88190e05abe1256bf1e62367620331ddf574303356d21169'
+)
+
+_bazel_build() {
+ bazel build -c opt wheels
+ _status=$?
+ bazel shutdown
+ if [[ $_status -gt 0 ]]; then
+ exit $_status # or call false
+ fi
+}
+
+prepare(){
+ cd "anki-$pkgver"
+ # pro-actively prevent "module not found" error
+ [ -d ts/node_modules ] && rm -r ts/node_modules
+ patch -p1 < "$srcdir/no-update.patch"
+ patch -p1 < "$srcdir/inc_qt_timeout.patch"
+ patch -p1 < "$srcdir/force_qt5.patch"
+ rm .bazelversion
+}
+
+build() {
+ cd "anki-$pkgver"
+ #fixes linker for clang users
+ if [ "$CC" = clang ] && [ "$CXX" = 'clang++' ]; then
+ export LDSHARED="/usr/bin/clang -shared"
+ fi
+ # build requires java 11 to work, does not compile with java 17
+ export JAVA_HOME="/usr/lib/jvm/java-11-openjdk"
+ echo "####################
+Beginning compilation... This step is known to be prone to failure by the anki devs.
+If the build is failing retry the installation. This usually fixes the problem.
+A too slow internet connection can also hinder the dependency fetching process because of hardcoded timeouts in bazel.
+If the problem persists consider removing data in ~/.cache/bazel and your AUR manager cache (~/.cache/paru/clone/anki for paru) and retry again.
+####################"
+ _bazel_build
+}
+
+package() {
+ cd "anki-$pkgver"
+ PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps .bazel/out/k8-opt/bin/qt/aqt/aqt-*.whl .bazel/out/k8-opt/bin/pylib/anki/anki-*.whl
+
+ install -Dm755 qt/runanki.py "$pkgdir"/usr/bin/anki
+ install -Dm644 qt/bundle/lin/anki.desktop "$pkgdir"/usr/share/applications/anki.desktop
+ install -Dm644 qt/bundle/lin/anki.png "$pkgdir"/usr/share/pixmaps/anki.png
+ find $pkgdir -iname __pycache__ | xargs -r rm -rf
+ find $pkgdir -iname direct_url.json | xargs -r rm -rf
+}
diff --git a/force_qt5.patch b/force_qt5.patch
new file mode 100644
index 000000000000..a5f91fe73ea2
--- /dev/null
+++ b/force_qt5.patch
@@ -0,0 +1,19 @@
+--- a/qt/aqt/qt/__init__.py
++++ b/qt/aqt/qt/__init__.py
+@@ -9,16 +9,7 @@ import sys
+ import traceback
+ from typing import Callable, Union
+
+-try:
+- import PyQt6
+-except:
+- from .qt5 import * # type: ignore
+-else:
+- if not os.getenv("DISABLE_QT5_COMPAT"):
+- print("Running with temporary Qt5 compatibility shims.")
+- print("Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.")
+- from . import qt5_compat # needs to be imported first
+- from .qt6 import *
++from .qt5 import * # type: ignore
+
+ from anki.utils import is_mac, is_win
diff --git a/inc_qt_timeout.patch b/inc_qt_timeout.patch
new file mode 100644
index 000000000000..f4ea058d2fa0
--- /dev/null
+++ b/inc_qt_timeout.patch
@@ -0,0 +1,11 @@
+--- a/python/pyqt/defs.bzl
++++ b/python/pyqt/defs.bzl
+@@ -1,7 +1,7 @@
+ # based off https://github.com/ali5h/rules_pip/blob/master/defs.bzl
+
+ def _execute(repository_ctx, arguments, quiet = False):
+- return repository_ctx.execute(arguments, environment = {}, quiet = quiet)
++ return repository_ctx.execute(arguments, environment = {}, quiet = quiet, timeout=6000)
+
+ def _install_pyqt_impl(repository_ctx):
+ python_interpreter = repository_ctx.attr.python_interpreter
diff --git a/no-update.patch b/no-update.patch
new file mode 100644
index 000000000000..2c6e36520239
--- /dev/null
+++ b/no-update.patch
@@ -0,0 +1,11 @@
+--- a/qt/aqt/update.py
++++ b/qt/aqt/update.py
+@@ -34,6 +34,8 @@
+ }
+
+ def run(self) -> None:
++ return
++
+ if not self.config["updates"]:
+ return
+ d = self._data()