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, wrapGAppsHook
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-6DWVou4d1oAOlhHb2A2vxR4Fy+1q7Xz9w9VK9rEzZxA=";
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 [ wrapGAppsHook ];
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 [
58 "--with-qt5-includes=${qt5.qtbase.dev}/include"
59 ] ++ lib.optionals gtkClient [ "--enable-client=gtk3.22" ]
60 ++ lib.optional enableSqlite "--enable-fcdb=sqlite3"
61 ++ lib.optional (!gtkClient) "--enable-fcmp=cli"
62 ++ lib.optional (!server) "--disable-server";
64 postFixup = lib.optionalString qtClient ''
65 wrapQtApp $out/bin/freeciv-qt
66 '' + lib.optionalString gtkClient ''
67 wrapGApp $out/bin/freeciv-gtk3.22
70 enableParallelBuilding = true;
73 description = "Multiplayer (or single player), turn-based strategy game";
75 Freeciv is a Free and Open Source empire-building strategy game
76 inspired by the history of human civilization. The game commences in
77 prehistory and your mission is to lead your tribe from the stone age
80 homepage = "http://www.freeciv.org"; # http only
81 license = licenses.gpl2;
82 maintainers = with maintainers; [ pierron ];
83 platforms = platforms.unix;
84 hydraPlatforms = platforms.linux; # sdl-config times out on darwin