|
| 1 | +# Copyright 1999-2022 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +PYTHON_COMPAT=( python3_{8..10} ) |
| 7 | + |
| 8 | +inherit autotools flag-o-matic python-single-r1 |
| 9 | + |
| 10 | +DESCRIPTION="A small program that grabs information and displays it on an external LCD" |
| 11 | +HOMEPAGE="https://github.com/jmccrohan/lcd4linux/" |
| 12 | +SRC_URI="https://dev.gentoo.org/~conikost/files/${P}.tar.bz2" |
| 13 | + |
| 14 | +LICENSE="GPL-2" |
| 15 | +SLOT="0" |
| 16 | +KEYWORDS="~amd64 ~x86" |
| 17 | +IUSE="dmalloc outb" |
| 18 | +REQUIRED_USE=" |
| 19 | + ?? ( lcd_devices_hd44780 lcd_devices_hd44780-i2c ) |
| 20 | + python? ( ${PYTHON_REQUIRED_USE} ) |
| 21 | +" |
| 22 | + |
| 23 | +# Define the list of valid lcd devices. |
| 24 | +# Some drivers were removed from this list: |
| 25 | +# - lcdlinux: It's an ancient driver, which needs app-misc/lcd-linux, that made it never to the portage tree. |
| 26 | +# - lcdlinux: Besides, app-misc/lcd-linux won't compile on a modern linux kernel. |
| 27 | +# - st2205: It's needs dev-libs/libst2205, which made it never to the portage tree and is quite outdated. |
| 28 | +IUSE_LCD_DEVICES=( |
| 29 | + ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D DPF EA232graphic EFN FutabaVFD |
| 30 | + FW8888 G15 GLCD2USB HD44780 HD44780-I2C IRLCD LCD2USB LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 |
| 31 | + MatrixOrbital MatrixOrbitalGX MilfordInstruments MDM166A Newhaven Noritake NULL Pertelian PHAnderson |
| 32 | + PICGraphic picoLCD picoLCDGraphic PNG PPM RouterBoard Sample SamsungSPF serdisplib ShuttleVFD |
| 33 | + SimpleLCD T6963 TeakLCM Trefon ULA200 USBHUB USBLCD VNC WincorNixdorf X11 |
| 34 | +) |
| 35 | + |
| 36 | +# Define the list of valid lcd4linux plugins. |
| 37 | +# Some plugins were removed from this list: |
| 38 | +# - imon: Uses telmond, which is only available on a fli4l router or an eisfair server. |
| 39 | +# - ppp: It has been replaced by the netdev plugin. |
| 40 | +# - seti: SETI@home software was replaced by sci-misc/boinc, which is not compatible. |
| 41 | +# - xmms: XMMS software was replaced by media-sound/xmms2, which is not compatible. |
| 42 | +IUSE_LCD4LINUX_PLUGINS=( |
| 43 | + apm asterisk button-exec cpuinfo dbus diskstats dvb exec event |
| 44 | + fifo file gps hddtemp huawei i2c-sensors iconv isdn kvv |
| 45 | + loadavg meminfo mpd mpris-dbus mysql netdev netinfo pop3 |
| 46 | + proc-stat python qnaplog raspi sample statfs uname uptime |
| 47 | + w1retap wireless |
| 48 | +) |
| 49 | + |
| 50 | +# Add supported drivers from 'IUSE_LCD_DEVICES' to 'IUSE' and 'REQUIRED_USE' |
| 51 | +REQUIRED_USE+=" || ( " |
| 52 | +for LCD_DEVICE in "${IUSE_LCD_DEVICES[@]}"; do |
| 53 | + LCD_DEVICE=${LCD_DEVICE,,} |
| 54 | + IUSE+=" lcd_devices_${LCD_DEVICE} " |
| 55 | + REQUIRED_USE+=" lcd_devices_${LCD_DEVICE} " |
| 56 | +done |
| 57 | +REQUIRED_USE+=" ) " |
| 58 | +unset LCD_DEVICE |
| 59 | + |
| 60 | +# Add supported plugins from 'IUSE_LCD4LINUX_PLUGINS' to 'IUSE' and 'REQUIRED_USE' |
| 61 | +IUSE+=" ${IUSE_LCD4LINUX_PLUGINS[*]} " |
| 62 | +REQUIRED_USE+=" || ( ${IUSE_LCD4LINUX_PLUGINS[*]} ) " |
| 63 | + |
| 64 | +# Define dependencies for all drivers in 'IUSE_LCD_DEVICES' |
| 65 | +DEPEND_LCD_DEVICES=" |
| 66 | + lcd_devices_astusb? ( virtual/libusb:0= ) |
| 67 | + lcd_devices_bwct? ( virtual/libusb:0= ) |
| 68 | + lcd_devices_curses? ( sys-libs/ncurses:0= ) |
| 69 | + lcd_devices_dpf? ( virtual/libusb:0= ) |
| 70 | + lcd_devices_g15? ( virtual/libusb:0= ) |
| 71 | + lcd_devices_glcd2usb? ( virtual/libusb:0= ) |
| 72 | + lcd_devices_irlcd? ( virtual/libusb:0= ) |
| 73 | + lcd_devices_lcd2usb? ( virtual/libusb:0= ) |
| 74 | + lcd_devices_ledmatrix? ( virtual/libusb:0= ) |
| 75 | + lcd_devices_luise? ( |
| 76 | + dev-libs/luise |
| 77 | + virtual/libusb:0= |
| 78 | + ) |
| 79 | + lcd_devices_matrixorbitalgx? ( virtual/libusb:0= ) |
| 80 | + lcd_devices_mdm166a? ( virtual/libusb:0= ) |
| 81 | + lcd_devices_picolcd? ( virtual/libusb:0= ) |
| 82 | + lcd_devices_picolcdgraphic? ( virtual/libusb:0= ) |
| 83 | + lcd_devices_png? ( |
| 84 | + media-libs/gd[png] |
| 85 | + media-libs/libpng:0= |
| 86 | + ) |
| 87 | + lcd_devices_ppm? ( media-libs/gd ) |
| 88 | + lcd_devices_samsungspf? ( virtual/libusb:0= ) |
| 89 | + lcd_devices_serdisplib? ( dev-libs/serdisplib ) |
| 90 | + lcd_devices_shuttlevfd? ( virtual/libusb:0= ) |
| 91 | + lcd_devices_trefon? ( virtual/libusb:0= ) |
| 92 | + lcd_devices_ula200? ( |
| 93 | + dev-embedded/libftdi:1= |
| 94 | + virtual/libusb:0= |
| 95 | + ) |
| 96 | + lcd_devices_usbhub? ( virtual/libusb:0= ) |
| 97 | + lcd_devices_usblcd? ( virtual/libusb:0= ) |
| 98 | + lcd_devices_vnc? ( net-libs/libvncserver ) |
| 99 | + lcd_devices_x11? ( x11-libs/libX11 ) |
| 100 | +" |
| 101 | + |
| 102 | +# Define dependencies for all plugins in 'IUSE_LCD4LINUX_PLUGINS' |
| 103 | +DEPEND_LCD4LINUX_PLUGINS=" |
| 104 | + asterisk? ( net-misc/asterisk ) |
| 105 | + dbus? ( sys-apps/dbus ) |
| 106 | + gps? ( dev-libs/nmeap ) |
| 107 | + hddtemp? ( app-admin/hddtemp ) |
| 108 | + iconv? ( virtual/libiconv ) |
| 109 | + mpd? ( media-libs/libmpd ) |
| 110 | + mpris-dbus? ( sys-apps/dbus ) |
| 111 | + mysql? ( dev-db/mysql-connector-c:0= ) |
| 112 | + python? ( ${PYTHON_DEPS} ) |
| 113 | + wireless? ( |
| 114 | + || ( |
| 115 | + net-wireless/iw |
| 116 | + net-wireless/wireless-tools |
| 117 | + ) |
| 118 | + ) |
| 119 | +" |
| 120 | + |
| 121 | +RDEPEND=" |
| 122 | + dmalloc? ( dev-libs/dmalloc ) |
| 123 | + ${DEPEND_LCD_DEVICES} |
| 124 | + ${DEPEND_LCD4LINUX_PLUGINS} |
| 125 | +" |
| 126 | + |
| 127 | +DEPEND="${RDEPEND}" |
| 128 | + |
| 129 | +BDEPEND="sys-devel/autoconf-archive" |
| 130 | + |
| 131 | +PATCHES=( |
| 132 | + "${FILESDIR}/${P}-libtool.patch" # 783492 |
| 133 | + "${FILESDIR}/${P}-python3.patch" |
| 134 | +) |
| 135 | + |
| 136 | +pkg_setup() { |
| 137 | + use python && python-single-r1_pkg_setup |
| 138 | +} |
| 139 | + |
| 140 | +src_prepare() { |
| 141 | + default |
| 142 | + |
| 143 | + if use python; then |
| 144 | + # Shipped one is outdated and doesn't know python3, use system's instead. |
| 145 | + rm ax_python_devel.m4 |
| 146 | + |
| 147 | + # Use correct python version. |
| 148 | + # (See: bug #793869) |
| 149 | + append-libs $(python_get_LIBS) |
| 150 | + fi |
| 151 | + |
| 152 | + eautoreconf |
| 153 | +} |
| 154 | + |
| 155 | +src_configure() { |
| 156 | + # Enable all users enabled lcd devices |
| 157 | + local myeconfargs_lcd_devices |
| 158 | + for lcd_device in "${IUSE_LCD_DEVICES[@]}"; do |
| 159 | + if use "lcd_devices_${lcd_device,,}"; then |
| 160 | + myeconfargs_lcd_devices+=",${lcd_device}" |
| 161 | + fi |
| 162 | + done |
| 163 | + |
| 164 | + # Enable all users enabled lcd4linux plugins |
| 165 | + local myeconfargs_lcd4linux_plugins |
| 166 | + for lcd4linux_plugin in "${IUSE_LCD4LINUX_PLUGINS[@]}"; do |
| 167 | + if use "${lcd4linux_plugin}"; then |
| 168 | + myeconfargs_lcd4linux_plugins+=",${lcd4linux_plugin/-/_}" |
| 169 | + fi |
| 170 | + done |
| 171 | + |
| 172 | + local myeconfargs=( |
| 173 | + --disable-rpath |
| 174 | + $(use_with dmalloc) |
| 175 | + $(use_with outb) |
| 176 | + $(use_with python) |
| 177 | + $(use_with lcd_devices_x11 x) |
| 178 | + --with-drivers="${myeconfargs_lcd_devices#,}" |
| 179 | + --with-plugins="${myeconfargs_lcd4linux_plugins#,}" |
| 180 | + --x-include="/usr/include" |
| 181 | + --x-libraries="/usr/$(get_libdir)" |
| 182 | + ) |
| 183 | + |
| 184 | + econf "${myeconfargs[@]}" |
| 185 | +} |
| 186 | + |
| 187 | +src_install() { |
| 188 | + default |
| 189 | + |
| 190 | + # Install sample config, and must have 600, as lcd4linux checks this. |
| 191 | + insinto /etc/lcd4linux |
| 192 | + insopts -m 0600 |
| 193 | + doins lcd4linux.conf.sample |
| 194 | + |
| 195 | + newinitd "${FILESDIR}/lcd4linux-r2.initd" lcd4linux |
| 196 | +} |
| 197 | + |
| 198 | +pkg_postinst() { |
| 199 | + if [[ ! -z ${REPLACING_VERSIONS} ]]; then |
| 200 | + use python && einfo "Starting with this version, the python plugins now uses python3 instead of python2!" |
| 201 | + fi |
| 202 | +} |
0 commit comments