1{
2 lib,
3 stdenv,
4 asciidoc,
5 boost,
6 cmake,
7 curl,
8 docbook_xsl,
9 docbook_xsl_ns,
10 fetchurl,
11 freetype,
12 glew,
13 jdk,
14 libdevil,
15 libGL,
16 libGLU,
17 libunwind,
18 libvorbis,
19 makeWrapper,
20 minizip,
21 openal,
22 p7zip,
23 python3,
24 SDL2,
25 xorg,
26 xz,
27 zlib,
28 withAI ? true, # support for AI Interfaces and Skirmish AIs
29}:
30
31stdenv.mkDerivation rec {
32 pname = "spring";
33 version = "106.0";
34
35 src = fetchurl {
36 url = "https://springrts.com/dl/buildbot/default/master/${version}/source/spring_${version}_src.tar.gz";
37 sha256 = "sha256-mSA4ioIv68NMEB72lYnwDb1QOuWr1VHwu4+grAoHlV0=";
38 };
39
40 postPatch = ''
41 patchShebangs .
42
43 substituteInPlace ./rts/build/cmake/FindAsciiDoc.cmake \
44 --replace "PATHS /usr /usr/share /usr/local /usr/local/share" "PATHS ${docbook_xsl}"\
45 --replace "xsl/docbook/manpages" "share/xml/docbook-xsl/manpages"
46
47 # The cmake included module correcly finds nix's glew, however
48 # it has to be the bundled FindGLEW for headless or dedicated builds
49 rm rts/build/cmake/FindGLEW.cmake
50 '';
51
52 cmakeFlags = [
53 "-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON"
54 "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON"
55 "-DPREFER_STATIC_LIBS:BOOL=OFF"
56 ];
57
58 nativeBuildInputs = [
59 cmake
60 makeWrapper
61 docbook_xsl
62 docbook_xsl_ns
63 asciidoc
64 ];
65 buildInputs =
66 [
67 boost
68 curl
69 freetype
70 glew
71 libdevil
72 libGL
73 libGLU
74 libunwind
75 libvorbis
76 minizip
77 openal
78 p7zip
79 SDL2
80 xorg.libX11
81 xorg.libXcursor
82 xz
83 zlib
84 ]
85 ++ lib.optionals withAI [
86 python3
87 jdk
88 ];
89
90 postInstall = ''
91 wrapProgram "$out/bin/spring" \
92 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
93 '';
94
95 meta = with lib; {
96 homepage = "https://springrts.com/";
97 description = "Powerful real-time strategy (RTS) game engine";
98 license = licenses.gpl2Plus;
99 maintainers = with maintainers; [
100 qknight
101 domenkozar
102 sorki
103 ];
104 platforms = [ "x86_64-linux" ];
105 broken = true;
106 };
107}