1{
2 lib,
3 stdenv,
4 bzip2,
5 cmake,
6 fetchFromGitHub,
7 libtomcrypt,
8 zlib,
9 pkg-config,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "stormlib";
14 version = "9.30";
15
16 src = fetchFromGitHub {
17 owner = "ladislav-zezula";
18 repo = "StormLib";
19 tag = "v${finalAttrs.version}";
20 hash = "sha256-gW3jR9XnBo5uEORu12TpGsUMFAS4w5snWPA/bIUt9UY=";
21 };
22
23 nativeBuildInputs = [
24 cmake
25 pkg-config
26 ];
27
28 buildInputs = [
29 bzip2
30 libtomcrypt
31 zlib
32 ];
33
34 cmakeFlags = [
35 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
36 (lib.cmakeBool "WITH_LIBTOMCRYPT" true)
37 ];
38
39 strictDeps = true;
40
41 env.NIX_CFLAGS_COMPILE = toString (
42 lib.optionals stdenv.cc.isClang [
43 "-Wno-implicit-function-declaration"
44 "-Wno-int-conversion"
45 ]
46 );
47
48 postPatch = ''
49 substituteInPlace CMakeLists.txt \
50 --replace-fail "FRAMEWORK DESTINATION /Library/Frameworks" "FRAMEWORK DESTINATION Library/Frameworks"
51 '';
52
53 meta = {
54 homepage = "https://github.com/ladislav-zezula/StormLib";
55 description = "Open-source project that can work with Blizzard MPQ archives";
56 license = lib.licenses.mit;
57 maintainers = with lib.maintainers; [
58 aanderse
59 ];
60 platforms = lib.platforms.all;
61 broken = stdenv.hostPlatform.isDarwin; # installation directory mismatch
62 };
63})