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