summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/re/readstat/package.nix
blob: bdcfdd89e32970bdc8e470e7f66a6782a6db0ffc (plain)
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
62
63
64
65
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  autoreconfHook,
  pkg-config,
  libtool,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "readstat";
  version = "1.1.9";

  src = fetchFromGitHub {
    owner = "WizardMac";
    repo = "ReadStat";
    rev = "v${finalAttrs.version}";
    sha256 = "sha256-4lRJgZPB2gfaQ9fQKvDDpGhy1eDNT/nT1QmeZlCmCis=";
  };

  patches = [
    # Remove `gettext` requirement
    # https://github.com/WizardMac/ReadStat/issues/341
    (fetchpatch {
      url = "https://github.com/WizardMac/ReadStat/pull/342/commits/b5512b32d3b3c39e2f0c322df1339a3c61f73712.patch";
      hash = "sha256-k1yeplrx3pFPl5qzLfsAaj+qunv1BqOZypA05xSolaQ=";
    })

    # Add (void) to remove -Wstrict-prototypes warnings
    (fetchpatch {
      url = "https://github.com/WizardMac/ReadStat/commit/211c342a1cfe46fb7fb984730dd7a29ff4752f35.patch";
      hash = "sha256-nkaEgusylVu7NtzSzBklBuOnqO9qJPovf0qn9tTE6ls=";
    })

    # Backport use-after-free:
    #   https://github.com/WizardMac/ReadStat/pull/298
    (fetchpatch {
      url = "https://github.com/WizardMac/ReadStat/commit/718d49155e327471ed9bf4a8c157f849f285b46c.patch";
      hash = "sha256-9hmuFa05b4JlxSzquIxXArOGhbi27A+3y5gH1IDg+R0=";
    })

    # fix stringop-truncation warning
    (fetchpatch {
      url = "https://github.com/WizardMac/ReadStat/commit/43d4cdec6783b29d0f1d0ae9564507739cd27567.patch";
      hash = "sha256-LZtdFdru2y89NvmLqa1sryhfzZX09jEeC2qWJpDS/kI=";
    })
  ];

  nativeBuildInputs = [
    pkg-config
    autoreconfHook
    libtool
  ];

  enableParallelBuilding = true;

  meta = {
    homepage = "https://github.com/WizardMac/ReadStat";
    description = "Command-line tool (+ C library) for converting SAS, Stata, and SPSS files";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ swflint ];
    platforms = lib.platforms.all;
  };
})