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

EAPI=6

inherit desktop qmake-utils

DESCRIPTION="Interactive 3D mathematical function viewer"
HOMEPAGE="https://sourceforge.net/projects/zhu3d"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

LANGS=(cs de es fr zh)
IUSE="${LANGS[@]/#/l10n_}"

DEPEND="
	dev-qt/qtcore:5
	dev-qt/qtgui:5
	dev-qt/qtopengl:5
	dev-qt/qtprintsupport:5
	dev-qt/qtwidgets:5
	virtual/glu
	virtual/opengl
"
RDEPEND="${DEPEND}"

PATCHES=( "${FILESDIR}"/${P}-qt5.patch )

src_prepare() {
	default

	local datadir=/usr/share/${PN}
	sed \
		-e "s:^SYSDIR=:SYSDIR=${datadir}/system:" \
		-e "s:^TEXDIR=:TEXDIR=${datadir}/textures:" \
		-e "s:^WORKDIR=:WORKDIR=${datadir}/work:" \
		-e "s:^DOCDIR=:DOCDIR=/usr/share/doc/${PF}/html:" \
		-i ${PN}.pri || die "sed zhu3d.pri failed"

	sed \
		-e "/# Optimisation/,/# Include/d" \
		-i ${PN}.pro || die "optimisation sed failed"

	eqmake5 zhu3d.pro
}

src_install() {
	# not working: emake install INSTALL_ROOT="${D}"
	dobin zhu3d

	dodoc readme.txt src/changelog.txt

	docinto html
	dodoc doc/*.png doc/${PN}_en.html

	local lang
	insinto /usr/share/${PN}/system/languages
	for lang in "${LANGS[@]}" ; do
		if use l10n_${lang} ; then
			doins system/languages/${PN}_${lang}.qm
			[[ -e doc/${PN}_${lang}.html ]] && dodoc doc/${PN}_${lang}.html
		fi
	done

	insinto /usr/share/${PN}
	doins -r work/textures

	insinto /usr/share/${PN}/work
	doins -r work/*.zhu work/slideshow

	insinto /usr/share/${PN}/system
	doins -r system/*.zhu system/icons

	doicon system/icons/${PN}.png
	make_desktop_entry ${PN} "Zhu3D Function Viewer" \
		${PN} "Education;Science;Math;Qt"
}