Build instructions
Crosswords and Crossword Editor build on most modern Linux distributions and MacOS (build hints). It was developed primarily on Fedora and OpenSUSE and should build easily on recent releases of those platforms. It has dependencies on:
meson 1.1
glib 2.82
GTK 4.14
libadwaita-1.7
It also follow libipuz development extremely closely. These will be built as submodules if not installed.
There are multiple approaches supported to to build Crosswords from source:
Flatpak — Best for testing the latest version
Provided container image — Best for doing development
Directly on the host — Best for targeting a sepcific platform
Note
The git history is fairly substantial due to the inclusion of the word list data. To download crosswords for building/testing only, use:
$ git clone --depth=1 https://gitlab.gnome.org/jrb/crosswords.git
This will cut the size/bandwidth requirement down by a third.
Flatpak
The easiest way to build and test Crosswords from source is by building a flatpak. This command will build and install it:
$ git clone --depth=1 https://gitlab.gnome.org/jrb/crosswords.git
$ cd crosswords/
$
$ # For the game
$ flatpak-builder --force-clean _flatpak/ org.gnome.Crosswords.Devel.json --user --install
$
$ # For the editor
$ flatpak-builder --force-clean _flatpak/ org.gnome.Crosswords.Editor.Devel.json --user --install
$
$ # To run the flatpak:
$ flatpak run org.gnome.Crosswords.Devel
$ flatpak run org.gnome.Crosswords.Editor.Devel
This approach is much less convenient for development, unless you’re using a flatpak-native IDE like GNOME Builder.
Local build from a container image
An easy way to set up a development environment is to use a container
image. We provide an image for Crosswords that has all the necessary
dependencise for it already installed. It is used for the continuous
integration pipeline (CI), so you can have exactly the same setup on
your own machine. We recommend using distrobox (a useful wrapper
around podman) to work with the container.
To do this, first install podman and distrobox on your distro, and
grab crosswords from git.
Important
Not every distro has distrobox within its package system. The upstream github page has detailed alternative instructions on how to install it. YMMV.
$ # If you forked the repo for development, obviously use your URL instead
$ git clone https://gitlab.gnome.org/jrb/crosswords.git
Next, run the ci/pull-container-image.sh script:
$ cd crosswords/
$ bash ci/pull-container-image.sh
This script will invoke podman pull to download the container image
we use for development. When complete, the script will give detailed
instructions on how to use distrobox to build and install Crosswords
inside the container:
$ bash ci/pull-container-image.sh
Now run this:
distrobox create --image $IMAGE_NAME --name crosswords
env XDG_DATA_DIRS= distrobox enter crosswords
Once inside the container, you can build and install with this:
source ci/env.sh
sudo --preserve-env=PATH,RUSTUP_HOME sh ci/build-and-install.sh
You can just run crosswords on the shell afterwards. It is installed to
the overlay /usr filesystem, and will not interfere with your system:
crosswords
$
Important
We clear the XDG_DATA_DIRS environment to avoid a
distrobox bug where /usr is doubled up.
Run those commands from the script with the correct $IMAGE_NAME copied from the instructions.
Now you can build and install Crosswords while inside the container.
With the instructions above, the crosswords program will get
installed to the container’s overlay file system for /usr without
affecting your main system. Simply call:
env XDG_DATA_DIRS= distrobox enter crosswords
whenever you want to develop against the code base.
Tip
When done with this approach, you can remove the image by
calling distrobox rm crosswords.
Build the docs
We use the Sphinx documentation generator for our docs. To build the docs, run:
$ source ci/env.sh
$ sudo --preserve-env=PATH,RUSTUP_HOME sh ci/gen-devel-docs.sh
The HTML pages are stored in public/devel-docs.
Local build
You can use standard meson tools to build crosswords locally on Linux. You’ll need recent versions of most libraries to get this to build. In general, we test crosswords on the latest released Fedora, openSUSE, and Ubuntu, but it’s not guaranteed to build on older versions of linux.
$ meson setup _build -Dlocaledir=/usr/share/locale
$ ninja -C _build
Note
We set localedir just so that we can find translations of language names. It’s not necessary, but there will be a runtime warning about missing translations without it.
Important
We require a relatively new version of meson to build Crosswords. If
necessary, you can install a local version of meson that’s
sufficiently new by running pip3 install --user meson.
Load .puz files (Optional)
In order to use the convertor to load other crossword types, you need to install some python dependencies. The easiest way to do this is to use pip:
$ # Set up the virtualenv first (see note)
$ pip install -r requirements.txt
$ pip install --no-deps -r requirements.no-deps.txt
Important
If you’re not running this in a VM, we strongly
recommended that you use virtualenv to setup a python environment
before using
pip. Here’s
an example of how to do so on fedora.
Running Crosswords without installation
Running it locally out of the builddir is a little more involved as
it requires some environment variables set to work. To make this
simple and avoid a full system installation, a run script is
included.
Use it as follows:
$ cd _build/
$ # To run the game
$ ./run ./src/crosswords
$ # To run the crossword editor
$ ./run ./src/crossword-editor
$ # To use the convertor
$ ./run ./tools/ipuz-convertor -i puzzle.puz -o /path/to/puzzle.ipuz
$ # To debug the game
$ ./run gdb ./src/crosswords
$ # To run crossword tests
$ ./run ninja test
Loading Puzzle Sets
If you want to test the game with another puzzle-set without installation, you can use the PUZZLE_SET_PATH and PATH environment variables. As an example:
$ PATH=~/Projects/puzzle-sets-xword-dl/ PUZZLE_SET_PATH=~/Projects/puzzle-sets-xword-dl/_build/puzzle-sets/ ./run src/crosswords
Common problems
gschemas.compiled
Meson doesn’t rebuild the compiled gschemas file when the source gschema file changes. If you see an error that looks similar to this after a rebuild:
$ ./run src/crosswords
(crosswords:100131): GLib-GIO-ERROR **: 09:46:51.527: Settings schema 'org.gnome.Crosswords' does not contain a key named 'hidden-puzzle-sets'
Trace/breakpoint trap (core dumped)
You’ll have to recreate the compiled file. Assuming you’re still in _build, this should fix it:
$ rm data/gschemas.compiled
$ ninja -C .
Tests fail on Arch Linux
Arch linux doesn’t include the en_US.UTF-8 locale by default. This
is needed to run tests. If you get an error like:
** (process:327375): ERROR **: 18:06:47.884: word-list-tests requires the en_US.UTF-8 locale to be installed on the host system.
This can be fixed by uncommenting it in /etc/locale.gen and running
locale-gen as root.