# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="4" inherit linux-info multilib DESCRIPTION="Samsung Unified Linux Driver" HOMEPAGE="http://www.samsung.com" SRC_URI="http://downloadcenter.samsung.com/content/DR/201110/20111020101424892/UnifiedLinuxDriver_1.01.tar.gz -> ${P}.tar.gz" LICENSE="samsung" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="cups scanner network qt4" RESTRICT="mirror strip" DEPEND="" RDEPEND="virtual/libstdc++ cups? ( net-print/cups !net-print/splix ) qt4? ( x11-libs/qt-core:4 media-libs/tiff ) scanner? ( media-gfx/sane-backends )" S=${WORKDIR}/cdroot/Linux pkg_setup() { if use kernel_linux; then linux-info_pkg_setup if ! linux_config_exists; then ewarn "Can't check the linux kernel configuration." ewarn "You might have some incompatible options enabled." else if use scanner; then if ! linux_chkconfig_present USB_PRINTER; then ewarn "You've enabled scanner support then you should also enable the USB_PRINTER" ewarn "support in your kernel." ewarn "Please enable it:" ewarn " CONFIG_USB_PRINTER=y" ewarn "in /usr/src/linux/.config or" ewarn " Device Drivers --->" ewarn " USB support --->" ewarn " [*] USB Printer support" ewarn "Scanning WILL NOT work without loaded usblp module or via libusb." ewarn "" fi fi fi fi } src_unpack() { tar xozf ${DISTDIR}/${A} } src_prepare() { find . -type d -exec chmod 755 '{}' \; find . -type f -exec chmod 644 '{}' \; find . -type f -name \*.sh -exec chmod 755 '{}' \; chmod 755 ./i386/at_root/usr/sbin/* chmod 755 ./i386/at_root/usr/lib/cups/filter/* chmod 755 ./i386/at_root/usr/lib/cups/backend/mfp chmod 755 ./i386/qt4/at_opt/bin/* chmod 755 ./x86_64/at_root/usr/sbin/* chmod 755 ./x86_64/at_root/usr/lib64/cups/filter/* chmod 755 ./x86_64/at_root/usr/lib64/cups/backend/mfp chmod 755 ./x86_64/qt4/at_opt/bin/* } src_install() { SOPT="/opt/Samsung/mfp" if [ "${ABI}" == "amd64" ]; then SARCH="x86_64" SLIBDIR="lib64" else SARCH="i386" SLIBDIR="lib" fi # Common lib needed for both printing and scanning dolib.so ${SARCH}/at_root/usr/${SLIBDIR}/libmfp.so.* dosym libmfp.so.1.0.1 /usr/$(get_libdir)/libmfp.so # Printing support if use cups; then insinto /etc/cups doins noarch/at_root/etc/cups/* dodir /usr/libexec cp -r ${SARCH}/at_root/usr/${SLIBDIR}/cups "${D}"/usr/libexec dodir /usr/share/cups/model cp -r noarch/at_opt/share/ppd "${D}"/usr/share/cups/model/samsung gzip "${D}"/usr/share/cups/model/samsung/*.ppd fi # Scanning support if use scanner; then insinto /etc/sane.d doins noarch/at_root/etc/sane.d/smfp.conf exeinto /usr/$(get_libdir)/sane/ doexe ${SARCH}/at_root/usr/${SLIBDIR}/sane/* dosym libsane-smfp.so.1.0.1 /usr/$(get_libdir)/sane/libsane-smfp.so.1 dosym libsane-smfp.so.1.0.1 /usr/$(get_libdir)/sane/libsane-smfp.so fi # Network tool if use network; then if [ ! -e "/usr/$(get_libdir)/libnetsnmp.so.10*" ]; then dolib.so ${SARCH}/at_root/opt/smfp-common/${SLIBDIR}/libnetsnmp.so.* dosym libnetsnmp.so.10.0.2 /usr/$(get_libdir)/libnetsnmp.so.10 else einfo "libnetsnmp.so.10 already exists in /usr/$(get_libdir)" einfo "system-wide version will be used." fi exeinto ${SOPT}/libexec doexe ${SARCH}/at_opt/bin/netdiscovery for i in ${SARCH}/at_opt/bin/*; do make_wrapper $(basename ${i}) \ ${SOPT}/libexec/$(basename ${i}) \ ${SOPT}/libexec \ ${SOPT}/lib \ ${SOPT}/bin done fi # GUI tools if use qt4; then if [ ! -e "/usr/$(get_libdir)/libtiff.so.3" ]; then ewarn "User is not forced to install media-libs/tiff:3 because" ewarn "Samsung's software is also working with latter versions of tiff." ewarn "Instead the symlink libtiff.so.3 will be created in /usr/$(get_libdir)." ewarn "If you will have any issues regarding libtiff.so" ewarn "version mismatch, emerge media-libs/tiff:3." dosym libtiff.so /usr/$(get_libdir)/libtiff.so.3 fi insinto ${SOPT}/share doins OEM.ini cp -r noarch/at_opt/share/V* \ noarch/at_opt/share/help \ noarch/at_opt/share/images \ noarch/at_opt/share/utils \ noarch/qt4/at_opt/share/tr \ noarch/qt4/at_opt/share/ui "${D}"/${SOPT}/share exeinto ${SOPT}/lib doexe ${SARCH}/qt4/at_opt/lib/* # Do not install supplied Qt4 libs and use system-wide instead #doexe ${SARCH}/qt4/at_root/opt/smfp-common/${SLIBDIR}/* exeinto ${SOPT}/libexec doexe ${SARCH}/qt4/at_opt/bin/* for i in ${SARCH}/qt4/at_opt/bin/*; do make_wrapper $(basename ${i}) \ ${SOPT}/libexec/$(basename ${i}) \ ${SOPT}/libexec \ ${SOPT}/lib \ ${SOPT}/bin done fi } pkg_postinst() { if use scanner; then elog "You need to manually add smfp to /etc/sane.d/dll.conf:" elog " # echo smfp >> /etc/sane.d/dll.conf" fi }