iscan-2.26.2.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="2"
  4. inherit eutils flag-o-matic autotools
  5. SRC_REV="1" # revision used by upstream
  6. # HINTS:
  7. # -> non-free modules are x86 and amd64 only
  8. # -> iscan frontend needs non-free modules
  9. # -> sane-epkowa should be usable on every arch
  10. # -> ${P}-${SRC_REV}.tar.gz (for gcc 3.2/3.3)
  11. # -> ${P}-${SRC_REV}.c2.tar.gz (for gcc 3.4 or later)
  12. # FIXME:
  13. # Make jpeg/png optional. The problem is, that the configure script ignores --disable-*,
  14. # if the corresponding lib is found on the system.
  15. # Furthermore, iscan doesn't compile w/o libusb, this should be fixed somehow.
  16. # TODO:
  17. # (re)add closed-source binary modules which are needed for some scanners.
  18. KEYWORDS="amd64 x86"
  19. DESCRIPTION="EPSON Image Scan! for Linux (including sane-epkowa backend)"
  20. HOMEPAGE="http://www.avasys.jp/english/linux_e/dl_scan.html"
  21. SRC_URI="http://linux.avasys.jp/drivers/iscan/${PV}/${PN}_${PV}-${SRC_REV}.tar.gz
  22. doc? ( http://linux.avasys.jp/drivers/iscan/doc/userg_revL_e.pdf )"
  23. LICENSE="GPL-2 AVASYS"
  24. SLOT="0"
  25. IUSE="X gimp jpeg png tiff doc l10n_ja"
  26. IUSE_LINGUAS="ar de es fr it ja ko nl pt zh_CN zh_TW"
  27. for X in ${IUSE_LINGUAS}; do IUSE="${IUSE} linguas_${X}"; done
  28. QA_PRESTRIPPED="usr/$(get_libdir)/libesmod.so.*"
  29. QA_TEXTRELS="${QA_PRESTRIPPED}"
  30. QA_FLAGS_IGNORED="${QA_PRESTRIPPED}"
  31. # Upstream ships broken sanity test
  32. RESTRICT="test"
  33. RDEPEND="media-gfx/iscan-data
  34. media-gfx/sane-backends
  35. virtual/udev
  36. virtual/libusb:0
  37. X? (
  38. x11-libs/gtk+:2
  39. gimp? ( media-gfx/gimp )
  40. png? ( media-libs/libpng )
  41. jpeg? ( virtual/jpeg )
  42. tiff? ( media-libs/tiff )
  43. )"
  44. DEPEND="${RDEPEND}
  45. virtual/pkgconfig
  46. X? ( sys-devel/gettext )"
  47. src_prepare() {
  48. local i
  49. # convert japanese docs to UTF-8
  50. if use l10n_ja; then
  51. for i in {NEWS,README}.ja non-free/*.ja.txt; do
  52. if [ -f "${i}" ]; then
  53. echo ">>> Converting ${i} to UTF-8"
  54. iconv -f eucjp -t utf8 -o "${i}~" "${i}" && mv -f "${i}~" "${i}" || rm -f "${i}~"
  55. fi
  56. done
  57. fi
  58. # disable checks for gtk+
  59. if ! use X; then
  60. sed -i -e "s:PKG_CHECK_MODULES(GTK,.*):AC_DEFINE([HAVE_GTK_2], 0):g" \
  61. -e "s:\(PKG_CHECK_MODULES(GDK_IMLIB,.*)\):#\1:g" configure.ac
  62. fi
  63. epatch "${FILESDIR}"/iscan-2.25.0-drop-ltdl.patch
  64. epatch "${FILESDIR}"/iscan-2.25.0-fix-g++-test.patch
  65. epatch "${FILESDIR}"/iscan-2.26.2-libpng15.patch
  66. epatch "${FILESDIR}"/iscan-2.26.2-png-libs.patch
  67. eautoreconf
  68. }
  69. src_configure() {
  70. append-flags -D_GNU_SOURCE # needed for 'strndup'
  71. local myconf="--enable-dependency-reduction"
  72. if use X; then
  73. myconf="${myconf}
  74. --enable-frontend
  75. $(use_enable gimp)
  76. $(use_enable jpeg)
  77. $(use_enable png)
  78. $(use_enable tiff)"
  79. else
  80. myconf="${myconf}
  81. --disable-frontend --disable-gimp
  82. --disable-jpeg --disable-png --disable-tiff"
  83. fi
  84. econf --disable-static ${myconf}
  85. }
  86. src_install() {
  87. local MY_LIB="/usr/$(get_libdir)"
  88. emake DESTDIR="${D}" install || die "emake install failed"
  89. # install docs
  90. dodoc AUTHORS NEWS README
  91. use l10n_ja && dodoc NEWS.ja README.ja
  92. # install sane config
  93. insinto /etc/sane.d
  94. doins backend/epkowa.conf
  95. # install extra docs
  96. if use doc; then
  97. insinto /usr/share/doc/${PF}
  98. doins "${DISTDIR}/userg_revL_e.pdf"
  99. fi
  100. # link iscan so it is seen as a plugin in gimp
  101. if use X && use gimp; then
  102. local plugindir
  103. if [ -x /usr/bin/gimptool ]; then
  104. plugindir="$(gimptool --gimpplugindir)/plug-ins"
  105. elif [ -x /usr/bin/gimptool-2.0 ]; then
  106. plugindir="$(gimptool-2.0 --gimpplugindir)/plug-ins"
  107. else
  108. die "Can't find GIMP plugin directory."
  109. fi
  110. dodir "${plugindir}"
  111. dosym /usr/bin/iscan "${plugindir}"
  112. fi
  113. # install desktop entry
  114. if use X; then
  115. make_desktop_entry iscan "Image Scan! for Linux ${PV}" scanner
  116. fi
  117. }
  118. pkg_postinst() {
  119. local i
  120. local DLL_CONF="/etc/sane.d/dll.conf"
  121. local EPKOWA_CONF="/etc/sane.d/epkowa.conf"
  122. elog
  123. if grep -q "^[ \t]*\<epkowa\>" ${DLL_CONF}; then
  124. elog "Please edit ${EPKOWA_CONF} to suit your needs."
  125. elif grep -q "\<epkowa\>" ${DLL_CONF}; then
  126. elog "Hint: to enable the backend, add 'epkowa' to ${DLL_CONF}"
  127. elog "Then edit ${EPKOWA_CONF} to suit your needs."
  128. else
  129. echo "epkowa" >> ${DLL_CONF}
  130. elog "A new entry 'epkowa' was added to ${DLL_CONF}"
  131. elog "Please edit ${EPKOWA_CONF} to suit your needs."
  132. fi
  133. }