Install this version:
emerge -a =net-print/epson-inkjet-printer-escpr2-9999
If this version is masked, you can unmask it using the autounmask tool or standard emerge options:
autounmask =net-print/epson-inkjet-printer-escpr2-9999
Or alternatively:
emerge --autounmask-write -a =net-print/epson-inkjet-printer-escpr2-9999
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DL_UUID="42a6470c-53bf-4993-abad-ba5b4a1d5d84"
MY_PV="${PV}-1"
DESCRIPTION="Epson ESC/P-R 2 generic Inkjet Printer Driver"
HOMEPAGE="https://support.epson.net/linux/Printer/LSB_distribution_pages/en/escpr2.php"
UA_STRING="Mozilla/5.0 (KHTML, like Gecko)"
if [[ ${PV} == *9999* ]] ; then
# Epson has started restricting downloads by checking the User Agent string, which results in SRC_URI failing to download.
# With the live build ("-9999") the source file will be downloaded but deleted after use instead of being in DISTDIR.
PROPERTIES="live"
MY_PV="1.2.38-1"
SRC_SHA256="655b9afc5ca7dcba939d67fac67edd0209fe94decd168b78c0503868fd94f7a1"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
RESTRICT="mirror"
else
# To get the (link for the) .tar.gz sources, which are identical to the .rpm sources for x86, go to the Epson Download Center
# https://download-center.epson.com/search/?language=en. Search for any supported printer, e.g. "XP-970", select
# "Linux Deb(ARM32)", any country, and under "Source Code" click "Proceed to download".
SRC_URI="https://download-center.epson.com/f/module/${DL_UUID}/${PN}-${MY_PV}.tar.gz"
KEYWORDS="amd64 arm arm64 x86"
RESTRICT="fetch"
fi
LICENSE="EPSON-EULA LGPL-2.1"
SLOT="0"
IUSE="escprlib velvet-paper"
RDEPEND="net-print/cups
!net-print/epson-inkjet-printer-escpr2-bin"
DEPEND="${RDEPEND}"
PATCHES=(
# Shamelessly copied from:
# https://aur.archlinux.org/packages/epson-inkjet-printer-escpr2/
# Patch URL: https://aur.archlinux.org/cgit/aur.git/commit/?h=epson-inkjet-printer-escpr2&id=8fbca325d6d39fa3ffe001f90a432380bdeacc2f
"${FILESDIR}/gcc-no-implicit-function-declaration-1.2.31.patch"
)
pkg_nofetch() {
einfo
einfo "Epson restricted download by blocking User Agent strings like the one wget uses."
einfo "This means you have to fetch the source file manually."
einfo
einfo "Please either visit the Epson Download Center to get the source file using your Internet browser:"
einfo " 1. Visit https://download-center.epson.com/search/?language=en"
einfo " 2. Search for your or any other supported printer, e.g. \"XP-970\"."
einfo " 3. Select \"Linux Deb(ARM 32Bit)\" and any country."
einfo " 4. Click \"Search\", a new page with the results will be loaded."
einfo " 5. Under \"Source Code\" there should be \"Epson Inkjet Printer Driver 2 (ESC/P-R) for Linux\"."
einfo " Simply click \"Proceed to download\" on the right."
einfo
einfo "Alternatively you may specify a browser User Agent string for the download:"
einfo " wget --user-agent=\"${UA_STRING}\" \\"
einfo " ${SRC_URI}"
einfo
einfo "Place the source file into your DISTDIR directory."
einfo
}
src_unpack() {
if [[ ${PV} == *9999* ]] ; then
# Epson has restricted downloads to certain User Agent strings, and sadly a download with wget fails with error 403 "forbidden".
# This whole function was specifically designed to fake the User Agent string to ensure the download succeeds.
#
# NOTE #1: This will download the driver to the temporary directory $T, it will therefore NOT be in DISTDIR (as specified in /etc/portage/make.conf)!
# NOTE #2: The User Agent string "Mozilla/5.0 (KHTML, like Gecko)" is for example used by the Falkon browser.
# NOTE #3: The hard-coded User Agent string in this ebuild ($UA_STRING at the top) must be adapted in case Epson blocks it once again.
#
local MY_A="${PN}-${MY_PV}.tar.gz"
local MY_SRC_URI="https://download-center.epson.com/f/module/${DL_UUID}/${MY_A}"
ewarn "Downloading with User Agent string \"${UA_STRING}\"..."
wget --user-agent="${UA_STRING}" -c "${MY_SRC_URI}" -P "${T}" || die "failed to fetch ${MY_SRC_URI}"
# check sha256sum
local sha256sum_present
sha256sum_present="$(sha256sum "${T}/${MY_A}" | cut -d ' ' -f 1)"
if [[ "${SRC_SHA256}" != "${sha256sum_present}" ]]; then
eerror "sha256sum mismatch for ${MY_A}"
eerror " expected ${SRC_SHA256}"
eerror " found ${sha256sum_present}"
die "sha256sum mismatch"
fi
ewarn "Source file ${MY_A} was downloaded successfully to the temporary build directory."
ewarn "BE AWARE that by default portage will deleted it as part of the cleanup."
unpack "${T}/${MY_A}"
local dirs
dirs="$(find "${WORKDIR}" -mindepth 1 -maxdepth 1 | wc -l)"
if [[ "${dirs}" -ne 1 ]]; then
die "unpack resulted in ${dirs} dirs in ${WORKDIR}"
fi
mv "${WORKDIR}"/* "${S}" || die "mv"
else
unpack "${A}"
fi
}
src_prepare() {
# the patch to re-enable Velvet Fine Art paper was provided by DerFetzer, see https://aur.archlinux.org/packages/epson-inkjet-printer-escpr2
if use velvet-paper; then
PATCHES+=( "${FILESDIR}/enable_velvet_fine_art_paper.patch" )
fi
default
eautoreconf
}
src_configure() {
econf --disable-shared
# Makefile calls ls to generate a file list which is included in Makefile.am
# Set the collation to C to avoid automake being called automatically
unset LC_ALL
export LC_COLLATE=C
}
src_install() {
emake -C ppd DESTDIR="${D}" install
if use escprlib ; then
emake -C escprlib DESTDIR="${D}" install
fi
emake -C src DESTDIR="${D}" install
einstalldocs
}
pkg_postinst() {
elog "The online user manual is available at:"
elog " https://download.ebz.epson.net/man/linux/escpr2.html"
}
Manage flags for this package:
euse -i <flag> -p net-print/epson-inkjet-printer-escpr2 |
euse -E <flag> -p net-print/epson-inkjet-printer-escpr2 |
euse -D <flag> -p net-print/epson-inkjet-printer-escpr2
net-print/cups
!net-print/epson-inkjet-printer-escpr2-bin
net-print/cups
!net-print/epson-inkjet-printer-escpr2-bin
| Type | File | Size | Source URLs |
|---|---|---|---|
| DIST | epson-inkjet-printer-escpr2-1.2.38-1.tar.gz | 6552683 bytes | https://download-center.epson.com/f/module/42a6470c-53bf-4993-abad-ba5b4a1d5d84/epson-inkjet-printer-escpr2-1.2.38-1.tar.gz |