# SliTaz package receipt.

PACKAGE="cdrdao"
VERSION="1.2.3"
CATEGORY="multimedia"
SHORT_DESC="Records audio/data CD-Rs using toc files"
MAINTAINER="jozee@slitaz.org"
DEPENDS="gcc-lib-base lame libmad libvorbis libao"
BUILD_DEPENDS="lame-dev libmad-dev libvorbis-dev libao-dev libao libogg-dev"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://downloads.sourceforge.net/$PACKAGE" 
WGET_URL="$WEB_SITE/$TARBALL"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	for i in trackdb/*.cc ; do
		grep -q string.h $i && continue
		grep -q util.h $i || continue
		sed -i 's/"util.h"/&\n#include <string.h>/' $i
	done
	find -name '*.c' | xargs sed -i -e 's/getline/get_line/' \
		-e 's/fexecve/fexec_ve/' scsilib/include/schily.h
	grep -qs 'define u8' scsilib/libscg/scsi-linux-sg.c ||
	sed -i 's|#include <scsi/scsi.h>|#define u8 __u8\n&|' \
		scsilib/libscg/scsi-linux-sg.c
	patch -Np1 -i $stuff/$PACKAGE-$VERSION-stat.patch || return 1
	./configure --prefix=/usr --with-lame $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/bin
	cp -a $_pkg/usr/bin/cdrdao $fs/usr/bin
	cp -a $_pkg/usr/share $fs/usr
}