Skip to content

Commit

Permalink
net-printer/brother-dcp1610w-bin: ebuild overhaul
Browse files Browse the repository at this point in the history
Follows guidelines of PR #88.

The CUPS driver is now compiled from GPL source code.

NOTES
=====

CUPS driver, PPD file, and filter wrapper:
- As of now, in the official download site, there's no GPL package
  available for this printer (aka source code).
- The CUPS driver is compiled from DCP-1510's source code, since the
  binary distributions provide the same driver.
- The PPD file and filter wrapper are from the binary distribution.

The notes of the latest DCP1510 commit apply here too, just exchange
DCP1510 with DCP1610W (i.e. filter_DCP1510 -> filter_DCP1610W, etc.).
  • Loading branch information
mehw committed Nov 6, 2019
1 parent 458f62f commit 61ed391
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 57 deletions.
1 change: 1 addition & 0 deletions net-print/brother-dcp1610w-bin/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DIST dcp1510cupswrapper-GPL_src-3.0.1-1.tar.gz 17511 BLAKE2B 60c35fbfc526fc0732bc32865c5f4971df9265496e5a4f488bdf33832733d27efbe93a70e8b5641ed5010763a9e6c003f534df00adacad9d896d8bd7567d666e SHA512 f9a6d7b38ef988231e676ac4a3663281700a26d1f2f8ca63f12903906ce4f0dc5bae25c5e6bc4ac1fb0e191a9c21b6cff81b357c2a9f5e9263924fbcdffac518
DIST dcp1610wcupswrapper-3.0.1-1.i386.rpm 19008 BLAKE2B 09540ae34457ac3b385133b9c850913fc29fa7fff71701480a76f8bc952da14555a82bf9c574e69dee308b55bfcf6e72fe494dfd083f5522929ee6b7fa98d8fd SHA512 c472c4d33a9d07da9cbb4a16a23aa046ad8f91589a43aadb22098a6862379653883aa060778e26c6b84c93fc3cd3037184434978f744b4a7250e83b903a1dc1b
DIST dcp1610wlpr-3.0.1-1.i386.rpm 37664 BLAKE2B d5a7ff59b02e07f9af6bc97bf452a47c20c24bc5a000b297680d3a74579fe0d550cfa188d0eb136b09caadbf8e0fd6eb9e44f1f796398a5a992101333340cea3 SHA512 8c10da582d28fb5ef129e3959258f69713b316813592ed832858cc938fb80b131bc4927437d7026c6446f89f286d8453da1ba2939157a145bcafa27e6efa2736
51 changes: 0 additions & 51 deletions net-print/brother-dcp1610w-bin/brother-dcp1610w-bin-3.0.1.ebuild

This file was deleted.

115 changes: 115 additions & 0 deletions net-print/brother-dcp1610w-bin/brother-dcp1610w-bin-3.0.1_p1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit eutils rpm linux-info

BR_PN="${PN/brother-/}"
BR_PN="${BR_PN/-bin/}"
BR_PV="${PV/-${PR}/}"
BR_PV="${BR_PV/_p/-}"

MODEL="${BR_PN^^}"

DESCRIPTION="Brother printer driver for DCP-1610W"
HOMEPAGE="http://support.brother.com"
SRC_URI="http://download.brother.com/welcome/dlf101535/${BR_PN}lpr-${BR_PV}.i386.rpm
http://download.brother.com/welcome/dlf101534/${BR_PN}cupswrapper-${BR_PV}.i386.rpm
http://www.brother.com/pub/bsc/linux/dlf/dcp1510cupswrapper-GPL_src-${BR_PV}.tar.gz"

LICENSE="GPL-2 brother-eula no-source-code"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="+metric debug"
RESTRICT="mirror strip"

DEPEND="net-print/cups"
RDEPEND="${DEPEND}
app-text/ghostscript-gpl
app-text/a2ps"

S="${WORKDIR}"
PAPER_TYPE="Letter"
DEST="/opt/brother/Printers/${MODEL}"
CUPS_PPD_PATH="/usr/share/cups/model/brother"
CUPS_FILTER_PATH="/usr/libexec/cups/filter"
RC_FILE="br${MODEL}rc"
PPD_FILE="brother-${MODEL}-cups-en.ppd"
CUPS_WRAPPER="brother_lpdwrapper_${MODEL}"
SRC_LPR_DIR="${S}${DEST}"
SRC_CUPS_DIR="${S}/dcp1510cupswrapper-GPL_src-${BR_PV}"

pkg_setup() {
CONFIG_CHECK=""
if use amd64; then
CONFIG_CHECK="${CONFIG_CHECK} ~IA32_EMULATION"
fi

linux-info_pkg_setup
}

src_prepare() {
default

# Install CUPS PPD and filter wrapper to their respective locations
mkdir -p "${S}${CUPS_PPD_PATH}" || die "Creating CUPS PPD install location failed"
mv "${SRC_LPR_DIR}/cupswrapper/${PPD_FILE}" "${S}${CUPS_PPD_PATH}/${MODEL}.ppd" || die "Preparing CUPS PPD file failed"
mkdir -p "${S}${CUPS_FILTER_PATH}" || die "Creating CUPS filter wrapper install location failed"
mv "${SRC_LPR_DIR}/cupswrapper/${CUPS_WRAPPER}" "${S}${CUPS_FILTER_PATH}" || die "Preparing CUPS filter wrapper failed"

einfo "Fixing ${CUPS_WRAPPER} PPD file path"
sed -i "s|/usr/share/cups/model/|${CUPS_PPD_PATH}/|" \
"${S}${CUPS_FILTER_PATH}/${CUPS_WRAPPER}" || die "Fixing ${CUPS_WRAPPER} PPD file path failed"
}

src_configure() {
if use metric; then
PAPER_TYPE="A4"
fi

sed -ri "s/^(PaperType=).*$/\1${PAPER_TYPE}/" \
"${SRC_LPR_DIR}/inf/${RC_FILE}" || die "Changing LPR paper type in rc file failed"

if use debug; then
sed -i -e 's:^\(DEBUG\)=0:\1=1:' \
"${S}${CUPS_FILTER_PATH}/${CUPS_WRAPPER}" || die "Enabling CUPS filter wrapper debug output failed"
fi
}

src_compile() {
cd "${SRC_CUPS_DIR}/brcupsconfig"
emake brcupsconfig
}

src_install() {
insinto "${DEST}"
doins -r "${SRC_LPR_DIR}/"* || die
fperms -R 755 "${DEST}/lpd" || die
fperms 755 "${DEST}/inf/braddprinter" || die
fperms 755 "${DEST}/inf/setupPrintcap" || die

exeinto "${DEST}/cupswrapper"
newexe "${SRC_CUPS_DIR}/brcupsconfig/brcupsconfig" brcupsconfig4 || die

insinto "${CUPS_PPD_PATH}"
doins "${S}${CUPS_PPD_PATH}/"* || die

exeinto "${CUPS_FILTER_PATH}"
doexe "${S}${CUPS_FILTER_PATH}/"* || die
}

pkg_postinst() {
elog "Set paper type to ${PAPER_TYPE} in ${DEST}/inf/${RC_FILE}."
elog
if use debug; then
elog "Set DEBUG=1 in ${CUPS_FILTER_PATH}/${CUPS_WRAPPER}."
elog
fi
elog "Debug output can be controlled setting the DEBUG var in"
elog "${CUPS_FILTER_PATH}/${CUPS_WRAPPER}."
elog "Allowed values go from 0 (no debug) to 4. The script is"
elog "able to accept the option force-debug=<level 1 to 4>."
elog
elog "A log file will be saved in /tmp when DEBUG is set."
}
12 changes: 6 additions & 6 deletions net-print/brother-dcp1610w-bin/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!--
# $Id$
-->
<pkgmetadata>
<longdescription>Printer driver for Brother DCP-1610W</longdescription>
<use>
</use>
<!-- maintainer-needed -->
<longdescription>Brother DCP-1610W lpr+cupswrapper (printer) drivers</longdescription>
<use>
<flag name="metric">Use A4 as default paper type, instead of Letter.</flag>
<flag name="debug">Default DEBUG=1 in wrapper script to save a log in /tmp</flag>
</use>
</pkgmetadata>

0 comments on commit 61ed391

Please sign in to comment.