autoPatchelfHook: expose script as top level package (#340162)

This commit is contained in:
Guillaume Maudoux 2024-09-30 10:03:28 +02:00 committed by GitHub
commit ced27bf29e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 44 additions and 7 deletions

View File

@ -71,7 +71,7 @@ autoPatchelf() {
fi
done
@pythonInterpreter@ @autoPatchelfScript@ \
auto-patchelf \
${norecurse:+--no-recurse} \
--ignore-missing "${ignoreMissingDepsArray[@]}" \
--paths "$@" \

View File

@ -425,7 +425,7 @@ interpreter_arch: str = None # type: ignore
libc_lib: Path = None # type: ignore
if __name__ == "__main__":
nix_support = Path(os.environ['NIX_BINTOOLS']) / 'nix-support'
nix_support = Path(os.environ.get('NIX_BINTOOLS', os.environ['DEFAULT_BINTOOLS'])) / 'nix-support'
interpreter_path = Path((nix_support / 'dynamic-linker').read_text().strip())
libc_lib = Path((nix_support / 'orig-libc').read_text().strip()) / 'lib'

View File

@ -0,0 +1,41 @@
{
lib,
python3Packages,
}:
python3Packages.buildPythonApplication {
pname = "auto-patchelf";
version = "0-unstable-2024-08-14";
pyproject = false;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./auto-patchelf.py
];
};
dependencies = with python3Packages; [
pyelftools
];
installPhase = ''
runHook preInstall
install -Dm755 auto-patchelf.py $out/bin/auto-patchelf
runHook postInstall
'';
makeWrapperArgs = [
"--set DEFAULT_BINTOOLS $NIX_BINTOOLS"
];
meta = {
description = "Automatically patch ELF binaries using patchelf";
mainProgram = "auto-patchelf";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ Scrumplex ];
};
}

View File

@ -185,11 +185,7 @@ with pkgs;
autoPatchelfHook = makeSetupHook {
name = "auto-patchelf-hook";
propagatedBuildInputs = [ bintools ];
substitutions = {
pythonInterpreter = "${python3.withPackages (ps: [ ps.pyelftools ])}/bin/python";
autoPatchelfScript = ../build-support/setup-hooks/auto-patchelf.py;
};
propagatedBuildInputs = [ auto-patchelf bintools ];
} ../build-support/setup-hooks/auto-patchelf.sh;
appflowy = callPackage ../applications/office/appflowy { };