# -*- 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.3.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  b5dfae46468edf61b8a00bb826005f62c65f2c46 \
                    sha256  92c4bb848af5c8128d4600a93f45e49b89ed953d885c60092459303a5d80e312 \
                    size    23291

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}
}
