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

name            libtheora
epoch           1
version         1.1.1
revision        3
checksums       rmd160  1d07234bd7e2296c61d6e30fe9816415aa7fd8e5 \
                sha256  b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc \
                size    1903175

categories      multimedia
platforms       darwin
license         BSD
maintainers     nomaintainer
description     Xiph.org Foundation's open video codec

long_description \
    Theora is an open video codec being developed by the \
    Xiph.org Foundation as part of their Ogg project (It is \
    a project that aims to integrate On2's VP3 video codec, \
    Ogg Vorbis audio codec and Ogg multimedia container \
    formats into a multimedia solution that can compete \
    with MPEG-4 format).

homepage        https://www.theora.org/
master_sites    https://ftp.osuosl.org/pub/xiph/releases/theora/
use_bzip2       yes

depends_build   port:autoconf \
                port:automake \
                port:libtool \
                port:pkgconfig

depends_lib     port:libogg

patchfiles      autogen.sh.patch \
                no-fforce-addr.patch \
                unversioned-docdir.patch

configure.env   SDL_CONFIG=/usr/bin/false \
                HAVE_PDFLATEX=no          \
                HAVE_DOXYGEN=no           \
                HAVE_BIBTEX=no            \
                HAVE_TRANSFIG=no

configure.args  --disable-asm \
                --disable-examples \
                --disable-oggtest \
                --disable-vorbistest

# configure and Makefile.in files were generated with ancient autotools
# versions (autoconf 2.63, automake 1.6.3, libtool 2.2.6). We need fixes
# from newer libtool, including the fix for the "Yosemite libtool bug"
# that misidentifies OS X 10.10 and later as Mac OS X 10.1, and the
# "Big Sur libtool bug" that does not identify macOS 11 or later at all.
configure.cmd   ./autogen.sh

minimum_xcodeversions   {8 2.5}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS CHANGES COPYING LICENSE README \
        ${destroot}${docdir}
}

test.run        yes
test.target     check

platform darwin powerpc {
    # http://trac.macports.org/ticket/13033
    # http://trac.macports.org/ticket/20141
    configure.args-delete   --disable-asm
    # https://trac.macports.org/ticket/64607
    configure.args-append   --build=powerpc-apple-darwin${os.major}
}

livecheck.type  regex
livecheck.url   [lindex ${master_sites} 0]
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"

