media-libs/oyranos: Drop old
[gentoo.git] / app-misc / recoll / recoll-1.19.5-r1.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 inherit toolchain-funcs qmake-utils qt4-r2 linux-info python-single-r1 readme.gentoo
9
10 DESCRIPTION="A personal full text search package"
11 HOMEPAGE="http://www.lesbonscomptes.com/recoll/"
12 SRC_URI="http://www.lesbonscomptes.com/recoll/${P}.tar.gz"
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="amd64 x86"
16
17 INDEX_HELPERS="chm djvu dvi exif postscript ics info lyx msdoc msppt msxls pdf rtf sound tex wordperfect xml"
18 IUSE="+spell inotify +qt4 +session camelcase xattr webkit fam ${INDEX_HELPERS}"
19
20 DEPEND="
21         virtual/libiconv
22         >=dev-libs/xapian-1.0.12
23         sys-libs/zlib
24         spell? ( app-text/aspell )
25         !inotify? ( fam? ( virtual/fam ) )
26         qt4? ( dev-qt/qtcore:4[qt3support] )
27         webkit? ( dev-qt/qtwebkit:4 )
28         session? (
29                 inotify? ( x11-libs/libX11 x11-libs/libSM x11-libs/libICE )
30                 !inotify? ( fam? ( x11-libs/libX11 x11-libs/libSM x11-libs/libICE ) )
31         )
32         ${PYTHON_DEPS}
33 "
34
35 RDEPEND="
36         ${DEPEND}
37         app-arch/unzip
38         sys-apps/sed
39         virtual/awk
40         pdf? ( app-text/poppler )
41         postscript? ( app-text/pstotext )
42         msdoc? ( app-text/antiword )
43         msxls? ( app-text/catdoc )
44         msppt? ( app-text/catdoc )
45         wordperfect? ( app-text/libwpd:0.9 )
46         rtf? ( app-text/unrtf )
47         tex? ( dev-tex/detex )
48         dvi? ( virtual/tex-base )
49         djvu? ( >=app-text/djvu-3.5.15 )
50         exif? ( media-libs/exiftool )
51         chm? ( dev-python/pychm[${PYTHON_USEDEP}] )
52         ics? ( dev-python/icalendar[${PYTHON_USEDEP}] )
53         lyx? ( app-office/lyx )
54         sound? ( media-libs/mutagen )
55         xml? ( dev-libs/libxslt )
56         info? ( sys-apps/texinfo )
57         "
58
59 REQUIRED_USE="session? ( || ( fam inotify ) )
60         ${PYTHON_REQUIRED_USE}"
61
62 pkg_pretend() {
63         if use inotify; then
64                 CONFIG_CHECK="~INOTIFY_USER"
65                 check_extra_config
66         fi
67 }
68
69 pkg_setup() {
70         python-single-r1_pkg_setup
71
72         local i at_least_one_helper
73
74         at_least_one_helper=0
75         for i in $INDEX_HELPERS; do
76                 if use $i; then
77                         at_least_one_helper=1
78                         break
79                 fi
80         done
81         if [[ $at_least_one_helper -eq 0 ]]; then
82                 ewarn
83                 ewarn "You did not enable any of the optional file format flags."
84                 ewarn "Recoll can read some file formats natively, but many of them"
85                 ewarn "are optional since they require external helpers."
86                 ewarn
87         fi
88 }
89
90 src_prepare() {
91         use xattr && has_version "${CATEGORY}/${PN}:${SLOT}[-xattr]" && FORCE_PRINT_ELOG="yes"
92         ! use xattr && has_version "${CATEGORY}/${PN}:${SLOT}[xattr]" && FORCE_PRINT_ELOG="yes"
93
94         DOC_CONTENTS="Default configuration files located at
95                 /usr/share/${PN}/examples. Either edit these files to match
96                 your needs or copy them to ~/.recoll/ and edit these files
97                 instead."
98
99         use xattr && DOC_CONTENTS+="
100                 Use flag \"xattr\" enables support for fetching field values
101                 from extended file attributes. You will also need to set up a
102                 map from the attributes names to the Recoll field names
103                 (see comment at the end of the fields configuration file."
104
105         # remember configure.ac is b0rked. Fix it before using eautoreconf in the
106         # future
107         # eautoreconf
108
109         # do not strip binaries
110         sed -i -e "/STRIP/d" "${S}"/${PN}install.in \
111                 || die "Failed to fix the installation script"
112         # Drop all the QMAKE lines. We will do it ourselves
113         sed -i -e "/QMAKE/d" Makefile.in || die
114 }
115
116 src_configure() {
117         local qtconf
118
119         if use qt4 || use webkit; then
120                 qtconf="QMAKEPATH=$(qt4_get_bindir)/qmake"
121         fi
122
123         econf \
124                 $(use_with spell aspell) \
125                 $(use_enable xattr) \
126                 $(use_with inotify) \
127                 $(use_enable qt4 qtgui) \
128                 $(use_enable camelcase) \
129                 $(use_with fam) \
130                 $(use_with inotify) \
131                 $(use_enable session x11mon) \
132                 ${qtconf}
133         if use qt4; then
134                 cd qtgui && eqmake4 ${PN}.pro && cd ..
135         fi
136 }
137
138 src_compile() {
139         # Do not let upstream people decide on our behalf
140         sed -i "s:ar ru:$(tc-getAR) ru:" lib/Makefile || die
141
142         emake \
143                 CC=$(tc-getCC) \
144                 CXX=$(tc-getCXX) \
145                 CFLAGS="${CFLAGS} ${LDFLAGS}" \
146                 CXXFLAGS="${CXXFLAGS} ${LDFLAGS}"
147 }
148
149 src_install() {
150         # You probably wonder why I did not fix recollinstall in src_prepare.
151         # --prefix requires an absolute path but recollinstall requires prefix
152         # to be actually 'usr' because double // makes portage sad. And no, I am not
153         # gonna ask upstream to fix the build system
154         sed -i -e "/PREFIX/s:/usr:usr:" "${S}"/${PN}install || die
155         sed -i -e "/prefix/s:/usr:usr:" "${S}"/Makefile || die
156
157         emake DESTDIR="${D%/}" install
158         python_optimize
159         dodoc ChangeLog README
160         mv "${D}/usr/share/${PN}/doc" "${D}/usr/share/doc/${PF}/html"
161         dosym /usr/share/doc/${PF}/html /usr/share/${PN}/doc
162
163         readme.gentoo_create_doc
164 }
165
166 pkg_postinst() {
167         readme.gentoo_print_elog
168
169         if [[ -n ${REPLACING_VERSIONS} ]]; then
170                 elog
171                 elog "1.18 introduces significant index formats"
172                 elog "changes to support optional character case and diacritics"
173                 elog "sensitivity, and it will be advisable to reset the index in"
174                 elog "most cases. This will be best done by destroying the index"
175                 elog "directory (rm -rf ~/.recoll/xapiandb). If 1.18 is not configured"
176                 elog "for case and diacritics sensitivity, it is mostly compatible"
177                 elog "with 1.17 indexes."
178                 elog
179         fi
180 }