# -*- 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               cmake 1.1
PortGroup               github 1.0

github.setup            albertodemichelis squirrel 3.2 v
revision                0
checksums               rmd160  413d4360909a96eee4af053e426d7e21cb5a6565 \
                        sha256  211f1452f00b24b94f60ba44b50abe327fd2735600a7bacabc5b774b327c81db \
                        size    620486

categories              lang
license                 MIT
maintainers             nomaintainer

description             The Squirrel programming language

long_description        Squirrel is a high level imperative, \
                        object-oriented programming language, designed \
                        to be a light-weight scripting language that \
                        fits in the size, memory bandwidth, and \
                        real-time requirements of applications like \
                        video games.

set major               [lindex [split ${version} .] 0]
homepage                http://www.squirrel-lang.org
github.tarball_from     releases
master_sites-append     sourceforge:project/${name}/${name}${major}/${name}%20${version}%20stable/
distname                ${name}_[string map {. _} ${version}]_stable
worksrcdir              ${name}${major}

pre-patch {
    # Missing from tarball.
    # https://github.com/albertodemichelis/squirrel/issues/269
    copy ${filespath}/squirrel-config.cmake.in ${worksrcpath}

    # DOS to UNIX line endings so we can patch.
    reinplace -W ${worksrcpath} "s|\r||g" sq/CMakeLists.txt
}

patchfiles              no-LINKER_LANGUAGE.patch

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} COPYRIGHT HISTORY README ${destroot}${docdir}
    copy ${worksrcpath}/samples ${destroot}${docdir}/examples
}
