glucose: refactor

This commit is contained in:
Weijia Wang 2023-03-18 19:00:45 +02:00
parent d0781217d2
commit 0ddc01c569
3 changed files with 23 additions and 32 deletions

View File

@ -1,13 +1,21 @@
{ lib, stdenv, fetchurl, zlib }:
{ lib
, stdenv
, fetchurl
, zlib
, enableUnfree ? false
}:
stdenv.mkDerivation rec {
pname = "glucose";
pname = "glucose" + lib.optionalString enableUnfree "-syrup";
version = "4.1";
src = fetchurl {
url = "http://www.labri.fr/perso/lsimon/downloads/softwares/glucose-syrup-${version}.tgz";
sha256 = "0aahrkaq7n0z986fpqz66yz946nxardfi6dh8calzcfjpvqiraji";
hash = "sha256-Uaoc8b7SsU8VQ7CZ6FpW3RqSvjfm4+sMSh/Yg9XMUCk=";
};
sourceRoot = "glucose-syrup-${version}/${if enableUnfree then "parallel" else "simp"}";
postPatch = ''
substituteInPlace Main.cc \
--replace "defined(__linux__)" "defined(__linux__) && defined(__x86_64__)"
@ -15,17 +23,22 @@ stdenv.mkDerivation rec {
buildInputs = [ zlib ];
sourceRoot = "glucose-syrup-${version}/simp";
makeFlags = [ "r" ];
installPhase = ''
install -Dm0755 glucose_release $out/bin/glucose
runHook preInstall
install -Dm0755 ${pname}_release $out/bin/${pname}
mkdir -p "$out/share/doc/${pname}-${version}/"
install -Dm0755 ../{LICEN?E,README*,Changelog*} "$out/share/doc/${pname}-${version}/"
runHook postInstall
'';
meta = with lib; {
description = "Modern, parallel SAT solver (sequential version)";
license = licenses.mit;
description = "Modern, parallel SAT solver (${if enableUnfree then "parallel" else "sequential"} version)";
homepage = "https://www.labri.fr/perso/lsimon/research/glucose/";
license = if enableUnfree then licenses.unfreeRedistributable else licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ gebner ];
};

View File

@ -1,24 +0,0 @@
{ lib, stdenv, zlib, glucose }:
stdenv.mkDerivation rec {
pname = "glucose-syrup";
version = glucose.version;
src = glucose.src;
buildInputs = [ zlib ];
sourceRoot = "glucose-syrup-${version}/parallel";
makeFlags = [ "r" ];
installPhase = ''
install -Dm0755 glucose-syrup_release $out/bin/glucose-syrup
mkdir -p "$out/share/doc/${pname}-${version}/"
install -Dm0755 ../{LICEN?E,README*,Changelog*} "$out/share/doc/${pname}-${version}/"
'';
meta = with lib; {
description = "Modern, parallel SAT solver (parallel version)";
license = licenses.unfreeRedistributable;
platforms = platforms.unix;
maintainers = with maintainers; [ gebner ];
};
}

View File

@ -37281,7 +37281,9 @@ with pkgs;
glom = callPackage ../applications/misc/glom { };
glucose = callPackage ../applications/science/logic/glucose { };
glucose-syrup = callPackage ../applications/science/logic/glucose/syrup.nix { };
glucose-syrup = callPackage ../applications/science/logic/glucose {
enableUnfree = true;
};
hol = callPackage ../applications/science/logic/hol { };