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