at 24.11-pre 74 lines 2.2 kB view raw
1{ fetchurl 2, lib 3, stdenv 4, unzip 5, fixDarwinDylibNames 6}: 7 8let 9 versionMajor = "1"; 10 versionMinor = "0.6"; 11 version = versionMajor + "." + versionMinor; 12 removeDots = lib.replaceStrings [ "." ] [ "" ]; 13 src-doc = fetchurl { 14 url = "http://www.inchi-trust.org/download/${removeDots version}/INCHI-1-DOC.zip"; 15 sha256 = "1kyda09i9p89xfq90ninwi7w13k1w3ljpl4gqdhpfhi5g8fgxx7f"; 16 }; 17in 18 stdenv.mkDerivation rec { 19 pname = "inchi"; 20 inherit version; 21 22 src = fetchurl { 23 url = "http://www.inchi-trust.org/download/${removeDots version}/INCHI-1-SRC.zip"; 24 sha256 = "1zbygqn0443p0gxwr4kx3m1bkqaj8x9hrpch3s41py7jq08f6x28"; 25 }; 26 27 nativeBuildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; 28 outputs = [ "out" "doc" ]; 29 30 enableParallelBuilding = true; 31 32 preConfigure = '' 33 cd ./INCHI_API/libinchi/gcc 34 '' + lib.optionalString stdenv.isDarwin '' 35 substituteInPlace makefile \ 36 --replace ",--version-script=libinchi.map" "" \ 37 --replace "LINUX_Z_RELRO = ,-z,relro" "" \ 38 --replace "-soname" "-install_name" \ 39 --replace "gcc" $CC 40 ''; 41 installPhase = let 42 versionOneDot = versionMajor + "." + removeDots versionMinor; 43 in '' 44 runHook preInstall 45 46 cd ../../.. 47 mkdir -p $out/lib 48 mkdir -p $out/include/inchi 49 mkdir -p $doc/share/ 50 51 install -m 755 INCHI_API/bin/Linux/libinchi.so.${versionOneDot}.00 $out/lib 52 ln -s $out/lib/libinchi.so.${versionOneDot}.00 $out/lib/libinchi.so.1 53 ln -s $out/lib/libinchi.so.${versionOneDot}.00 $out/lib/libinchi.so 54 install -m 644 INCHI_BASE/src/*.h $out/include/inchi 55 56 runHook postInstall 57 ''; 58 59 preFixup = lib.optionalString stdenv.isDarwin '' 60 fixDarwinDylibNames $(find "$out" -name "*.so.*") 61 ''; 62 63 postInstall = '' 64 unzip '${src-doc}' 65 install -m 644 INCHI-1-DOC/*.pdf $doc/share 66 ''; 67 68 meta = with lib; { 69 homepage = "https://www.inchi-trust.org/"; 70 description = "IUPAC International Chemical Identifier library"; 71 license = licenses.lgpl2Plus; 72 maintainers = with maintainers; [ rmcgibbo ]; 73 }; 74 }