# Copyright 2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 DESCRIPTION="CUPS driver for Brother QL-570" HOMEPAGE="https://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=lpql570eus&os=131" SRC_URI="ql570cupswrapper-${PV}-0.i386.rpm ql570lpr-${PV}-0.i386.rpm" LPV="${PV}-0" LICENSE="" SLOT="0" KEYWORDS="amd64 x86" IUSE="" RESTRICT="fetch" DEPEND="net-print/cups" RDEPEND="${DEPEND}" BDEPEND="app-arch/rpm2targz" pkg_nofetch() { einfo "Please download" einfo " - ql570cupswrapper-${LPV}.i386.rpm" einfo " - ql570lpr-${LPV}.i386.rpm" einfo "from ${HOMEPAGE} and place them in your DISTDIR directory." } src_unpack() { mkdir "${P}" cd "${P}" for f in ${A}; do rpmunpack "../../distdir/${f}" || die "could not unpack ${f}" done } src_compile() { # modify install script to only dump out the embedded files INST=ql570cupswrapper-${LPV}.i386/opt/brother/PTouch/ql570/cupswrapper/cupswrapperql570pt1 sed -i -e '/^tmp_filter=/,/^cat <brother_ql570_printer_en.ppd' -e '/^brotherlpdwrapper=/,/^cat <brother_lpdwrapper_ql570' -e '/^chmod a+x/,$ d' "${INST}" || die "could not patch installer" # run the modified installer "${INST}" || die "installer failed" chmod 755 brother_lpdwrapper_ql570 rm ql570cupswrapper-${LPV}.i386/opt/brother/PTouch/ql570/cupswrapper/cupswrapperql570pt1 } src_install() { insinto /usr/share/cups/model/Brother/ doins brother_ql570_printer_en.ppd exeinto /usr/libexec/cups/filter/ doexe brother_lpdwrapper_ql570 dodir /opt/brother/PTouch/ql570/inf dodir /opt/brother/PTouch/ql570/lpd cp -R "${S}/ql570lpr-${LPV}.i386/opt" "${D}/" || die "LPR install failed" dodir /opt/brother/PTouch/ql570/cupswrapper cp -R "${S}/ql570cupswrapper-${LPV}.i386/opt" "${D}/" || die "cupswrapper install failed" dobin ql570lpr-${LPV}.i386/usr/bin/* }