1{
2 lib,
3 stdenv,
4 fetchurl,
5 unzip,
6 zlib,
7 enableUnfree ? false,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "glucose" + lib.optionalString enableUnfree "-syrup";
12 version = "4.2.1";
13
14 src = fetchurl {
15 url = "https://www.labri.fr/perso/lsimon/downloads/softwares/glucose-${version}.zip";
16 hash = "sha256-J0J9EKC/4cCiZr/y4lz+Hm7OcmJmMIIWzQ+4c+KhqXg=";
17 };
18
19 sourceRoot = "glucose-${version}/sources/${if enableUnfree then "parallel" else "simp"}";
20
21 postPatch = ''
22 substituteInPlace Main.cc \
23 --replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)"
24 '';
25
26 nativeBuildInputs = [ unzip ];
27
28 buildInputs = [ zlib ];
29
30 makeFlags = [ "r" ];
31
32 installPhase = ''
33 runHook preInstall
34
35 install -Dm0755 ${pname}_release $out/bin/${pname}
36 mkdir -p "$out/share/doc/${pname}-${version}/"
37 install -Dm0755 ../{LICEN?E,README*,Changelog*} "$out/share/doc/${pname}-${version}/"
38
39 runHook postInstall
40 '';
41
42 meta = with lib; {
43 description = "Modern, parallel SAT solver (${
44 if enableUnfree then "parallel" else "sequential"
45 } version)";
46 mainProgram = "glucose";
47 homepage = "https://www.labri.fr/perso/lsimon/research/glucose/";
48 license = if enableUnfree then licenses.unfreeRedistributable else licenses.mit;
49 platforms = platforms.unix;
50 maintainers = with maintainers; [ ];
51 };
52}