Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use GPL CUPS filter wrapper and revise all the ebuilds #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net-print/brother-dcp1510-bin/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DIST dcp1510cupswrapper-3.0.1-1.i386.rpm 18940 BLAKE2B 6816bba2076e873ab4392f3e283a8be178ceff9d75b54cf58ba996a6f97b595efaf98bbd7a7fbe8f88e3a9bde085e600e4e12933c964ed04a99e0855aef82ece SHA512 04414d6ff2e79a7126c1a5ca2be486a03bec1639cec3b883366c0723d642639da0b7e6dd7f87a49aeeaba868e9226372e613095a8ce36cbfd48bbaec5a1195a4
DIST dcp1510cupswrapper-GPL_src-3.0.1-1.tar.gz 17511 BLAKE2B 60c35fbfc526fc0732bc32865c5f4971df9265496e5a4f488bdf33832733d27efbe93a70e8b5641ed5010763a9e6c003f534df00adacad9d896d8bd7567d666e SHA512 f9a6d7b38ef988231e676ac4a3663281700a26d1f2f8ca63f12903906ce4f0dc5bae25c5e6bc4ac1fb0e191a9c21b6cff81b357c2a9f5e9263924fbcdffac518
DIST dcp1510lpr-3.0.1-1.i386.rpm 37915 BLAKE2B 0a0ace322963b2ea3f2d4813ba7b55f35a76fb4ed1993cc2bb6e5aacab2b152a2ec38905f2424976af5c51cf81483ba64f1458aaa1ffedd15fe554c803885e76 SHA512 a08b7075c1e7666b7c3d1b8eea41877fe5d81dbc81d1198653c16f190181a50b504cc2d2c4bd9f374314cd31c9386fc66f70bbc4d952c7deac5c7194e105d825
54 changes: 0 additions & 54 deletions net-print/brother-dcp1510-bin/brother-dcp1510-bin-3.0.1-r1.ebuild

This file was deleted.

114 changes: 114 additions & 0 deletions net-print/brother-dcp1510-bin/brother-dcp1510-bin-3.0.1_p1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# 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-1510"
HOMEPAGE="http://support.brother.com"
SRC_URI="http://www.brother.com/pub/bsc/linux/dlf/${BR_PN}lpr-${BR_PV}.i386.rpm
http://www.brother.com/pub/bsc/linux/dlf/${BR_PN}cupswrapper-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}/${BR_PN}cupswrapper-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"
cp "${SRC_CUPS_DIR}/PPD/${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"
cp "${SRC_CUPS_DIR}/filter/${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-dcp1510-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-1510</longdescription>
<use>
</use>
<!-- maintainer-needed -->
<longdescription>Brother DCP-1510 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>
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>