Skip to content

Commit

Permalink
emacs: use held back patchelf_0_15 to avoid upstream bug
Browse files Browse the repository at this point in the history
patchelf-0.17.2 corrupts `$out/bin/emacs` binary. It has something to
do with program headers change. Let's pin `emcas` back to `0.15.0`
until `patchelf` is fixed.
  • Loading branch information
trofi committed Mar 18, 2023
1 parent 403b148 commit 114bccd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkgs/applications/editors/emacs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
, recurseIntoAttrs, emacsPackagesFor
, libgccjit, makeWrapper # native-comp params
, fetchFromSavannah, fetchFromBitbucket
, patchelf_0_15

# macOS dependencies for NS and macPort
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
Expand Down Expand Up @@ -136,6 +137,9 @@ assert withTreeSitter -> tree-sitter != null;
];

nativeBuildInputs = [ pkg-config makeWrapper ]
# TODO: remove once it's fixed upstream and released:
# https://github.com/NixOS/patchelf/issues/482
++ [ patchelf_0_15 ]
++ lib.optionals (srcRepo || withMacport) [ texinfo ]
++ lib.optionals srcRepo [ autoreconfHook ]
++ lib.optional (withX && (withGTK3 || withXwidgets)) wrapGAppsHook;
Expand Down
36 changes: 36 additions & 0 deletions pkgs/development/tools/misc/patchelf/0.15.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl }:

# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.

stdenv.mkDerivation rec {
pname = "patchelf";
version = "0.15.0";

src = fetchurl {
url = "https://github.com/NixOS/${pname}/releases/download/${version}/${pname}-${version}.tar.bz2";
sha256 = "sha256-9ANtPuTY4ijewb7/8PbkbYpA6eVw4AaOOdd+YuLIvcI=";
};

strictDeps = true;

setupHook = [ ./setup-hook.sh ];

enableParallelBuilding = true;

# fails 8 out of 24 tests, problems when loading libc.so.6
doCheck = stdenv.name == "stdenv-linux"
# test scripts require unprefixed bintools binaries
# https://github.com/NixOS/patchelf/issues/417
&& stdenv.cc.targetPrefix == "";

meta = with lib; {
homepage = "https://github.com/NixOS/patchelf";
license = licenses.gpl3Plus;
description = "A small utility to modify the dynamic linker and RPATH of ELF executables";
maintainers = [ maintainers.eelco ];
platforms = platforms.all;
};
}
5 changes: 5 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18562,6 +18562,11 @@ with pkgs;
patchelf_0_13 = callPackage ../development/tools/misc/patchelf/0.13.nix {
patchelf = patchelfStable;
};

# used by emacs which is not compatible to 0.17.2 release:
# https://github.com/NixOS/patchelf/issues/482
patchelf_0_15 = callPackage ../development/tools/misc/patchelf/0.15.nix { };

patchelfStable = callPackage ../development/tools/misc/patchelf { };

patchelfUnstable = lowPrio (callPackage ../development/tools/misc/patchelf/unstable.nix { });
Expand Down

0 comments on commit 114bccd

Please sign in to comment.