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

name                sfml
version             2.5.1
revision            3
categories          multimedia devel
maintainers         gmail.com:rkitover openmaintainer
license             zlib

description         SFML is the Simple and Fast Multimedia Library

long_description    {*}${description}. It provides a simple interface to the various \
                    components of your computer, to ease the development of games and \
                    multimedia applications. It is composed of five modules: system, \
                    window, graphics, audio and network.

homepage            https://www.sfml-dev.org/
master_sites        https://www.sfml-dev.org/files/
distname            SFML-${version}-sources
use_zip             yes

checksums           rmd160  3b137887696a223f0c3576b16bae9f0e3535f16f \
                    sha256  bf1e0643acb92369b24572b703473af60bac82caf5af61e77c063b779471bb7f \
                    size    23283095

worksrcdir          SFML-${version}

depends_build-append path:bin/doxygen:doxygen

# and we are not using mesa because it uses X11
# (most users will not want this)

depends_lib-append  port:freetype \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libsndfile \
                    port:flac \
                    port:libogg \
                    port:libvorbis \
                    port:openal-soft

cmake.out_of_source yes

patchfiles          patch-apple-silicon.diff

configure.args-append \
                    -DSFML_USE_SYSTEM_DEPS=TRUE \
                    -DSFML_BUILD_DOC=TRUE \
                    -DCMAKE_FRAMEWORK_PATH=${frameworks_dir}

post-destroot {
    file mkdir ${destroot}${prefix}/share/doc/${name}
    move {*}[glob ${destroot}/usr/local/share/SFML/*.md] \
        ${destroot}${prefix}/share/doc/${name}
    move {*}[glob ${destroot}/usr/local/share/SFML/doc/*] \
        ${destroot}${prefix}/share/doc/${name}
    delete ${destroot}${prefix}/share/SFML/doc
    copy ${worksrcpath}/examples/ \
        ${destroot}${prefix}/share/doc/${name}/examples
}