at master 137 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 autoreconfHook, 6 lua5_3, 7 pkg-config, 8 python3, 9 zlib, 10 bzip2, 11 curl, 12 xz, 13 gettext, 14 libiconv, 15 icu, 16 SDL2, 17 SDL2_mixer, 18 SDL2_image, 19 SDL2_ttf, 20 SDL2_gfx, 21 freetype, 22 fluidsynth, 23 sdl2Client ? false, 24 gtkClient ? true, 25 gtk3, 26 wrapGAppsHook3, 27 qtClient ? false, 28 qt5, 29 server ? true, 30 readline, 31 enableSqlite ? true, 32 sqlite, 33}: 34 35stdenv.mkDerivation rec { 36 pname = "freeciv"; 37 version = "3.2.0"; 38 39 src = fetchFromGitHub { 40 owner = "freeciv"; 41 repo = "freeciv"; 42 rev = "R${lib.replaceStrings [ "." ] [ "_" ] version}"; 43 hash = "sha256-IlJ51ryoQ7qzIY9n8dmPQdwH8aPjXvRXXO2COOxWRcc="; 44 }; 45 46 postPatch = '' 47 for f in {common,utility}/*.py; do 48 substituteInPlace $f \ 49 --replace '/usr/bin/env python3' ${python3.interpreter} 50 done 51 for f in bootstrap/*.sh; do 52 patchShebangs $f 53 done 54 ''; 55 56 nativeBuildInputs = [ 57 autoreconfHook 58 pkg-config 59 ] 60 ++ lib.optionals qtClient [ qt5.wrapQtAppsHook ] 61 ++ lib.optionals gtkClient [ wrapGAppsHook3 ]; 62 63 buildInputs = [ 64 lua5_3 65 zlib 66 bzip2 67 curl 68 xz 69 gettext 70 libiconv 71 icu 72 ] 73 ++ lib.optionals sdl2Client [ 74 SDL2 75 SDL2_mixer 76 SDL2_image 77 SDL2_ttf 78 SDL2_gfx 79 freetype 80 fluidsynth 81 ] 82 ++ lib.optionals gtkClient [ gtk3 ] 83 ++ lib.optionals qtClient [ qt5.qtbase ] 84 ++ lib.optional server readline 85 ++ lib.optional enableSqlite sqlite; 86 87 dontWrapQtApps = true; 88 dontWrapGApps = true; 89 90 # configure is not smart enough to look for SDL2 headers under 91 # .../SDL2, but thankfully $SDL2_PATH is almost exactly what we want 92 preConfigure = '' 93 export CPPFLAGS="$(echo $SDL2_PATH | sed 's#/nix/store/#-I/nix/store/#g')" 94 ''; 95 configureFlags = [ 96 "--enable-shared" 97 ] 98 ++ lib.optionals sdl2Client [ 99 "--enable-client=sdl2" 100 "--enable-sdl-mixer=sdl2" 101 ] 102 ++ lib.optionals qtClient [ 103 "--enable-client=qt" 104 "--with-qtver=qt5" 105 "--with-qt5-includes=${qt5.qtbase.dev}/include" 106 ] 107 ++ lib.optionals gtkClient [ "--enable-client=gtk3.22" ] 108 ++ lib.optional enableSqlite "--enable-fcdb=sqlite3" 109 ++ lib.optional (!gtkClient) "--enable-fcmp=cli" 110 ++ lib.optional (!server) "--disable-server"; 111 112 postFixup = 113 lib.optionalString qtClient '' 114 wrapQtApp $out/bin/freeciv-qt 115 '' 116 + lib.optionalString gtkClient '' 117 wrapGApp $out/bin/freeciv-gtk3.22 118 ''; 119 120 enableParallelBuilding = true; 121 122 meta = { 123 description = "Multiplayer (or single player), turn-based strategy game"; 124 longDescription = '' 125 Freeciv is a Free and Open Source empire-building strategy game 126 inspired by the history of human civilization. The game commences in 127 prehistory and your mission is to lead your tribe from the stone age 128 to the space age... 129 ''; 130 homepage = "http://www.freeciv.org"; # http only 131 license = lib.licenses.gpl2Plus; 132 maintainers = with lib.maintainers; [ pierron ]; 133 platforms = lib.platforms.unix; 134 hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin 135 broken = qtClient && stdenv.hostPlatform.isDarwin; # Missing Qt5 development files 136 }; 137}