# -*- 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            cdparanoia
epoch           20050508
version         10.2
revision        3
categories      audio
maintainers     {jeremyhu @jeremyhu} openmaintainer
license         GPL-2+ LGPL-2.1+
description     An audio extraction tool for sampling CDs.
long_description    \
    Cdparanoia is a Compact Disc Digital Audio (CDDA) extraction tool, \
    commonly known on the net as a 'ripper'. The application is built \
    on top of the Paranoia library, which is doing the real work (the \
    Paranoia source is included in the cdparanoia source distribution). \
    Like the original cdda2wav, cdparanoia package reads audio from the \
    CDROM directly as data, with no analog step between, and writes the \
    data to a file or pipe in WAV, AIFC or raw 16 bit linear PCM. \
    Cdparanoia is a bit different than most other CDDA extraction \
    tools. It contains few-to-no 'extra' features, concentrating only \
    on the ripping process and knowing as much as possible about the \
    hardware performing it. Cdparanoia will read correct, rock-solid \
    audio data from inexpensive drives prone to misalignment, frame \
    jitter and loss of streaming during atomic reads. Cdparanoia will \
    also read and repair data from CDs that have been damaged in some \
    way. At the same time, however, cdparanoia turns out to be easy to \
    use and administrate. It has no compile time configuration, happily \
    autodetecting the CDROM, its type, its interface and other aspects \
    of the ripping process at runtime. A single binary can serve the \
    diverse hardware of the do-it-yourself computer laboratory from Hell...

# Original Mac OS X port mentioned here: http://www.livejournal.com/users/strangehours/9698.html
homepage        https://www.xiph.org/paranoia/
platforms       darwin

distname        cdparanoia-III-${version}
extract.suffix  .src.tgz
master_sites        https://ftp.osuosl.org/pub/xiph/releases/cdparanoia/
checksums           md5     b304bbe8ab63373924a744eac9ebc652 \
                    sha1    1901e20d3a370ca6afa4c76a9ef30d3f03044320 \
                    rmd160  d6c4ea9cc4aa4d5bcca4985e668ea6142d53cc55

patchfiles      osx_interface.patch \
                fixing-include.patch \
                fixing-labs.patch \
                fixing-fprintf.patch \
                configure.in.patch
patch.pre_args-replace  -p0 -p1

post-patch {
    move ${worksrcpath}/configure.guess ${worksrcpath}/config.guess
    move ${worksrcpath}/configure.sub ${worksrcpath}/config.sub
}

use_autoconf    yes

# The Makefile sets its own optimization flags as appropriate.
configure.optflags
# It doesn't need anything from ${prefix}/lib and it finds old versions of its own
# dynamic libraries there so don't let it look.
configure.ldflags

destroot.destdir    prefix=${destroot}${prefix}

platform darwin 8 {
    patchfiles-append   patch-paranoia_paranoia.c.10.4.diff
}

post-destroot {
    file delete ${destroot}${prefix}/include/utils.h
}

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