1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, ninja
7, useFloat ? false
8}:
9
10stdenv.mkDerivation rec {
11 pname = "fuzzylite";
12 version = "6.0";
13
14 src = fetchFromGitHub {
15 owner = "fuzzylite";
16 repo = "fuzzylite";
17 rev = "v${version}";
18 hash = "sha256-i1txeUE/ZSRggwLDtpS8dd4uuZfHX9w3zRH0gBgGXnk=";
19 };
20 sourceRoot = "${src.name}/fuzzylite";
21
22 outputs = [ "out" "dev" ];
23
24 postPatch = ''
25 substituteInPlace CMakeLists.txt \
26 --replace "-Werror" "-Wno-error"
27 '';
28
29 nativeBuildInputs = [
30 cmake
31 ninja
32 ];
33
34 cmakeFlags = [
35 "-DFL_BUILD_TESTS:BOOL=OFF"
36 "-DFL_USE_FLOAT:BOOL=${if useFloat then "ON" else "OFF"}"
37 ];
38
39 meta = with lib; {
40 description = "A fuzzy logic control library in C++";
41 homepage = "https://fuzzylite.com";
42 changelog = "https://github.com/fuzzylite/fuzzylite/${src.rev}/release/CHANGELOG";
43 license = licenses.gpl3Only;
44 maintainers = with maintainers; [ azahi ];
45 platforms = platforms.all;
46 };
47}