From 9951092d515030a4944fa7a6a26db361b881a49c Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Fri, 14 Sep 2018 20:40:34 +0200 Subject: [PATCH] build-package: Use cargo install for rust packages Starting with rust 0.29.0 the cargo install command can be used with --target. Also, install shell completion scripts for ripgrep. --- build-package.sh | 7 +++---- packages/fd/build.sh | 2 -- packages/ripgrep/build.sh | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/build-package.sh b/build-package.sh index 24119962e..259e40886 100755 --- a/build-package.sh +++ b/build-package.sh @@ -1024,10 +1024,9 @@ termux_step_make_install() { elif test -f Cargo.toml; then termux_setup_rust cargo build --release --target $CARGO_TARGET_NAME - # Once https://github.com/rust-lang/cargo/commit/0774e97da3894f07ed5b6f7db175027a9bc4718b - # is available on master we can use cargo install: - # cargo install --root $TERMUX_PREFIX - # rm $TERMUX_PREFIX/.crates.toml + cargo install --force --target $CARGO_TARGET_NAME --root $TERMUX_PREFIX + # https://github.com/rust-lang/cargo/issues/3316: + rm $TERMUX_PREFIX/.crates.toml fi } diff --git a/packages/fd/build.sh b/packages/fd/build.sh index 361a56728..2cf4e0bbe 100644 --- a/packages/fd/build.sh +++ b/packages/fd/build.sh @@ -6,8 +6,6 @@ TERMUX_PKG_SRCURL=https://github.com/sharkdp/fd/archive/v$TERMUX_PKG_VERSION.tar TERMUX_PKG_BUILD_IN_SRC=yes termux_step_post_make_install() { - cp target/$CARGO_TARGET_NAME/release/fd $TERMUX_PREFIX/bin/fd - mkdir -p $TERMUX_PREFIX/share/man/man1 cp $TERMUX_PKG_SRCDIR/doc/fd.1 $TERMUX_PREFIX/share/man/man1/fd.1 } diff --git a/packages/ripgrep/build.sh b/packages/ripgrep/build.sh index af76f6814..6c2cb21c4 100644 --- a/packages/ripgrep/build.sh +++ b/packages/ripgrep/build.sh @@ -1,13 +1,25 @@ TERMUX_PKG_HOMEPAGE=https://github.com/BurntSushi/ripgrep TERMUX_PKG_DESCRIPTION="Search tool like grep and The Silver Searcher" TERMUX_PKG_VERSION=0.10.0 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=a2a6eb7d33d75e64613c158e1ae450899b437e37f1bfbd54f713b011cd8cc31e TERMUX_PKG_SRCURL=https://github.com/BurntSushi/ripgrep/archive/$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_BUILD_IN_SRC=yes termux_step_post_make_install() { - cp target/$CARGO_TARGET_NAME/release/rg $TERMUX_PREFIX/bin/rg - + # Install man page: mkdir -p $TERMUX_PREFIX/share/man/man1/ cp `find . -name rg.1` $TERMUX_PREFIX/share/man/man1/ + + # Install bash completion script: + mkdir -p $TERMUX_PREFIX/share/bash-completion/completions/ + cp `find . -name rg.bash` $TERMUX_PREFIX/share/bash-completion/completions/rg + + # Install fish completion script: + mkdir -p $TERMUX_PREFIX/share/fish/completions/ + cp `find . -name rg.fish` $TERMUX_PREFIX/share/fish/completions/ + + # Install zsh completion script: + mkdir -p $TERMUX_PREFIX/share/zsh/site-functions/ + cp complete/_rg $TERMUX_PREFIX/share/zsh/site-functions/ }