2021-01-17 05:49:22 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, lua5_3, pkg-config, python3
|
2022-06-10 22:21:12 +00:00
|
|
|
, zlib, bzip2, curl, xz, gettext, libiconv, icu
|
|
|
|
, SDL2, SDL2_mixer, SDL2_image, SDL2_ttf, SDL2_gfx, freetype, fluidsynth
|
|
|
|
, sdl2Client ? false
|
|
|
|
, gtkClient ? true, gtk3, wrapGAppsHook
|
2019-06-25 04:55:12 +00:00
|
|
|
, qtClient ? false, qt5
|
2016-12-28 21:12:57 +00:00
|
|
|
, server ? true, readline
|
|
|
|
, enableSqlite ? true, sqlite
|
|
|
|
}:
|
2011-08-20 14:30:16 +00:00
|
|
|
|
2021-08-05 14:57:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-06-25 04:55:12 +00:00
|
|
|
pname = "freeciv";
|
2024-03-02 04:21:38 +00:00
|
|
|
version = "3.1.0";
|
2019-06-25 04:55:12 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "freeciv";
|
|
|
|
repo = "freeciv";
|
2021-08-05 14:57:52 +00:00
|
|
|
rev = "R${lib.replaceStrings [ "." ] [ "_" ] version}";
|
2024-03-02 04:21:38 +00:00
|
|
|
hash = "sha256-8cMy0O5VxVi1ffvA/Gz4BnTB0WvJptMSgM7Zu992k5k=";
|
2011-08-20 14:30:16 +00:00
|
|
|
};
|
|
|
|
|
2019-06-25 04:55:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
for f in {common,utility}/*.py; do
|
|
|
|
substituteInPlace $f \
|
2020-04-03 20:26:05 +00:00
|
|
|
--replace '/usr/bin/env python3' ${python3.interpreter}
|
2019-06-25 04:55:12 +00:00
|
|
|
done
|
2023-07-25 09:04:55 +00:00
|
|
|
for f in bootstrap/*.sh; do
|
|
|
|
patchShebangs $f
|
|
|
|
done
|
2019-06-25 04:55:12 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-17 05:31:10 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ]
|
2022-10-06 16:38:53 +00:00
|
|
|
++ lib.optionals qtClient [ qt5.wrapQtAppsHook ]
|
|
|
|
++ lib.optionals gtkClient [ wrapGAppsHook ];
|
2012-02-13 19:34:39 +00:00
|
|
|
|
2022-06-10 22:21:12 +00:00
|
|
|
buildInputs = [ lua5_3 zlib bzip2 curl xz gettext libiconv icu ]
|
|
|
|
++ [ SDL2 SDL2_mixer SDL2_image SDL2_ttf SDL2_gfx freetype fluidsynth ]
|
2021-08-05 14:57:52 +00:00
|
|
|
++ lib.optionals gtkClient [ gtk3 ]
|
|
|
|
++ lib.optionals qtClient [ qt5.qtbase ]
|
|
|
|
++ lib.optional server readline
|
|
|
|
++ lib.optional enableSqlite sqlite;
|
2011-08-20 14:30:16 +00:00
|
|
|
|
2021-01-12 11:50:23 +00:00
|
|
|
dontWrapQtApps = true;
|
2021-09-06 20:18:32 +00:00
|
|
|
dontWrapGApps = true;
|
2021-01-12 11:50:23 +00:00
|
|
|
|
2022-06-10 22:21:12 +00:00
|
|
|
# configure is not smart enough to look for SDL2 headers under
|
|
|
|
# .../SDL2, but thankfully $SDL2_PATH is almost exactly what we want
|
|
|
|
preConfigure = ''
|
|
|
|
export CPPFLAGS="$(echo $SDL2_PATH | sed 's#/nix/store/#-I/nix/store/#g')"
|
|
|
|
'';
|
2016-12-28 21:33:13 +00:00
|
|
|
configureFlags = [ "--enable-shared" ]
|
2022-06-10 22:21:12 +00:00
|
|
|
++ lib.optionals sdl2Client [
|
|
|
|
"--enable-client=sdl2"
|
|
|
|
"--enable-sdl-mixer=sdl2"
|
|
|
|
]
|
2021-08-05 14:57:52 +00:00
|
|
|
++ lib.optionals qtClient [
|
2019-06-25 04:55:12 +00:00
|
|
|
"--enable-client=qt"
|
2024-03-08 07:40:05 +00:00
|
|
|
"--with-qtver=qt5"
|
2019-06-25 04:55:12 +00:00
|
|
|
"--with-qt5-includes=${qt5.qtbase.dev}/include"
|
2021-08-05 14:57:52 +00:00
|
|
|
] ++ lib.optionals gtkClient [ "--enable-client=gtk3.22" ]
|
|
|
|
++ lib.optional enableSqlite "--enable-fcdb=sqlite3"
|
|
|
|
++ lib.optional (!gtkClient) "--enable-fcmp=cli"
|
|
|
|
++ lib.optional (!server) "--disable-server";
|
2015-08-02 19:37:03 +00:00
|
|
|
|
2021-09-06 14:39:49 +00:00
|
|
|
postFixup = lib.optionalString qtClient ''
|
|
|
|
wrapQtApp $out/bin/freeciv-qt
|
2021-09-06 20:18:32 +00:00
|
|
|
'' + lib.optionalString gtkClient ''
|
|
|
|
wrapGApp $out/bin/freeciv-gtk3.22
|
2021-09-06 14:39:49 +00:00
|
|
|
'';
|
|
|
|
|
2017-11-26 07:42:18 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2013-10-06 09:49:53 +00:00
|
|
|
description = "Multiplayer (or single player), turn-based strategy game";
|
2011-08-20 14:30:16 +00:00
|
|
|
longDescription = ''
|
|
|
|
Freeciv is a Free and Open Source empire-building strategy game
|
|
|
|
inspired by the history of human civilization. The game commences in
|
|
|
|
prehistory and your mission is to lead your tribe from the stone age
|
|
|
|
to the space age...
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.freeciv.org"; # http only
|
2011-08-20 14:30:16 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ pierron ];
|
2018-05-21 22:08:43 +00:00
|
|
|
platforms = platforms.unix;
|
2019-06-25 04:55:12 +00:00
|
|
|
hydraPlatforms = platforms.linux; # sdl-config times out on darwin
|
2024-03-08 07:40:05 +00:00
|
|
|
broken = qtClient && stdenv.isDarwin; # Missing Qt5 development files
|
2011-08-20 14:30:16 +00:00
|
|
|
};
|
|
|
|
}
|