summaryrefslogtreecommitdiff
blob: 25aff0bfbc8f83a08dd3dea2e58531cf3fd93434 (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
133
134
135
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit elisp-common flag-o-matic

PATCHSET_VER="6"
MY_P="mozart-${PV}.20080704"

DESCRIPTION="Advanced development platform for intelligent, distributed applications"
HOMEPAGE="https://mozart.github.io/ https://github.com/mozart/mozart"
SRC_URI="
	mirror://sourceforge/project/mozart-oz/v1/1.4.0-2008-07-02-tar/${MY_P}-src.tar.gz
	https://dev.gentoo.org/~keri/distfiles/mozart/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz
	doc? ( mirror://sourceforge/project/mozart-oz/v1/1.4.0-2008-07-02-tar/${MY_P}-doc.tar.gz )"

SLOT="0"
LICENSE="Mozart"
KEYWORDS="-amd64 ~ppc -ppc64 ~x86"
IUSE="doc emacs examples gdbm static tcl threads tk"

RDEPEND="
	dev-lang/perl
	dev-libs/gmp:0=
	sys-libs/zlib
	emacs? ( >=app-editors/emacs-23.1:* )
	gdbm? ( sys-libs/gdbm  )
	tcl? (
		tk? (
			dev-lang/tk:0=
			dev-lang/tcl:0=
		)
	)"
DEPEND="${RDEPEND}
	sys-devel/bison
	sys-devel/flex"

SITEFILE=50${PN}-gentoo.el

S="${WORKDIR}"/${MY_P}

src_prepare() {
	default
	eapply "${WORKDIR}"/${PV}

	mkdir -p "${S}"/build/contrib
	ln -s "${S}"/configure "${S}"/build/configure
}

src_configure() {
	cd "${S}"/build

	append-flags -fno-tree-vrp
	local myconf="\
			--without-global-oz \
			--enable-opt=none"

	if use tcl && use tk ; then
		myconf="${myconf} --enable-wish"
	else
		myconf="${myconf} --disable-wish"
	fi

	econf \
		${myconf} \
		--disable-doc \
		--enable-contrib \
		--disable-contrib-micq \
		$(use_enable doc contrib-doc) \
		$(use_enable gdbm contrib-gdbm) \
		$(use_enable tk contrib-tk) \
		$(use_enable emacs compile-elisp) \
		$(use_enable static link-static) \
		$(use_enable threads threaded)
}

src_compile() {
	cd "${S}"/build
	emake bootstrap
}

src_test() {
	# Mozart tests must be run single-threaded
	cd "${S}"/share/test || die
	emake -j1 boot-oztest
	emake -j1 boot-check
}

src_install() {
	cd "${S}"/build

	emake \
		PREFIX="${D}"/usr/lib/mozart \
		ELISPDIR="${D}${SITELISP}/${PN}" \
		install

	dosym ../lib/mozart/bin/convertTextPickle /usr/bin/convertTextPickle
	dosym ../lib/mozart/bin/oldpickle2text /usr/bin/oldpickle2text
	dosym ../lib/mozart/bin/ozc /usr/bin/ozc
	dosym ../lib/mozart/bin/ozd /usr/bin/ozd
	dosym ../lib/mozart/bin/ozengine /usr/bin/ozengine
	dosym ../lib/mozart/bin/ozl /usr/bin/ozl
	dosym ../lib/mozart/bin/ozplatform /usr/bin/ozplatform
	dosym ../lib/mozart/bin/oztool /usr/bin/oztool
	dosym ../lib/mozart/bin/pickle2text /usr/bin/pickle2text
	dosym ../lib/mozart/bin/text2pickle /usr/bin/text2pickle

	if use emacs; then
		dosym ../lib/mozart/bin/oz /usr/bin/oz
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi

	dodoc "${S}"/README
	if use doc ; then
		docinto html
		dodoc -r "${WORKDIR}"/mozart/doc/*
	fi

	if use examples; then
		cd "${S}"/share || die
		insinto /usr/share/doc/${PF}
		doins -r examples demo
		rm -rf $(find "${ED}"/usr/share/doc/${PF}/examples \
			-name Makefile -o -name Makefile.in) || die
	fi
}

pkg_postinst() {
	use emacs && elisp-site-regen
}

pkg_postrm() {
	use emacs && elisp-site-regen
}