# Copyright 1999-20012 Gentoo Foundation # $Header: $ # This ebuild comes from http://bugs.gentoo.org/show_bug.cgi?id=258244 # Written by rogge # # Changelog: 2011-04-13 Current Version: 3.00-r2 # * add eclass versionator to fix unpack-bug (non-hardcoding) # see comment 15 of bugreport # * fix dependency-bug for 2nd emul-linux-x86-bjdeps (noneffective downgrade) # see comment 17 of bugreport # * replaced dependency of non-existing virtual/ghostscript with app-text/ghostscript-gpl # see comment 14 of bugreport # * remove dependency of non-existing dev-libs/libxml-1.8; dependency >=dev-libs/libxml2-2.6.0 is to continue # ibidem # * change chmod of /usr/lib/cnijlib rspv. /usr/lib32/cnijlib to 755 # ibidem # Changelog: 2012-04-06 Current Version: 3.00-r4 # * Switsch to EAPI=4 # * Add SLOT 3.00 # * Add Canon-License and GPL-2 # * Add metadata.xml # * Add libpng15.patch and include_cups_ppd_h.patch # * tighten code EAPI=4 inherit eutils flag-o-matic multilib versionator DESCRIPTION="Canon InkJet Printer Driver for Linux (Pixus/Pixma-Series)." HOMEPAGE="http://support-sg.canon-asia.com/contents/SG/EN/0100160603.html" RESTRICT="mirror" SRC_URI="http://gdlp01.c-wss.com/gds/6/0100001606/01/${PN}-common-${PV}-1.tar.gz" MY_PV=$(get_version_component_range '1-2') LICENSE="GPL-2 Canon" #cnijfilter ROM package set name correctly REAL_PN="cnijfilter" SLOT="3.00" KEYWORDS="~x86 ~amd64" IUSE="amd64 nocupsdetection servicetools ip1900 ip3600 ip4600 mp190 mp240 mp540 mp630" # app-emulation/emul-linux-x86-bjdeps-0.1 is available via zugaina-overlay as 0.1-r2, # otherwise fetch this one -> http://rpm5.org/files/popt/popt-1.13.tar.gz DEPEND="servicetools? ( !amd64? ( >=sys-devel/automake-1.9.5 >=sys-devel/autoconf-2.59 ) )" RDEPEND="${DEPEND} app-text/ghostscript-gpl >=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/libxml2-2.7.3-r2 >=x11-libs/gtk+-2.6.0 ) amd64? ( >=app-emulation/emul-linux-x86-bjdeps-0.1 app-emulation/emul-linux-x86-gtklibs ) )" #>=dev-libs/popt-1.4 # Arrays of supported Printers, there IDs and compatible models _pruse=("ip1900" "ip3600" "ip4600" "mp190" "mp240" "mp540" "mp630") _prname=(${_pruse[@]}) _prid=("346" "333" "334" "342" "341" "338" "336") _prcomp=("ip1900series" "ip3600series" "ip4600series" "mp190series" "mp240series" "mp540series" "mp630series") _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 # use amd64 && export ABI=x86 # use amd64 && append-flags -L/emul/linux/x86/lib -L/emul/linux/x86/usr/lib -L/usr/lib32 use amd64 && multilib_toolchain_setup x86 _prefix="/usr/local" _datadir="/usr/local/share" _bindir="/usr/local/bin" _libdir="/usr/$(get_libdir)" _cupsdir1="/usr/lib/cups" _cupsdir2="/usr/libexec/cups" _ppddir="/usr/share/cups/model" einfo "" einfo " USE-flags (description / probably compatible printers)" einfo "" einfo " amd64 (basic support for this architecture - currently without servicetools)" einfo " servicetools (additional monitoring and maintenance software)" einfo " nocupsdetection (this is only useful to create binary packages)" _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:\t MP540 support without maintenance tools" einfo "\t\t -> USE=\"mp540\"" einfo "" einfo "Sleeping 10 seconds (Press CTRL+C to abort)" einfo "" echo ebeep epause 10 fi } src_unpack() { PN=${REAL_PN} unpack ${A} mv "${PN}-common-${MY_PV}" "${P}" # Correcting directory-structure einfo "S: ${S}" cd "${S}" # EPATCH_SOURCE=${FILESDIR} EPATCH_SUFFIX="patch" \ # EPATCH_FORCE="yes" epatch epatch ${FILESDIR}/include_cups_ppd_h.patch || die epatch ${FILESDIR}/libpng15.patch || die } src_compile() { cd "libs" ./autogen.sh || die "Error: libs/autoconf.sh failed" emake cd "../backend" ./autogen.sh --prefix=/usr --enable-progpath=${_bindir} || die "Error: backend/autoconf.sh failed" emake cd "../pstocanonij" ./autogen.sh --prefix=/usr --enable-progpath=${_bindir} || die "Error: pstocanonij/autoconf.sh failed" emake if use servicetools; then cd "../cngpij" ./autogen.sh --prefix=${_prefix} --enable-progpath=${_bindir} || die "Error: cngpij/autoconf.sh failed" emake cd "../cngpijmon" ./autogen.sh --datadir=${_datadir} --program-suffix=${_pr} || die "Error: cngpijmon/autoconf.sh failed" emake 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} mkdir -p ${D}${_libdir}/cups/filter mkdir -p ${D}${_ppddir} mkdir -p ${D}${_libdir}/cnijlib cd "libs" emake DESTDIR=${D} install cd "../backend" emake DESTDIR=${D} install cd "../pstocanonij" emake DESTDIR=${D} install if use servicetools; then cd "../cngpij" emake DESTDIR=${D} install cd "../cngpijmon" emake DESTDIR=${D} install 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 # fix directory structure if use nocupsdetection; then mkdir -p ${D}${_cupsdir2}/filter || die dosym ${_cupsdir1}/filter/pstocanonij ${_cupsdir2}/filter/pstocanonij elif has_version ">=net-print/cups-1.2.0"; then mkdir -p ${D}${_cupsdir2} || die mv ${D}${_cupsdir1}/* ${D}${_cupsdir2} || die fi } pkg_postinst() { elog "" elog "For installing a printer:" elog " * Restart CUPS: /etc/init.d/cupsd restart" elog " * Go to http://127.0.0.1:631/" elog " -> Printers -> Add Printer" elog "" elog "You can find the printerspecific config-file here:" elog " /usr/lib/cnijlib/cif${_pr}.conf" elog "" elog "If you experience any problems, please visit:" elog " http://forums.gentoo.org/viewtopic-p-3217721.html" elog " or" elog " http://forums.gentoo.org/viewtopic-t-723203.html" elog " or" elog " http://bugs.gentoo.org/show_bug.cgi?id=258244" # ln -s /usr/lib/cups/filter/pstocanonij /usr/libexec/cups/filter/pstocanonij # ln -s /usr/lib/cups/backend/cnijusb /usr/libexec/cups/backend/cnijusb if use amd64; then ln -s /usr/lib32/cnijlib /usr/lib32/bjlib chown 755 /usr/lib32/bjlib/* else ln -s /usr/lib/cnijlib /usr/lib/bjlib chown 755 /usr/lib/bjlib/* fi } ### # Custom Helper Functions ### src_compile_pr() { mkdir ${_pr} cp -a ${_prid} ${_pr} cp -a cnijfilter ${_pr} cp -a printui ${_pr} cp -a lgmon ${_pr} cd "${_pr}/cnijfilter" # ${_libdir}/bjlib ??? ./autogen.sh --prefix=${_prefix} --program-suffix=${_pr} --enable-libpath=${_libdir}/bjlib || die emake if use servicetools; then cd "../printui" ./autogen.sh --datadir=${_datadir} --program-suffix=${_pr} || die emake cd "../lgmon" ./autogen.sh --program-suffix=${_pr} || die emake fi cd "../.." } src_install_pr() { cd ${_pr}/cnijfilter emake DESTDIR=${D} install if use servicetools; then cd "../printui" emake DESTDIR=${D} install cd "../lgmon" emake DESTDIR=${D} install fi cd "../.." cp "${_prid}"/libs_bin/*.so.* "${D}${_libdir}" # install -c -s -m 755 cp "${_prid}"/database/* "${D}${_libdir}/cnijlib" # install -c -s -m 755 cp "ppd/canon${_pr}.ppd" "${D}${_ppddir}" } pkg_postrm() { rm -f /usr/libexec/cups/filter/pstocanonij rm -f /usr/libexec/cups/backend/cnijusb rm -f /usr/lib/bjlib }