nixpkgs/pkgs/by-name/ju/judy/package.nix
Liam Murphy d4a8babe90
judy: revert Darwin reproducibility fixes
It was already reproducible: the only reason it seemed not to be was due
to a quirk of how `--rebuild` works on macOS. Since the implementation
of the Nix sandbox on macOS is unable to change the meaning of paths,
when rebuilding a derivation, it can't be done at the same path as the
original. Instead, the rebuild occurs with a different output path, and
the output is scanned for instances of that path so that they can be
replaced with the correct one afterwards (ala ca-derivations).

Unfortunately, macOS's codesigning system seems to include the hash of
the signed binary as part of its signature, including any incorrect
paths it contains. This results in the binaries still being different
after the path replacement step has occured.

The reason to go out of our way to revert this is that the workaround to
avoid including the output path in any binaries includes replacing the
install name of judy with `@rpath/*` rather than its absolute path,
which breaks at least one dependency that doesn't add it to RPATH
(gtkwave), and possibly others.

To confirm that it's reproducible:

```
drv=$(nix eval .#judy --apply "pkg: (pkg.overrideAttrs { __REBUILD = true; }).drvPath" --raw)
out=$(nix derivation show "$drv" | jq -r ".[].outputs.out.path")

nix build "$drv^*" --no-link
cp -r "$out" rebuild-1

nix store delete "$out" --option keep-outputs false
nix build "$drv^*" --no-link
cp -r "$out" rebuild-2

diff -r rebuild-1 rebuild-2
```
2025-04-09 13:12:12 +10:00

39 lines
1.1 KiB
Nix

{
lib,
stdenv,
fetchurl,
pkgsBuildBuild,
autoreconfHook,
}:
stdenv.mkDerivation rec {
pname = "judy";
version = "1.0.5";
src = fetchurl {
url = "mirror://sourceforge/judy/Judy-${version}.tar.gz";
sha256 = "1sv3990vsx8hrza1mvq3bhvv9m6ff08y4yz7swn6znszz24l0w6j";
};
nativeBuildInputs = [ autoreconfHook ];
depsBuildBuild = [ pkgsBuildBuild.stdenv.cc ];
patches = [
./cross.patch
# Fix reproducible timestamps.
./fix-source-date.patch
];
# Disable parallel builds as manpages lack some dependencies:
# ../tool/jhton ext/JudyHS_funcs_3.htm | grep -v '^[ ]*$' | sed -e 's/\.C//' > man/man3/JudyHS_funcs
# make[2]: *** No rule to make target 'man/man3/JSLD', needed by 'all-am'. Stop.
# Let's wait for the upstream fix similar to https://sourceforge.net/p/judy/patches/4/
enableParallelBuilding = false;
meta = {
homepage = "https://judy.sourceforge.net/";
license = lib.licenses.lgpl21Plus;
description = "State-of-the-art C library that implements a sparse dynamic array";
platforms = lib.platforms.unix;
};
}