Merge github#363: sys-process/atop: add systemd support
[gentoo.git] / dev-lang / xsb / xsb-3.3.7.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=2
6
7 MY_P="XSB${PV//./}"
8
9 PATCHSET_VER="0"
10
11 inherit eutils autotools java-pkg-opt-2
12
13 DESCRIPTION="XSB is a logic programming and deductive database system"
14 HOMEPAGE="http://xsb.sourceforge.net"
15 SRC_URI="http://xsb.sourceforge.net/downloads/${MY_P}.tar.gz
16         mirror://gentoo/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz"
17
18 LICENSE="GPL-2 LGPL-2"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="curl debug examples iodbc java mysql odbc pcre threads xml"
22
23 RDEPEND="curl? ( net-misc/curl )
24         iodbc? ( dev-db/libiodbc )
25         java? ( >=virtual/jdk-1.4 )
26         mysql? ( virtual/mysql )
27         odbc? ( dev-db/unixODBC )
28         pcre? ( dev-libs/libpcre )
29         xml? ( dev-libs/libxml2 )"
30
31 DEPEND="${RDEPEND}"
32
33 S="${WORKDIR}"/XSB
34
35 src_prepare() {
36         EPATCH_FORCE=yes
37         EPATCH_SUFFIX=patch
38         epatch "${WORKDIR}"/${PV}
39
40         cd "${S}"/build
41         eautoconf
42
43         find "${S}"/emu -name '*\.o' | xargs rm -f
44 }
45
46 src_configure() {
47         cd "${S}"/build
48
49         econf \
50                 --libdir=/usr/$(get_libdir) \
51                 --disable-optimization \
52                 --without-smodels \
53                 --with-config-tag="" \
54                 $(use_with odbc) \
55                 $(use_with iodbc) \
56                 $(use_enable threads mt) \
57                 $(use_enable debug)
58
59         if use curl ; then
60                 cd "${S}"/packages/curl
61                 econf
62         fi
63
64         if use mysql ; then
65                 cd "${S}"/packages/dbdrivers/mysql
66                 econf
67         fi
68
69         if use odbc ; then
70                 cd "${S}"/packages/dbdrivers/odbc
71                 econf
72         fi
73
74         if use pcre ; then
75                 cd "${S}"/packages/pcre
76                 econf
77         fi
78
79         if use xml ; then
80                 cd "${S}"/packages/xpath
81                 econf
82         fi
83 }
84
85 src_compile() {
86         cd "${S}"/build
87
88         emake || die "emake failed"
89
90         # All XSB Packages are compiled using a single Prolog engine.
91         # Consequently they must all be compiled using a single make job.
92
93         cd "${S}"/packages
94         rm -rf *.xwam
95         emake -j1 || die "emake packages failed"
96
97         if use curl ; then
98                 emake -j1 curl || die "emake curl package failed"
99                 emake -j1 sgml || die "emake sgml package failed"
100                 if use xml ; then
101                         emake -j1 xpath || die "emake xpath package failed"
102                 fi
103         fi
104
105         if use mysql ; then
106                 emake -j1 mysql || die "emake mysql package failed"
107         fi
108
109         if use odbc ; then
110                 emake -j1 odbc || die "emake odbc package failed"
111         fi
112
113         if use pcre ; then
114                 emake -j1 pcre || die "emake pcre package failed"
115         fi
116 }
117
118 src_install() {
119         cd "${S}"/build
120         emake DESTDIR="${D}" install || die "make install failed"
121
122         local XSB_INSTALL_DIR=/usr/$(get_libdir)/xsb-${PV}
123         dosym ${XSB_INSTALL_DIR}/bin/xsb /usr/bin/xsb || die
124
125         cd "${S}"/packages
126         local PACKAGES=${XSB_INSTALL_DIR}/packages
127         insinto ${PACKAGES}
128         doins *.xwam || die
129
130         insinto ${PACKAGES}/chr
131         doins chr/*.xwam || die
132
133         insinto ${PACKAGES}/chr_d
134         doins chr_d/*.xwam || die
135
136         insinto ${PACKAGES}/gap
137         doins gap/*.xwam || die
138
139         insinto ${PACKAGES}/justify
140         doins justify/*.xwam || die
141         doins justify/*.H || die
142
143         insinto ${PACKAGES}/regmatch
144         doins regmatch/*.xwam || die
145         insinto ${PACKAGES}/regmatch/cc
146         doins regmatch/cc/*.H || die
147
148         insinto ${PACKAGES}/slx
149         doins slx/*.xwam || die
150
151         insinto ${PACKAGES}/wildmatch
152         doins wildmatch/*.xwam || die
153         insinto ${PACKAGES}/wildmatch/cc
154         doins wildmatch/cc/*.H || die
155
156         if use curl ; then
157                 insinto ${PACKAGES}/curl
158                 doins curl/*.xwam || die
159                 insinto ${PACKAGES}/sgml
160                 doins sgml/*.xwam || die
161                 insinto ${PACKAGES}/sgml/cc
162                 doins sgml/cc/*.H || die
163                 insinto ${PACKAGES}/sgml/cc/dtd
164                 doins sgml/cc/dtd/* || die
165                 if use xml ; then
166                         insinto ${PACKAGES}/xpath
167                         doins xpath/*xwam || die
168                         insinto ${PACKAGES}/xpath/cc
169                         doins xpath/cc/*.H || die
170                 fi
171         fi
172
173         if use mysql || use odbc ; then
174                 insinto ${PACKAGES}/dbdrivers
175                 doins dbdrivers/*.xwam || die
176                 doins dbdrivers/*.H || die
177                 insinto ${PACKAGES}/dbdrivers/cc
178                 doins dbdrivers/cc/*.H || die
179                 if use mysql ; then
180                         insinto ${PACKAGES}/dbdrivers/mysql
181                         doins dbdrivers/mysql/*.xwam || die
182                         insinto ${PACKAGES}/dbdrivers/mysql/cc
183                         doins dbdrivers/mysql/cc/*.H || die
184                 fi
185                 if use odbc ; then
186                         insinto ${PACKAGES}/dbdrivers/odbc
187                         doins dbdrivers/odbc/*.xwam || die
188                         insinto ${PACKAGES}/dbdrivers/odbc/cc
189                         doins dbdrivers/odbc/cc/*.H || die
190                 fi
191         fi
192
193         if use pcre ; then
194                 insinto ${PACKAGES}/pcre
195                 doins pcre/*.xwam || die
196                 insinto ${PACKAGES}/pcre/cc
197                 doins pcre/cc/*.H || die
198         fi
199
200         if use examples ; then
201                 cd "${S}"/build
202                 emake \
203                         DESTDIR="${D}" \
204                         install_examples="${D}"/usr/share/doc/${PF}/examples \
205                         install_examples || die "make install_examples failed"
206         fi
207
208         cd "${S}"
209         dodoc FAQ README || die
210 }