# -*- 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        erincatto box2d 3.1.1 v
github.tarball_from archive
revision            0

name                box2d
categories          devel
license             MIT

maintainers         {stromnov @stromnov} openmaintainer

description         Box2D Physics Engine
long_description    {*}${description}

homepage            https://box2d.org/

checksums           rmd160  52f2115370dd159d331ab82bb92cebc5be2d84c3 \
                    sha256  fb6ef914b50f4312d7d921a600eabc12318bb3c55a0b8c0b90608fa4488ef2e4 \
                    size    780115

compiler.c_standard 2017

configure.args-append \
                    -DBOX2D_UNIT_TESTS=OFF \
                    -DBOX2D_SAMPLES=OFF \
                    -DBOX2D_BENCHMARKS=OFF \
                    -DBOX2D_DOCS=OFF

# Upstream 3.1.1 installs CMake metadata but no pkg-config file.
post-destroot {
    xinstall -d ${destroot}${prefix}/lib/pkgconfig
    set pcfile [open ${destroot}${prefix}/lib/pkgconfig/box2d.pc w]
    puts ${pcfile} "prefix=${prefix}
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include

Name: box2d
Description: ${description}
Version: ${version}
Libs: -L\${libdir} -lbox2d
Libs.private: -lm
Cflags: -I\${includedir}"
    close ${pcfile}
}
