1{ stdenv, lib, fetchzip, cmake }:
2
3stdenv.mkDerivation rec {
4 pname = "openfec";
5 version = "1.4.2";
6
7 src = fetchzip {
8 url = "http://openfec.org/files/openfec_v1_4_2.tgz";
9 sha256 = "sha256:0c2lg8afr7lqpzrsi0g44a6h6s7nq4vz7yc9vm2k57ph2y6r86la";
10 };
11
12 outputs = [ "out" "dev" ];
13
14 nativeBuildInputs = [
15 cmake
16 ];
17
18 cmakeFlags = [ "-DDEBUG:STRING=OFF" ];
19
20 installPhase =
21 let so = stdenv.hostPlatform.extensions.sharedLibrary;
22 in ''
23 # This is pretty horrible but sadly there is not installation procedure
24 # provided.
25 mkdir -p $dev/include
26 cp -R ../src/* $dev/include
27 find $dev/include -type f -a ! -iname '*.h' -delete
28
29 install -D -m755 -t $out/lib ../bin/Release/libopenfec${so}
30 '' + lib.optionalString stdenv.isDarwin ''
31 install_name_tool -id $out/lib/libopenfec${so} $out/lib/libopenfec${so}
32 '' + ''
33 ln -s libopenfec${so} $out/lib/libopenfec${so}.1
34 '';
35
36 meta = with lib; {
37 description = "Application-level Forward Erasure Correction codes";
38 homepage = "https://github.com/roc-streaming/openfec";
39 license = licenses.cecill-c;
40 maintainers = with maintainers; [ bgamari ];
41 platforms = platforms.unix;
42 };
43}