# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           cargo 1.0

github.setup        BurntSushi ripgrep 16.0.0
github.tarball_from archive
revision            0
categories          textproc
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

description         fast command line search tool
long_description    ripgrep is a command line search tool that combines the \
                    usability of The Silver Searcher (an ack clone) with the \
                    raw speed of GNU grep.

checksums-append    ${distname}${extract.suffix} \
                    rmd160  1112f9507cb057f12999b7add0de8d6422205a6e \
                    sha256  17e7a1a0db80ed9618a0963c7ae4aecb8fce25c70cf7ebed514daf2b38a0d153 \
                    size    653384

depends_build-append \
                    port:asciidoc \
                    port:docbook-xsl-nons \
                    port:libiconv

set ripgrep_bin     ${worksrcpath}/target/[cargo.rust_platform]/release/rg

post-build {
    # Generate shell completions
    foreach _shell {bash fish zsh} {
        system -W ${worksrcpath} \
            "${ripgrep_bin} --generate complete-${_shell} > rg.${_shell}"
    }

    # Generate man page
    system -W ${worksrcpath} "${ripgrep_bin} --generate man > rg.1"
}

destroot {
    # Install ripgrep
    xinstall -m 0755 ${ripgrep_bin} ${destroot}${prefix}/bin/
    ln -s rg ${destroot}${prefix}/bin/ripgrep

    # Install shell completions
    xinstall -d -m 0755 ${destroot}${prefix}/share/bash-completion/completions
    xinstall -m 0644 ${worksrcpath}/rg.bash \
        ${destroot}${prefix}/share/bash-completion/completions/rg

    xinstall -d -m 0755 ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall -m 0644 ${worksrcpath}/rg.fish \
        ${destroot}${prefix}/share/fish/vendor_completions.d/

    xinstall -d -m 0755 ${destroot}${prefix}/share/zsh/site-functions
    xinstall -m 0644 ${worksrcpath}/rg.zsh \
        ${destroot}${prefix}/share/zsh/site-functions/_rg

    # Install man page
    xinstall -m 0644 ${worksrcpath}/rg.1 ${destroot}${prefix}/share/man/man1/
}

variant pcre description {Build with pcre2} {
    build.args-append       --features 'pcre2'
    depends_run-append      port:pcre2
}
default_variants    +pcre

cargo.crates \
    aho-corasick                                                            1.1.5  c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba \
    anyhow                                                                1.0.104  330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470 \
    arbitrary                                                               1.5.0  3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed \
    bstr                                                                   1.14.0  a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214 \
    cc                                                                     1.11.3  02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69 \
    cfg-if                                                                  1.0.5  4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600 \
    core_detect                                                             1.0.0  7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48 \
    crossbeam-channel                                                      0.5.17  98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1 \
    crossbeam-deque                                                         0.8.8  622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a \
    crossbeam-epoch                                                        0.9.21  dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d \
    crossbeam-utils                                                        0.8.23  a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6 \
    derive_arbitrary                                                        1.5.0  1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac \
    encoding_rs                                                            0.8.44  89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5 \
    encoding_rs_io                                                          0.1.8  fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22 \
    find-msvc-tools                                                        0.1.15  1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48 \
    getrandom                                                               0.4.3  300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099 \
    glob                                                                    0.3.4  e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b \
    itoa                                                                   1.0.19  3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4 \
    jobserver                                                              0.1.35  1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3 \
    lexopt                                                                  0.3.2  803ec87c9cfb29b9d2633f20cba1f488db3fd53f2158b1024cbefb47ba05d413 \
    libc                                                                  0.2.191  65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a \
    log                                                                    0.4.35  5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c \
    memchr                                                                  2.8.3  cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98 \
    memmap2                                                                0.9.12  6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157 \
    multiversion_no_op                                                      1.0.0  743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d \
    pcre2                                                                  0.2.11  9e970b0fcce0c7ee6ef662744ff711f21ccd6f11b7cf03cd187a80e89797fc67 \
    pcre2-sys                                                              0.2.10  18b9073c1a2549bd409bf4a32c94d903bb1a09bf845bc306ae148897fa0760a4 \
    pkg-config                                                             0.3.34  f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548 \
    proc-macro2                                                           1.0.107  985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9 \
    quote                                                                  1.0.47  1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001 \
    r-efi                                                                   6.0.0  f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf \
    regex                                                                  1.13.2  9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857 \
    regex-automata                                                         0.4.19  41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158 \
    regex-syntax                                                           0.8.12  d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6 \
    rustversion                                                            1.0.23  cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f \
    same-file                                                               1.0.6  93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502 \
    scopeguard                                                              1.2.0  94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49 \
    serde                                                                 1.0.229  4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba \
    serde_core                                                            1.0.229  67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48 \
    serde_derive                                                          1.0.229  e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348 \
    serde_json                                                            1.0.154  e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6 \
    shlex                                                                   2.0.1  f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba \
    simdutf8                                                                0.1.5  e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e \
    syn                                                                    3.0.10  4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79 \
    termcolor                                                               1.4.1  06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755 \
    textwrap                                                               0.16.4  6ecfad6c3abc80a577f2b91c1e412ee57e7a060d430b553c1b0c940974ebcd49 \
    tikv-jemalloc-sys     0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8  1a2825c78386b4ae0314074867860ba9577875de945f05992c38815cbec327f0 \
    tikv-jemallocator                                                       0.7.0  249f09e49ab1609436f34c776e84231bead18d6a955f119f939bdc1d847561bd \
    unicode-ident                                                          1.0.27  a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563 \
    walkdir                                                                 2.5.1  b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403 \
    winapi-util                                                            0.1.11  c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22 \
    windows-link                                                            0.2.1  f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5 \
    windows-sys                                                            0.61.2  ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc \
    zmij                                                                   1.0.23  29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b
