From e90ec60e33b7ad353749b6e5d415c5211ad48858 Mon Sep 17 00:00:00 2001 From: "Robert T. McGibbon" Date: Tue, 22 Dec 2020 21:55:05 -0500 Subject: [PATCH] inchi: fix build on darwin --- pkgs/development/libraries/inchi/default.nix | 26 +++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/inchi/default.nix b/pkgs/development/libraries/inchi/default.nix index 6acdf340c91..256e0d70243 100644 --- a/pkgs/development/libraries/inchi/default.nix +++ b/pkgs/development/libraries/inchi/default.nix @@ -1,4 +1,11 @@ -{ pkgs, fetchurl, lib, stdenv, unzip }: +{ pkgs +, fetchurl +, lib +, stdenv +, unzip +, fixDarwinDylibNames +}: + stdenv.mkDerivation { pname = "inchi"; version = "1.05"; @@ -7,15 +14,23 @@ stdenv.mkDerivation { sha1 = "e3872a46d58cb321a98f4fd4b93a989fb6920b9c"; }; - nativeBuildInputs = [ pkgs.unzip ]; + nativeBuildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; outputs = [ "out" "doc" ]; enableParallelBuilding = true; - preBuild = '' + 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 = '' + runHook preInstall + cd ../../.. mkdir -p $out/lib mkdir -p $out/include/inchi @@ -29,6 +44,10 @@ stdenv.mkDerivation { runHook postInstall ''; + preFixup = lib.optionalString stdenv.isDarwin '' + fixDarwinDylibNames $(find "$out" -name "*.so.*") + ''; + postInstall = let src-doc = fetchurl { @@ -45,7 +64,6 @@ stdenv.mkDerivation { homepage = "https://www.inchi-trust.org/"; description = "IUPAC International Chemical Identifier library"; license = licenses.lgpl2Plus; - platforms = platforms.all; maintainers = with maintainers; [ rmcgibbo ]; }; }