mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +00:00
11692ab62c
Instead of having to know the version of native-platform at the Nix level, we use the file `lib/native-platform-<version>.jar` to figure out the version of the library JAR to patch.
30 lines
441 B
Bash
30 lines
441 B
Bash
extractVersion() {
|
|
local jar version
|
|
local prefix="$1"
|
|
shift
|
|
local candidates="$@"
|
|
|
|
jar="$(basename -a $candidates | sort | head -n1)"
|
|
|
|
version="${jar#$prefix-}"
|
|
|
|
echo "${version%.jar}"
|
|
}
|
|
|
|
autoPatchelfInJar() {
|
|
local file="$1" rpath="$2"
|
|
local work
|
|
|
|
work="$(mktemp -dt patching.XXXXXXXXXX)"
|
|
pushd "$work"
|
|
|
|
jar xf "$file"
|
|
rm "$file"
|
|
|
|
autoPatchelf -- .
|
|
|
|
jar cf "$file" .
|
|
|
|
popd
|
|
}
|