1{ lib, stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 pname = "memstream";
5 version = "0.1";
6
7 src = fetchurl {
8 url = "https://piumarta.com/software/memstream/memstream-${version}.tar.gz";
9 sha256 = "0kvdb897g7nyviaz72arbqijk2g2wa61cmi3l5yh48rzr49r3a3a";
10 };
11
12 dontConfigure = true;
13
14 postBuild = ''
15 $AR rcs libmemstream.a memstream.o
16 '';
17
18 doCheck = true;
19 checkPhase = ''
20 runHook preCheck
21
22 ./test | grep "This is a test of memstream"
23
24 runHook postCheck
25 '';
26
27 installPhase = ''
28 runHook preInstall
29
30 install -D libmemstream.a "$out"/lib/libmemstream.a
31 install -D memstream.h "$out"/include/memstream.h
32
33 runHook postInstall
34 '';
35
36 meta = with lib; {
37 homepage = "https://www.piumarta.com/software/memstream/";
38 description = "memstream.c is an implementation of the POSIX function open_memstream() for BSD and BSD-like operating systems";
39 license = licenses.mit;
40 maintainers = with maintainers; [ veprbl ];
41 platforms = platforms.unix;
42 };
43}