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

PortSystem      1.0
PortGroup       github 1.0
PortGroup       xcode 1.0

github.setup    MuntashirAkon DPCIManager 2.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision        9
categories      sysutils aqua
maintainers     {i0ntempest @i0ntempest} openmaintainer
license         GPL-2

description     Simple app for viewing PCI hardware info
long_description \
                {*}${description}

checksums       rmd160  e48da52bbf13b2f0032ddf5d24d47090eb79174f \
                sha256  fe84fa3ee9d3b8d800118b9accd5597e3150f4f518258ae3012fc343ceec0236 \
                size    208257

platforms       macosx

depends_build-append \
                port:pciids

patch.args      -p1
patchfiles-append \
                patch-4ddb0bb2691d3a978dc83101ae3b836566999476.diff \
                patch-7f87272722f359c71817045417a1f4380572e503.diff
# See https://github.com/MuntashirAkon/DPCIManager/pull/9
patchfiles-append \
                patch-getsect.diff

xcode.target    DPCIManager
xcode.configuration \
                Release

post-configure {
    ln -s ${prefix}/share/pci.ids ${worksrcpath}/pci.ids
}

destroot {
    file copy ${worksrcpath}/build/${xcode.configuration}/DPCIManager.app ${destroot}${applications_dir}
}

variant cli description {Build and install dspci CLI utility (lspci alternative)} {
    xcode.target-append dspci
    post-destroot {
        xinstall -m 755 ${worksrcpath}/build/${xcode.configuration}/dspci ${destroot}${prefix}/bin
    }
}

default_variants \
                +cli
