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

github.setup        SolaWing xcode-build-server 1.2.0 v
github.tarball_from archive
revision            0
platforms           {macosx any}
license             MIT
categories          devel python
maintainers         {woolsweater.net:macports @woolsweater} \
                    openmaintainer
supported_archs     noarch

description         Build Server Protocol implementation for Xcode projects

long_description    ${name} integrates Xcode with Apple's sourcekit-lsp. \
                    sourcekit-lsp doesn't itself support Xcode projects, but it does \
                    provide a Build Server Protocol client to work with other \
                    build systems. xcode-build-server implements a build \
                    server to provide sourcekit-lsp with the build \
                    information it needs for an Xcode project.

checksums           rmd160  c691dd2fc9c4a8010851038b47ea2e28f7321d3b \
                    sha256  dc2a7019e00ff0d2b0d8c2761900395b39fb69543b9278285d2e85bd57382531 \
                    size    21947

build {}

post-patch {
    reinplace "s|/usr/bin/env python3|${python.bin}|" \
        ${worksrcpath}/${name}
}

destroot {
    xinstall -d ${destroot}/${python.pkgd}/${name}
    xinstall -m 0755 {*}[glob ${worksrcpath}/*.py] ${destroot}/${python.pkgd}/${name}
    xinstall -d ${destroot}/${python.pkgd}/${name}/config
    xinstall -m 0755 {*}[glob ${worksrcpath}/config/*.py] ${destroot}/${python.pkgd}/${name}/config
    xinstall -d ${destroot}/${python.pkgd}/${name}/xcode
    xinstall -m 0755 {*}[glob ${worksrcpath}/xcode/*.js] ${destroot}/${python.pkgd}/${name}/xcode
    xinstall -m 0755 -W ${worksrcpath} ${name} ${destroot}/${python.pkgd}/${name}
    ln -s ${python.pkgd}/${name}/${name} ${destroot}${prefix}/bin/${name}
}
