1{
2 lib,
3 stdenv,
4 gccStdenv,
5 autoreconfHook,
6 autoconf-archive,
7 pkg-config,
8 fetchurl,
9 fetchFromGitHub,
10 openal,
11 enet,
12 SDL2,
13 curl,
14 gettext,
15 libiconv,
16}:
17
18let
19 version = "2.15.6";
20
21 musicVersion = lib.versions.majorMinor version;
22 music = stdenv.mkDerivation {
23 pname = "7kaa-music";
24 version = musicVersion;
25
26 src = fetchurl {
27 url = "https://www.7kfans.com/downloads/7kaa-music-${musicVersion}.tar.bz2";
28 hash = "sha256-sNdntuJXGaFPXzSpN0SoAi17wkr2YnW+5U38eIaVwcM=";
29 };
30
31 installPhase = ''
32 mkdir -p $out
33 cp -r * $out/
34 '';
35
36 meta.license = lib.licenses.unfree;
37 };
38in
39gccStdenv.mkDerivation (finalAttrs: {
40 pname = "7kaa";
41 inherit version;
42
43 src = fetchFromGitHub {
44 owner = "the3dfxdude";
45 repo = "7kaa";
46 tag = "v${finalAttrs.version}";
47 hash = "sha256-kkM+kFQ+tGHS5NrVPeDMRWFQb7waESt8xOLfFGaGdgo=";
48 };
49
50 nativeBuildInputs = [
51 autoreconfHook
52 autoconf-archive
53 pkg-config
54 ];
55
56 buildInputs = [
57 openal
58 enet
59 SDL2
60 curl
61 gettext
62 libiconv
63 ];
64
65 preAutoreconf = ''
66 autoupdate
67 '';
68
69 hardeningDisable = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin) [
70 "stackprotector"
71 ];
72
73 postInstall = ''
74 mkdir $out/share/7kaa/MUSIC
75 cp -R ${music}/MUSIC $out/share/7kaa/
76 cp ${music}/COPYING-Music.txt $out/share/7kaa/MUSIC
77 cp ${music}/COPYING-Music.txt $out/share/doc/7kaa
78 '';
79
80 # Multiplayer is auto-disabled for non-x86 system
81
82 meta = {
83 homepage = "https://www.7kfans.com";
84 description = "GPL release of the Seven Kingdoms with multiplayer (available only on x86 platforms)";
85 license = lib.licenses.gpl2Only;
86 platforms = lib.platforms.x86_64 ++ lib.platforms.aarch64;
87 maintainers = with lib.maintainers; [ _1000101 ];
88 };
89})