anki/README.development
2020-02-27 14:22:53 +10:00

114 lines
4.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

For non-developers who want to try this development code, the easiest way is
to use a binary package - please see:
https://anki.tenderapp.com/discussions/beta-testing
You are welcome to run Anki from source instead, but it is expected that you
can sort out all dependencies and issues by yourself - we are not able to
provide support for problems you encounter when running from source.
To start, make sure you have the following installed:
- Python 3.7+
- portaudio
- mpv
- lame
- npm
- your platform's C compiler, eg gcc, Xcode or Visual Studio 2017.
- GNU make
- protoc v3 (https://github.com/protocolbuffers/protobuf/releases)
- rustup (https://rustup.rs/)
- gettext
- rename
- rsync
- perl
The build scripts assume a UNIX-like environment, so on Windows you will
need to use WSL or Cygwin to use them.
Once you've installed the above components, execute ./run in this repo,
which will build the subcomponents, and start Anki. Any arguments included
on the command line will be passed on to Anki.
Before contributing code, please read README.contributing.
If you'd like to contribute translations, please see the translations section
of http://ankisrs.net/docs/manual.html#_contributing
Subcomponents
--------------
- pylib contains a Python module (anki) with most of the non-GUI code.
- qt contains the Qt GUI implementation (aqt).
- rspy contains a Python module (ankirspy) for accessing the Rust code.
- rslib contains the parts of the code implemented in Rust. This
is only a tiny subsection at the moment.
- proto contains the interface used to communicate between different
languages.
- tslib and react are just an experiment at the moment.
Makefile
--------------
Use 'make check' to run unit tests, type checking and linting on all of the
subcomponents.
Use 'make fix' to fix any formatting issues that were found with 'make check'.
Use 'make build' to output Python wheels of the subcomponents into the dist/
folder.
Use 'make clean' to remove some generated files.
Performance
------------
'make run' builds the Rust libraries in unoptimized debug mode. Before doing
any performance testing, please make sure you make a release build with
'make build', and install the resulting .whl files with pip.
PyQt
-----
The build scripts will use PyQt/Qt from PyPI by default. If you wish to use a
system install, you will need to set up the pyenv folder yourself, making sure
you have PyQt5, the WebEngine module and development tools (eg pyqt5-dev-tools)
installed as well. You'll need to create the venv with --system-site-packages.
Mac users
----------
You can use homebrew to install some dependencies:
$ brew install python mpv lame portaudio protobuf npm rustup-init gettext rename
$ brew link gettext --force
Windows users (using Visual Studio)
----------
User-contributed instructions for building using Cygwin:
1. Download and install Cygwin and put its `/bin/` directory on your system path.
1. Install the Cygwin Packages: `apt-cyg install rsync make`
1. Download `gettext` 0.20.1 or superior and put its `bin` directory on your system path.
1. https://mlocati.github.io/articles/gettext-iconv-windows.html
1. If the Cygwin `/usr/bin/` directory exists, move all files from `/usr/bin/` to `/bin/`.
The problem with the `/usr/bin/` is that it should not exists. Cygwin should map/mount `/bin/`
into `/usr/bin/`, i.e., they should be the same directory.
1. Download and install Python for Windows (not from Cygwin) and put `python.exe` (not `python3.exe`) on your system path.
1. Download and install pip for your Windows Python (`python -m ensurepip`).
1. Download and install rust (compiler), npm, git and put them your system path.
1. Download and install the pyaudio wheel from: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
1. After download the file for your Python version, you need to define the following environment
variable before running anki:
`set "ANKI_EXTRA_PIP=python -m pip install full/path/to/PyAudio0.2.11cp38cp38win_amd64.whl"`
1. If there is not an wheel available for your Python version, you can built it from the source
following the installation instructions on: https://github.com/evandroforks/pyaudio
After building and installing portaudio, you need to define the following environment
variable before running anki:
`set "ANKI_EXTRA_PIP=python -m pip install git+https://github.com/evandroforks/pyaudio"`
1. Open a `cmd.exe` (command prompt) on the anki repository and run the command `sh run`
1. Do not use `bash run` because it my call for Windows Subsystem for Linux
1. Do not use any Cygwin terminal as `mintty.exe` because the `rust lang` compiler does not work with them