ripgrep-all/ci/before_deploy.sh

100 lines
3.2 KiB
Bash
Raw Normal View History

2019-06-12 19:59:50 +00:00
#!/bin/bash
# package the build artifacts
set -ex
. "$(dirname $0)/utils.sh"
# Generate artifacts for release
mk_artifacts() {
CARGO="$(builder)"
2019-06-12 20:07:46 +00:00
"$CARGO" build --target "$TARGET" --release
2019-06-12 19:59:50 +00:00
}
# 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
2019-06-18 21:57:57 +00:00
wget -q 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
2019-06-18 21:57:57 +00:00
wget -q 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"
2019-06-18 21:57:57 +00:00
wget -q 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"
2019-06-18 21:57:57 +00:00
wget -q https://github.com/BurntSushi/ripgrep/releases/download/11.0.1/ripgrep-11.0.1-x86_64-pc-windows-msvc.zip -O ripgrep.zip
unzip ripgrep.zip
cp rg.exe "$outdir/"
}
2019-06-12 19:59:50 +00:00
mk_tarball() {
# When cross-compiling, use the right `strip` tool on the binary.
local gcc_prefix="$(gcc_prefix)"
# Create a temporary dir that contains our staging area.
# $tmpdir/$name is what eventually ends up as the deployed archive.
local tmpdir="$(mktemp -d)"
local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
local staging="$tmpdir/$name"
mkdir -p "$staging/"
# mkdir -p "$staging"/{complete,doc}
2019-06-12 19:59:50 +00:00
# The deployment directory is where the final archive will reside.
# This path is known by the .travis.yml configuration.
local out_dir="$(pwd)/deployment"
mkdir -p "$out_dir"
# Find the correct (most recent) Cargo "out" directory. The out directory
# contains shell completion files and the man page.
local cargo_out_dir="$(cargo_out_dir "target/$TARGET")"
2019-06-18 16:05:44 +00:00
bin_ext=""
if is_windows; then
bin_ext=".exe"
fi
2019-06-15 08:20:10 +00:00
# Copy the binaries and strip it.
for binary in rga rga-preproc; do
2019-06-18 16:05:44 +00:00
cp "target/$TARGET/release/$binary$bin_ext" "$staging/$binary$bin_ext"
# "${gcc_prefix}strip" "$staging/$binary"
2019-06-15 09:27:27 +00:00
done
2019-06-12 19:59:50 +00:00
# Copy the licenses and README.
2019-06-14 21:30:31 +00:00
cp {README.md,LICENSE.md} "$staging/"
2019-06-12 19:59:50 +00:00
# Copy documentation and man page.
2019-06-14 21:30:31 +00:00
# cp {CHANGELOG.md,FAQ.md,GUIDE.md} "$staging/doc/"
2019-06-14 21:29:15 +00:00
#if command -V a2x 2>&1 > /dev/null; then
# # The man page should only exist if we have asciidoc installed.
# cp "$cargo_out_dir/rg.1" "$staging/doc/"
#fi
2019-06-12 19:59:50 +00:00
# Copy shell completion files.
2019-06-14 21:55:56 +00:00
# cp "$cargo_out_dir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
# cp complete/_rg "$staging/complete/"
2019-06-12 19:59:50 +00:00
2019-06-18 21:57:57 +00:00
#if is_windows; then
(cd "$tmpdir" && download_other_binaries "$name")
(cd "$tmpdir" && 7za a "$out_dir/$name.7z" "$name")
2019-06-18 21:57:57 +00:00
#else
# (cd "$tmpdir" && tar czf "$out_dir/$name.tar.gz" "$name")
#fi
2019-06-12 19:59:50 +00:00
rm -rf "$tmpdir"
}
main() {
mk_artifacts
mk_tarball
}
main