about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/memstream/default.nix
blob: 90505a56a9317956276076e0ec51941c6ed27942 (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
{ lib, stdenv, fetchurl }:

stdenv.mkDerivation rec {
  pname = "memstream";
  version = "0.1";

  src = fetchurl {
    url = "https://piumarta.com/software/memstream/memstream-${version}.tar.gz";
    sha256 = "0kvdb897g7nyviaz72arbqijk2g2wa61cmi3l5yh48rzr49r3a3a";
  };

  dontConfigure = true;

  postBuild = ''
    $AR rcs libmemstream.a memstream.o
  '';

  doCheck = true;
  checkPhase = ''
    runHook preCheck

    ./test | grep "This is a test of memstream"

    runHook postCheck
  '';

  installPhase = ''
    runHook preInstall

    install -D libmemstream.a "$out"/lib/libmemstream.a
    install -D memstream.h "$out"/include/memstream.h

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://www.piumarta.com/software/memstream/";
    description = "memstream.c is an implementation of the POSIX function open_memstream() for BSD and BSD-like operating systems";
    license = licenses.mit;
    maintainers = with maintainers; [ veprbl ];
    platforms = platforms.unix;
  };
}