From 572a46da0c04c6562770019ca215aec4f432aac6 Mon Sep 17 00:00:00 2001
From: Robert Buchholz <rbu@gentoo.org>
Date: Wed, 24 Jan 2007 22:27:14 +0000
Subject: Introduced LCD_DEVICES, moved drivers to /usr/lib/lcdproc (Portage
 version: 2.1.1-r2)

---
 app-misc/lcdproc/ChangeLog                         |  12 +-
 .../files/0.5.1-LCDd-conf-driver-path.patch        |   2 +
 .../lcdproc/files/0.5.1-nested-functions.patch     | 184 ++++++++++++++++++++
 app-misc/lcdproc/files/digest-lcdproc-0.5.1-r2     |   3 +
 app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild           |   6 +-
 app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild           |   6 +-
 app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild           | 191 +++++++++++++++++++++
 7 files changed, 396 insertions(+), 8 deletions(-)
 create mode 100644 app-misc/lcdproc/files/0.5.1-nested-functions.patch
 create mode 100644 app-misc/lcdproc/files/digest-lcdproc-0.5.1-r2
 create mode 100644 app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild

(limited to 'app-misc/lcdproc')

diff --git a/app-misc/lcdproc/ChangeLog b/app-misc/lcdproc/ChangeLog
index 1f5020018123..8cf675d1f66f 100644
--- a/app-misc/lcdproc/ChangeLog
+++ b/app-misc/lcdproc/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog for app-misc/lcdproc
-# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/ChangeLog,v 1.44 2006/12/26 14:45:09 gustavoz Exp $
+# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/ChangeLog,v 1.45 2007/01/24 22:27:14 rbu Exp $
+
+*lcdproc-0.5.1-r2 (24 Jan 2007)
+
+  24 Jan 2007; Robert Buchholz <rbu@gentoo.org>
+  +files/0.5.1-nested-functions.patch,
+  files/0.5.1-LCDd-conf-driver-path.patch, lcdproc-0.5.0-r2.ebuild,
+  lcdproc-0.5.1-r1.ebuild, +lcdproc-0.5.1-r2.ebuild:
+  Introduced LCD_DEVICES, moved drivers to /usr/lib/lcdproc
 
   26 Dec 2006; Gustavo Zacarias <gustavoz@gentoo.org>
   lcdproc-0.5.1-r1.ebuild:
diff --git a/app-misc/lcdproc/files/0.5.1-LCDd-conf-driver-path.patch b/app-misc/lcdproc/files/0.5.1-LCDd-conf-driver-path.patch
index fcc66fc2c97a..5da934ba8d84 100644
--- a/app-misc/lcdproc/files/0.5.1-LCDd-conf-driver-path.patch
+++ b/app-misc/lcdproc/files/0.5.1-LCDd-conf-driver-path.patch
@@ -1,3 +1,5 @@
+This patch is only used in 0.5.1-r1
+
 --- LCDd.conf.orig	2006-09-22 07:26:02.069860250 +0200
 +++ LCDd.conf	2006-09-22 07:26:12.458509500 +0200
 @@ -76,7 +76,7 @@
diff --git a/app-misc/lcdproc/files/0.5.1-nested-functions.patch b/app-misc/lcdproc/files/0.5.1-nested-functions.patch
new file mode 100644
index 000000000000..c1e986a4b958
--- /dev/null
+++ b/app-misc/lcdproc/files/0.5.1-nested-functions.patch
@@ -0,0 +1,184 @@
+Upstream patches to avoid nested functions (which need exec. stack)
+Included in >=0.5.1-r2
+
+--- ./server/parse.c	2006/04/27 15:11:00	1.21
++++ ./server/parse.c	2006/12/09 20:52:44	1.22
+@@ -62,18 +62,6 @@
+ 	int argpos = 0;
+ 	CommandFunc function = NULL;
+ 
+-	void close_arg() {
+-		if (argc >= MAX_ARGUMENTS-1) {
+-			error = 1;
+-		}
+-		else {
+-			argv[argc][argpos] = '\0';
+-			argv[argc+1] = argv[argc] + argpos + 1;
+-			argc++;
+-			argpos = 0;
+-		}
+-	}
+-
+ 	debug( RPT_DEBUG, "%s( str=\"%.120s\", client=[%d] )", __FUNCTION__, str, c->sock );
+ 
+ 	/* We will create a list of strings that is shorter or equally long as
+@@ -105,7 +93,15 @@
+ 			if (is_final(ch)) {
+ 				if (quote)
+ 					error = 2;
+-				close_arg();
++				if (argc >= MAX_ARGUMENTS-1) {
++					error = 1;
++				}
++				else {
++					argv[argc][argpos] = '\0';
++					argv[argc+1] = argv[argc] + argpos + 1;
++					argc++;
++					argpos = 0;
++				}
+ 				state = ST_FINAL;
+ 			}
+ 			else if (ch == '\\') {
+@@ -131,7 +127,15 @@
+ 			 	else {
+ 			 		error = 2;
+ 					/* alternative: argv[argc][argpos++] = ch; */
+-			 		close_arg();
++					if (argc >= MAX_ARGUMENTS-1) {
++						error = 1;
++					}
++					else {
++						argv[argc][argpos] = '\0';
++						argv[argc+1] = argv[argc] + argpos + 1;
++						argc++;
++						argpos = 0;
++					}
+ 			 		state = ST_FINAL;
+ 			 	}
+ 			}
+@@ -140,11 +144,27 @@
+ 			}	
+ 			else if (is_closing_quote(ch, quote)) {
+ 				quote = '\0';
+-				close_arg();
++				if (argc >= MAX_ARGUMENTS-1) {
++					error = 1;
++				}
++				else {
++					argv[argc][argpos] = '\0';
++					argv[argc+1] = argv[argc] + argpos + 1;
++					argc++;
++					argpos = 0;
++				}
+ 				state = ST_WHITESPACE;
+ 			}
+ 			else if (is_whitespace(ch) && (quote == '\0')) {
+-				close_arg();
++				if (argc >= MAX_ARGUMENTS-1) {
++					error = 1;
++				}
++				else {
++					argv[argc][argpos] = '\0';
++					argv[argc+1] = argv[argc] + argpos + 1;
++					argc++;
++					argpos = 0;
++				}
+ 				state = ST_WHITESPACE;
+ 			}	
+ 			else {
+--- ./shared/configfile.c	2006/09/18 10:39:21	1.16
++++ ./shared/configfile.c	2006/12/03 12:04:44	1.17
+@@ -49,7 +49,11 @@
+ static key *find_key(section *s, const char *keyname, int skip);
+ static key *add_key(section *s, const char *keyname, const char *value);
+ static char get_next_char_f(FILE *f);
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ static int process_config(section **current_section, char(*get_next_char)(), const char *source_descr, FILE *f);
++#else
++static int process_config(section **current_section, const char *source_descr, FILE *f);
++#endif
+ 
+ 
+ #ifdef WITH_LDAP_SUPPORT
+@@ -121,7 +125,11 @@
+ 		return -1;
+ 	}
+ 
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ 	result = process_config(&curr_section, get_next_char_f, filename, f);
++#else
++	result = process_config(&curr_section, filename, f);
++#endif
+ 
+ 	fclose(f);
+ 
+@@ -129,6 +137,7 @@
+ }
+ 
+ 
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ int config_read_string(const char *sectionname, const char *str)
+ /* All the config parameters are placed in the given section in memory.*/
+ {
+@@ -145,6 +154,7 @@
+ 
+ 	return process_config(&s, get_next_char, "command line", NULL);
+ }
++#endif
+ 
+ 
+ /** Get string from configuration in memory.
+@@ -584,12 +594,14 @@
+ }
+ 
+ 
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ static char get_next_char_f(FILE *f)
+ {
+ 	int c = fgetc(f);
+ 
+ 	return((c == EOF) ? '\0' : c);
+ }
++#endif
+ 
+ 
+ /* Parser states */
+@@ -614,10 +626,14 @@
+ #define MAXVALUELENGTH		200
+ 
+ 
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ static int process_config(section **current_section, char(*get_next_char)(), const char *source_descr, FILE *f)
++#else
++static int process_config(section **current_section, const char *source_descr, FILE *f)
++#endif
+ {
+ 	int state = ST_INITIAL;
+-	char ch;
++	int ch;
+ 	char sectionname[MAXSECTIONLABELLENGTH+1];
+ 	int sectionname_pos = 0;
+ 	char keyname[MAXKEYNAMELENGTH+1];
+@@ -629,11 +645,22 @@
+ 	int line_nr = 1;
+ 	int error = 0;
+ 
++#if !defined(LCDPROC_CONFIG_READ_STRING)
++	if (f == NULL)
++		return(0);
++#endif
++
+ 	while (state != ST_END) {
+ 
++#if defined(LCDPROC_CONFIG_READ_STRING)
+ 		ch = (f != NULL)
+ 			? get_next_char(f)
+ 			: get_next_char();
++#else
++		ch = fgetc(f);
++		if (ch == EOF)
++			ch = '\0';
++#endif
+ 
+ 		/* Secretly keep count of the line numbers */
+ 		if (ch == '\n')
\ No newline at end of file
diff --git a/app-misc/lcdproc/files/digest-lcdproc-0.5.1-r2 b/app-misc/lcdproc/files/digest-lcdproc-0.5.1-r2
new file mode 100644
index 000000000000..247c7eae1867
--- /dev/null
+++ b/app-misc/lcdproc/files/digest-lcdproc-0.5.1-r2
@@ -0,0 +1,3 @@
+MD5 ad13d6cce7a7e068d85a66d30285af95 lcdproc-0.5.1.tar.gz 800205
+RMD160 2672f660afac8437a9b6a1791bff80466cdfde64 lcdproc-0.5.1.tar.gz 800205
+SHA256 f459280eb4eeb70be584895364c97ffab22b888235b2351a31e1c87ca9710727 lcdproc-0.5.1.tar.gz 800205
diff --git a/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild b/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild
index 1660448996b5..5bff5a932b53 100644
--- a/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild
+++ b/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild,v 1.4 2006/12/06 11:42:59 jokey Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.5.0-r2.ebuild,v 1.5 2007/01/24 22:27:14 rbu Exp $
 
 WANT_AUTOCONF="latest"
 WANT_AUTOMAKE="latest"
@@ -40,7 +40,7 @@ EXTRA_DRIVERS="bayrad CFontz CFontz633 CFontzPacket CwLnx \
 ALL_DRIVERS="${USE_DRIVERS} ${EXTRA_DRIVERS}"
 
 
-# compatibility with 1.4-ebuild format
+# compatibility with 0.4-ebuild format
 LCDPROC_DRIVERS=${LCDPROC_DRIVERS//,/ }
 
 # if no drivers or all are set, select the defaults
diff --git a/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild b/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild
index 52f7d8540de4..cf4c10ee7b54 100644
--- a/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild
+++ b/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild,v 1.3 2006/12/26 14:45:09 gustavoz Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.5.1-r1.ebuild,v 1.4 2007/01/24 22:27:14 rbu Exp $
 
 WANT_AUTOCONF="latest"
 WANT_AUTOMAKE="latest"
@@ -41,7 +41,7 @@ EXTRA_DRIVERS="bayrad CFontz CFontz633 CFontzPacket CwLnx EyeboxOne \
 ALL_DRIVERS="${USE_DRIVERS} ${EXTRA_DRIVERS}"
 
 
-# compatibility with 1.4-ebuild format
+# compatibility with 0.4-ebuild format
 LCDPROC_DRIVERS=${LCDPROC_DRIVERS//,/ }
 
 # if no drivers or all are set, select the defaults
diff --git a/app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild b/app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild
new file mode 100644
index 000000000000..13f85e327627
--- /dev/null
+++ b/app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild
@@ -0,0 +1,191 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-misc/lcdproc/lcdproc-0.5.1-r2.ebuild,v 1.1 2007/01/24 22:27:14 rbu Exp $
+
+WANT_AUTOCONF="latest"
+WANT_AUTOMAKE="latest"
+inherit eutils autotools multilib
+
+DESCRIPTION="Client/Server suite to drive all kinds of LCD (-like) devices"
+HOMEPAGE="http://lcdproc.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~sparc ~x86"
+
+IUSE="doc debug ldap nfs samba seamless-hbars usb lirc irman joystick"
+
+# The following array holds the USE_EXPANDed keywords
+IUSE_LCD_DEVICES=(ncurses bayrad cfontz cfontz633 cfontzpacket
+	cwlinux eyeboxone g15 graphlcd glk
+	hd44780 icpa106 imon iowarrior
+	lb216 lcdm001 lcterm
+	md8800 ms6931 mtcs16209x mtxorb noritakevfd
+	pyramid sed1330 sed1520 serialvfd sli
+	stv5730 svga t6963 text tyan
+	ula200 xosd)
+
+# Iterate through the array and add the lcd_devices_* that we support
+NUM_DEVICES=${#IUSE_LCD_DEVICES[@]}
+index=0
+while [ "${index}" -lt "${NUM_DEVICES}" ] ; do
+	IUSE="${IUSE} lcd_devices_${IUSE_LCD_DEVICES[${index}]}"
+	let "index = ${index} + 1"
+done
+
+RDEPEND="
+	ldap?     ( net-nds/openldap )
+	usb?      ( dev-libs/libusb )
+	lirc?     ( app-misc/lirc )
+	irman?    ( media-libs/libirman )
+
+	lcd_devices_graphlcd?  ( app-misc/graphlcd-base  app-misc/glcdprocdriver )
+	lcd_devices_g15?      ( dev-libs/libg15  >=dev-libs/libg15render-1.1.1 )
+	lcd_devices_ncurses?   ( sys-libs/ncurses )
+	lcd_devices_svga?     ( media-libs/svgalib )
+	lcd_devices_ula200?   ( dev-embedded/libftdi  dev-libs/libusb )
+	lcd_devices_xosd?     ( x11-libs/xosd  x11-libs/libX11  x11-libs/libXext )
+	lcd_devices_cfontzpacket? ( dev-libs/libusb )
+	lcd_devices_cwlinux?    ( dev-libs/libusb )
+	lcd_devices_pyramid?  ( dev-libs/libusb )"
+DEPEND="${RDEPEND}
+	doc?      ( app-text/xmlto )"
+RDEPEND="${RDEPEND}
+	lcd_devices_g15?      ( app-misc/g15daemon )"
+
+
+pkg_setup() {
+	if [ -n "${LCDPROC_DRIVERS}" ] ; then
+		ewarn "Setting the drivers to compile via LCDPROC_DRIVERS is not supported anymore."
+		ewarn "Please use LCD_DEVICES now and see emerge -pv output for the options."
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	sed -i "79s:server/drivers:/usr/$(get_libdir)/lcdproc:" LCDd.conf
+	einfo "Patching LCDd.conf to use DriverPath=/usr/$(get_libdir)/lcdproc/"
+
+	epatch "${FILESDIR}/${PV}-as-needed.patch"
+	epatch "${FILESDIR}/${PV}-serialvfd-parallel.patch"
+	epatch "${FILESDIR}/${PV}-nested-functions.patch"
+	eautoreconf
+}
+
+src_compile() {
+	# This array contains the driver names required by configure --with-drivers=
+	# The positions must be the same as the corresponding use_expand flags
+	local DEVICE_DRIVERS=(curses bayrad CFontz CFontz633 CFontzPacket
+		CwLnx EyeboxOne g15 glcdlib glk
+		hd44780 icp_a106 imon IOWarrior
+		lb216 lcdm001 lcterm
+		MD8800 ms6931 mtc_s16209x MtxOrb NoritakeVFD
+		pyramid sed1330 sed1520 serialVFD sli
+		stv5730 svga t6963 text tyan
+		ula200 xosd)
+
+	# Generate comma separated list of drivers
+	COMMA_DRIVERS=""
+	FIRST_DRIVER=""
+	local index=0
+
+	while [ "${index}" -lt "${NUM_DEVICES}" ] ; do
+		if use "lcd_devices_${IUSE_LCD_DEVICES[${index}]}" ; then
+			append-driver "${DEVICE_DRIVERS[${index}]}"
+		fi
+		let "index = ${index} + 1"
+	done
+
+	# Append the not-lcd-drivers (input)
+	use lirc && append-driver "lirc"
+	use irman && append-driver "irman"
+	use joystick && append-driver "joy"
+
+	if [ -z "${COMMA_DRIVERS}" ] ; then
+		ewarn "You are compiling LCDd without support for any LCD drivers at all."
+	else
+		# Patch the config to contain a driver that is actually installed instead of the default
+		elog "Compiling the following drivers for LCDd: ${COMMA_DRIVERS}"
+		elog "Setting Driver=${FIRST_DRIVER} in LCDd.conf"
+		sed -i "44s:curses:${FIRST_DRIVER}:" LCDd.conf
+	fi
+
+	local ENABLEUSB
+	if use lcd_devices_cfontzpacket || use lcd_devices_cwlinux || use lcd_devices_pyramid; then
+		ENABLEUSB="--enable-libusb"
+	else
+		ENABLEUSB="$(use_enable usb libusb)"
+	fi
+
+	econf \
+		$(use_enable debug) \
+		$(use_enable ldap) \
+		$(use_enable nfs stat-nfs) \
+		$(use_enable samba stat-smbfs ) \
+		$(use_enable seamless-hbars) \
+		${ENABLEUSB} \
+		"--enable-drivers=${COMMA_DRIVERS}"  \
+		|| die "configure failed"
+
+	emake || die "make failed"
+
+	if use doc; then
+		ebegin "Creating user documentation"
+		cd ${S}/docs/lcdproc-user
+		xmlto html lcdproc-user.docbook
+		eend $?
+
+		ebegin "Creating dev documentation"
+		cd ${S}/docs/lcdproc-dev
+		xmlto html lcdproc-dev.docbook
+		eend $?
+	fi
+}
+
+append-driver() {
+	[[ -z $* ]] && return 0
+	if [ -z "${COMMA_DRIVERS}" ] ; then
+		# First in the list
+		COMMA_DRIVERS="$*"
+		FIRST_DRIVER="$*"
+	else
+		# Second, third, ... include a comma at the front
+		COMMA_DRIVERS="${COMMA_DRIVERS},$*"
+	fi
+	return 0
+}
+
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+
+	# move example clients installed to /usr/bin
+	rm -f "${D}"/usr/bin/{tail,lcdmetar,iosock,fortune,x11amp}.pl
+	insinto /usr/share/lcdproc/clients
+	doins clients/examples/*.pl
+	doins clients/metar/
+
+	# backwards compat with <lcdproc-0.5.1-r2
+	dosym ../../$(get_libdir)/lcdproc /usr/share/lcdproc/drivers
+
+	newinitd "${FILESDIR}/${PV}-LCDd.initd" LCDd
+	newinitd "${FILESDIR}/${PV}-lcdproc.initd" lcdproc
+
+	dodoc README CREDITS ChangeLog INSTALL TODO
+	dodoc docs/README.* docs/*.txt
+
+	if use doc; then
+		insinto /usr/share/doc/${PF}/lcdproc-user
+		doins docs/lcdproc-user/*.html
+		insinto /usr/share/doc/${PF}/lcdproc-dev
+		doins docs/lcdproc-dev/*.html
+	fi
+}
+
+pkg_postinst() {
+	ewarn "As of lcdproc-0.5.1-r2, having the drivers in /usr/share/lcdproc is deprecated."
+	ewarn "Please update your conf pointing to /usr/$(get_libdir)/lcdproc."
+}
-- 
cgit v1.2.3-65-gdbad