1 { lib, stdenv, fetchFromGitHub, autoreconfHook, lua5_3, pkg-config, python3
2 , zlib, bzip2, curl, xz, gettext, libiconv, icu
3 , SDL2, SDL2_mixer, SDL2_image, SDL2_ttf, SDL2_gfx, freetype, fluidsynth
5 , gtkClient ? true, gtk3, wrapGAppsHook3
6 , qtClient ? false, qt5
7 , server ? true, readline
8 , enableSqlite ? true, sqlite
11 stdenv.mkDerivation rec {
15 src = fetchFromGitHub {
18 rev = "R${lib.replaceStrings [ "." ] [ "_" ] version}";
19 hash = "sha256-z4BmkAjKgK0rf4fCMpAhI++HCKFrvpwKmcUvdPSF6Zw=";
23 for f in {common,utility}/*.py; do
24 substituteInPlace $f \
25 --replace '/usr/bin/env python3' ${python3.interpreter}
27 for f in bootstrap/*.sh; do
32 nativeBuildInputs = [ autoreconfHook pkg-config ]
33 ++ lib.optionals qtClient [ qt5.wrapQtAppsHook ]
34 ++ lib.optionals gtkClient [ wrapGAppsHook3 ];
36 buildInputs = [ lua5_3 zlib bzip2 curl xz gettext libiconv icu ]
37 ++ [ SDL2 SDL2_mixer SDL2_image SDL2_ttf SDL2_gfx freetype fluidsynth ]
38 ++ lib.optionals gtkClient [ gtk3 ]
39 ++ lib.optionals qtClient [ qt5.qtbase ]
40 ++ lib.optional server readline
41 ++ lib.optional enableSqlite sqlite;
43 dontWrapQtApps = true;
46 # configure is not smart enough to look for SDL2 headers under
47 # .../SDL2, but thankfully $SDL2_PATH is almost exactly what we want
49 export CPPFLAGS="$(echo $SDL2_PATH | sed 's#/nix/store/#-I/nix/store/#g')"
51 configureFlags = [ "--enable-shared" ]
52 ++ lib.optionals sdl2Client [
53 "--enable-client=sdl2"
54 "--enable-sdl-mixer=sdl2"
56 ++ lib.optionals qtClient [
59 "--with-qt5-includes=${qt5.qtbase.dev}/include"
60 ] ++ lib.optionals gtkClient [ "--enable-client=gtk3.22" ]
61 ++ lib.optional enableSqlite "--enable-fcdb=sqlite3"
62 ++ lib.optional (!gtkClient) "--enable-fcmp=cli"
63 ++ lib.optional (!server) "--disable-server";
65 postFixup = lib.optionalString qtClient ''
66 wrapQtApp $out/bin/freeciv-qt
67 '' + lib.optionalString gtkClient ''
68 wrapGApp $out/bin/freeciv-gtk3.22
71 enableParallelBuilding = true;
74 description = "Multiplayer (or single player), turn-based strategy game";
76 Freeciv is a Free and Open Source empire-building strategy game
77 inspired by the history of human civilization. The game commences in
78 prehistory and your mission is to lead your tribe from the stone age
81 homepage = "http://www.freeciv.org"; # http only
82 license = lib.licenses.gpl2Plus;
83 maintainers = with lib.maintainers; [ pierron ];
84 platforms = lib.platforms.unix;
85 hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
86 broken = qtClient && stdenv.hostPlatform.isDarwin; # Missing Qt5 development files