Browse Source

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.
android-5
Fredrik Fornwall 6 years ago
parent
commit
9951092d51
  1. 7
      build-package.sh
  2. 2
      packages/fd/build.sh
  3. 16
      packages/ripgrep/build.sh

7
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
}

2
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
}

16
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/
}

Loading…
Cancel
Save