# $MidnightBSD: trunk/audio/libsndfile/Makefile 16949 2014-09-07 17:48:56Z laffer1 $

PORTNAME=	libsndfile
PORTVERSION=	1.0.25
PORTREVISION=	2
CATEGORIES=	audio
MASTER_SITES=	http://www.mega-nerd.com/libsndfile/files/

MAINTAINER=	ports@MidnightBSD.org
COMMENT=	Reading and writing files containing sampled sound (like WAV or AIFF)

LICENSE=	lgpl2.1

USES=		gmake libtool:keepla pathfix pkgconfig
GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--disable-gcc-pipe \
		--disable-sqlite \
		--disable-alsa \
		--disable-octave
CPPFLAGS+=	-isystem /usr/include -isystem ${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib
USE_LDCONFIG=	yes

PORTDOCS=	AUTHORS ChangeLog NEWS README libsndfile.css \
		new_file_type.HOWTO libsndfile.jpg *.html

OPTIONS_DEFINE=	CPU_CLIP EXTERNAL DOCS
OPTIONS_DEFAULT=	EXTERNAL
CPU_CLIP_DESC=	Allow machine-dependent clipping
EXTERNAL_DESC=	Enable FLAC and Ogg Vorbis support

.include <bsd.mport.options.mk>

.if ${PORT_OPTIONS:MCPU_CLIP}
MANUAL_PACKAGE_BUILD=	WITH_CPU_CLIP may customize the package for the build machine
.else
CONFIGURE_ARGS+=	--disable-cpu-clip
.endif

.if ${PORT_OPTIONS:MEXTERNAL}
LIB_DEPENDS+=	libFLAC.so:${PORTSDIR}/audio/flac \
		libvorbis.so:${PORTSDIR}/audio/libvorbis
.else
CONFIGURE_ARGS+=--disable-external-libs
.endif

post-patch:
	@${REINPLACE_CMD} -e '/^SUBDIRS =/s/ doc / /g' ${WRKSRC}/Makefile.in

check regression-test test: build
	@cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} \
	check

post-install:
	@${MKDIR} ${DOCSDIR}
	@${TAR} -C ${WRKSRC}/doc --exclude "*Makefile*" --exclude "*.in" \
		-cf - . | ${TAR} -C ${DOCSDIR} --unlink -xf -

.include <bsd.port.mk>
