|
1 | | -{ lib, stdenv, fetchurl, gmp4, ncurses, zlib, clang }: |
2 | | - |
3 | | -let |
4 | | - libPath = lib.makeLibraryPath |
5 | | - [ stdenv.cc.libc |
6 | | - stdenv.cc.cc |
7 | | - gmp4 |
8 | | - ncurses |
9 | | - zlib |
10 | | - ] + ":${lib.getLib stdenv.cc.cc}/lib64"; |
11 | | - |
12 | | - url = "https://github.com/GaloisInc/saw-script/releases/download"; |
13 | | - |
14 | | - saw-bin = |
15 | | - if stdenv.hostPlatform.system == "i686-linux" |
16 | | - then fetchurl { |
17 | | - url = url + "/v0.1.1-dev/saw-0.1.1-dev-2015-07-31-CentOS6-32.tar.gz"; |
18 | | - sha256 = "126iag5nnvndi78c921z7vjrjfwcspn1hlxwwhzmqm4rvbhhr9v9"; |
19 | | - } |
20 | | - else fetchurl { |
21 | | - url = url + "/v0.1.1-dev/saw-0.1.1-dev-2015-07-31-CentOS6-64.tar.gz"; |
22 | | - sha256 = "07gyf319v6ama6n1aj96403as04bixi8mbisfy7f7va689zklflr"; |
23 | | - }; |
24 | | -in |
25 | | -stdenv.mkDerivation { |
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchurl, |
| 5 | + autoPatchelfHook, |
| 6 | + makeWrapper, |
| 7 | + gmp, |
| 8 | + ncurses, |
| 9 | + zlib, |
| 10 | + readline, |
| 11 | + testers, |
| 12 | +}: |
| 13 | + |
| 14 | +stdenv.mkDerivation (finalAttrs: { |
26 | 15 | pname = "saw-tools"; |
27 | | - version = "0.1.1-20150731"; |
| 16 | + version = "1.2"; |
28 | 17 |
|
29 | | - src = saw-bin; |
| 18 | + src = fetchurl { |
| 19 | + url = "https://github.com/GaloisInc/saw-script/releases/download/v${finalAttrs.version}/saw-${finalAttrs.version}-ubuntu-22.04-X64-with-solvers.tar.gz"; |
| 20 | + hash = "sha256-A99BCiVV5Ep/PL7VSDNYcvr177Q+FKdDrxhFJLW/iU4="; |
| 21 | + }; |
| 22 | + |
| 23 | + buildInputs = [ |
| 24 | + gmp |
| 25 | + ncurses |
| 26 | + readline |
| 27 | + stdenv.cc.libc |
| 28 | + zlib |
| 29 | + ]; |
| 30 | + |
| 31 | + nativeBuildInputs = [ |
| 32 | + autoPatchelfHook |
| 33 | + makeWrapper |
| 34 | + ]; |
30 | 35 |
|
31 | 36 | installPhase = '' |
32 | 37 | mkdir -p $out/lib $out/share |
33 | 38 |
|
34 | 39 | mv bin $out/bin |
35 | 40 | mv doc $out/share |
36 | 41 |
|
37 | | - ln -s ${ncurses.out}/lib/libtinfo.so.5 $out/lib/libtinfo.so.5 |
38 | | - ln -s ${stdenv.cc.libc}/lib/libpthread.so.0 $out/lib/libpthread.so.0 |
39 | | -
|
40 | | - # Add a clang symlink for easy building with a suitable compiler. |
41 | | - ln -s ${clang}/bin/clang $out/bin/saw-clang |
| 42 | + wrapProgram "$out/bin/saw" --prefix PATH : "$out/bin/" |
42 | 43 | ''; |
43 | 44 |
|
44 | | - fixupPhase = '' |
45 | | - for x in bin/bcdump bin/extcore-info bin/jss bin/llvm-disasm bin/lss bin/saw; do |
46 | | - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ |
47 | | - --set-rpath "$out/lib:${libPath}" $out/$x; |
48 | | - done |
49 | | - ''; |
| 45 | + passthru.tests.version = testers.testVersion { |
| 46 | + package = finalAttrs.finalPackage; |
| 47 | + command = "saw --version"; |
| 48 | + }; |
50 | 49 |
|
51 | 50 | meta = { |
52 | 51 | description = "Tools for software verification and analysis"; |
53 | | - homepage = "https://saw.galois.com"; |
| 52 | + homepage = "https://saw.galois.com"; |
54 | 53 | sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; |
55 | | - license = lib.licenses.bsd3; |
56 | | - platforms = lib.platforms.linux; |
| 54 | + license = lib.licenses.bsd3; |
| 55 | + platforms = [ "x86_64-linux" ]; |
57 | 56 | maintainers = [ lib.maintainers.thoughtpolice ]; |
58 | 57 | }; |
59 | | -} |
| 58 | +}) |
0 commit comments