From 4f0ff90a95d69f9ba314f198c79454f95a3643f0 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 11 Nov 2024 09:06:47 +0000 Subject: [PATCH] adns: fix Darwin properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The post‐facto install name replacement was unpredictably running out of space; just patch the build system to do the right thing instead. And don’t use `.so` on Darwin, either. --- pkgs/by-name/ad/adns/darwin.patch | 21 +++++++++++++++++++++ pkgs/by-name/ad/adns/package.nix | 21 ++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 pkgs/by-name/ad/adns/darwin.patch diff --git a/pkgs/by-name/ad/adns/darwin.patch b/pkgs/by-name/ad/adns/darwin.patch new file mode 100644 index 000000000000..9c44f89d462e --- /dev/null +++ b/pkgs/by-name/ad/adns/darwin.patch @@ -0,0 +1,21 @@ +diff --git a/configure.in b/configure.in +index b753a5bb3e..ee7d546984 100644 +--- a/configure.in ++++ b/configure.in +@@ -134,12 +134,12 @@ + AC_SUBST(SHLIBFILE) + AC_SUBST(SHLIBSONAME) + +-SHLIBFORLINK='libadns.so' +-SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)' +-SHLIBFILE='$(SHLIBSONAME).$(MINOR)' ++SHLIBFORLINK='libadns.dylib' ++SHLIBSONAME='libadns.$(MAJOR).dylib' ++SHLIBFILE='libadns.$(MAJOR).$(MINOR).dylib' + + SHLIBCC='$(CC) $(CFLAGS) -fpic' +-MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o' ++MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-install_name,$(libdir)/$(SHLIBFILE) -o' + MKSHLIB_2='' + MKSHLIB_3='-lc' + diff --git a/pkgs/by-name/ad/adns/package.nix b/pkgs/by-name/ad/adns/package.nix index d57c8768ceed..70c04d94aadd 100644 --- a/pkgs/by-name/ad/adns/package.nix +++ b/pkgs/by-name/ad/adns/package.nix @@ -3,6 +3,7 @@ stdenv, fetchurl, gnum4, + autoreconfHook, gitUpdater, }: @@ -18,7 +19,12 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-cTizeJt1Br1oP0UdT32FMHepGAO3s12G7GZ/D5zUAc0="; }; - nativeBuildInputs = [ gnum4 ]; + patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./darwin.patch ]; + + nativeBuildInputs = [ + gnum4 + autoreconfHook + ]; configureFlags = lib.optional stdenv.hostPlatform.isStatic "--disable-dynamic"; @@ -27,18 +33,7 @@ stdenv.mkDerivation (finalAttrs: { # https://www.mail-archive.com/nix-dev@cs.uu.nl/msg01347.html for details. doCheck = false; - # darwin executables fail, but I don't want to fail the 100-500 packages depending on this lib - doInstallCheck = !stdenv.hostPlatform.isDarwin; - - preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin "sed -i -e 's|-Wl,-soname=$(SHLIBSONAME)||' configure"; - - postInstall = - let - suffix = lib.versions.majorMinor version; - in - lib.optionalString stdenv.hostPlatform.isDarwin '' - install_name_tool -id $out/lib/libadns.so.${suffix} $out/lib/libadns.so.${suffix} - ''; + doInstallCheck = true; installCheckPhase = '' runHook preInstallCheck