summary refs log tree commit diff
path: root/pkgs/development/libraries/inchi
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/libraries/inchi
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/libraries/inchi')
-rw-r--r--pkgs/development/libraries/inchi/default.nix74
1 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/development/libraries/inchi/default.nix b/pkgs/development/libraries/inchi/default.nix
new file mode 100644
index 00000000000..f74cfdec930
--- /dev/null
+++ b/pkgs/development/libraries/inchi/default.nix
@@ -0,0 +1,74 @@
+{ fetchurl
+, lib
+, stdenv
+, unzip
+, fixDarwinDylibNames
+}:
+
+let
+  versionMajor = "1";
+  versionMinor = "0.6";
+  version = versionMajor + "." + versionMinor;
+  removeDots = lib.replaceStrings [ "." ] [ "" ];
+  src-doc = fetchurl {
+    url = "http://www.inchi-trust.org/download/${removeDots version}/INCHI-1-DOC.zip";
+    sha256 = "1kyda09i9p89xfq90ninwi7w13k1w3ljpl4gqdhpfhi5g8fgxx7f";
+   };
+in
+  stdenv.mkDerivation rec {
+    pname = "inchi";
+    inherit version;
+
+    src = fetchurl {
+      url = "http://www.inchi-trust.org/download/${removeDots version}/INCHI-1-SRC.zip";
+      sha256 = "1zbygqn0443p0gxwr4kx3m1bkqaj8x9hrpch3s41py7jq08f6x28";
+    };
+
+    nativeBuildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    outputs = [ "out" "doc" ];
+
+    enableParallelBuilding = true;
+
+    preConfigure = ''
+      cd ./INCHI_API/libinchi/gcc
+    '' + lib.optionalString stdenv.isDarwin ''
+      substituteInPlace makefile \
+        --replace ",--version-script=libinchi.map" "" \
+        --replace "LINUX_Z_RELRO = ,-z,relro" "" \
+        --replace "-soname" "-install_name" \
+        --replace "gcc" $CC
+    '';
+    installPhase = let
+      versionOneDot = versionMajor + "." + removeDots versionMinor;
+    in ''
+      runHook preInstall
+
+      cd ../../..
+      mkdir -p $out/lib
+      mkdir -p $out/include/inchi
+      mkdir -p $doc/share/
+
+      install -m 755 INCHI_API/bin/Linux/libinchi.so.${versionOneDot}.00 $out/lib
+      ln -s $out/lib/libinchi.so.${versionOneDot}.00 $out/lib/libinchi.so.1
+      ln -s $out/lib/libinchi.so.${versionOneDot}.00 $out/lib/libinchi.so
+      install -m 644 INCHI_BASE/src/*.h $out/include/inchi
+
+      runHook postInstall
+    '';
+
+    preFixup = lib.optionalString stdenv.isDarwin ''
+      fixDarwinDylibNames $(find "$out" -name "*.so.*")
+    '';
+
+    postInstall = ''
+      unzip '${src-doc}'
+      install -m 644 INCHI-1-DOC/*.pdf $doc/share
+    '';
+
+    meta = with lib; {
+      homepage = "https://www.inchi-trust.org/";
+      description = "IUPAC International Chemical Identifier library";
+      license = licenses.lgpl2Plus;
+      maintainers = with maintainers; [ rmcgibbo ];
+    };
+  }