Anki/build/ninja_gen/src
Kai Knoblich 42cc2c913c
Add support for offline builds (#2963)
* CONTRIBUTORS: Add myself to the contributors list

* Add support for offline builds

Downloading files during build time is a non-starter for FreeBSD ports
(and presumably for other *BSD ports and some Linux distros as well).

In order to still be able to build Anki successfully, two new
environment variables have been added that can be set accordingly:

* NO_VENV: If set, the Python system environment is used instead of
  a venv. This is necessary if there are no usable Python wheels for a
  platform, e.g. PyQt6.

* OFFLINE_BUILD: If set, the git repository synchronization (translation
  files, build hash, etc.) is skipped.

To successfully build Anki offline, following conditions must be met:

1. All required dependencies (node, Python, rust, yarn, etc.) must be
   present in the build environment.

2. The offline repositories for the translation files must be
   copied/linked to ftl/qt-repo and ftl/core-repo.

3. The Python pseudo venv needs to be setup:

   $ mkdir out/pyenv/bin
   $ ln -s /path/to/python out/pyenv/bin/python
   $ ln -s /path/to/protoc-gen-mypy out/pyenv/bin/protoc-gen-mypy

4. Create the offline cache for yarn and use its own environment
   variable YARN_CACHE_FOLDER to it:

   YARN_CACHE_FOLDER=/path/to/the/yarn/cache
   $ /path/to/yarn install --ignore-scripts

5. Build Anki:

   $ /path/to/cargo build --package runner --release --verbose --verbose
   $ OFFLINE_BUILD=1 \
     NO_VENV=1 \
     ${WRKSRC}/out/rust/release/runner build wheels
2024-01-31 09:13:46 +10:00
..
action.rs Shift output suppression into n2 (#2618) 2023-08-23 11:59:52 +10:00
archives.rs Fix bundling 2023-07-02 18:22:44 +10:00
build.rs Fix ninja compatibility 2023-08-25 02:45:16 +10:00
cargo.rs Skip tests failing around rollover hour (#2909) 2023-12-28 18:06:19 +10:00
command.rs Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
configure.rs Add option to use LTO in release builds 2023-07-02 18:22:44 +10:00
copy.rs Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
git.rs Add support for offline builds (#2963) 2024-01-31 09:13:46 +10:00
hash.rs Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
input.rs Bump Rust version 2023-03-31 14:11:33 +10:00
lib.rs Migrate proto build actions to ninja_gen; switch from dyn Error to anyhow 2023-06-30 19:37:02 +10:00
node.rs Shift output suppression into n2 (#2618) 2023-08-23 11:59:52 +10:00
protobuf.rs Migrate proto build actions to ninja_gen; switch from dyn Error to anyhow 2023-06-30 19:37:02 +10:00
python.rs Add support for offline builds (#2963) 2024-01-31 09:13:46 +10:00
render.rs Revert "Revert "Pull in latest upstream n2 fixes"" 2023-08-31 08:31:43 +10:00
rsync.rs Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
sass.rs Migrate proto build actions to ninja_gen; switch from dyn Error to anyhow 2023-06-30 19:37:02 +10:00