summaryrefslogtreecommitdiff
blob: 2e7b339fc0f355431a4efb84bd5babf864dd70a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

MY_P=YAP-${PV}

PYTHON_COMPAT=( python3_{6,7,8} )

inherit cmake-utils eutils flag-o-matic multilib python-r1

PATCHSET_VER="0"

DESCRIPTION="YAP is a high-performance Prolog compiler"
HOMEPAGE="http://www.dcc.fc.up.pt/~vsc/Yap/"
SRC_URI="https://github.com/vscosta/yap-6.3/archive/YAP-${PV}.tar.gz
	https://dev.gentoo.org/~keri/distfiles/yap/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz"

LICENSE="Artistic LGPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="R debug doc examples gmp java mpi mysql odbc postgres python raptor readline sqlite ssl static threads xml"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="dev-libs/libutf8proc
	sys-libs/zlib
	gmp? ( dev-libs/gmp:0 )
	java? ( >=virtual/jdk-1.7:= )
	mpi? ( virtual/mpi )
	mysql? ( dev-db/mysql-connector-c:0= )
	odbc? ( dev-db/unixODBC )
	postgres? ( dev-db/postgresql:= )
	R? ( dev-lang/R )
	python? ( ${PYTHON_DEPS} )
	raptor? ( media-libs/raptor )
	readline? ( sys-libs/readline:= sys-libs/ncurses:= )
	sqlite? ( dev-db/sqlite )
	ssl? ( dev-libs/openssl )
	xml? ( dev-libs/libxml2 )"

DEPEND="${RDEPEND}
	doc? ( app-doc/doxygen[dot] )
	java? ( dev-lang/swig )
	python? ( dev-lang/swig )"

S="${WORKDIR}"/yap-6.3-${MY_P}
BUILD_DIR="${S}"/build
CMAKE_USE_DIR="${S}"

src_prepare() {
	if [[ -d "${WORKDIR}"/${PV} ]] ; then
		eapply "${WORKDIR}"/${PV}
	fi
	eapply_user

	sed -i \
		-e "s|\(set ( libdir \"\${exec_prefix}\)/lib\")|\1/$(get_libdir)\")|" \
		-e "s|\(set ( dlls \"\${exec_prefix}\)/lib/Yap\")|\1/$(get_libdir)/Yap\")|" \
		-e "s|\(set ( docdir \"\${exec_prefix}/share/doc\)/Yap\")|\1/${PF}\")|" \
		CMakeLists.txt || die
	rm -rf "${S}"/yap || die "failed to remove yap xcode project"

	cmake-utils_src_prepare
}

src_configure() {
	append-flags -fno-strict-aliasing

	local mycmakeargs=(
		-DWITH_YAP_STATIC=$(usex static)
		-DWITH_Threads=$(usex threads)
		-DWITH_GMP=$(usex gmp)
		-DWITH_Readline=$(usex readline)
		-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=$(usex !ssl)
		-DWITH_MPI=$(usex mpi)
		-DWITH_ODBC=$(usex odbc)
		-DWITH_MySQL=$(usex mysql)
		-DWITH_PostgreSQL=$(usex postgres)
		-DWITH_Sqlite3=$(usex sqlite)
		-DWITH_JNI=$(usex java)
		-DCMAKE_DISABLE_FIND_PACKAGE_Java=$(usex !java)
		-DWITH_PythonInterp=$(usex python)
		-DWITH_PythonLibs=$(usex python)
		-DWITH_SWIG=$(if use java || use python; then echo yes; else echo no; fi)
		-DWITH_R=$(usex R)
		-DWITH_RAPTOR=$(usex raptor)
		-DWITH_LibXml2=$(usex xml)
		-DWITH_DOCUMENTATION=$(usex doc)
		-DWITH_CUDD=no
		-DWITH_Gecode=no
		-DWITH_Matlab=no
	)

	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile

	if use doc ; then
		cmake-utils_src_compile doc
	fi
}

src_test() {
	# libtai package contains check.c which confuses the default
	# src_test() function
	true
}

src_install() {
	cmake-utils_src_install

	dodoc changes*.html README

	if use examples ; then
		docinto /usr/share/doc/${PF}/examples/chr
		dodoc packages/chr/Examples/*
		if use java ; then
			docinto /usr/share/doc/${PF}/examples/jpl/prolog
			dodoc packages/jpl/jpl/examples/prolog/*
			docinto /usr/share/doc/${PF}/examples/jpl/java
			dodoc packages/jpl/jpl/examples/java/README
			dodoc -r packages/jpl/jpl/examples/java/*/*.{java,pl}
		fi
		if use mpi ; then
			docinto /usr/share/doc/${PF}/examples/mpi
			dodoc library/mpi/examples/*.pl
		fi
	fi
}