--- /usr/portage/app-misc/lcdproc/lcdproc-0.4.3.ebuild	2002-11-30 22:10:03.000000000 +0100
+++ lcdproc-0.4.3.ebuild	2003-01-05 15:16:15.000000000 +0100
@@ -2,37 +2,108 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /home/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.4.3.ebuild,v 1.3 2002/11/30 21:10:03 vapier Exp $
 
-DESCRIPTION="lcdproc - displays system status on Matrix-Orbital 20x4 LCD on a serial port."
+DESCRIPTION="Client/Server suite to drive all kinds of LCD (-like) devices"
+HOMEPAGE="http://lcdproc.org/"
 SRC_URI="mirror://sourceforge/lcdproc/${P}.tar.gz"
-HOMEPAGE="http://lcdproc.omnipotent.net/"
 
-SLOT="0"
+# By default, all drivers that are supported by the given plattform/hardware
+# are compiled (of course respecting the existing USE flags). If the 
+# LCDPROC_DRIVERS environment variable is set to a comma separated list, only 
+# the specified drivers will be compiled.
+# Example:
+#
+#   env LCDPROC_DRIVERS="curses,CFontz" emerge lcdproc
+#
+# NOTE: The ebuild still respects your USE variable and will not install any 
+# additional packages unless the corresponding USE flag is set!
+# You might have to alter it if e.g. ncurses is normally not part of your 
+# USE variable.
+# Example:
+#
+#   env USE="$USE ncurses" LCDPROC_DRIVERS="curses,CFontz" emerge lcdproc
+#
+
 LICENSE="GPL-2"
-KEYWORDS="~x86"
+SLOT="0"
+KEYWORDS="x86"
+
+IUSE="doc ncurses svga"
 
-DEPEND=">=sys-apps/baselayout-1.6.4"
+DEPEND=">=sys-apps/baselayout-1.6.4
+	doc? ( >=app-text/docbook-sgml-utils-0.6.11-r2 )
+	ncurses? ( >=sys-libs/ncurses-5.3 )
+	svga? ( >=media-libs/svgalib-1.4.3 )"
+	#A 'lirc' USE flag would be handy...
+
+S=${WORKDIR}/${P}
+
+src_unpack() {
+	unpack ${A} || die
+	cd ${S}
+
+	# fix a few bugs ;)
+	patch -p2 < ${FILESDIR}/${P}-gentoo.diff || die \
+		"Patch #1 failed."
+}
 
 src_compile() {
-	econf
-	make || die
+	local myconf
+	myconf="--enable-drivers=mtxorb,cfontz,text,lb216,\
+hd44780,joy,irman,lircin,bayrad,glk,stv5730,sed1330,sed1520,\
+lcdm001,t6963"
+	use ncurses && myconf="${myconf},curses"
+	use svga && myconf="${myconf},svgalib"
+
+	[ x"${LCDPROC_DRIVERS}" = x ] || \
+		myconf="--enable-drivers=${LCDPROC_DRIVERS}"
+
+	use samba && myconf="$myconf --enable-stat-smbfs"
+
+	./configure \
+		--host=${CHOST} \
+		--prefix=/usr \
+		--infodir=/usr/share/info \
+		--mandir=/usr/share/man \
+		--sysconfdir=/etc \
+		--enable-stat-nfs \
+		${myconf} || die "./configure failed"
+
+	emake || die "emake failed."
+	if [ `use doc` ]; then
+		cd ${S}/docs/lcdproc-user
+		docbook2html lcdproc-user.docbook
+	fi
 }
 
 src_install() {
-	exeinto /usr/local/bin
+	exeinto /usr/sbin
 	doexe server/LCDd
+	exeinto /usr/bin
 	doexe clients/lcdproc/lcdproc
 	doman docs/lcdproc.1
+	doman docs/LCDd.8
 	dodoc README ChangeLog COPYING INSTALL 
-	docinto docs
+	docinto olddocs
 	dodoc docs/README.dg* docs/*.txt
-	docinto clients/example
-	dodoc clients/examples/*.pl
-	docinto clients/headlines
-	dodoc clients/headlines/lcdheadlines
+	insinto /usr/share/doc/${PF}/clients/examples
+	doins clients/examples/*.pl
+	insinto /usr/share/doc/${PF}/clients/headlines
+	doins clients/headlines/lcdheadlines
+	if [ `use doc` ]; then
+		insinto /usr/share/doc/${PF}/lcdproc-user
+		doins docs/lcdproc-user/*.html
+	fi
+
+	# Starting from version 0.4.3 LCDproc comes with a config file
+	# for LCDd - the LCDproc server
+	insinto /etc
+	doins LCDd.conf
+	
+	# the lcdproc.conf file is currently only parsed by the lcdproc
+	# init script (which will porbably change in the future)
+	doins scripts/lcdproc.conf
 
-	# init.d & conf.d installation
 	exeinto /etc/init.d
-	doexe ${FILESDIR}/lcdproc
-	insinto /etc/conf.d
-	newins ${FILESDIR}/lcdproc.confd lcdproc
+	doexe ${FILESDIR}/LCDd
+	doexe ${FILESDIR}/lcdproc		
 }