1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils flag-o-matic multilib multilib-minimal udev user toolchain-funcs
9 # gphoto and v4l are handled by their usual USE flags.
10 # The pint backend was disabled because I could not get it to compile.
97 IUSE="doc gphoto2 ipv6 nls snmp systemd threads usb v4l xinetd zeroconf"
99 for backend in ${IUSE_SANE_BACKENDS}; do
101 # Disable backends that require parallel ports as no one has those anymore.
102 canon_pp|hpsj5s|mustek_pp|\
104 IUSE+=" -sane_backends_${backend}"
107 IUSE+=" sane_backends_${backend}"
110 IUSE+=" +sane_backends_${backend}"
115 sane_backends_mustek_usb2? ( threads )
116 sane_backends_kvs40xx? ( threads )
119 DESCRIPTION="Scanner Access Now Easy - Backends"
120 HOMEPAGE="http://www.sane-project.org/"
123 EGIT_REPO_URI="git://anonscm.debian.org/sane/sane-backends.git"
124 inherit git-r3 autotools
127 MY_P="${PN}-git${PV#*_pre}"
128 SRC_URI="http://www.sane-project.org/snapshots/${MY_P}.tar.gz
129 mirror://gentoo/${MY_P}.tar.gz"
135 SRC_URI="https://alioth.debian.org/frs/download.php/file/${FRS_ID}/${P}.tar.gz"
139 LICENSE="GPL-2 public-domain"
141 if [[ ${PV} != "9999" ]] ; then
142 KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux"
146 sane_backends_dc210? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
147 sane_backends_dc240? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
148 sane_backends_dell1600n_net? (
149 >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}]
150 >=media-libs/tiff-3.9.7-r1:0=[${MULTILIB_USEDEP}]
152 sane_backends_canon_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
153 sane_backends_hpsj5s? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
154 sane_backends_mustek_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
155 usb? ( >=virtual/libusb-1-r1:1=[${MULTILIB_USEDEP}] )
157 >=media-libs/libgphoto2-2.5.3.1:=[${MULTILIB_USEDEP}]
158 >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}]
160 v4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
161 xinetd? ( sys-apps/xinetd )
162 snmp? ( net-analyzer/net-snmp )
163 systemd? ( sys-apps/systemd:0= )
164 zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] )
168 v4l? ( sys-kernel/linux-headers )
171 dev-texlive/texlive-latexextra
173 >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
175 # We now use new syntax construct (SUBSYSTEMS!="usb|usb_device)
179 MULTILIB_CHOST_TOOLS=(
185 enewuser saned -1 -1 -1 scanner
189 cat >> backend/dll.conf.in <<-EOF
190 # Add support for the HP-specific backend. Needs net-print/hplip installed.
192 # Add support for the Epson-specific backend. Needs media-gfx/iscan installed.
195 epatch "${FILESDIR}"/${PN}-1.0.24-saned_pidfile_location.patch
196 epatch "${FILESDIR}"/${PN}-1.0.25-disable-usb-tests.patch
197 if [[ ${PV} == "9999" ]] ; then
198 mv configure.{in,ac} || die
199 AT_NOELIBTOOLIZE=yes eautoreconf
202 # Fix for "make check". Upstream sometimes forgets to update this.
203 local ver=$(./configure --version | awk '{print $NF; exit 0}')
205 -e "/by sane-desc 3.5 from sane-backends/s:sane-backends .*:sane-backends ${ver}:" \
206 testsuite/tools/data/html* || die
210 append-flags -fno-strict-aliasing
212 # if LINGUAS is set, just use the listed and supported localizations.
213 if [[ ${LINGUAS+set} == "set" ]]; then
216 printf '%s\n' ${LINGUAS} > po/LINGUAS
219 multilib-minimal_src_configure
222 multilib_src_configure() {
223 # the blank is intended - an empty string would result in building ALL backends.
226 use gphoto2 && BACKENDS="gphoto2"
227 use v4l && BACKENDS="${BACKENDS} v4l"
228 for backend in ${IUSE_SANE_BACKENDS}; do
229 if use "sane_backends_${backend}" && [ ${backend} != pnm ]; then
230 BACKENDS="${BACKENDS} ${backend}"
235 $(use_enable usb libusb_1_0)
236 $(multilib_native_use_with snmp)
239 # you can only enable this backend, not disable it...
240 if use sane_backends_pnm; then
241 myconf+=( --enable-pnm-backend )
244 myconf+=( --disable-latex )
246 if use sane_backends_mustek_pp; then
247 myconf+=( --enable-parport-directio )
249 if ! { use sane_backends_canon_pp || use sane_backends_hpsj5s || use sane_backends_mustek_pp; }; then
250 myconf+=( sane_cv_use_libieee1284=no )
253 # relative path must be used for tests to work properly
255 SANEI_JPEG="sanei_jpeg.o" SANEI_JPEG_LO="sanei_jpeg.lo" \
256 BACKENDS="${BACKENDS}" \
258 $(use_with gphoto2) \
259 $(multilib_native_use_with systemd) \
262 $(use_enable nls translations) \
263 $(use_enable threads pthread) \
264 $(use_enable zeroconf avahi) \
268 multilib_src_compile() {
269 emake VARTEXFONTS="${T}/fonts"
271 if tc-is-cross-compiler; then
272 pushd "${BUILD_DIR}"/tools >/dev/null || die
274 # The build system sucks and doesn't handle this properly.
275 # https://alioth.debian.org/tracker/index.php?func=detail&aid=314236&group_id=30186&atid=410366
276 tc-export_build_env BUILD_CC
277 ${BUILD_CC} ${BUILD_CPPFLAGS} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \
278 -I. -I../include -I"${S}"/include \
279 "${S}"/sanei/sanei_config.c "${S}"/sanei/sanei_constrain_value.c \
280 "${S}"/sanei/sanei_init_debug.c "${S}"/tools/sane-desc.c -o sane-desc || die
281 local dirs=( hal hotplug hotplug-ng udev )
284 hotplug/libsane.usermap
285 hotplug-ng/libsane.db
288 mkdir -p "${dirs[@]}" || die
289 emake "${targets[@]}"
296 tools/hotplug/libsane.usermap || die
300 multilib_src_install() {
301 emake INSTALL_LOCKPATH="" DESTDIR="${D}" install \
302 docdir="${EPREFIX}"/usr/share/doc/${PF}
304 if multilib_is_native_abi; then
306 insinto /etc/hotplug/usb
307 doins tools/hotplug/libsane.usermap
310 udev_newrules tools/udev/libsane.rules 41-libsane.rules
311 insinto "/usr/share/pkgconfig"
312 doins tools/sane-backends.pc
316 multilib_src_install_all() {
317 keepdir /var/lib/lock/sane
318 fowners root:scanner /var/lib/lock/sane
319 fperms g+w /var/lib/lock/sane
323 exeinto /etc/hotplug/usb
324 doexe tools/hotplug/libusbscanner
325 newdoc tools/hotplug/README README.hotplug
328 dodoc NEWS AUTHORS ChangeLog* PROBLEMS README README.linux
329 prune_libtool_files --all
331 insinto /etc/xinetd.d
332 doins "${FILESDIR}"/saned
335 newinitd "${FILESDIR}"/saned.initd saned
336 newconfd "${FILESDIR}"/saned.confd saned
341 elog "If you want remote clients to connect, edit"
342 elog "/etc/sane.d/saned.conf and /etc/hosts.allow"
345 elog "If you are using a USB scanner, add all users who want"
346 elog "to access your scanner to the \"scanner\" group."