1{
2 lib,
3 stdenv,
4 fetchurl,
5 zlib,
6 unzip,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "libipasirglucose4";
11 # This library has no version number AFAICT (beyond generally being based on
12 # Glucose 4.x), but it was submitted to the 2017 SAT competition so let's use
13 # that as the version number, I guess.
14 version = "2017";
15
16 libname = pname + stdenv.hostPlatform.extensions.sharedLibrary;
17
18 src = fetchurl {
19 url = "https://baldur.iti.kit.edu/sat-competition-2017/solvers/incremental/glucose-ipasir.zip";
20 sha256 = "0xchgady9vwdh8frmc8swz6va53igp2wj1y9sshd0g7549n87wdj";
21 };
22 nativeBuildInputs = [ unzip ];
23
24 buildInputs = [ zlib ];
25
26 sourceRoot = "sat/glucose4";
27 patches = [ ./0001-Support-shared-library-build.patch ];
28
29 makeFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ];
30
31 postBuild = ''
32 $CXX -shared -o ${libname} \
33 ${lib.optionalString (!stdenv.cc.isClang) "-Wl,-soname,${libname}"} \
34 ipasirglucoseglue.o libipasirglucose4.a
35 '';
36
37 installPhase = ''
38 install -D ${libname} $out/lib/${libname}
39 '';
40
41 meta = with lib; {
42 description = "Shared library providing IPASIR interface to the Glucose SAT solver";
43 license = licenses.mit;
44 platforms = platforms.unix;
45 maintainers = with maintainers; [ kini ];
46 };
47}