adns: fix Darwin properly

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.
This commit is contained in:
Emily
2024-11-11 10:03:30 +00:00
parent e7e4bcc65b
commit 4f0ff90a95
2 changed files with 29 additions and 13 deletions
+21
View File
@@ -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'
+8 -13
View File
@@ -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