add windows dependencies and update readme

This commit is contained in:
phiresky 2019-06-18 22:54:31 +02:00
parent 9201add7e0
commit e4c0cb8349
4 changed files with 89 additions and 18 deletions

View File

@ -3,6 +3,8 @@
- Fix file ending regex ([#13](https://github.com/phiresky/ripgrep-all/issues/13))
- Fix decoding of UTF16 with BOM ([#5](https://github.com/phiresky/ripgrep-all/issues/5))
- Shorten the output on failure to two lines (https://github.com/phiresky/ripgrep-all/issues/7), you can use `--no-messages` to completely suppress errors.
- Better installations instructions in readme for each OS
- Add windows binaries! Including all dependencies!
# 0.9.1 (2019-06-16)

View File

@ -28,6 +28,44 @@ demo/
![rga output](doc/demodir.png)
## INSTALLATION
Linux x64, OSX and Windows binaries are available [in GitHub Releases][latestrelease].
[latestrelease]: https://github.com/phiresky/ripgrep-all/releases/latest
### Linux
On Arch Linux, you can simply install from AUR: `yay -S ripgrep-all`.
On Debian-based distributions you can download the [rga binary][latestrelease] and get the dependencies like this:
`apt install ripgrep pandoc poppler-utils ffmpeg cargo`
If ripgrep is not included in your package sources, get it from [here](https://github.com/BurntSushi/ripgrep/releases).
rga will search for all binaries it calls in \$PATH and the directory itself is in.
### Windows
Just unzip the [Windows binary release][latestrelease] anywhere, possibly somewhere in your \$PATH. It includes all necessary and optional dependencies.
### OSX
To get all necessary and optional dependencies:
`brew install ripgrep pandoc poppler tesseract ffmpeg`
### Compile from source
rga should compile with stable Rust (v1.35.0+, check with `rustc --version`). To build it, run the following (or the equivalent in your OS):
```
~$ apt install build-essential pandoc poppler-utils ffmpeg ripgrep cargo
~$ cargo install ripgrep_all
~$ rga --version # this should work now
```
## Available Adapters
```
@ -100,23 +138,11 @@ The following adapters are disabled by default, and can be enabled using '--rga-
Extensions: .jpg, .png
## INSTALLATION:
rga should compile with stable Rust. To build it, run the following (or the equivalent in your OS):
```
~$ apt install build-essential pandoc poppler-utils ffmpeg ripgrep cargo
~$ cargo install ripgrep_all
~$ rga --version # this should work now
```
You could do `cargo build`, instead of `cargo install ripgrep_all`, to just build rga in the local tree.
## USAGE:
## USAGE
> rga \[FLAGS\] \[OPTIONS\] PATTERN \[PATH ...\]
## FLAGS:
## FLAGS
**\--rga-accurate**

View File

@ -12,6 +12,33 @@ mk_artifacts() {
"$CARGO" build --target "$TARGET" --release
}
# run from tmpdir, put results in $1/
# currently windows only, because other OS probably have a package manager
# also currently just a fixed version of each tool since it doesn't matter much
download_other_binaries() {
outdir="$1"
mkdir -p "$outdir/licenses"
# ffmpeg
wget https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1.3-win64-static.zip -O ffmpeg.zip
unzip ffmpeg.zip
cp ffmpeg-*/bin/{ffmpeg,ffprobe}.exe "$outdir"
cp ffmpeg-*/LICENSE.txt "$outdir/licenses/ffmpeg"
# xpdf
wget https://xpdfreader-dl.s3.amazonaws.com/xpdf-tools-win-4.01.01.zip -O xpdf.zip
unzip xpdf.zip
cp xpdf-tools*/bin64/pdftotext.exe "$outdir/"
cp xpdf-tools*/COPYING3 "$outdir/licenses/xpdf"
wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-windows-x86_64.zip -O pandoc.zip
unzip pandoc.zip
cp pandoc-*/pandoc.exe "$outdir/"
cp pandoc-*/COPYRIGHT.txt "$outdir/licenses/pandoc"
}
mk_tarball() {
# When cross-compiling, use the right `strip` tool on the binary.
local gcc_prefix="$(gcc_prefix)"
@ -20,7 +47,8 @@ mk_tarball() {
local tmpdir="$(mktemp -d)"
local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
local staging="$tmpdir/$name"
mkdir -p "$staging"/{complete,doc}
mkdir -p "$staging/"
# mkdir -p "$staging"/{complete,doc}
# The deployment directory is where the final archive will reside.
# This path is known by the .travis.yml configuration.
local out_dir="$(pwd)/deployment"
@ -52,6 +80,7 @@ mk_tarball() {
# cp complete/_rg "$staging/complete/"
if is_windows; then
(cd "$tmpdir" && download_other_binaries "$name")
(cd "$tmpdir" && zip -r "$out_dir/$name.zip" "$name")
else
(cd "$tmpdir" && tar czf "$out_dir/$name.tar.gz" "$name")

View File

@ -85,8 +85,7 @@ fn main() -> Result<(), exitfailure::ExitFailure> {
"*".to_owned()
};
let exe = std::env::current_exe().expect("Could not get executable location");
let preproc_exe = exe.with_file_name("rga-preproc");
add_exe_to_path()?;
let rg_args = vec![
"--no-line-number",
@ -98,7 +97,7 @@ fn main() -> Result<(), exitfailure::ExitFailure> {
let mut child = Command::new("rg")
.args(rg_args)
.arg("--pre")
.arg(preproc_exe)
.arg("rga-preproc")
.arg("--pre-glob")
.arg(pre_glob)
.args(passthrough_args)
@ -108,3 +107,18 @@ fn main() -> Result<(), exitfailure::ExitFailure> {
child.wait()?;
Ok(())
}
/// add the directory that contains `rga` to PATH, so ripgrep can find rga-preproc and rga-preproc can find pandoc etc (if we are on Windows where we include dependent binaries)
fn add_exe_to_path() -> Fallible<()> {
use std::env;
let mut exe = env::current_exe().expect("Could not get executable location");
// let preproc_exe = exe.with_file_name("rga-preproc");
exe.pop(); // dirname
let path = env::var_os("PATH").unwrap_or("".into());
let mut paths = env::split_paths(&path).collect::<Vec<_>>();
paths.push(exe); // append: this way system PATH gets higher priority than bundled versions
let new_path = env::join_paths(paths)?;
env::set_var("PATH", &new_path);
Ok(())
}