How to play Magic the Gathering using Cockatrice on Linux


(last time edited: 2021-03-19)

tags: linux, games

Cockatrice is an open-source, multiplatform program for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline. This project uses C++ and the Qt5 libraries.

Install these dependencies:









Download the latest source code release tar from here.

Create a Games directory in your home user directory.

$ mkdir ~/Games

Extract the content.

$ tar -xf ~/Downloads/Cockatrice*.tar.gz -C ~/Games

Make and compile.

$ mkdir ~/Games/Cockatrice*/build

$ cmake -S ~/Games/Cockatrice* -B ~/Games/Cockatrice-*/build

$ make -C ~/Games/Cockatrice*/build

Install Cockatrice in your system.

$ sudo make -C ~/Games/Cockatrice*/build install

Create a package template using Void Linux's xbps-src

xbps-src is an utility to create XBPS packages. Those packages can be used for installing and uninstalling programs later on. Similar to PKGBUILDs on Arch Linux, xbps-src takes a script-like file with variables and instructions to grab the source and build it to generate package files.

xbps-src is a bash script tool wrapper that lets you build programs in a separate (Git) directory away from your system packaging directory. xbps-src enables you to check dependencies, re-compile, add specific installation functions for package deployment in system, and you can also pull request your own created packages to the void-packages Git repository.

I recommend reading the manual at all times.

To simplify some jobs you might need to install xtools.

# xbps-install xtools

Then clone all the void-packages templates repository in your home directory.

$ git clone ~/void-packages

Update your void-packages dir regularly, if you just cloned it right now there is no need to do so.

$ git pull -C ~/void-packages

Change directory.

$ cd ~/void-packages

Download/update the binary bootstrap.

$ ./xbps-src bootstrap-update

$ ./xbps-src binary-bootstrap

Create a new template along all other templates, in this guide I'll show you how to create a Cockatrice template.

$ xnew Cockatrice

Let's edit the template with your favorite text editor.

$ vim ~/void-packages/srcpkgs/Cockatrice/template

A blank template looks like this.

# Template file for 'pkg'
#archs="i686 x86_64"
#make_dirs="/var/log/dir 0755 root root"
maintainer="me <>"

SOMEPACKAGE_package() {
    pkg_install() {
        #vmove path

I added some Cockatrice info and template corrections. At the end it should be looking like this.

# Template file for 'Cockatrice'
pkgname=Cockatrice # self-explanatory
version=2.8.0 # this is the latest release I grabbed from
revision=2 # my second revision of the template because I added server cmake args
_reldate="2021-01-26" # date included by the Cockatrice devs, this is a custom variable to solve the devs' bad practice, releases shouldn't be tagged like this
wrksrc="${pkgname}-${_reldate}-Release-${version}" # this is the name of wrksrc, same as the directory
_server_depends="qt5-plugin-mysql qt5-plugin-odbc qt5-plugin-pgsql qt5-plugin-sqlite qt5-plugin-tds"
build_style="cmake" # Cockatrice is built with cmake by default
configure_args="-DWITH_SERVER=1" # compile with server binary and dependencies, make sure the _server_depends is inside makedepends
makedepends="qt5-websockets-devel qt5-svg-devel qt5-multimedia-devel protobuf protobuf-devel ${_server_depends}" # dependencies to build the program including server program
short_desc="Open-source program for playing multiplayer tabletop card games" # simple description
maintainer="me <>" # me
license="GPL-2.0-or-later" # Cockatrice's license using SPDX specification, usually shown in the Git page
homepage="" # program main's webpage, rather than Git page
distfiles="${pkgname}/${pkgname}/archive/${_reldate}-Release-${version}.tar.gz" # the release source files grabbed from; notice how I reuse variables
checksum="fbf908138e40b20529ebdc27b3b37d63891bf6a91f660be694407a8e57471e79" # this is the sha256sum of the .tar source files, could also be obtained via xgensum Cockatrice

Save and run xlint on the template to check for any errors.

If you take a look at the template, I managed to get the SHA256 checksum manually by running sha256sum on the .tar file. Yes it could also be obtained using xgensum Cockatrice but I like doing it manually and then pasting it on the template.

Now let's build. xbps-src will start downloading dependencies and start building, it might take some time depending on your CPU.

$ ./xbps-src pkg Cockatrice

Since everything was done correctly now I wanna install the package on my system. Do this inside the void-packages directory.

$ xi Cockatrice

or which is the same but longer:

$ sudo xbps-install --repository=~/void-packages/hostdir/binpkgs Cockatrice

If you compiled Cockatrice with the CMake arguments -DWITH_SERVER=1 to get a server binary, you'll find it inside the installed files. How to check?

$ xls Cockatrice


$ xbps-query --repository=~/void-packages/hostdir/binpkgs -f Cockatrice

You will see a new binary called servatrice.

That's all folks. xbps-src is very simple, can be a little tough to understand at first but that's normal if we take consideration that is a program talking to other multiple programs.