mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
wasmtime: add enableShared/enableStatic & shell completions (#440501)
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
buildPackages,
|
||||
cmake,
|
||||
installShellFiles,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
enableShared ? !stdenv.hostPlatform.isStatic,
|
||||
enableStatic ? stdenv.hostPlatform.isStatic,
|
||||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "wasmtime";
|
||||
@@ -35,7 +39,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
"dev"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
doCheck =
|
||||
with stdenv.buildPlatform;
|
||||
@@ -54,10 +61,12 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
postInstall =
|
||||
let
|
||||
inherit (stdenv.targetPlatform.rust) cargoShortTarget;
|
||||
inherit (stdenv.hostPlatform.rust) cargoShortTarget;
|
||||
in
|
||||
''
|
||||
moveToOutput lib $dev
|
||||
${lib.optionalString (!enableShared) "rm $dev/lib/*.so{,.*}"}
|
||||
${lib.optionalString (!enableStatic) "rm $dev/lib/*.a"}
|
||||
|
||||
# copy the build.rs generated c-api headers
|
||||
# https://github.com/rust-lang/cargo/issues/9661
|
||||
@@ -67,6 +76,18 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
install_name_tool -id \
|
||||
$dev/lib/libwasmtime.dylib \
|
||||
$dev/lib/libwasmtime.dylib
|
||||
''
|
||||
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd wasmtime \
|
||||
--bash <("$out/bin/wasmtime" completion bash) \
|
||||
--zsh <("$out/bin/wasmtime" completion zsh) \
|
||||
--fish <("$out/bin/wasmtime" completion fish)
|
||||
''
|
||||
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd wasmtime \
|
||||
--bash "${buildPackages.wasmtime}"/share/bash-completion/completions/*.bash \
|
||||
--zsh "${buildPackages.wasmtime}"/share/zsh/site-functions/* \
|
||||
--fish "${buildPackages.wasmtime}"/share/fish/*/*
|
||||
'';
|
||||
|
||||
nativeInstallCheckInputs = [
|
||||
|
||||
Reference in New Issue
Block a user