@@ -1,6 +1,8 @@
1−{ stdenv, fetchurl, zlib, bzip2, pkgconfig, curl, lzma, gettext, libiconv
1+{ stdenv, fetchFromGitHub, autoreconfHook, lua5_3, pkgconfig, python
2+, zlib, bzip2, curl, lzma, gettext, libiconv
23, sdlClient ? true, SDL, SDL_mixer, SDL_image, SDL_ttf, SDL_gfx, freetype, fluidsynth
3−, gtkClient ? false, gtk2
4+, gtkClient ? false, gtk3
5+, qtClient ? false, qt5
46, server ? true, readline
57, enableSqlite ? true, sqlite
68}:
@@ -8,31 +10,42 @@
810let
911 inherit (stdenv.lib) optional optionals;
1012
11− name = "freeciv";
13+in stdenv.mkDerivation rec {
14+ pname = "freeciv";
1215 version = "2.6.0";
13−in
14−stdenv.mkDerivation {
15− name = "${name}-${version}";
16− inherit version;
17−
18− src = fetchurl {
19− url = "mirror://sourceforge/freeciv/${name}-${version}.tar.bz2";
20− sha256 = "16f9wsnn7073s6chzbm3819swd0iw019p9nrzr3diiynk28kj83w";
16+
17+ src = fetchFromGitHub {
18+ owner = "freeciv";
19+ repo = "freeciv";
20+ rev = "R${builtins.replaceStrings [ "." ] [ "_" ] version}";
21+ sha256 = "1b3q5k9wpv7z24svz01ybw8d8wlzkkdr6ia5hgp6cxk6vq67n67s";
2122 };
2223
23− nativeBuildInputs = [ pkgconfig ];
24+ postPatch = ''
25+ for f in {common,utility}/*.py; do
26+ substituteInPlace $f \
27+ --replace '/usr/bin/env python' ${python.interpreter}
28+ done
29+ '';
30+
31+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
2432
25− buildInputs = [ zlib bzip2 curl lzma gettext libiconv ]
33+ buildInputs = [ lua5_3 zlib bzip2 curl lzma gettext libiconv ]
2634 ++ optionals sdlClient [ SDL SDL_mixer SDL_image SDL_ttf SDL_gfx freetype fluidsynth ]
27− ++ optionals gtkClient [ gtk2 ]
35+ ++ optionals gtkClient [ gtk3 ]
36+ ++ optionals qtClient [ qt5.qtbase ]
2837 ++ optional server readline
2938 ++ optional enableSqlite sqlite;
3039
3140 configureFlags = [ "--enable-shared" ]
3241 ++ optional sdlClient "--enable-client=sdl"
42+ ++ optionals qtClient [
43+ "--enable-client=qt"
44+ "--with-qt5-includes=${qt5.qtbase.dev}/include"
45+ ]
3346 ++ optional enableSqlite "--enable-fcdb=sqlite3"
3447 ++ optional (!gtkClient) "--enable-fcmp=cli"
35− ++ optional (!server) "--disable-server";
48+ ++ optional (!server) "--disable-server";
3649
3750 enableParallelBuilding = true;
3851
@@ -46,11 +59,11 @@ stdenv.mkDerivation {
4659 to the space age...
4760 '';
4861
49− homepage = http://freeciv.wikia.com/;
62+ homepage = http://www.freeciv.org; # http only
5063 license = licenses.gpl2;
5164
5265 maintainers = with maintainers; [ pierron ];
5366 platforms = platforms.unix;
54− hydraPlatforms = stdenv.lib.platforms.linux; # sdl-config times out on darwin
67+ hydraPlatforms = platforms.linux; # sdl-config times out on darwin
5568 };
5669}