# -*- 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               cmake 1.1
PortGroup               legacysupport 1.1

# fstatat
legacysupport.newest_darwin_requires_legacy 13

github.setup            fish-shell fish-shell 3.7.1
revision                0
checksums               rmd160  ca1d6747e878fbd724f3e800bcaceb224ad33319 \
                        sha256  614c9f5643cd0799df391395fa6bbc3649427bb839722ce3b114d3bbc1a3b250 \
                        size    2965756

name                    fish3
conflicts               fish

license                 GPL-2
categories              shells
maintainers             {@aeiouaeiouaeiouaeiouaeiouaeiou outlook.com:aeioudev} openmaintainer

description             The user-friendly command line shell - legacy version
long_description        fish is a smart and user-friendly command line shell \
                        for macOS, Linux, and the rest of the family. This \
                        port is the last version of fish that written in C++. \
                        It is suitable for bootstrapping or use on systems \
                        without Rust installed.

homepage                https://fishshell.com/
github.tarball_from     releases
distname                fish-${version}
use_xz                  yes

depends_build-append    port:gettext \
                        path:bin/pkg-config:pkgconfig

depends_lib-append      port:gettext-runtime \
                        port:libiconv \
                        port:ncurses \
                        port:pcre2

patchfiles              patch-share_config_fish.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}/bin|g" "${worksrcpath}/share/config.fish"
    # skip failing tests for now, future updates should try enabling them
    file rename "${worksrcpath}/tests/checks/sigint.fish" "${worksrcpath}/tests/checks/sigint.fish.skip"
}

compiler.cxx_standard   2011
compiler.thread_local_storage \
                        yes

# doxygen appears to only regenerate html files and is not needed to install man pages
configure.args-append   -DBUILD_DOCS=OFF

configure.args-append   -DFISH_USE_SYSTEM_PCRE2=ON \
                        -DMAC_CODESIGN_ID=OFF

platform darwin 8 {
    #/opt/local/var/macports/build/_opt_myports_shells_fish/fish/work/fish-3.0.2/src/env.cpp:436:31: error: invalid conversion from 'char*' to 'int'
    configure.cxxflags-append -D__DARWIN_UNIX03

    depends_test-append port:bash
    test.env-append     SHELL=${prefix}/bin/bash
}

depends_test-append     port:py313-pexpect
# other possible options are ansi, dtterm, rxvt, vt52, vt100, vt102, xterm
test.env-append         TERM=nsterm
test.run                yes
test.target             test

pre-test {
    append portsandbox_profile " (allow process-exec (literal \"/bin/ps\") (with no-profile))"
}

notes "
To set MacPorts' ${name} as default login shell, run:

    sudo chpass -s ${prefix}/bin/fish \${USER}

To be able to switch default shells to or from ${name} without superuser\
privileges, add it to /etc/shells:

    sudo sh -c 'echo ${prefix}/bin/fish >> /etc/shells'

For X clipboard integration, install the xsel port:

    sudo port install xsel
"

livecheck.type          none
