dev-libs/libmaxminddb: arm64 stable
[gentoo.git] / dev-libs / link-grammar / link-grammar-5.3.11.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 GNOME2_LA_PUNT="yes"
6 PYTHON_COMPAT=( python{2_7,3_5,3_6} )
7
8 inherit autotools eutils gnome2 java-pkg-opt-2 python-r1
9
10 DESCRIPTION="A Syntactic English parser"
11 HOMEPAGE="http://www.abisource.com/projects/link-grammar/ http://www.link.cs.cmu.edu/link/"
12 SRC_URI="http://www.abisource.com/downloads/${PN}/${PV}/${P}.tar.gz"
13
14 LICENSE="LGPL-2.1"
15 SLOT="0"
16 KEYWORDS="~alpha amd64 ~arm hppa ~ia64 ~ppc ~ppc64 sparc x86"
17 IUSE="aspell +hunspell java python static-libs threads" # pcre
18 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
19
20 # XXX: sqlite is automagic
21 # Does not build with >=sci-mathematics/minisat-2, bug #593662
22 # add pcre support: pcre? ( dev-libs/libpcre )
23 RDEPEND="
24         dev-db/sqlite:3
25         aspell? ( app-text/aspell )
26         hunspell? ( app-text/hunspell )
27         java? (
28                 >=virtual/jdk-1.6:*
29                 dev-java/ant-core )
30         python? ( ${PYTHON_DEPS} )
31         !sci-mathematics/minisat
32 "
33 DEPEND="${RDEPEND}
34         dev-lang/swig:0
35         sys-devel/autoconf-archive
36         virtual/pkgconfig
37 "
38
39 NORMAL_BUILD_DIR="${WORKDIR}/${P}-normal"
40
41 pkg_setup() {
42         if use aspell && use hunspell; then
43                 ewarn "You have enabled 'aspell' and 'hunspell' support, but both cannot coexist,"
44                 ewarn "only hunspell will be built. Press Ctrl+C and set only 'aspell' USE flag if"
45                 ewarn "you want aspell support."
46         fi
47         use java && java-pkg-opt-2_pkg_setup
48 }
49
50 src_prepare() {
51         use java && java-pkg-opt-2_src_prepare
52
53         # http://bugzilla.abisource.com/show_bug.cgi?id=13806
54         eapply "${FILESDIR}"/${PN}-5.3.9-out-of-source-build.patch
55         eapply_user
56         eautoreconf
57
58         if use python ; then
59                 prepare_python() {
60                         mkdir -p "${BUILD_DIR}" || die
61                 }
62                 python_foreach_impl prepare_python
63         fi
64
65         mkdir -p "${NORMAL_BUILD_DIR}" || die
66         gnome2_src_prepare
67 }
68
69 src_configure() {
70         local myconf=(
71                 --disable-editline
72                 --disable-perl-bindings
73                 --enable-shared
74                 --enable-sat-solver=bundled
75                 $(use_enable aspell)
76                 $(use_enable hunspell)
77                 $(usex hunspell --with-hunspell-dictdir=/usr/share/myspell)
78                 $(use_enable java java-bindings)
79                 # $(use_enable pcre regex-tokenizer)
80                 # $(use_with pcre)
81                 $(use_enable static-libs static)
82                 $(use_enable threads pthreads)
83         )
84
85         cd "${NORMAL_BUILD_DIR}" || die
86         ECONF_SOURCE="${S}" gnome2_src_configure \
87                 --disable-python-bindings \
88                 --disable-python3-bindings \
89                 ${myconf[@]}
90
91         if use python ; then
92                 prepare_python() {
93                         if python_is_python3; then
94                                 ECONF_SOURCE="${S}" gnome2_src_configure \
95                                         --disable-python-bindings \
96                                         --enable-python3-bindings \
97                                         ${myconf[@]}
98                         else
99                                 ECONF_SOURCE="${S}" gnome2_src_configure \
100                                         --enable-python-bindings \
101                                         --disable-python3-bindings \
102                                         ${myconf[@]}
103                         fi
104                 }
105                 python_foreach_impl run_in_build_dir prepare_python
106         fi
107 }
108
109 src_compile() {
110         cd "${NORMAL_BUILD_DIR}" || die
111         gnome2_src_compile
112
113         if use python ; then
114                 compile_binding() {
115                         local pysuffix
116                         if python_is_python3; then
117                                 pysuffix=3
118                         else
119                                 pysuffix=
120                         fi
121
122                         emake -C bindings/python$pysuffix \
123                                 VPATH="${S}:${NORMAL_BUILD_DIR}" \
124                                 _clinkgrammar_la_DEPENDENCIES="${NORMAL_BUILD_DIR}"/link-grammar/liblink-grammar.la \
125                                 _clinkgrammar_la_LIBADD="${NORMAL_BUILD_DIR}"/link-grammar/liblink-grammar.la
126                 }
127                 python_foreach_impl run_in_build_dir compile_binding
128         fi
129 }
130
131 src_test() {
132         cd "${NORMAL_BUILD_DIR}" || die
133         ln -s "${S}"/data tests/data || die
134         emake check
135 }
136
137 src_install() {
138         cd "${NORMAL_BUILD_DIR}" || die
139         gnome2_src_install
140
141         if use python ; then
142                 install_binding() {
143                         local pysuffix
144                         if python_is_python3; then
145                                 pysuffix=3
146                         else
147                                 pysuffix=
148                         fi
149
150                         emake -C bindings/python$pysuffix \
151                                 VPATH="${S}:${NORMAL_BUILD_DIR}" \
152                                 _clinkgrammar_la_DEPENDENCIES="${NORMAL_BUILD_DIR}"/link-grammar/liblink-grammar.la \
153                                 _clinkgrammar_la_LIBADD="${NORMAL_BUILD_DIR}"/link-grammar/liblink-grammar.la \
154                                 DESTDIR="${D}" \
155                                 install
156                 }
157                 python_foreach_impl run_in_build_dir install_binding
158         fi
159 }
160
161 pkg_preinst() {
162         use java && java-pkg-opt-2_pkg_preinst
163         gnome2_pkg_preinst
164 }