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.
This commit is contained in:
Fredrik Fornwall 2018-09-14 20:40:34 +02:00
parent c032139479
commit b67725b59a
3 changed files with 17 additions and 8 deletions

View File

@ -1024,10 +1024,9 @@ termux_step_make_install() {
elif test -f Cargo.toml; then elif test -f Cargo.toml; then
termux_setup_rust termux_setup_rust
cargo build --release --target $CARGO_TARGET_NAME cargo build --release --target $CARGO_TARGET_NAME
# Once https://github.com/rust-lang/cargo/commit/0774e97da3894f07ed5b6f7db175027a9bc4718b cargo install --force --target $CARGO_TARGET_NAME --root $TERMUX_PREFIX
# is available on master we can use cargo install: # https://github.com/rust-lang/cargo/issues/3316:
# cargo install --root $TERMUX_PREFIX rm $TERMUX_PREFIX/.crates.toml
# rm $TERMUX_PREFIX/.crates.toml
fi fi
} }

View File

@ -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_PKG_BUILD_IN_SRC=yes
termux_step_post_make_install() { termux_step_post_make_install() {
cp target/$CARGO_TARGET_NAME/release/fd $TERMUX_PREFIX/bin/fd
mkdir -p $TERMUX_PREFIX/share/man/man1 mkdir -p $TERMUX_PREFIX/share/man/man1
cp $TERMUX_PKG_SRCDIR/doc/fd.1 $TERMUX_PREFIX/share/man/man1/fd.1 cp $TERMUX_PKG_SRCDIR/doc/fd.1 $TERMUX_PREFIX/share/man/man1/fd.1
} }

View File

@ -1,13 +1,25 @@
TERMUX_PKG_HOMEPAGE=https://github.com/BurntSushi/ripgrep TERMUX_PKG_HOMEPAGE=https://github.com/BurntSushi/ripgrep
TERMUX_PKG_DESCRIPTION="Search tool like grep and The Silver Searcher" TERMUX_PKG_DESCRIPTION="Search tool like grep and The Silver Searcher"
TERMUX_PKG_VERSION=0.10.0 TERMUX_PKG_VERSION=0.10.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=a2a6eb7d33d75e64613c158e1ae450899b437e37f1bfbd54f713b011cd8cc31e TERMUX_PKG_SHA256=a2a6eb7d33d75e64613c158e1ae450899b437e37f1bfbd54f713b011cd8cc31e
TERMUX_PKG_SRCURL=https://github.com/BurntSushi/ripgrep/archive/$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SRCURL=https://github.com/BurntSushi/ripgrep/archive/$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_post_make_install() { 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/ mkdir -p $TERMUX_PREFIX/share/man/man1/
cp `find . -name rg.1` $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/
} }