# -*- 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

name                    xsel
version                 1.2.0
revision                2
checksums               rmd160  53fc7fe06e4e4ebe3c47a3a97408876cd0c5faed \
                        sha256  b927ce08dc82f4c30140223959b90cf65e1076f000ce95e520419ec32f5b141c \
                        size    169155

categories              x11
platforms               darwin
maintainers             {ryandesign @ryandesign} openmaintainer
license                 MIT

homepage                http://www.kfish.org/software/xsel/
master_sites            ${homepage}download/

description             command-line program for getting and setting the \
                        contents of the X selection

long_description        XSel is a ${description}. Normally this is only \
                        accessible by manually highlighting information and \
                        pasting it with the middle mouse button.

depends_build           port:xorg-libXt

depends_lib             port:xorg-libX11

# cache autoconf vfork check to yes on darwin 21+ (macOS Monterey) disabling
# the autoconf vfork macro "#define vfork fork" that will result in a build
# failure due to vfork deprecation warning in macOS Monterey and -Werror
# https://trac.macports.org/ticket/63748
# https://github.com/kfish/xsel/issues/42
if {${os.platform} eq "darwin" && ${os.major} >= 21} {
    configure.args-append ac_cv_func_vfork=yes
}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${subport}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        ChangeLog \
        README \
        ${docdir}
}

livecheck.type          regex
livecheck.url           [lindex ${master_sites} 0]
livecheck.regex         ${name}-(\[0-9.\]+)\\.tar
