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

name                scons
version             4.8.1
revision            1
checksums           rmd160  9dd76ddd5b616214d5870d0579a947cda59c9303 \
                    sha256  cad573b329b6a5bc7e654b01f0231064acc979026af68a9e467ddb32bf2ee501 \
                    size    3244423

categories          devel python
supported_archs     noarch
platforms           {darwin any}
license             MIT
maintainers         {ryandesign @ryandesign} openmaintainer

description         A software construction tool
long_description    SCons is an Open Source software construction \
                    tool--that is, a next-generation build tool. Think \
                    of SCons as an improved, cross-platform substitute \
                    for the classic Make utility with integrated \
                    functionality similar to autoconf/automake and \
                    compiler caches such as ccache.

homepage            https://www.scons.org
master_sites        sourceforge:project/scons/scons/${version}
distname            SCons-${version}
worksrcdir          scons-${version}

# Keep the python version synchronized with ports that need extra python modules
# in their scons scripts, including: cantera
python.default_version \
                    313

patchfiles          python-interp.patch
post-patch {
    reinplace -W ${worksrcpath}/SCons/Utilities "1s|__PYTHON__|${python.bin}|" \
        ConfigureCache.py sconsign.py
}

post-destroot {
    xinstall -m 0755 -d \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} \
        LICENSE README.rst \
        ${destroot}${prefix}/share/doc/${name}
    file mkdir ${destroot}${python.prefix}/share/man/man1
    foreach manfile [glob -tails -directory ${worksrcpath} *.1] {
        copy ${worksrcpath}/${manfile} \
            ${destroot}${python.prefix}/share/man/man1/${manfile}
        ln -s ${python.prefix}/share/man/man1/${manfile} \
            ${destroot}${prefix}/share/man/man1/${manfile}
    }
}
