cadical: use finalAttrs

This commit is contained in:
Christoph Jabs
2026-02-05 09:16:57 +02:00
parent e212b5250d
commit 95b818aef4
+14 -12
View File
@@ -7,14 +7,14 @@
version ? "3.0.0",
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "cadical";
inherit version;
src = fetchFromGitHub {
owner = "arminbiere";
repo = "cadical";
rev = "rel-${version}";
rev = "rel-${finalAttrs.version}";
hash =
{
"3.0.0" = "sha256-pymbSC6bwQQ0YCtJd3xWZiC22UEkFiKSLObSOnoQj9I=";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
"2.1.3" = "sha256-W3kO+6nVzkmJXyHJU+NZWP0oatK3gon4EWF1/03rgL4=";
"2.0.0" = "sha256-qoeEM9SdpuFuBPeQlCzuhPLcJ+bMQkTUTGiT8QdU8rc=";
}
.${version};
.${finalAttrs.version};
};
outputs = [
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
pkgconfigItems = [
(makePkgconfigItem {
name = "cadical";
inherit version;
inherit (finalAttrs) version;
cflags = [ "-I\${includedir}" ];
libs = [
"-L\${libdir}"
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
includedir = "@includedir@";
libdir = "@libdir@";
};
inherit (meta) description;
inherit (finalAttrs.meta) description;
})
];
@@ -64,10 +64,12 @@ stdenv.mkDerivation rec {
substituteInPlace makefile.in --replace-fail "ar rc" '$(AR) rc'
''
# Racy/flaky tests that sometimes spontaneously combust on darwin.
+ lib.optionalString (stdenv.hostPlatform.isDarwin && (lib.versionAtLeast version "2.1.1")) ''
substituteInPlace test/api/run.sh --replace-fail 'run parcompwrite' ""
substituteInPlace test/api/run.sh --replace-fail 'run example_tracer' ""
'';
+
lib.optionalString (stdenv.hostPlatform.isDarwin && (lib.versionAtLeast finalAttrs.version "2.1.1"))
''
substituteInPlace test/api/run.sh --replace-fail 'run parcompwrite' ""
substituteInPlace test/api/run.sh --replace-fail 'run example_tracer' ""
'';
# the configure script is not generated by autotools and does not accept the
# arguments that the default configurePhase passes like --prefix and --libdir
@@ -89,8 +91,8 @@ stdenv.mkDerivation rec {
install -Dm0644 src/cadical.hpp "$dev/include/cadical/cadical.hpp"
install -Dm0644 src/tracer.hpp "$dev/include/cadical/tracer.hpp"
install -Dm0644 build/libcadical.a "$lib/lib/libcadical.a"
mkdir -p "$out/share/doc/${pname}/"
install -Dm0755 {LICEN?E,README*,VERSION} "$out/share/doc/${pname}/"
mkdir -p "$out/share/doc/${finalAttrs.pname}/"
install -Dm0755 {LICEN?E,README*,VERSION} "$out/share/doc/${finalAttrs.pname}/"
runHook postInstall
'';
@@ -105,4 +107,4 @@ stdenv.mkDerivation rec {
license = lib.licenses.mit;
homepage = "https://fmv.jku.at/cadical/";
};
}
})