diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-07-23 11:47:34 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-07-23 11:47:34 +0100 |
commit | 96c18127d9c7d7a753387456363a6f564dbd024d (patch) | |
tree | eae0705ca6b2162fe2e18bcc5641f2385d7ffcdc /eclass/ecnij.eclass | |
parent | a682946240648ea27a30e07aaef46d0504e7566c (diff) |
net-print/cnijfilter-drivers : drop (merged into net-print/cnijfilter), net-print/cnijfilter-drivers : version bump
Diffstat (limited to 'eclass/ecnij.eclass')
-rw-r--r-- | eclass/ecnij.eclass | 180 |
1 files changed, 92 insertions, 88 deletions
diff --git a/eclass/ecnij.eclass b/eclass/ecnij.eclass index 57d599b3..b48714b1 100644 --- a/eclass/ecnij.eclass +++ b/eclass/ecnij.eclass @@ -1,13 +1,14 @@ # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: eclass/ecnij.eclass,v 3.4 2016/05/14 19:33:34 Exp $ +# $Header: eclass/ecnij.eclass,v 4.1 2016/11/14 19:33:34 Exp $ # @ECLASS: ecnij.eclass # @MAINTAINER: -# bar-overlay <bar@overlay.org> +# bar-overlay <bar-overlay@noreply.github.com> # @AUTHOR: # Original author: tokiclover <tokiclover@gmail.com> -# @BLURB: Provide a set of functions to get Canon(R) printers/scanners utilities +# @BLURB: Provide a set of functions to get CUPS backends, filters and utilities +# for Canon(R) Pixma/Pixus printer series # @DESCRIPTION: # Exports base functions used by ebuilds written # for net-print/cnijfilter package for canon(r) hardware @@ -17,13 +18,6 @@ _ECNIJ_ECLASS=1 inherit autotools eutils flag-o-matic multilib-build -# @ECLASS-VARIABLE: CANON_PRINTERS -# @DESCRIPTION: -# Global use-expand variable -# -# CANON_PRINTERS="ip90 ip 100" -: ${CANON_PRINTERS:=} - # @ECLASS-VARIABLE: PRINTER_MODEL # @DESCRIPTION: # Array of printer models supported by the ebuild @@ -36,46 +30,47 @@ inherit autotools eutils flag-o-matic multilib-build # PRINTER_ID=(303 253) : ${PRINTER_ID:=} -# @ECLASS-VARIABLE: PRINTER_USE -# @DESCRIPTION: -# Array containing the expanded use flags from PRINTER_MODEL -# PRINTER_USE=(canon_printers_ip{90,100}) -: ${PRINTER_USE:=} - -for card in ${PRINTER_MODEL[@]}; do - has ${card} ${CANON_PRINTERS} && - PRINTER_USE=(${PRINTER_USE[@]} +canon_printers_${card}) || - PRINTER_USE=(${PRINTER_USE[@]} canon_printers_${card}) -done - -IUSE="${IUSE} backends debug +drivers gtk servicetools +usb ${PRINTER_USE[@]}" +IUSE="${IUSE} +cups debug servicetools ${PRINTER_MODEL[@]/#/canon_printers_}" KEYWORDS="~x86 ~amd64" -REQUIRED_USE="${REQUIRED_USE} servicetools? ( gtk ) - || ( drivers backends ) drivers? ( || ( ${PRINTER_USE[@]} ) )" -( (( ${PV:0:1} > 3 )) || ( (( ${PV:0:1} == 3 )) && (( ${PV:2:2} >= 10 )) ) ) && -REQUIRED_USE+=" servicetools? ( net ) backends? ( || ( net usb ) )" || -REQUIRED_USE+=" backends? ( usb )" +REQUIRED_USE="${REQUIRED_USE} + || ( cups ${PRINTER_MODEL[@]/#/canon_printers_} )" +if (( ${PV:0:1} > 3 )) || ( (( ${PV:0:1} == 3 )) && (( ${PV:2:2} >= 10 )) ); then +IUSE="${IUSE} +net +usb" +REQUIRED_USE="${REQUIRED_USE} + servicetools? ( net ) cups? ( || ( net usb ) )" +SLOT="3/${PV}" +else +SLOT="2/${PV}" +fi LICENSE="GPL-2" has net ${IUSE} && LICENSE+=" net? ( CNIJFILTER )" RDEPEND="${RDEPEND} + >=net-print/cups-1.6.0[${MULTILIB_USEDEP}] app-text/ghostscript-gpl dev-libs/glib[${MULTILIB_USEDEP}] dev-libs/popt[${MULTILIB_USEDEP}] - servicetools? ( - gnome-base/libglade[${MULTILIB_USEDEP}] - dev-libs/libxml2[${MULTILIB_USEDEP}] ) media-libs/tiff[${MULTILIB_USEDEP}] media-libs/libpng[${MULTILIB_USEDEP}] - !backends? ( >=${CATEGORY}/${P}[${MULTILIB_USEDEP},backends] )" + !cups? ( >=${CATEGORY}/${P}[${MULTILIB_USEDEP},cups] )" -( (( ${PV:0:1} >= 3 )) || (( ${PV:2:2} >= 80 )) ) && +if (( ${PV:0:1} == 3 )) || ( (( ${PV:0:1} == 2 )) && (( ${PV:2:2} >= 80 )) ); then RDEPEND="${RDEPEND} - gtk? ( x11-libs/gtk+:2[${MULTILIB_USEDEP}] )" || + servicetools? ( + dev-libs/libxml2[${MULTILIB_USEDEP}] + gnome-base/libglade[${MULTILIB_USEDEP}] + x11-libs/gtk+:2[${MULTILIB_USEDEP}] + )" +elif (( ${PV:0:1} == 2 )); then RDEPEND="${RDEPEND} - gtk? ( x11-libs/gtk+:1[${MULTILIB_USEDEP}] )" + servicetools? ( + dev-libs/libxml2[${MULTILIB_USEDEP}] + gnome-base/libglade[${MULTILIB_USEDEP}] + x11-libs/gtk+:2[${MULTILIB_USEDEP}] + )" +fi DEPEND="${DEPEND} virtual/libintl" @@ -89,14 +84,16 @@ EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_ # Internal wrapper to handle subdir phase {prepare,config,compilation...} dir_src_command() { - local dirs="${1}" cmd="${2}" args="${3}" + local dirs=( ${1} ) cmd="${2}" args="${3}" (( $# < 2 )) && eeror "Invalid number of argument" && return 1 - for dir in ${dirs}; do + for dir in "${dirs[@]}"; do pushd ${dir} || die case "${cmd}" in (eautoreconf) [[ -d po ]] && echo "no" | glib-gettextize --force --copy + [[ ! -e configure.in ]] && [[ -e configures/configure.in.new ]] && + mv -f configures/configure.in.new configure.in ${cmd} ${args} ;; (econf) @@ -136,32 +133,36 @@ ecnij_pkg_setup() use abi_x86_32 && use amd64 && multilib_toolchain_setup "x86" - CNIJFILTER_SRC="libs pstocanonij" - PRINTER_SRC="cnijfilter" - use usb && CNIJFILTER_SRC+=" backend" - use_if_iuse net && CNIJFILTER_SRC+=" backendnet" - if use gtk; then - CNIJFILTER_SRC+=" cngpij" - if (( ${PV:0:1} == 4 )); then - PRINTER_SRC+=" lgmon2" - use net && PRINTER_SRC+=" cnijnpr" - else - PRINTER_SRC+=" lgmon cngpijmon" - use_if_iuse net && PRINTER_SRC+=" cngpijmon/cnijnpr" - fi + CNIJFILTER_SRC+=( libs pstocanonij ) + PRINTER_SRC+=( cnijfilter ) + use_if_iuse usb && CNIJFILTER_SRC+=( backend ) + use_if_iuse net && CNIJFILTER_SRC+=( backendnet ) + if ! has usb; then + (( ${PV:0:1} >= 3 )) || ( (( ${PV:0:1} == 2 )) && (( ${PV:2:2} >= 80 )) ) && + CNIJFILTER_SRC+=( backend ) fi - use servicetools && + CNIJFILTER_SRC+=( cngpij ) + if (( ${PV:0:1} == 4 )); then + PRINTER_SRC+=( lgmon2 ) + use_if_iuse net && PRINTER_SRC+=( cnijnpr ) + else + PRINTER_SRC+=( lgmon cngpijmon ) + use_if_iuse net && PRINTER_SRC+=( cngpijmon/cnijnpr ) + fi + + if use servicetools; then if (( ${PV:0:1} == 4 )); then - CNIJFILTER_SRC+=" cngpijmnt" + CNIJFILTER_SRC+=( cngpijmnt ) elif (( ${PV:0:1} == 3 )) && (( ${PV:2:2} >= 80 )); then - CNIJFILTER_SRC+=" cngpijmnt maintenance" + CNIJFILTER_SRC+=( cngpijmnt maintenance ) else - PRINTER_SRC+=" printui" + PRINTER_SRC+=( printui ) + fi fi if (( ${PV:0:1} == 4 )); then - PRINTER_SRC="bscc2sts ${PRINTER_SRC}" - CNIJFILTER_SRC="cmdtocanonij ${CNIJFILTER_SRC} cnijbe" + PRINTER_SRC=( bscc2sts "${PRINTER_SRC[@]}" ) + CNIJFILTER_SRC=( cmdtocanonij "${CNIJFILTER_SRC[@]}" cnijbe ) fi } @@ -173,6 +174,7 @@ ecnij_src_unpack() debug-print-function ${FUNCNAME} "${@}" default + mv ${PN}-* ${P} || die "Failed to unpack" cd "${S}" } @@ -188,20 +190,17 @@ ecnij_src_prepare() epatch_user - use backends && - dir_src_command "${CNIJFILTER_SRC}" "eautoreconf" + use cups && dir_src_command "${CNIJFILTER_SRC[*]}" "eautoreconf" local p pr prid for (( p=0; p<${#PRINTER_ID[@]}; p++ )); do pr=${PRINTER_MODEL[$p]} prid=${PRINTER_ID[$p]} if use canon_printers_${pr}; then mkdir ${pr} || die - for dir in ${prid} ${PRINTER_SRC}; do - cp -a ${dir} ${pr} || die - done + cp -a ${prid} "${PRINTER_SRC[@]}" ${pr} || die pushd ${pr} || die [[ -d ../com ]] && ln -s {../,}com - dir_src_command "${PRINTER_SRC}" "eautoreconf" + dir_src_command "${PRINTER_SRC[*]}" "eautoreconf" popd fi done @@ -214,16 +213,14 @@ ecnij_src_configure() { debug-print-function ${FUNCNAME} "${@}" - use backends && - dir_src_command "${CNIJFILTER_SRC}" "econf" + use cups && dir_src_command "${CNIJFILTER_SRC[*]}" "econf" local p pr prid for (( p=0; p<${#PRINTER_ID[@]}; p++ )); do pr=${PRINTER_MODEL[$p]} prid=${PRINTER_ID[$p]} if use canon_printers_${pr}; then pushd ${pr} || die - dir_src_command "${PRINTER_SRC}" \ - "econf" "--program-suffix=${pr}" + dir_src_command "${PRINTER_SRC[*]}" "econf" "--program-suffix=${pr}" popd fi done @@ -240,13 +237,12 @@ ecnij_src_compile() { pr=${PRINTER_MODEL[$p]} prid=${PRINTER_ID[$p]} if use canon_printers_${pr}; then pushd ${pr} || die - dir_src_command "${PRINTER_SRC}" "emake" + dir_src_command "${PRINTER_SRC[*]}" "emake" popd fi done - use backends && - dir_src_command "${CNIJFILTER_SRC}" "emake" + use cups && dir_src_command "${CNIJFILTER_SRC[*]}" "emake" } # @FUNCTION: ecnij_src_install @@ -258,19 +254,20 @@ ecnij_src_install() local abi_libdir=/usr/$(get_libdir) p pr prid local abi_lib=${abi_libdir#*lib} - local lib license lingua lng + local lib license lingua=false local -a DOCS (( ${#MULTILIB_COMPAT[@]} == 1 )) && abi_lib= - use backends && - dir_src_command "${CNIJFILTER_SRC}" "emake" "DESTDIR=\"${D}\" install" + use cups && + dir_src_command "${CNIJFILTER_SRC[*]}" "emake" "DESTDIR=\"${D}\" install" for (( p=0; p<${#PRINTER_ID[@]}; p++ )); do pr=${PRINTER_MODEL[$p]} prid=${PRINTER_ID[$p]} if use canon_printers_${pr}; then + lingua=true pushd ${pr} || die - dir_src_command "${PRINTER_SRC}" "emake" "DESTDIR=\"${D}\" install" + dir_src_command "${PRINTER_SRC[*]}" "emake" "DESTDIR=\"${D}\" install" popd dolib.so ${prid}/libs_bin${abi_lib}/*.so* @@ -279,17 +276,17 @@ ecnij_src_install() insinto /usr/share/cups/model doins ppd/canon${pr}.ppd - use_if_iuse doc && + if use_if_iuse doc; then for lingua in ${LINGUAS}; do - lng=${lingua^^[a-z]} - [[ -f lproptions/lproptions-${pr}-${PV}${lng}.txt ]] && - DOCS+=(lproptions/lproptions-${pr}-${PV}${lng}.txt) + lingua="${lingua^^[a-z]}" + [[ -f lproptions/lproptions-${pr}-${PV}${lingua}.txt ]] && + DOCS+=(lproptions/lproptions-${pr}-${PV}${lingua}.txt) done + fi fi done - use backends && - if use_if_iuse net; then + if use cups && use_if_iuse net; then pushd com/libs_bin${abi_lib} || die for lib in lib*.so; do [[ -L ${lib} ]] && continue || @@ -303,18 +300,17 @@ ecnij_src_install() doexe com/ini/cnnet.ini fi - use backends && - if (( ${PV:0:1} == 4 )); then + if use cups && (( ${PV:0:1} == 4 )); then mkdir -p "${ED}"/usr/share/${PN} || die mv "${ED}"/usr/share/{cmdtocanonij,${PN}} || die fi - if use drivers || use_if_iuse net; then + if ${lingua} || use_if_iuse net; then for lingua in ${LINGUAS}; do - lng=${lingua^^[a-z]} - license=LICENSE-${PN}-${PV}${lng}.txt - [[ -e ${license%${lng:0:1}.txt}.txt ]] && - mv -f ${license%{lng:0:1}.txt} ${license} + lingua="${lingua^^[a-z]}" + license=LICENSE-${PN}-${PV}${lingua}.txt + [[ -e ${license%${lingua:0:1}.txt}.txt ]] && + mv -f ${license%{lingua:0:1}.txt} ${license} [[ -e ${license} ]] && DOCS+=(${license}) done fi @@ -329,13 +325,21 @@ ecnij_pkg_postinst() { debug-print-function ${FUNCNAME} "${@}" + # XXX: set up ppd files to use newer CUPS backends + if (( ${PV:0:1} < 3 )) || ( (( ${PV:0:1} == 3 )) && (( ${PV:2:1} == 0 )) ); then + use cups || sed 's,cnij_usb,cnijusb,g' -i "${ED}"/usr/share/cups/model/canon*.ppd + fi + elog "To install a printer:" - elog " * First, restart CUPS: /etc/init.d/cupsd restart" + elog " * First, restart CUPS: 'service cupsd restart'" elog " * Go to http://127.0.0.1:631/ with your favorite browser" elog " and then go to Printers/Add Printer" + elog elog "You can consult the following for any issue/bug:" + elog + elog "${FILESDIR%/*}/README.md" elog "https://forums.gentoo.org/viewtopic-p-3217721.html" - elog "https://bugs.gentoo.org/show_bug.cgi?id=258244" + elog "https://bugs.gentoo.org/show_bug.cgi?id=130645" } fi |