about summary refs log tree commit diff
path: root/pkgs/by-name/st/stormlib/package.nix
blob: 8248956f26675a59126553f035e39c66c085b88c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  lib,
  bzip2,
  cmake,
  darwin,
  fetchFromGitHub,
  libtomcrypt,
  stdenv,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "stormlib";
  version = "9.23";

  src = fetchFromGitHub {
    owner = "ladislav-zezula";
    repo = "StormLib";
    rev = "v${finalAttrs.version}";
    hash = "sha256-8JDMqZ5BWslH4+Mfo5lnWTmD2QDaColwBOLzcuGZciY=";
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    bzip2
    libtomcrypt
    zlib
  ]
  ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Carbon
  ];

  cmakeFlags = [
    (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
    (lib.cmakeBool "WITH_LIBTOMCRYPT" true)
  ];

  strictDeps = true;

  env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [
    "-Wno-implicit-function-declaration"
    "-Wno-int-conversion"
  ]);

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace "FRAMEWORK DESTINATION /Library/Frameworks" "FRAMEWORK DESTINATION Library/Frameworks"
  '';

  meta = {
    homepage = "https://github.com/ladislav-zezula/StormLib";
    description = "An open-source project that can work with Blizzard MPQ archives";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ aanderse karolchmist ];
    platforms = lib.platforms.all;
    broken = stdenv.isDarwin; # installation directory mismatch
  };
})