Merge pull request #294514 from nomeata/joachim/elan

fix: elan: use relative paths in wrapper script

authored by Mauricio Collares and committed by GitHub 79435d8c 5c00df70

+7 -13
+6 -4
pkgs/applications/science/logic/elan/0001-dynamically-patchelf-binaries.patch
··· 2 2 index c51e76d..ae8159e 100644 3 3 --- a/src/elan-dist/src/component/package.rs 4 4 +++ b/src/elan-dist/src/component/package.rs 5 - @@ -56,6 +56,35 @@ fn unpack_without_first_dir<R: Read>(archive: &mut tar::Archive<R>, path: &Path) 5 + @@ -56,6 +56,37 @@ fn unpack_without_first_dir<R: Read>(archive: &mut tar::Archive<R>, path: &Path) 6 6 entry 7 7 .unpack(&full_path) 8 8 .chain_err(|| ErrorKind::ExtractingPackage)?; ··· 26 26 + use std::os::unix::fs::PermissionsExt; 27 27 + let new_path = dest_path.with_extension("orig"); 28 28 + ::std::fs::rename(dest_path, &new_path)?; 29 - + ::std::fs::write(dest_path, format!(r#"#! @shell@ 30 - +LEAN_CC="${{LEAN_CC:-@cc@}}" exec -a "$0" {} "$@" -L {}/lib # use bundled libraries, but not bundled compiler that doesn't know about NIX_LDFLAGS 31 - +"#, new_path.to_str().unwrap(), dest_path.parent().unwrap().parent().unwrap().to_str().unwrap()))?; 29 + + ::std::fs::write(dest_path, r#"#! @shell@ 30 + +dir="$(dirname "${BASH_SOURCE[0]}")" 31 + +# use bundled libraries, but not bundled compiler that doesn't know about NIX_LDFLAGS 32 + +LEAN_CC="${LEAN_CC:-@cc@}" exec -a "$0" "$dir/leanc.orig" "$@" -L"$dir/../lib" 33 + +"#)?; 32 34 + ::std::fs::set_permissions(dest_path, ::std::fs::Permissions::from_mode(0o755))?; 33 35 + } 34 36 +
+1 -9
pkgs/applications/science/logic/elan/default.nix
··· 1 - { stdenv, lib, runCommand, patchelf, makeWrapper, pkg-config, curl, runtimeShell, fetchpatch 1 + { stdenv, lib, runCommand, patchelf, makeWrapper, pkg-config, curl, runtimeShell 2 2 , openssl, zlib, fetchFromGitHub, rustPlatform, libiconv }: 3 3 4 4 rustPlatform.buildRustPackage rec { ··· 23 23 buildFeatures = [ "no-self-update" ]; 24 24 25 25 patches = lib.optionals stdenv.isLinux [ 26 - # revert temporary directory creation, because it break the wrapper 27 - # https://github.com/NixOS/nixpkgs/pull/289941#issuecomment-1980778358 28 - (fetchpatch { 29 - url = "https://github.com/leanprover/elan/commit/bd54acaab75d08b3912ee1f051af8657f3a9cfdf.patch"; 30 - hash = "sha256-6If/wxWSea8Zjlp3fx9wh3D0TjmWZbvCuY9q5c2qJGA="; 31 - revert = true; 32 - }) 33 - 34 26 # Run patchelf on the downloaded binaries. 35 27 # This is necessary because Lean 4 is now dynamically linked. 36 28 (runCommand "0001-dynamically-patchelf-binaries.patch" {