Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/linux-gpib/
Date: Fri, 23 Dec 2016 19:46:53
Message-Id: 1482522327.bc91031b8b7c2b41be9de6cbf2828722124d8db4.dilfridge@gentoo
1 commit: bc91031b8b7c2b41be9de6cbf2828722124d8db4
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 23 19:29:51 2016 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 23 19:45:27 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc91031b
7
8 sci-libs/linux-gpib: Force-fix $D in installed udev rules, bug 590922
9
10 Package-Manager: portage-2.3.3
11
12 sci-libs/linux-gpib/linux-gpib-4.0.3-r1.ebuild | 210 +++++++++++++++++++++++++
13 1 file changed, 210 insertions(+)
14
15 diff --git a/sci-libs/linux-gpib/linux-gpib-4.0.3-r1.ebuild b/sci-libs/linux-gpib/linux-gpib-4.0.3-r1.ebuild
16 new file mode 100644
17 index 00000000..0e9d00a
18 --- /dev/null
19 +++ b/sci-libs/linux-gpib/linux-gpib-4.0.3-r1.ebuild
20 @@ -0,0 +1,210 @@
21 +# Copyright 1999-2016 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI=6
26 +
27 +PYTHON_COMPAT=( python2_7 )
28 +
29 +inherit readme.gentoo-r1 versionator eutils linux-mod autotools perl-functions python-single-r1 toolchain-funcs udev user
30 +
31 +DESCRIPTION="Kernel module and driver library for GPIB (IEEE 488.2) hardware"
32 +HOMEPAGE="http://linux-gpib.sourceforge.net/"
33 +SRC_URI="mirror://sourceforge/linux-gpib/${P}.tar.gz
34 + firmware? ( http://linux-gpib.sourceforge.net/firmware/gpib_firmware-2006-11-12.tar.gz )
35 +"
36 +
37 +LICENSE="GPL-2"
38 +SLOT="0"
39 +KEYWORDS="~amd64 ~arm ~x86"
40 +IUSE="isa pcmcia static debug guile perl php python tcl doc firmware"
41 +
42 +COMMONDEPEND="
43 + tcl? ( dev-lang/tcl:0= )
44 + guile? ( dev-scheme/guile:12 )
45 + perl? ( dev-lang/perl:= )
46 + php? ( dev-lang/php:= )
47 + python? ( ${PYTHON_DEPS} )
48 + firmware? ( sys-apps/fxload )"
49 +RDEPEND="${COMMONDEPEND}"
50 +DEPEND="${COMMONDEPEND}
51 + virtual/pkgconfig
52 + doc? ( app-text/docbook-sgml-utils )
53 + perl? ( virtual/perl-ExtUtils-MakeMaker )"
54 +
55 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
56 +
57 +PATCHES=(
58 + "${FILESDIR}"/${PN}-3.2.21-build.patch
59 + "${FILESDIR}"/${PN}-3.2.16-perl.patch
60 + "${FILESDIR}"/${PN}-4.0.3-reallydie.patch
61 +)
62 +
63 +pkg_setup () {
64 + use perl && perl_set_version
65 + use python && python_setup
66 + linux-mod_pkg_setup
67 +
68 + if kernel_is -lt 2 6 8; then
69 + die "Kernel versions older than 2.6.8 are not supported."
70 + fi
71 +
72 + # https://sourceforge.net/tracker/?func=detail&aid=3285657&group_id=42378&atid=432940
73 + if use pcmcia && kernel_is -ge 2 6 38; then
74 + die "pcmcia support is broken on kernels newer 2.6.38"
75 + fi
76 +}
77 +
78 +src_prepare () {
79 + default
80 + eautoreconf
81 +}
82 +
83 +src_configure() {
84 + set_arch_to_kernel
85 + econf \
86 + $(use_enable isa) \
87 + $(use_enable pcmcia) \
88 + $(use_enable static) \
89 + $(use_enable debug driver-debug) \
90 + $(use_enable guile guile-binding) \
91 + $(use_enable perl perl-binding) \
92 + $(use_enable php php-binding) \
93 + $(use_enable python python-binding) \
94 + $(use_enable tcl tcl-binding) \
95 + $(use_enable doc documentation) \
96 + --with-linux-srcdir=${KV_DIR}
97 +}
98 +
99 +src_compile() {
100 + set_arch_to_kernel
101 + FIRM_DIR=/usr/share/usb
102 + emake \
103 + DESTDIR="${D}" \
104 + INSTALL_MOD_PATH="${D}" \
105 + HOTPLUG_USB_CONF_DIR="${D}"/etc/hotplug/usb \
106 + UDEV_RULES_DIR="${D}$(get_udevdir)"/rules.d \
107 + USB_FIRMWARE_DIR="${D}"${FIRM_DIR} \
108 + docdir=/usr/share/doc/${PF}/html
109 +}
110 +
111 +src_install() {
112 + set_arch_to_kernel
113 + FIRM_DIR=/usr/share/usb
114 + emake \
115 + DESTDIR="${D}" \
116 + INSTALL_MOD_PATH="${D}" \
117 + HOTPLUG_USB_CONF_DIR="${D}"/etc/hotplug/usb \
118 + UDEV_RULES_DIR="${D}/$(get_udevdir)"/rules.d \
119 + USB_FIRMWARE_DIR="${D}"${FIRM_DIR} \
120 + docdir=/usr/share/doc/${PF}/html install
121 +
122 + if use perl; then
123 + einfo "Installing perl module"
124 + cd "${S}"/language/perl || die
125 + DESTDIR=${D} emake install
126 + perl_fix_packlist
127 + perl_delete_emptybsdir
128 + cd "${S}" || die
129 + fi
130 +
131 + echo "KERNEL==\"gpib[0-9]*\", MODE=\"0660\", GROUP=\"gpib\"" >> 99-gpib.rules
132 + udev_dorules 99-gpib.rules
133 +
134 + dodoc doc/linux-gpib.pdf ChangeLog AUTHORS README* NEWS
135 +
136 + insinto /etc
137 + newins util/templates/gpib.conf gpib.conf
138 + newins util/templates/gpib.conf gpib.conf.example
139 +
140 + if use pcmcia; then
141 + dodir /etc/pcmcia
142 + insinto /etc/pcmcia
143 + doins "${S}"/etc/pcmcia/*
144 + fi
145 +
146 + if use firmware; then
147 + insinto "${FIRM_DIR}"/agilent_82357a
148 + doins "${WORKDIR}"/gpib_firmware-2006-11-12/agilent_82357a/*
149 +
150 + insinto "${FIRM_DIR}"/ni_gpib_usb_b
151 + doins "${WORKDIR}"/gpib_firmware-2006-11-12/ni_gpib_usb_b/*
152 +
153 + insinto /usr/share/linux-gpib/hp_82341
154 + # do not install precompiled generate_firmware
155 + doins "${WORKDIR}"/gpib_firmware-2006-11-12/hp_82341/{*.bin,README}
156 + fi
157 +
158 + # fix rules files
159 + local f
160 + find "${D}$(get_udevdir)"/rules.d -type f -print0 | while read -rd '' f ; do
161 + grep -q "${D}" "${f}" && einfo "File ${f} contains a temporary path, fixing."
162 + sed -i -e "s:${D}:/:g" "${f}"
163 + done
164 +
165 + DOC_CONTENTS="
166 +You need to run the 'gpib_config' utility to setup the driver before
167 +you can use it. In order to do it automatically you can add to your
168 +start script something like this (supposing the appropriate driver
169 +is loaded on the startup):
170 +\n
171 + gpib_config --minor 0
172 +\n
173 +To give a user access to the computer's gpib board you will have to add
174 +them to the group 'gpib' or, you could change the permissions on the device
175 +files /dev/gpib[0-15] to something you like better, using 'chmod'
176 +\n
177 +Edit /etc/gpib.conf to match your interface board, and any devices you wish
178 +to open via ibfind(). See the documentation in /usr/share/linux-gpib/html for
179 +more information.
180 +\n
181 +"
182 +
183 + if use pcmcia; then
184 + DOC_CONTENTS+='
185 +For PCMCIA cards:\n
186 +All files needed for a PCMCIA board were copied to /etc/pcmcia.
187 +You may wish to edit the options passed to the gpib_config call in the
188 +/etc/pcmcia/linux-gpib-pcmcia script.
189 +You may need to send a SIGHUP signal to the cardmgr daemon to force it
190 +to reload the files in /etc/pcmcia \(alternatively you could use your
191 +pcmcia init.d script to restart the cardmgr, or you could just reboot\).
192 +The driver module will be loaded as needed by the cardmgr.
193 +
194 +'
195 + fi
196 +
197 + if use firmware; then
198 + DOC_CONTENTS+='
199 +For Agilent \(HP\) 82341C and 82341D cards:
200 +The firmware for these boards is uploaded by passing the appropriate
201 +firmware file from /usr/share/linux-gpib/hp_82341 directory to
202 +gpib_config using the -I or --init-data command line option. Example:\n
203 +gpib_config --minor 0 --init-data /usr/share/linux-gpib/hp_82341/hp_82341c_fw.bin
204 +'
205 + fi
206 +
207 + readme.gentoo_create_doc
208 +}
209 +
210 +pkg_preinst () {
211 + linux-mod_pkg_preinst
212 + use perl && perl_set_version
213 + enewgroup gpib
214 +}
215 +
216 +pkg_postinst () {
217 + linux-mod_pkg_postinst
218 + readme.gentoo_print_elog
219 +
220 + local v
221 + for v in ${REPLACING_VERSIONS}; do
222 + if ! version_is_at_least 3.2.21-r1 ${v}; then
223 + ewarn "sci-libs/linux-gpib-3.2.21-r1 introduces incompatible changes to the kernel"
224 + ewarn "interface. You may need to reboot to make sure the newly built driver modules"
225 + ewarn "are used (some of the driver modules cannot be unloaded)."
226 + ewarn "If you do not do this, every gpib call will just result in an error message."
227 + break
228 + fi
229 + done
230 +}