summaryrefslogtreecommitdiff
blob: f899be5be27d54d32e0a9d3b347ab15253c07ae0 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="source"

inherit desktop toolchain-funcs xdg java-pkg-2

DESCRIPTION="Tool for building Expert Systems (Java version)"
HOMEPAGE="http://www.clipsrules.net/"

CLPN="clips_jni_$(ver_cut 1)$(ver_cut 2)"
SRC_URI="https://sourceforge.net/projects/clipsrules/files/CLIPS/${PV}/${CLPN}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN^^}"

LICENSE="public-domain"
KEYWORDS="amd64 ~x86"
SLOT="0"
IUSE="examples"

RDEPEND=">=virtual/jre-1.8:*"
DEPEND=">=virtual/jdk-1.8:*"

PATCHES=(
	"${FILESDIR}/${PN}-library-src_makefile.lnx-remove_hardcoded.patch"
	"${FILESDIR}/${PN}-makefile.lnx-java.patch"
)

src_prepare() {
	xdg_environment_reset
	tc-export AR CC

	rm ./*.dll ./*.jar ./*jnilib || die
	java-pkg-2_src_prepare

	default
}

src_compile() {
	pushd library-src || die
	emake -f makefile.lnx
	popd || die

	if use examples ; then
		emake -f makefile.lnx
	else
		emake -f makefile.lnx clipsjni ide
	fi
}

src_install() {
	java-pkg_doso ./library-src/libCLIPSJNI.so
	java-pkg_dojar CLIPSIDE.jar CLIPSJNI.jar

	local e
	for e in clipside clipsjni ; do
		java-pkg_dolauncher ${e} --jar ${e^^}.jar
	done

	doicon ./java-src/net/sf/clipsrules/jni/examples/ide/resources/CLIPS.png

	make_desktop_entry  \
		clipside CLIPSIDE CLIPS "Development;IDE"
	make_desktop_entry  \
		clipsjni CLIPSJNI CLIPS "Development;ConsoleOnly;" "Terminal=true"

	if use examples ; then
		insinto /usr/share/clipsjni/examples
		doins ./*Demo.jar
	fi

	use source && java-pkg_dosrc ./java-src
}

pkg_preinst() {
	java-pkg-2_pkg_preinst
	xdg_pkg_preinst
}