# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name            libsdl
version         1.2.15-20220801
revision        1
categories      devel multimedia
platforms       {macosx any} freebsd
license         Permissive
maintainers     {jmr @jmroot} openmaintainer
description     Cross-platform multi-media development API

long_description \
    Simple DirectMedia Layer is a cross-platform multimedia library designed \
    to provide fast access to the graphics framebuffer and audio device. It is \
    used by MPEG playback software, emulators, and many popular games, including \
    the award winning Linux port of \"Civilization: Call To Power.\" Simple \
    DirectMedia Layer supports Linux, Win32, BeOS, Mac OS, Solaris, IRIX, and FreeBSD. \
    This port is a wrapper around either sdl12-compat or libsdl12.

homepage        https://www.libsdl.org/

distfiles

use_configure   no
universal_variant   yes
build           {}

variant compat conflicts legacy description {Use SDL2-based compatibility layer} {
    set ::dep_prefix ${prefix}/libexec/sdl12-compat
    depends_lib-append  port:sdl12-compat
}
variant legacy conflicts compat description {Use legacy SDL 1.2 library} {
    set ::dep_prefix ${prefix}/libexec/libsdl12
    depends_lib-append  port:libsdl12
}
if {![variant_isset compat] && ${os.platform} eq "darwin" && ${os.major} <= 17} {
    default_variants    +legacy
} elseif {![variant_isset legacy]} {
    default_variants    +compat
}

destroot {
    xinstall -d ${destroot}${prefix}/include/SDL \
                ${destroot}${prefix}/share/aclocal

    ln -s ${dep_prefix}/bin/sdl-config ${destroot}${prefix}/bin
    ln -s {*}[glob ${dep_prefix}/include/SDL/*] ${destroot}${prefix}/include/SDL
    ln -s {*}[glob ${dep_prefix}/lib/lib*] ${destroot}${prefix}/lib
    if {[variant_isset compat]} {
        ln -s ${dep_prefix}/lib/pkgconfig/sdl12_compat.pc ${destroot}${prefix}/lib/pkgconfig/sdl.pc
    } else {
        ln -s ${dep_prefix}/lib/pkgconfig/sdl.pc ${destroot}${prefix}/lib/pkgconfig
    }
    ln -s ${dep_prefix}/share/aclocal/sdl.m4 ${destroot}${prefix}/share/aclocal
}

livecheck.type  none
