1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5}:
6
7stdenv.mkDerivation rec {
8 version = "0.4.5";
9 pname = "theft";
10
11 src = fetchFromGitHub {
12 owner = "silentbicycle";
13 repo = "theft";
14 rev = "v${version}";
15 sha256 = "1n2mkawfl2bpd4pwy3mdzxwlqjjvb5bdrr2x2gldlyqdwbk7qjhd";
16 };
17
18 postPatch = ''
19 substituteInPlace Makefile \
20 --replace "ar -rcs" "${stdenv.cc.targetPrefix}ar -rcs"
21 '';
22
23 preConfigure = "patchShebangs ./scripts/mk_bits_lut";
24
25 doCheck = true;
26 checkTarget = "test";
27
28 installFlags = [ "PREFIX=$(out)" ];
29
30 # fix the libtheft.pc file to use the right installation
31 # directory. should be fixed upstream, too
32 postInstall = ''
33 install -m644 vendor/greatest.h $out/include/
34
35 substituteInPlace $out/lib/pkgconfig/libtheft.pc \
36 --replace "/usr/local" "$out"
37 '';
38
39 meta = with lib; {
40 description = "C library for property-based testing";
41 homepage = "https://github.com/silentbicycle/theft/";
42 platforms = platforms.unix;
43 license = licenses.isc;
44 maintainers = with maintainers; [
45 kquick
46 thoughtpolice
47 ];
48 };
49}