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

name                libaacs
version             0.11.1
revision            0
categories          multimedia
license             LGPL-2.1
maintainers         {i0ntempest @i0ntempest} openmaintainer
description         AACS support library for Blu-ray playback

long_description    Implementation of the Advanced Access Content System Specification

homepage            https://www.videolan.org/developers/libaacs.html
master_sites        https://download.videolan.org/pub/videolan/libaacs/${version}

use_bzip2           yes

depends_build       port:perl5 \
                    port:flex \
                    port:bison \
                    port:gettext

depends_lib         port:libgcrypt \
                    port:libgpg-error \
                    port:libiconv
                    
checksums           rmd160  960e9ce613c4c23dc90ff9df48476d71b6edfc0b \
                    sha256  a88aa0ebe4c98a77f7aeffd92ab3ef64ac548c6b822e8248a8b926725bea0a39 \
                    size    325669

platform macosx {
    # This chunk is only relevant for old systems.
    if {${configure.build_arch} in [list ppc ppc64] || ${os.major} < 10} {
        # Newer versions need blocks, which are not yet supported by gcc:
        # https://trac.macports.org/ticket/64909
        version     0.9.0
        checksums   rmd160  f96e4c6aa3c06c79bf8e023a5c02a8dead407259 \
                    sha256  47e0bdc9c9f0f6146ed7b4cc78ed1527a04a537012cf540cf5211e06a248bace \
                    size    316323
        # https://trac.macports.org/ticket/60782
        patchfiles  Makefile.in-0.9.0.diff
    } elseif {${os.major} == 10} {
        # Shameless copy from libsdl2
        # On Intel build requires at least 10.7.3 SDK, even when targeting 10.6
        set lion_sdkpath ${developer_dir}/SDKs/MacOSX10.7.sdk
        if {[file exists $lion_sdkpath]} {
            configure.sdkroot $lion_sdkpath
        } else {
            pre-fetch {
                error "Building $name @${version} on Mac OS X 10.6 requires the MacOSX10.7.sdk to be present in ${developer_dir}/SDKs/"
            }
        }
    }
}

configure.perl      ${prefix}/bin/perl5

configure.args-append \
                    --disable-silent-rules

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     libaacs (\[0-9.]+)