PortSystem 1.0

name		streamripper
version		1.64.6
categories	audio net
platforms	darwin
maintainers	nomaintainer
description	separate tracks via Shoutcasts title-streaming
long_description	Streamripper started as a way to separate \
	tracks via Shoutcasts title-streaming feature. This has   \
	now been expanded into a much more generic feature, where \
	part of the program only tries to hint at where one track \
	starts and another ends, thus allowing a mp3 decoding     \
	engine to scan for a silent mark, which is used to find   \
	an exact track separation.

homepage	http://streamripper.sourceforge.net/
master_sites	${homepage}/files/ sourceforge:${name}
checksums	md5 a37a1a8b8f9228522196a122a1c2dd32 \
		sha1 bc8a8d3ad045e0772ca691d2063c39efcc0dca45 \
		rmd160 3c010038f7be6959ada637b933feff2616915dba

depends_build	port:automake \
		port:pkgconfig

depends_lib	path:lib/pkgconfig/glib-2.0.pc:glib2 \
		port:libiconv \
		port:libogg \
		port:libvorbis

patchfiles	patch-libmad-0.15.1b__configure

post-patch {
    # Use newer config.guess and config.sub to support Apple Silicon.
    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}
    copy -force ${automake_dir}/config.guess ${automake_dir}/config.sub \
        ${worksrcpath}/libmad-0.15.1b
}

configure.args	--with-ogg=${prefix} --with-vorbis=${prefix} \
		--with-libiconv-prefix=${prefix} \
		--with-included-argv \
		--with-included-libmad \
		--with-included-tre \
		--mandir=${prefix}/share/man \
		--disable-rpath

# Fix implicit declaration of functions.
configure.cflags-append \
		-DANSI_PROTOTYPES

pre-destroot {
	file attributes ${worksrcpath}/install-sh -permissions +rx
}
post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath} CHANGES COPYING README THANKS \
		${destroot}${prefix}/share/doc/${name}
}
