# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # Changelog since last bugzilla upload # # fixed 'servicetools' dependencies # it now tells 'amd64' users why 'servicetools' currently won't compile and how to fix this # added neccessary check of the 'LINGUAS'-variable # inherit eutils rpm flag-o-matic multilib DESCRIPTION="Canon InkJet Printer Driver for Linux (Pixus/Pixma-Series)." HOMEPAGE="ftp://download.canon.jp/pub/driver/bj/linux/" RESTRICT="nomirror confcache" SRC_URI="${HOMEPAGE}${PN}-common-${PV}-1.src.rpm" LICENSE="???" # GPL-2 source and proprietary binaries SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="amd64 unstablecups servicetools ip2200 ip4200 ip6600d ip7500 mp500" DEPEND="virtual/ghostscript >=net-print/cups-1.1.14 !amd64? (sys-libs/glibc >=dev-libs/popt-1.6 >=media-libs/tiff-3.4 >=media-libs/libpng-1.0.9) amd64? (>=app-emulation/emul-linux-x86-bjdeps-0.1 app-emulation/emul-linux-x86-compat app-emulation/emul-linux-x86-baselibs) servicetools? (!amd64? (>=gnome-base/libglade-0.6 >=dev-libs/libxml-1.8 >=x11-libs/gtk+-1.2) amd64? (>=app-emulation/emul-linux-x86-bjdeps-0.2 app-emulation/emul-linux-x86-gtklibs))" # >=automake-1.6.3 # Arrays of supported Printers, there IDs and compatible models _pruse=("ip2200" "ip4200" "ip6600d" "ip7500" "mp500") _prname=(${_pruse[@]}) _prid=("256" "260" "265" "266" "273") _prcomp=("ip1600/2200 mp150/170/450" "ip4200 mp500" "ip6600d/6600pd" "ip7500" "ip4200 mp500") _max=$((${#_pruse[@]}-1)) # used for iterating through these arrays ### # Standard Ebuild-functions ### pkg_setup() { if [ -z "$LINGUAS" ]; then # -z tests to see if the argument is empty ewarn "You didn't specify 'LINGUAS' in your make.conf. Assuming" ewarn "english localisation, i.e. 'LINGUAS=\"en\"'." LINGUAS="en" fi if (use amd64 && use servicetools); then eerror "You can't build this package with 'servicetools' on amd64," eerror "because you would need to compile '>=gnome-base/libglade-0.6'" eerror "and '>=dev-libs/libxml-1.8' with 'export ABI=x86' first." eerror "That's exactly what 'emul-linux-x86-bjdeps-0.1' does with" eerror "'dev-libs/popt-1.6'. I encourage you to adapt this ebuild" eerror "to build 32bit versions of 'libxml' and 'libglade' too!" die "servicetools not yet available on amd64" fi use amd64 && export ABI=x86 use amd64 && append-flags -L/emul/linux/x86/lib -L/emul/linux/x86/usr/lib -L/usr/lib32 _prefix="/usr/local" _bindir="/usr/local/bin" _libdir="/usr/$(get_libdir)" _ppddir="/usr/share/cups/model" if (use unstablecups); then _prefix="/usr" _bindir="/usr/bin" _libdir="/usr/libexec" fi einfo "" einfo " USE-flags\t(description / probably compatible printers)" einfo "" einfo " amd64\t(basic support for this architecture - currently without servicetools)" einfo " servicetools\t(additional monitoring and maintenance software)" einfo " unstablecups\t(support for new versions of CUPS)" _autochoose="true" for i in `seq 0 ${_max}`; do einfo " ${_pruse[$i]}\t${_prcomp[$i]}" if (use ${_pruse[$i]}); then _autochoose="false" fi done einfo "" if (${_autochoose}); then ewarn "You didn't specify any driver model (set it's USE-flag)." einfo "" einfo "As example:\tbasic MP500 support without maintenance tools" einfo "\t\t -> USE=\"mp500\"" einfo "" einfo "Sleeping 10 seconds (Press CTRL+C to abort)" einfo "" sleep 10 fi } src_unpack() { rpm_src_unpack || die mv ${PN}-common-${PV} ${P} || die # Correcting directory-structure if use "ip4200" || ${_autochoose}; then epatch ${FILESDIR}/cnijfilter-2.60-ip4200-ppd.patch || die fi } src_compile() { cd libs || die ./autogen.sh --prefix=${_prefix} || die "Error: libs/autoconf.sh failed" make || die "Couldn't make libs" cd ../pstocanonij || die ./autogen.sh --prefix=/usr --enable-progpath=${_bindir} || die "Error: pstocanonij/autoconf.sh failed" make || die "Couldn't make pstocanonij" if use servicetools; then cd ../cngpij || die ./autogen.sh --prefix=${_prefix} --enable-progpath=${_bindir} || die "Error: cngpij/autoconf.sh failed" make || die "Couldn't make cngpij" cd ../cngpijmon || die ./autogen.sh --prefix=${_prefix} || die "Error: cngpijmon/autoconf.sh failed" make || die "Couldn't make cngpijmon" fi cd .. for i in `seq 0 ${_max}`; do if use ${_pruse[$i]} || ${_autochoose}; then _pr=${_prname[$i]} _prid=${_prid[$i]} src_compile_pr; fi done } src_install() { mkdir -p ${D}${_bindir} || die mkdir -p ${D}${_libdir}/cups/filter || die mkdir -p ${D}${_ppddir} || die mkdir -p ${D}${_libdir}/cnijlib || die ## mkdir -p ${D}${_libdir}/bjlib || die cd libs || die make DESTDIR=${D} install || die "Couldn't make install libs" cd ../pstocanonij || die make DESTDIR=${D} install || die "Couldn't make install pstocanoncnij" if use servicetools; then cd ../cngpij || die make DESTDIR=${D} install || die "Couldn't make install cngpij" cd ../cngpijmon || die make DESTDIR=${D} install || die "Couldn't make install cngpijmon" fi cd .. for i in `seq 0 ${_max}`; do if use ${_pruse[$i]} || ${_autochoose}; then _pr=${_prname[$i]} _prid=${_prid[$i]} src_install_pr; fi done } pkg_postinst() { einfo "" einfo "For installing a printer:" einfo " * Restart CUPS: /etc/init.d/cupsd restart" einfo " * Go to http://127.0.0.1:631/" einfo " -> Printers -> Add Printer" einfo "" einfo "If you experience any problems, please visit:" einfo " http://forums.gentoo.org/viewtopic-p-3217721.html" einfo "" } ### # Custom Helper Functions ### src_compile_pr() { mkdir ${_pr} cp -a ${_prid} ${_pr} || die cp -a cnijfilter ${_pr} || die cp -a printui ${_pr} || die cp -a stsmon ${_pr} || die sleep 10 cd ${_pr}/cnijfilter || die # ${_libdir}/bjlib ??? ./autogen.sh --prefix=${_prefix} --program-suffix=${_pr} --enable-libpath=${_libdir}/cnijlib --enable-binpath=${_bindir} || die make || die "Couldn't make ${_pr}/cnijfilter" if use servicetools; then cd ../printui || die ./autogen.sh --prefix=${_prefix} --program-suffix=${_pr} || die make || die "Couldn't make ${_pr}/printui" cd ../stsmon || die ./autogen.sh --prefix=${_prefix} --program-suffix=${_pr} --enable-progpath=${_bindir} || die make || die "Couldn't make ${_pr}/stsmon" fi cd ../.. } src_install_pr() { cd ${_pr}/cnijfilter || die make DESTDIR=${D} install || die "Couldn't make install ${_pr}/cnijfilter" if use servicetools; then cd ../printui || die make DESTDIR=${D} install || die "Couldn't make install ${_pr}/printui" cd ../stsmon || die make DESTDIR=${D} install || die "Couldn't make install ${_pr}/stsmon" fi cd ../.. cp ${_prid}/libs_bin/*.so.* ${D}${_libdir} || die cp ${_prid}/database/* ${D}${_libdir}/cnijlib || die cp ppd/canon${_pr}.ppd ${D}${_ppddir} || die }