about summary refs log tree commit diff
path: root/pkgs/by-name/us/ustr/package.nix
blob: 0da93206752ba9cdf4f891c43d66d5042bd08771 (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
{
  lib,
  stdenv,
  fetchgit,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ustr";
  version = "1.0.4";

  src = fetchgit {
    url = "http://www.and.org/ustr/ustr.git";
    rev = "v${finalAttrs.version}";
    hash = "sha256-pQrQy+S9fVFl8Mop4QmwEAXGiBSheQE4HgAZ4srFz64=";
  };

  # Fixes bogus warnings that failed libsemanage
  patches = [ ./va_args.patch ];

  # Work around gcc5 switch to gnu11
  env.NIX_CFLAGS_COMPILE = "-std=gnu89";

  # Fix detection of stdint.h
  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail "have_stdint_h=0" "have_stdint_h=1"

    cat ustr-import.in | grep USTR_CONF
    substituteInPlace ustr-import.in \
      --replace-fail "USTR_CONF_HAVE_STDINT_H 0" "USTR_CONF_HAVE_STDINT_H 1"
  '';

  makeFlags = [
    "prefix=${placeholder "out"}"
    "LDCONFIG=echo"
    "HIDE="
  ];

  # Remove debug libraries
  postInstall = ''
    find $out/lib -name \*debug\* -delete
  '';

  meta = with lib; {
    homepage = "http://www.and.org/ustr/";
    description = "Micro String API for C language";
    mainProgram = "ustr-import";
    license = licenses.bsd2;
    maintainers = with lib.maintainers; [ sigmanificient ];
    platforms = platforms.linux;
  };
})