PortSystem 1.0

name		madplay
version		0.15.2b
revision	4
categories	audio
license		GPL-2+
maintainers	nomaintainer
description	MPEG Audio Decoder
long_description	MAD is a high-quality MPEG audio decoder.  \
	It currently supports MPEG-1 as well as the \
	MPEG-2 extension to Lower Sampling Frequencies.  \
	All three audio layers (Layer I, Layer II, and Layer \
	III a.k.a. MP3) are fully implemented.
homepage	https://www.mars.org/home/rob/proj/mpeg/
master_sites	ftp://ftp.mars.org/pub/mpeg/
checksums	sha1 29105eb27c1416aa33c8d1ab3404a8e5f0aecd3f

patchfiles	patch-audio_carbon.c
configure.cflags-append	-I${prefix}/include
configure.args	--mandir=${prefix}/share/man --infodir=${prefix}/share/info

depends_lib	port:libid3tag port:esound \
		port:audiofile port:gettext \
		port:libmad port:zlib

platform darwin i386 {
	configure.cflags-append -msse
	configure.args-append --build=${build_arch}-apple-darwin${os.major}
}

# Update config.guess and config.sub to recognise arm64.
depends_build-append    port:automake
post-patch {
    set automake_dirs [glob -directory ${prefix}/share automake-*]
    set automake_dir [lindex [lsort -command vercmp $automake_dirs] end]
    copy -force ${automake_dir}/config.guess ${automake_dir}/config.sub \
        ${worksrcpath}
}
