Skip to content
Mathew K J edited this page Nov 28, 2023 · 33 revisions

This is a short guide to compiling Naev on *nix-based systems.

Dependencies

First install the Naev dependencies. They should be fairly common on most systems. They are:

  • SDL 2
  • SDL2_image
  • OpenGL
  • libwebp
  • libxml 2
  • Freetype 2
  • libpng 1.2
  • OpenAL
  • OpenBLAS (or, in principle, any BLAS implementation)
  • libvorbis
  • binutils
  • pyyaml (Used for generating the credits.)

Building is faster if these are also available:

  • GLPK
  • LuaJIT
  • physfs
  • SuiteSparse (cholmod, cxsparse)

Debian Wheezy, Ubuntu 14.04 and Newer

Runtime dependencies for Naev can be installed with:

apt-get install libsdl2-2.0-0 libsdl2-image-2.0-0 libgl1-mesa-dri \
  libxml2 libfreetype6 libpng-dev libopenal1 libvorbis0a libzip6 libphysfs1 libwebp7 libcholmod3 libcxsparse3 libopenblas-base

For compiling, you'll need the additional:

apt-get install build-essential git meson libsdl2-dev libsdl2-image-dev \
  libgl1-mesa-dev libxml2-dev libfreetype-dev libpng-dev libopenal-dev \
  libvorbis-dev binutils-dev libwebp-dev libiberty-dev intltool python3-yaml \
  libfontconfig1-dev libphysfs-dev libopenblas-dev libsuitesparse-dev

You'll also want libglpk-dev (if your OS has a good one -- 4.65 in Ubuntu 18.04 appears to be defective). Otherwise, you'll need to use the included SuiteSparse package (Meson option: --force-fallback-for=glpk,SuiteSparse), or export CPPFLAGS=-I/usr/include/suitesparse before configuring Meson.

Gentoo

(Dependencies here are out-of-date, contributors welcome!)

emerge media-libs/libsdl media-libs/sdl-image virtual/opengl\
  dev-libs/libxml2 media-libs/freetype media-libs/libpng media-libs/openal\
  media-libs/libvorbis sys-devel/binutils dev-libs/libzip sci-libs/openblas\
  sci-libs/suitesparse sci-mathematics/glpk

Arch

(Dependencies here are probably out-of-date, contributors welcome!) First make sure you have autotools and pkg-config installed:

pacman -S --needed automake autoconf autoconf-archive pkg-config meson

Then, install the dependencies:

pacman -S --needed sdl2 sdl2_image libxml2 freetype2 libpng libvorbis libzip openblas openal suitesparse glpk physfs cmake

pacman might tell you that openblas and blas are in conflict, but the regular blas package doesn't work (as of 14-08-2022). Replace it.

Fedora and Other RHEL-based Distributions

First make sure you have the build tools installed:

sudo dnf install meson ninja-build gcc 

Then, install these build-time dependencies:

sudo dnf install binutils-devel fontconfig-devel freetype-devel enet-devel glpk-devel libpng12-devel libxml2-devel \
  libvorbis-devel libwebp-devel libunibreak-devel luajit-devel openal-soft-devel openblas-devel physfs-devel \
  python3-pyyaml SDL2-devel SDL2_image-devel suitesparse-devel libbacktrace-devel  

If needed, you can install the following packages to allow for generation of documentation.

sudo dnf install doxygen lua-ldoc graphviz   

Compiling

First, clone the git repository with all git submodules by running:

git clone --recursive https://github.com/naev/naev.git naev
cd naev

Next, setup the build directory with:

meson setup build .  #or ("meson build", which is a shortcut for the same thing and NOT its own Meson command)

Move into the build directory with:

cd build

And proceed to compile with:

meson compile

If all went well you should see something like:

$ meson compile
Found runner: ['/usr/bin/ninja']
ninja: Entering directory `.'
[21/196] Generating gen-desktop-entry with a custom command
Creating new desktop-entry file 'org.naev.naev.desktop' using data from 'org.naev.naev.metainfo.xml'
[40/196] Generating ldoc with a custom command
reading configuration from ../docs/lua/config.ld
output written to /tmp/naev/build/docs/lua
[196/196] Linking target naev

Indicating the binary was built. Now you can run naev with:

./naev.sh

Enjoy!