@@ -0,0 +1,51 @@
1+{ pkgs, fetchurl, stdenv, unzip }:
2+stdenv.mkDerivation {
3+ pname = "inchi";
4+ version = "1.05";
5+ src = fetchurl {
6+ url = "http://www.inchi-trust.org/download/105/INCHI-1-SRC.zip";
7+ sha1 = "e3872a46d58cb321a98f4fd4b93a989fb6920b9c";
8+ };
9+
10+ nativeBuildInputs = [ pkgs.unzip ];
11+ outputs = [ "out" "doc" ];
12+
13+ enableParallelBuilding = true;
14+
15+ preBuild = ''
16+ cd ./INCHI_API/libinchi/gcc
17+ '';
18+ installPhase = ''
19+ cd ../../..
20+ mkdir -p $out/lib
21+ mkdir -p $out/include/inchi
22+ mkdir -p $doc/share/
23+
24+ install -m 755 INCHI_API/bin/Linux/libinchi.so.1.05.00 $out/lib
25+ ln -s $out/lib/libinchi.so.1.05.00 $out/lib/libinchi.so.1
26+ ln -s $out/lib/libinchi.so.1.05.00 $out/lib/libinchi.so
27+ install -m 644 INCHI_BASE/src/*.h $out/include/inchi
28+
29+ runHook postInstall
30+ '';
31+
32+ postInstall =
33+ let
34+ src-doc = fetchurl {
35+ url = "http://www.inchi-trust.org/download/105/INCHI-1-DOC.zip";
36+ sha1 = "2f54y0san34v01c215kk0cigzsn76js5";
37+ };
38+ in
39+ ''
40+ unzip '${src-doc}'
41+ install -m 644 INCHI-1-DOC/*.pdf $doc/share
42+ '';
43+
44+ meta = with stdenv.lib; {
45+ homepage = "https://www.inchi-trust.org/";
46+ description = "IUPAC International Chemical Identifier library";
47+ license = licenses.lgpl2Plus;
48+ platforms = platforms.all;
49+ maintainers = with maintainers; [ rmcgibbo ];
50+ };
51+}