commit:     8aa2232c76f14cc548f443c5a85baa771630d957
Author:     Pavel Kretov <firegurafiku <AT> gmail <DOT> com>
AuthorDate: Fri Aug 11 23:32:43 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep  6 10:58:31 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8aa2232c

net-print/kyocera-1x2x-mfp-driver: New ebuild

This ebuild installs proprietary PPDs and filter program which make CUPS
work with old Kyocera printers of 1x2x MFP family:

 - Kyocera FS-1020MFP
 - Kyocera FS-1025MFP
 - Kyocera FS-1040
 - Kyocera FS-1060DN
 - Kyocera FS-1120MFP
 - Kyocera FS-1125MFP

Closes: https://bugs.gentoo.org/627802
Closes: https://github.com/gentoo/gentoo/pull/5416
Signed-off-by: Pavel Kretov <firegurafiku <AT> gmail.com>

 net-print/kyocera-1x2x-mfp-driver/Manifest         |   1 +
 .../files/rastertokpsl-fix.sh                      |   7 ++
 .../kyocera-1x2x-mfp-driver-1.1203-r1.ebuild       | 129 +++++++++++++++++++++
 net-print/kyocera-1x2x-mfp-driver/metadata.xml     |  20 ++++
 4 files changed, 157 insertions(+)

diff --git a/net-print/kyocera-1x2x-mfp-driver/Manifest 
b/net-print/kyocera-1x2x-mfp-driver/Manifest
new file mode 100644
index 00000000000..0ad7830db96
--- /dev/null
+++ b/net-print/kyocera-1x2x-mfp-driver/Manifest
@@ -0,0 +1 @@
+DIST LinuxDrv_1.1203_FS-1x2xMFP.zip 5392941 SHA256 
ee88eca053203d5ceec48f05ef7e99b45ca18afb72b91f0c94407ae5ee68f7c3 SHA512 
afbe237d25d784a6202be01669ccb5e1f0f9a6349b6b74227723905529f23da6d7880b25420b289277020450286d02f579722add5c0d48c839ac44152a60d1ab
 WHIRLPOOL 
5e87ca28c92e22840e0680c054d6f5d63f0905f5eed459a016ab42652a3e98a16ef390627ab8d2690f90bf9da98aef7d856571cc680567c6f81cc2d3ed76126a

diff --git a/net-print/kyocera-1x2x-mfp-driver/files/rastertokpsl-fix.sh 
b/net-print/kyocera-1x2x-mfp-driver/files/rastertokpsl-fix.sh
new file mode 100644
index 00000000000..af898459f65
--- /dev/null
+++ b/net-print/kyocera-1x2x-mfp-driver/files/rastertokpsl-fix.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# This file is a slightly modified version of 'rastertokpsl_wrapper' script
+# by Maxim Norin. See https://github.com/mnorin/kyocera-ppd-installer for
+# the original version.
+# Distributed under the terms of the GNU General Public License v2.
+jobname="$(echo "$3" | grep -Eo "[[:alnum:]]" | tr -d "\n" | tail -c 20)"
+/usr/libexec/cups/filter/rastertokpsl "$1" "$2" "${jobname}" "$4" "$5"

diff --git 
a/net-print/kyocera-1x2x-mfp-driver/kyocera-1x2x-mfp-driver-1.1203-r1.ebuild 
b/net-print/kyocera-1x2x-mfp-driver/kyocera-1x2x-mfp-driver-1.1203-r1.ebuild
new file mode 100644
index 00000000000..a235beae8bd
--- /dev/null
+++ b/net-print/kyocera-1x2x-mfp-driver/kyocera-1x2x-mfp-driver-1.1203-r1.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Printer descriptions (PPDs) and filters for Kyocera 1x2x MFP"
+HOMEPAGE="http://www.kyoceradocumentsolutions.eu";
+SRC_URI="LinuxDrv_${PV}_FS-1x2xMFP.zip"
+
+LICENSE="GPL-2 kyocera-mita-ppds"
+SLOT="0"
+
+KEYWORDS="-* ~amd64"
+
+IUSE_L10N=(en ar cs de el es fr he hu it ko pl pt ro ru th tr vi zh-CN zh-TW)
+IUSE="+rastertokpsl-fix ${IUSE_L10N[@]/#/l10n_}"
+REQUIRED_USE="|| ( ${IUSE_L10N[@]/#/l10n_} )"
+
+RDEPEND="net-print/cups"
+DEPEND="app-arch/unzip"
+RESTRICT="fetch mirror"
+QA_PREBUILT="/usr/libexec/cups/filter/rastertokpsl"
+
+get_tarball_name() {
+       # Note the capitalization inconsistency. Don't "fix" that.
+       case "$1" in
+               ar) echo arabic ;;
+               cs) echo czech ;;
+               de) echo German ;;
+               el) echo greek ;;
+               en) echo English ;;
+               es) echo Spanish ;;
+               fr) echo French ;;
+               he) echo hebrew ;;
+               hu) echo hungarian ;;
+               it) echo Italian ;;
+               ko) echo Korean ;;
+               pl) echo polish ;;
+               pt) echo Portuguese ;;
+               ro) echo romanian ;;
+               ru) echo russian ;;
+               th) echo thai ;;
+               tr) echo turkish ;;
+               vi) echo vietnamese ;;
+               zh-CN) echo simplified ;;
+               zh-TW) echo traditional ;;
+               *) die ;;
+       esac
+}
+
+pkg_nofetch() {
+       einfo "Please, navigate your browser to the following URL and manually"
+       einfo "download the file named '${A}', then put it into your DISTDIR."
+       einfo 
"https://www.kyoceradocumentsolutions.eu/index/service/dlc.false.driver.FS1025MFP._.EN.html";
+       einfo
+       einfo "Consider keeping a local copy of the file since there're chances"
+       einfo "the company is going to eventually stop hosting it for whatever"
+       einfo "reason."
+}
+
+src_unpack() {
+       unpack ${A}
+       S="${WORKDIR}/Linux/$(usex amd64 64bit 32bit)/Global"
+
+       cd "${S}" || die
+       local l10n
+       for l10n in ${L10N}; do
+               local language="$(get_tarball_name "${l10n}")"
+               unpack "./${language}.tar.gz"
+       done
+}
+
+src_prepare() {
+       eapply_user
+
+       # Original PPD files need patching, since they expect their filter
+       # program to reside under /usr/lib, but Gentoo uses /usr/libexec.
+
+       local orig="/usr/lib/cups/filter/rastertokpsl"
+       local repl="/usr/libexec/cups/filter/rastertokpsl"
+       if use rastertokpsl-fix; then
+               repl+="-fix.sh"
+       fi
+
+       sed -i "s|${orig}|${repl}|g" ./*/Kyocera*.ppd || die
+}
+
+src_install() {
+       insinto /usr/share/cups/model/KyoceraMita
+
+       install_with_l10n_suffix() {
+               local l10n="$1"; shift
+               local file
+               for file; do
+                       local bn="${file}"
+                       bn="${bn##*/}"
+                       bn="${bn%.ppd}"
+                       newins "${file}" "${bn}_${l10n}.ppd"
+               done
+       }
+
+       local l10n
+       for l10n in ${L10N}; do
+               local language="$(get_tarball_name "${l10n}")"
+               install_with_l10n_suffix "${l10n}" "./${language}"/Kyocera*.ppd
+       done
+
+       exeinto /usr/libexec/cups/filter
+
+       # Each unpacked tarball contains an exact copy of 'rastertokpsl',
+       # just take any of them.
+       local rasterfile="$(find -name rastertokpsl -print -quit)"
+       [[ $? -eq 0 && -n "${rasterfile}" ]] || die
+       doexe "${rasterfile}"
+
+       if use rastertokpsl-fix; then
+               doexe "${FILESDIR}/rastertokpsl-fix.sh"
+       fi
+
+       dodoc ../../Readme.htm
+
+       elog "This packages installs Kyocera's 'Readme.htm' file (see package"
+       elog "documentation directory) which lists several common problems and"
+       elog "workarounds. You might want to have a look on it."
+       elog "(Merging the package with 'rastertokpsl-fix' USE flag can save 
you"
+       elog "from getting some of these problems.)"
+       elog
+       elog "Hint: try socket:// protocol when configuring network printing."
+}

diff --git a/net-print/kyocera-1x2x-mfp-driver/metadata.xml 
b/net-print/kyocera-1x2x-mfp-driver/metadata.xml
new file mode 100644
index 00000000000..ebe2cdf388d
--- /dev/null
+++ b/net-print/kyocera-1x2x-mfp-driver/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+
+<pkgmetadata>
+       <maintainer type="person">
+               <email>fireguraf...@gmail.com</email>
+               <name>Pavel Kretov</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-ma...@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+
+       <use>
+               <flag name="rastertokpsl-fix">
+                       Use custom wrapper script to sanitize arguments before 
passing
+                       to 'rastertokpsl' filter program
+               </flag>
+       </use>
+</pkgmetadata>

Reply via email to