After I gave up last year, I have restarted efforts to build Anki Desktop for Alpine Linux (Postmarket OS). You can see my current efforts in this merge request.
After some to and fro, I decided that I’d go the same route as was taken in the FreeBSD ports:
Build the rust part manually (i.e. without bazel).
Use bazel for the rest.
I now have successfully built a package, but it seems to be missing the translations. When I start anki I get the following stack trace:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 129, in __init__
self.setupUI()
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 164, in setupUI
self.setupMainWindow()
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 829, in setupMainWindow
self.form.setupUi(self)
File "/usr/lib/python3.10/site-packages/aqt/forms/main.py", line 134, in setupUi
self.retranslateUi(MainWindow)
File "/usr/lib/python3.10/site-packages/aqt/forms/main.py", line 139, in retranslateUi
self.menuHelp.setTitle(tr.qt_accel_help())
AttributeError: 'Translations' object has no attribute 'qt_accel_help'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 437, in run
_run()
File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 616, in _run
mw = aqt.main.AnkiQt(app, pm, backend, opts, args)
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 133, in __init__
showInfo(tr.qt_misc_error_during_startup(val=traceback.format_exc()))
Maybe I inadvertently patched the build step away that downloads the translations, but I don’t know where to start looking. Which folders/files should exist if the translation step was successful? Which build file is responsible for the translations?
However, there is no qt_accel_help or qt-accel-help in the strings.json (and therefore also not in the resulting fluent.py).
My strings.json is 7659 lines. I guess, you have found the culprit. I need to dig into how the strings.json is being generated. As far as I understand that happens in the rust part, which I could not get to compile through bazel on Alpine. So I (like the people at FreeBSD) had to run the manually. I probably messed sth. up there.
I only start cargo with the pylib/rsbridge/Cargo.toml. I assume I need to run the other tomls as well.
rslib/i18n/build/gather.rs
9://! - EXTRA_FTL_ROOT should normally be set to the l10n.toml file inside the qt translation
109: std::env::var(“EXTRA_FTL_ROOT”)
Okay, I get it now. During the build you are pulling a specific commit from the anki-core-i18n and anki-desktop-ftl repos on github. I’ll try to do that manually as well.
I think the only complete description I have are the build-files themselves. There is quite some patching involved. Which I don’t think are worth describing, because they are alpine and/or musl specific.So I guess anyone interested in building Anki for another musl-distro should look at alpine’s build file.
Note, that the merge request is not excepted yet. But I made my reviews today on my pinephone. So, I can confirm it works.
I’ll add a link here when the merge request has been accepted.