Merge branch 'marbre-ipykernel'
[gentoo.git] / dev-lang / swi-prolog / swi-prolog-7.3.10.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit eutils flag-o-matic java-pkg-opt-2 multilib
8
9 PATCHSET_VER="1"
10
11 DESCRIPTION="free, small, and standard compliant Prolog compiler"
12 HOMEPAGE="http://www.swi-prolog.org/"
13 SRC_URI="http://www.swi-prolog.org/download/devel/src/swipl-${PV}.tar.gz
14         mirror://gentoo/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz"
15
16 LICENSE="LGPL-2.1"
17 SLOT="0"
18 KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
19 IUSE="archive berkdb debug doc +gmp hardened java libressl minimal odbc +readline ssl static-libs test uuid zlib X"
20
21 RDEPEND="sys-libs/ncurses:=
22         archive? ( app-arch/libarchive )
23         berkdb? ( >=sys-libs/db-4:= )
24         zlib? ( sys-libs/zlib )
25         odbc? ( dev-db/unixODBC )
26         readline? ( sys-libs/readline:= )
27         gmp? ( dev-libs/gmp:0 )
28         ssl? (
29                 !libressl? ( dev-libs/openssl:0 )
30                 libressl? ( dev-libs/libressl )
31         )
32         java? ( >=virtual/jdk-1.5:= )
33         uuid? ( dev-libs/ossp-uuid )
34         X? (
35                 virtual/jpeg:0
36                 x11-libs/libX11
37                 x11-libs/libXft
38                 x11-libs/libXpm
39                 x11-libs/libXt
40                 x11-libs/libICE
41                 x11-libs/libSM )"
42
43 DEPEND="${RDEPEND}
44         X? ( x11-proto/xproto )
45         java? ( test? ( =dev-java/junit-3.8* ) )"
46
47 S="${WORKDIR}/swipl-${PV}"
48
49 src_prepare() {
50         EPATCH_FORCE=yes
51         EPATCH_SUFFIX=patch
52         epatch "${WORKDIR}"/${PV}
53
54         if ! use uuid; then
55                 mv packages/clib/uuid.pl packages/clib/uuid.pl.unused || die
56         fi
57
58         # OSX/Intel ld doesn't like an archive without table of contents
59         sed -i -e 's/-cru/-scru/' packages/nlp/libstemmer_c/Makefile.pl || die
60 }
61
62 src_configure() {
63         append-flags -fno-strict-aliasing
64         use ppc && append-flags -mno-altivec
65         use hardened && append-flags -fno-unit-at-a-time
66         use debug && append-flags -DO_DEBUG
67
68         # ARCH is used in the configure script to figure out host and target
69         # specific stuff
70         export ARCH=${CHOST}
71
72         export CC_FOR_BUILD=$(tc-getBUILD_CC)
73
74         cd "${S}"/src || die
75         econf \
76                 --libdir="${EPREFIX}"/usr/$(get_libdir) \
77                 $(use_enable gmp) \
78                 $(use_enable readline) \
79                 $(use_enable static-libs static) \
80                 --enable-shared \
81                 --enable-custom-flags COFLAGS="${CFLAGS}"
82
83         if ! use minimal ; then
84                 local jpltestconf
85                 if use java && use test ; then
86                         jpltestconf="--with-junit=$(java-config --classpath junit)"
87                 fi
88
89                 cd "${S}/packages" || die
90                 econf \
91                         --libdir="${EPREFIX}"/usr/$(get_libdir) \
92                         $(use_with archive) \
93                         $(use_with berkdb bdb ) \
94                         $(use_with java jpl) \
95                         ${jpltestconf} \
96                         $(use_with odbc) \
97                         $(use_with ssl) \
98                         $(use_with X xpce) \
99                         $(use_with zlib) \
100                         COFLAGS='"${CFLAGS}"'
101         fi
102 }
103
104 src_compile() {
105         cd "${S}"/src || die
106         emake
107
108         if ! use minimal ; then
109                 cd "${S}/packages" || die
110                 emake
111                 ./report-failed || die "Cannot report failed packages"
112         fi
113 }
114
115 src_test() {
116         cd "${S}/src" || die
117         emake check
118
119         if ! use minimal ; then
120                 unset DISPLAY
121                 cd "${S}/packages" || die
122                 emake \
123                         USE_PUBLIC_NETWORK_TESTS=false \
124                         USE_ODBC_TESTS=false \
125                         check
126                 ./report-failed || die
127         fi
128 }
129
130 src_install() {
131         emake -C src DESTDIR="${D}" install
132
133         if ! use minimal ; then
134                 emake -C packages DESTDIR="${D}" install
135                 if use doc ; then
136                         emake -C packages DESTDIR="${D}" html-install
137                 fi
138                 ./packages/report-failed || die "Cannot report failed packages"
139         fi
140
141         dodoc ReleaseNotes/relnotes-5.10 INSTALL README VERSION
142 }