2020-01-02 10:55:27 +01:00
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:
2020-01-07 09:34:36 +01:00
- Python 3.7+
2020-01-02 10:55:27 +01:00
- 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/)
2020-01-02 11:52:12 +01:00
- gettext
2020-01-06 18:30:11 +01:00
- rsync
2020-02-23 03:21:12 +01:00
- perl
2020-04-16 10:11:26 +02:00
- ripgrep (cargo install ripgrep)
2020-03-22 19:52:56 +01:00
- git
- curl
2020-01-02 10:55:27 +01:00
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,
2020-01-04 01:44:26 +01:00
which will build the subcomponents, and start Anki. Any arguments included
2020-06-02 11:35:28 +02:00
on the command line will be passed on to Anki. The first run will take
quite a while to download and build everything - please be patient.
2020-01-02 10:55:27 +01:00
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
--------------
2020-01-02 22:48:38 +01:00
- 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.
2020-05-11 06:30:56 +02:00
- rslib contains the parts of the code implemented in Rust.
2020-01-06 05:28:07 +01:00
- proto contains the interface used to communicate between different
languages.
2020-01-02 10:55:27 +01:00
2020-01-04 01:44:26 +01:00
Makefile
2020-01-02 10:55:27 +01:00
--------------
2020-01-04 01:44:26 +01:00
Use 'make check' to run unit tests, type checking and linting on all of the
subcomponents.
2020-01-02 10:55:27 +01:00
2020-01-04 01:44:26 +01:00
Use 'make fix' to fix any formatting issues that were found with 'make check'.
2020-01-02 10:55:27 +01:00
2020-01-04 01:44:26 +01:00
Use 'make build' to output Python wheels of the subcomponents into the dist/
folder.
2020-01-02 10:55:27 +01:00
2020-01-04 01:44:26 +01:00
Use 'make clean' to remove some generated files.
2020-01-02 10:55:27 +01:00
2020-03-22 19:52:56 +01:00
To see all commands run by make or any shell script, export the environment
variable SHELLFLAGS with '-x' to tell shell to print all commands run by it.
For example, 'export SHELLFLAGS=-x' on Linux or 'set SHELLFLAGS=-x' on Windows.
2020-01-02 10:55:27 +01:00
PyQt
-----
2020-01-04 01:44:26 +01:00
The build scripts will use PyQt/Qt from PyPI by default. If you wish to use a
2020-01-02 10:55:27 +01:00
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.
2020-04-16 10:19:56 +02:00
Debian/Ubuntu users
-------------------
2020-07-13 05:55:18 +02:00
Install Python 3.7+ if it's not installed.
2020-04-16 10:19:56 +02:00
Install other dependencies:
```
sudo apt install portaudio19-dev mpv lame npm rsync gcc gettext git curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-linux-x86_64.zip
sudo unzip protoc-3.11.4-linux-x86_64.zip -d /usr/local/ -x readme.txt
rustup update
cargo install ripgrep
```
2020-01-02 10:55:27 +01:00
Mac users
----------
You can use homebrew to install some dependencies:
2020-03-23 03:34:22 +01:00
$ brew install python mpv lame portaudio protobuf npm rustup-init gettext rename ripgrep
2020-01-04 01:44:26 +01:00
2020-01-22 22:53:06 +01:00
$ brew link gettext --force
2020-02-24 18:58:07 +01:00
2020-02-25 00:38:38 +01:00
Windows users (using Visual Studio)
2020-02-24 18:58:07 +01:00
----------
2020-02-27 05:22:53 +01:00
User-contributed instructions for building using Cygwin:
2020-04-09 11:54:19 +02:00
1. Download and install Cygwin and put its `/bin/` directory on your system path (This PC > Properties > Advancded system settings > Environment Variables > double-click Path > New).
1. Install the Cygwin Packages: `apt-cyg install rsync make` OR select rsync package during Cygwin installation
2020-02-24 21:54:39 +01:00
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
2020-02-24 18:58:07 +01:00
1. Download and install Python for Windows (not from Cygwin) and put `python.exe` (not `python3.exe`) on your system path.
2020-02-26 00:46:54 +01:00
1. Download and install pip for your Windows Python (`python -m ensurepip`).
2020-02-24 18:58:07 +01:00
1. Download and install rust (compiler), npm, git and put them your system path.
2020-02-26 00:46:54 +01:00
1. Download and install the pyaudio wheel from: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
2020-02-26 03:34:09 +01:00
1. After download the file for your Python version, you need to define the following environment
2020-04-10 00:29:58 +02:00
variable before running Anki:
2020-02-26 03:34:09 +01:00
`set "ANKI_EXTRA_PIP=python -m pip install full/path/to/PyAudio‑ 0.2.11‑ cp38‑ cp38‑ win_amd64.whl"`
1. If there is not an wheel available for your Python version, you can built it from the source
2020-02-26 00:46:54 +01:00
following the installation instructions on: https://github.com/evandroforks/pyaudio
2020-02-26 03:34:09 +01:00
After building and installing portaudio, you need to define the following environment
2020-04-10 00:29:58 +02:00
variable before running Anki:
2020-02-26 03:34:09 +01:00
`set "ANKI_EXTRA_PIP=python -m pip install git+https://github.com/evandroforks/pyaudio"`
2020-04-10 00:29:58 +02:00
1. Open a `cmd.exe` (command prompt) on the Anki repository and run the command `sh run`
2020-02-25 00:38:38 +01:00
1. Do not use `bash run` because it my call for Windows Subsystem for Linux
2020-02-24 18:58:07 +01:00
1. Do not use any Cygwin terminal as `mintty.exe` because the `rust lang` compiler does not work with them
2020-04-11 06:36:05 +02:00
Enviromental Variables
-----------------------
If ANKIDEV is set before starting Anki, some extra log messages will be printed on stdout,
and automatic backups will be disabled - so please don't use this except on a test profile.
If LOGTERM is set before starting Anki, warnings and error messages that are normally placed
in the collection2.log file will also be printed on stdout.