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

name                    openbrowser
version                 1.0.1
revision                10
categories              sysutils
platforms               macosx
maintainers             {ryandesign @ryandesign} openmaintainer
license                 MIT
supported_archs         noarch

description             opens files and URLs into the default web browser

long_description        openbrowser opens files and URLs into your default \
                        web browser. Unlike “open”, openbrowser will still \
                        open local .html files into your web browser even \
                        if you have configured LaunchServices to open .html \
                        files into e.g. a text editor.

homepage                https://www.macports.org

distfiles

perl5.branches          5.34

depends_lib
depends_run-append      port:perl${perl5.major} \
                        port:p${perl5.major}-mac-propertylist

extract.mkdir           yes

configure {
    copy ${filespath}/${name} ${worksrcpath}
}

build {
    reinplace "s|/usr/bin/env perl|${perl5.bin}|g" ${worksrcpath}/${name}

    # Use correct plist file
    if {${os.major} < 15} {
        reinplace "s|__PLISTFILE__|Library/Preferences/com.apple.LaunchServices.plist|" ${worksrcpath}/${name}
    } else {
        reinplace "s|__PLISTFILE__|Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist|" ${worksrcpath}/${name}
    }
}

destroot {
    xinstall -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/bin
}

livecheck.type          none
