nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 108 lines 2.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 copyPkgconfigItems, 6 makePkgconfigItem, 7 version ? "3.0.0", 8}: 9 10stdenv.mkDerivation rec { 11 pname = "cadical"; 12 inherit version; 13 14 src = fetchFromGitHub { 15 owner = "arminbiere"; 16 repo = "cadical"; 17 rev = "rel-${version}"; 18 hash = 19 { 20 "3.0.0" = "sha256-pymbSC6bwQQ0YCtJd3xWZiC22UEkFiKSLObSOnoQj9I="; 21 "2.2.1" = "sha256-dYRaw9DI63Nqz0IJkfQYU4y00KSfq1Xv0xZuL1G15CY="; 22 "2.1.3" = "sha256-W3kO+6nVzkmJXyHJU+NZWP0oatK3gon4EWF1/03rgL4="; 23 "2.0.0" = "sha256-qoeEM9SdpuFuBPeQlCzuhPLcJ+bMQkTUTGiT8QdU8rc="; 24 } 25 .${version}; 26 }; 27 28 outputs = [ 29 "out" 30 "dev" 31 "lib" 32 ]; 33 doCheck = true; 34 35 nativeBuildInputs = [ copyPkgconfigItems ]; 36 37 pkgconfigItems = [ 38 (makePkgconfigItem { 39 name = "cadical"; 40 inherit version; 41 cflags = [ "-I\${includedir}" ]; 42 libs = [ 43 "-L\${libdir}" 44 "-lcadical" 45 ]; 46 variables = { 47 includedir = "@includedir@"; 48 libdir = "@libdir@"; 49 }; 50 inherit (meta) description; 51 }) 52 ]; 53 54 env = { 55 # copyPkgconfigItems will substitute these in the pkg-config file 56 includedir = "${placeholder "dev"}/include"; 57 libdir = "${placeholder "lib"}/lib"; 58 }; 59 60 enableParallelBuilding = true; 61 62 # fix static build 63 postPatch = '' 64 substituteInPlace makefile.in --replace-fail "ar rc" '$(AR) rc' 65 '' 66 # Racy/flaky tests that sometimes spontaneously combust on darwin. 67 + lib.optionalString (stdenv.hostPlatform.isDarwin && (lib.versionAtLeast version "2.1.1")) '' 68 substituteInPlace test/api/run.sh --replace-fail 'run parcompwrite' "" 69 substituteInPlace test/api/run.sh --replace-fail 'run example_tracer' "" 70 ''; 71 72 # the configure script is not generated by autotools and does not accept the 73 # arguments that the default configurePhase passes like --prefix and --libdir 74 configurePhase = '' 75 runHook preConfigure 76 77 ./configure 78 79 runHook postConfigure 80 ''; 81 82 installPhase = '' 83 runHook preInstall 84 85 install -Dm0755 build/cadical "$out/bin/cadical" 86 install -Dm0755 build/mobical "$out/bin/mobical" 87 install -Dm0644 src/ccadical.h "$dev/include/ccadical.h" 88 install -Dm0644 src/cadical.hpp "$dev/include/cadical.hpp" 89 install -Dm0644 src/cadical.hpp "$dev/include/cadical/cadical.hpp" 90 install -Dm0644 src/tracer.hpp "$dev/include/cadical/tracer.hpp" 91 install -Dm0644 build/libcadical.a "$lib/lib/libcadical.a" 92 mkdir -p "$out/share/doc/${pname}/" 93 install -Dm0755 {LICEN?E,README*,VERSION} "$out/share/doc/${pname}/" 94 95 runHook postInstall 96 ''; 97 98 meta = { 99 description = "Simplified Satisfiability Solver"; 100 maintainers = with lib.maintainers; [ 101 shnarazk 102 chrjabs 103 ]; 104 platforms = lib.platforms.unix; 105 license = lib.licenses.mit; 106 homepage = "https://fmv.jku.at/cadical/"; 107 }; 108}