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

EAPI=6

inherit desktop multilib versionator

DESCRIPTION="Wolfram Player for the interactive Computable Document Format (CDF)"
SRC_URI="WolframPlayer_12.2.0_LINUX.sh"
HOMEPAGE="http://www.wolfram.com/cdf-player/"

LICENSE="WolframCDFPlayer"
KEYWORDS="-* ~amd64 ~x86"
SLOT="0"
IUSE=""

RESTRICT="strip mirror bindist fetch"

DEPEND=""

# this list comes from lsof output
# probably there are still some libraries missing
RDEPEND="
	x11-libs/libICE
	x11-libs/libSM
	x11-libs/libX11
	x11-libs/libXau
	x11-libs/libXcursor
	x11-libs/libXdmcp
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXi
	x11-libs/libXmu
	x11-libs/libXrandr
	x11-libs/libXrender
	x11-libs/libXt
	media-libs/alsa-lib
	dev-libs/expat
	media-libs/fontconfig
	dev-libs/icu
	x11-libs/libxcb
	dev-libs/libxml2
	sys-libs/ncurses-compat:5
	media-libs/freetype
"

# we need this a few times
MPN="WolframPlayer"
MPV=$(get_version_component_range 1-2)

# we might as well list all files in all QA variables...
QA_PREBUILT="opt/*"

S=${WORKDIR}

src_unpack() {
	/bin/sh "${DISTDIR}/${A}" --nox11 --confirm --keep -- -auto "-targetdir=${S}/opt/Wolfram/${MPN}/${MPV}" "-execdir=${S}/opt/bin" || die
}

src_install() {
	local ARCH
	if use amd64; then ARCH='-x86-64'; else ARCH=''; fi

	# move all over
	mv "${S}"/opt "${D}"/opt || die

	# the autogenerated symlinks point into sandbox, redo
	rm "${D}"/opt/bin/* || die
	dosym ../Wolfram/${MPN}/${MPV}/Executables/wolframplayer opt/bin/wolframplayer
	dosym ../Wolfram/${MPN}/${MPV}/Executables/WolframPlayer opt/bin/WolframPlayer

	# fix some embedded paths and install desktop files
	local filename
	for filename in $(find "${D}" -name "wolfram-cdf12.desktop") ; do
		echo Fixing "${filename}"
		sed -e "s:${S}::g" -e 's:^\t\t::g' -i "${filename}"
		echo "Categories=Physics;Science;Engineering;2DGraphics;Graphics;" >> "${filename}"
		domenu "${filename}"
	done

	# install a wrapper
	echo '#!/bin/sh' >> ${PN}
	echo "LD_PRELOAD=/usr/$(get_libdir)/libfreetype.so.6:/lib/libz.so.1 /opt/Wolfram/${MPN}/${MPV}/Executables/wolframplayer \$*" \
		 >> ${PN}
	dobin ${PN}
}

pkg_nofetch() {
	einfo "Sadly Wolfram provides no permanent link to the player files."
	einfo "Please download the Wolfram CFD Player installation file ${SRC_URI} from"
	einfo "${HOMEPAGE} and place it into your DISTDIR directory."
}