inchi: fix build on darwin

This commit is contained in:
Robert T. McGibbon 2020-12-22 21:55:05 -05:00
parent 86d5d9650d
commit e90ec60e33

View File

@ -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 ];
};
}