mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
44 lines
964 B
Bash
44 lines
964 B
Bash
installFromCargoArtifactsDir() {
|
|
local dir="$1"
|
|
local libs=".*\.\(so.[0-9.]+\|so\|a\|dylib\)"
|
|
|
|
echo "installing artifacts from ${dir}"
|
|
|
|
find "${dir}" \
|
|
-maxdepth 1 \
|
|
-regex "${libs}" \
|
|
-print0 | xargs -0 -r cp -t "${out}/lib"
|
|
|
|
find "${dir}" \
|
|
-maxdepth 1 \
|
|
-type f \
|
|
-executable \
|
|
! \( -regex "${libs}" \) \
|
|
-print0 | xargs -0 -r cp -t "${out}/bin"
|
|
}
|
|
|
|
installFromCargoArtifacts() {
|
|
runHook preInstall
|
|
|
|
echo "Executing cargoInstall"
|
|
mkdir -p "${out}/bin"
|
|
mkdir -p "${out}/lib"
|
|
|
|
for profile in release debug; do
|
|
local dir="${CARGO_TARGET_DIR:-target}/${profile}"
|
|
if [ -d "${dir}" ]; then
|
|
installFromCargoArtifactsDir "${dir}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
rmdir --ignore-fail-on-non-empty "${out}/bin"
|
|
rmdir --ignore-fail-on-non-empty "${out}/lib"
|
|
|
|
runHook postInstall
|
|
}
|
|
|
|
if [ -z "${dontInstallFromCargoArtifacts-}" ] && [ -z "${installPhase-}" ]; then
|
|
installPhase=installFromCargoArtifacts
|
|
fi
|