summary refs log tree commit diff
path: root/pkgs/development/libraries/stargate-libcds/default.nix
blob: 409d9e820fce501c66eb7c42d5feb05392645eae (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
{ lib
, stdenv
, fetchpatch
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
  pname = "stargate-libcds";
  version = "1.0.0";

  src = fetchFromGitHub {
    owner = "stargateaudio";
    repo = "libcds";
    rev = version;
    sha256 = "sha256-THThEzS8gGdwn3h0EBttaX5ljZH9Ma2Rcg143+GIdU8=";
  };

  # Fix 'error: unrecognized command line option' in platforms other than x86
  PLAT_FLAGS = lib.optionalString stdenv.isx86_64 "-mfpmath=sse -mssse3";

  patches = [
    # Remove unecessary tests (valgrind, coverage)
    ./Makefile.patch

    # Fix for building on darwin
    (fetchpatch {
      name = "malloc-to-stdlib.patch";
      url = "https://github.com/stargateaudio/libcds/commit/65dc08f059deda8ba5707ba6116b616d0ad0bd8d.patch";
      sha256 = "sha256-FIGlobUVrDYOtnHjsWyE420PoULPHEK/3T9Fv8hfTl4=";
    })
  ];

  doCheck = true;

  installPhase = ''
    runHook preInstall
    install -D libcds.so -t $out/lib/
    runHook postInstall
  '';

  meta = with lib; {
    description = "C data structure library";
    homepage = "https://github.com/stargateaudio/libcds";
    maintainers = with maintainers; [ yuu ];
    license = licenses.lgpl3Only;
  };
}