From f29d569cd33a73da5ad675f43a34ad53c5cc9bc6 Mon Sep 17 00:00:00 2001 From: davidovski Date: Thu, 2 Feb 2023 14:10:02 +0000 Subject: Work --- skip/ripgrep/minimize-size.patch | 28 ++++++++++++++++++++++++++++ skip/ripgrep/ripgrep.xibuild | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 skip/ripgrep/minimize-size.patch create mode 100644 skip/ripgrep/ripgrep.xibuild (limited to 'skip/ripgrep') diff --git a/skip/ripgrep/minimize-size.patch b/skip/ripgrep/minimize-size.patch new file mode 100644 index 0000000..dbb008b --- /dev/null +++ b/skip/ripgrep/minimize-size.patch @@ -0,0 +1,28 @@ +From: Jakub Jirutka +Date: Tue, 6 Apr 2021 00:24:00 +0200 +Subject: [PATCH] Reduce size of the binary + +Reduce size of the resulting binary: 4.6 -> 3.0 MiB (on x86_64). + +`opt-level="s"` provides the best size/performance ratio; the performance +is close to the default opt-level (according to the benchmark), but the +binary is significantly smaller. + +NOTE: ripgrep uses jemalloc allocator when building on musl libc. +It adds about 200 kiB to the binary size, but provides 2x performance; +so better keep it as-is. + +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -78,7 +78,10 @@ + pcre2 = ["grep/pcre2"] + + [profile.release] +-debug = 1 ++lto = true ++codegen-units = 1 ++panic = "abort" ++opt-level = "s" + + [package.metadata.deb] + features = ["pcre2"] diff --git a/skip/ripgrep/ripgrep.xibuild b/skip/ripgrep/ripgrep.xibuild new file mode 100644 index 0000000..8820a83 --- /dev/null +++ b/skip/ripgrep/ripgrep.xibuild @@ -0,0 +1,35 @@ +#!/bin/sh + +NAME="ripgrep" +DESC="ripgrep combines the usability of The Silver Searcher with the raw speed of grep" + +MAKEDEPS=" cargo asciidoc jemalloc pcre2" + +PKG_VER=13.0.0 +SOURCE="https://github.com/BurntSushi/ripgrep/archive/$PKG_VER/ripgrep-$PKG_VER.tar.gz" + +ADDITIONAL=" +minimize-size.patch +" + +prepare () { + apply_patches +} + +build() { + cargo build --release --locked --features 'pcre2' +} + +check() { + cargo test --release --locked --features 'pcre2' +} + +package() { + install -Dm755 "target/release/rg" "$PKG_DEST/usr/bin/rg" + install -Dm644 "target/release/build/ripgrep-"*/out/rg.1 \ + "$PKG_DEST/usr/share/man/man1/rg.1" + + install -Dm644 "$BUILD_ROOT"/target/release/build/ripgrep-*/out/rg.fish \ + -t "$PKG_DEST"/usr/share/fish/completions +} + -- cgit v1.2.1