1{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, boost } :
2
3stdenv.mkDerivation rec {
4 pname = "cm256cc";
5 version = "1.1.0";
6
7 src = fetchFromGitHub {
8 owner = "f4exb";
9 repo = "cm256cc";
10 rev = "v${version}";
11 sha256 = "sha256-T7ZUVVYGdzAialse//MoqWCVNBpbZvzWMAKc0cw7O9k=";
12 };
13
14 patches = [
15 # Pull fix pending upstream inclusion for gcc-13 support:
16 # https://github.com/f4exb/cm256cc/pull/18
17 (fetchpatch {
18 name = "gcc-13.patch";
19 url = "https://github.com/f4exb/cm256cc/commit/a7f142bcdae8be1c646d67176ba0ba0f7e8dcd68.patch";
20 hash = "sha256-J7bm44sqnGsdPhJxQrE8LDxZ6tkTzLslHQnnKmtgrtM=";
21 })
22 ];
23
24 nativeBuildInputs = [ cmake ];
25 buildInputs = [ boost ];
26
27 # https://github.com/f4exb/cm256cc/issues/16
28 postPatch = ''
29 substituteInPlace libcm256cc.pc.in \
30 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
31 '';
32
33 meta = with lib; {
34 description = "Fast GF(256) Cauchy MDS Block Erasure Codec in C++";
35 homepage = "https://github.com/f4exb/cm256cc";
36 platforms = platforms.unix;
37 maintainers = with maintainers; [ alkeryn ];
38 license = licenses.gpl3;
39 };
40}