kde-misc/kdiff3: use HTTPS for links to dev.gentoo.org
[gentoo.git] / app-misc / lcdproc / lcdproc-0.5.5.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=4
5 inherit multilib versionator
6
7 MY_PV=$(replace_version_separator 3 '-')
8 MY_P=${PN}-${MY_PV}
9 S=${WORKDIR}/${MY_P}
10
11 DESCRIPTION="Client/Server suite to drive all kinds of LCD (-like) devices"
12 HOMEPAGE="http://lcdproc.org/"
13 SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
18
19 IUSE="doc debug hid nfs samba seamless-hbars usb lirc irman joystick ftdi"
20
21 # The following array holds the USE_EXPANDed keywords
22 IUSE_LCD_DEVICES=(ncurses bayrad cfontz cfontz633 cfontzpacket
23         cwlinux eyeboxone g15 graphlcd glk
24         hd44780 icpa106 imon imonlcd iowarrior
25         lb216 lcdm001 lcterm
26         md8800 mdm166a ms6931 mtcs16209x mtxorb noritakevfd
27         pyramid sed1330 sed1520 serialvfd sli
28         stv5730 SureElec svga t6963 text tyan
29         ula200 xosd ea65 picolcd serialpos
30         i2500vfd irtrans lis shuttlevfd )
31
32 # Iterate through the array and add the lcd_devices_* that we support
33 NUM_DEVICES=${#IUSE_LCD_DEVICES[@]}
34 index=0
35 while [ "${index}" -lt "${NUM_DEVICES}" ] ; do
36         IUSE="${IUSE} lcd_devices_${IUSE_LCD_DEVICES[${index}]}"
37         let "index = ${index} + 1"
38 done
39
40 REQUIRED_USE="lcd_devices_mdm166a? ( hid )"
41
42 RDEPEND="
43         usb?      ( virtual/libusb:0 )
44         ftdi?     ( dev-embedded/libftdi:0 )
45         lirc?     ( app-misc/lirc )
46         irman?    ( media-libs/libirman )
47         hid?      ( >=dev-libs/libhid-0.2.16 )
48
49         lcd_devices_graphlcd?  ( app-misc/graphlcd-base  app-misc/glcdprocdriver )
50         lcd_devices_g15?       ( dev-libs/libg15  dev-libs/libg15render )
51         lcd_devices_ncurses?   ( sys-libs/ncurses )
52         lcd_devices_svga?      ( media-libs/svgalib )
53         lcd_devices_ula200?    ( dev-embedded/libftdi:0 )
54         lcd_devices_xosd?      ( x11-libs/xosd  x11-libs/libX11  x11-libs/libXext )
55         lcd_devices_cfontzpacket? ( virtual/libusb:0 )
56         lcd_devices_cwlinux?    ( virtual/libusb:0 )
57         lcd_devices_pyramid?    ( virtual/libusb:0 )
58         lcd_devices_picolcd?    ( virtual/libusb:0 )
59         lcd_devices_i2500vfd?   ( dev-embedded/libftdi:0 )
60         lcd_devices_lis?        ( dev-embedded/libftdi:0 virtual/libusb:0 )
61         lcd_devices_shuttlevfd? ( virtual/libusb:0 )"
62 DEPEND="${RDEPEND}
63         doc? ( app-text/xmlto
64                app-text/docbook-xml-dtd:4.5 )"
65 RDEPEND="${RDEPEND}
66         lcd_devices_g15?      ( app-misc/g15daemon )"
67
68 pkg_setup() {
69         if [ -n "${LCDPROC_DRIVERS}" ] ; then
70                 ewarn "Setting the drivers to compile via LCDPROC_DRIVERS is not supported anymore."
71                 ewarn "Please use LCD_DEVICES now and see emerge -pv output for the options."
72         fi
73 }
74
75 src_prepare() {
76         sed -i "37s:server/drivers:/usr/$(get_libdir)/lcdproc:" LCDd.conf || die
77         einfo "Patching LCDd.conf to use DriverPath=/usr/$(get_libdir)/lcdproc/"
78 }
79
80 src_configure() {
81         # This array contains the driver names required by configure --with-drivers=
82         # The positions must be the same as the corresponding use_expand flags
83         local DEVICE_DRIVERS=(curses bayrad CFontz CFontz633 CFontzPacket
84                 CwLnx EyeboxOne g15 glcdlib glk
85                 hd44780 icp_a106 imon imonlcd IOWarrior
86                 lb216 lcdm001 lcterm
87                 MD8800 mdm166a ms6931 mtc_s16209x MtxOrb NoritakeVFD
88                 pyramid sed1330 sed1520 serialVFD sli
89                 stv5730 SureElec svga t6963 text tyan
90                 ula200 xosd ea65 picolcd serialPOS
91                 i2500vfd irtrans lis shuttleVFD )
92
93         # Generate comma separated list of drivers
94         COMMA_DRIVERS=""
95         FIRST_DRIVER=""
96         local index=0
97
98         while [ "${index}" -lt "${NUM_DEVICES}" ] ; do
99                 if use "lcd_devices_${IUSE_LCD_DEVICES[${index}]}" ; then
100                         append-driver "${DEVICE_DRIVERS[${index}]}"
101                 fi
102                 let "index = ${index} + 1"
103         done
104
105         # Append the not-lcd-drivers (input)
106         use lirc && append-driver "lirc"
107         use irman && append-driver "irman"
108         use joystick && append-driver "joy"
109
110         if [ -z "${COMMA_DRIVERS}" ] ; then
111                 ewarn "You are compiling LCDd without support for any LCD drivers at all."
112         else
113                 # Patch the config to contain a driver that is actually installed instead of the default
114                 elog "Compiling the following drivers for LCDd: ${COMMA_DRIVERS}"
115                 elog "Setting Driver=${FIRST_DRIVER} in LCDd.conf"
116                 sed -i "53s:curses:${FIRST_DRIVER}:" LCDd.conf || die
117         fi
118
119         local EXTRA_CONF
120         if use lcd_devices_cfontzpacket || use lcd_devices_cwlinux || use lcd_devices_pyramid || \
121                 use lcd_devices_picolcd || use lcd_devices_lis || use lcd_devices_shuttlevfd ; then
122                 EXTRA_CONF="--enable-libusb"
123         else
124                 EXTRA_CONF="$(use_enable usb libusb)"
125         fi
126
127         if use lcd_devices_ula200 || use lcd_devices_i2500vfd || use lcd_devices_lis ; then
128                 EXTRA_CONF="${EXTRA_CONF} --enable-libftdi"
129         else
130                 EXTRA_CONF="${EXTRA_CONF} $(use_enable ftdi libftdi)"
131         fi
132
133         econf --enable-extra-charmaps \
134                 $(use_enable debug) \
135                 $(use_enable nfs stat-nfs) \
136                 $(use_enable samba stat-smbfs ) \
137                 $(use_enable seamless-hbars) \
138                 ${EXTRA_CONF} \
139                 "--enable-drivers=${COMMA_DRIVERS}"
140 }
141
142 src_compile() {
143         default
144
145         if use doc; then
146                 ebegin "Creating user documentation"
147                 cd "${S}"/docs/lcdproc-user
148                 xmlto html --skip-validation lcdproc-user.docbook
149                 eend $?
150
151                 ebegin "Creating dev documentation"
152                 cd "${S}"/docs/lcdproc-dev
153                 xmlto html --skip-validation lcdproc-dev.docbook
154                 eend $?
155         fi
156 }
157
158 append-driver() {
159         [[ -z $* ]] && return 0
160         if [ -z "${COMMA_DRIVERS}" ] ; then
161                 # First in the list
162                 COMMA_DRIVERS="$*"
163                 FIRST_DRIVER="$*"
164         else
165                 # Second, third, ... include a comma at the front
166                 COMMA_DRIVERS="${COMMA_DRIVERS},$*"
167         fi
168         return 0
169 }
170
171 src_install() {
172         emake DESTDIR="${D}" install
173
174         # move example clients installed to /usr/bin
175         rm -f "${D}"/usr/bin/{tail,lcdmetar,iosock,fortune,x11amp}.pl
176         insinto /usr/share/lcdproc/clients
177         doins clients/examples/*.pl
178         doins clients/metar/*.pl
179
180         newinitd "${FILESDIR}/0.5.1-LCDd.initd" LCDd
181         newinitd "${FILESDIR}/0.5.2-r2-lcdproc.initd" lcdproc
182
183         dodoc README CREDITS ChangeLog INSTALL TODO
184
185         if use doc; then
186                 insinto /usr/share/doc/${PF}/lcdproc-user
187                 doins docs/lcdproc-user/*.html
188                 insinto /usr/share/doc/${PF}/lcdproc-dev
189                 doins docs/lcdproc-dev/*.html
190         fi
191 }