1 |
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit desktop multilib xdg
|
|
6 |
CHECKREQS_DISK_BUILD=19G
|
|
7 |
inherit check-reqs desktop unpacker xdg
|
7 |
8 |
|
8 |
9 |
DESCRIPTION="Wolfram Mathematica"
|
9 |
10 |
SRC_URI="Mathematica_${PV}_BNDL_LINUX.sh"
|
... | ... | |
12 |
13 |
LICENSE="all-rights-reserved"
|
13 |
14 |
KEYWORDS="-* ~amd64"
|
14 |
15 |
SLOT="0"
|
15 |
|
IUSE="+doc"
|
|
16 |
IUSE="cuda doc R"
|
16 |
17 |
|
17 |
18 |
RESTRICT="strip mirror bindist fetch"
|
18 |
19 |
|
19 |
|
DEPEND=""
|
20 |
|
|
21 |
20 |
# Mathematica comes with a lot of bundled stuff. We should place here only what we
|
22 |
21 |
# explicitly override with LD_PRELOAD.
|
|
22 |
# RLink (libjri.so) requires dev-lang/R
|
23 |
23 |
RDEPEND="
|
|
24 |
cuda? ( dev-util/nvidia-cuda-toolkit )
|
24 |
25 |
media-libs/freetype
|
|
26 |
R? ( dev-lang/R )
|
|
27 |
virtual/libcrypt
|
|
28 |
"
|
|
29 |
|
|
30 |
DEPEND="
|
|
31 |
${RDEPEND}
|
|
32 |
"
|
|
33 |
|
|
34 |
BDEPEND="
|
|
35 |
dev-util/patchelf
|
25 |
36 |
"
|
26 |
37 |
|
27 |
38 |
# we need this a few times
|
28 |
39 |
MPN="Mathematica"
|
29 |
40 |
MPV=$(ver_cut 1-2)
|
30 |
|
M_BINARIES="MathKernel Mathematica MathematicaScript WolframKernel WolframScript math mathematica mcc wolfram"
|
|
41 |
M_BINARIES="MathKernel Mathematica WolframKernel wolframscript math mathematica mcc wolfram"
|
31 |
42 |
M_TARGET="opt/Wolfram/${MPN}/${MPV}"
|
32 |
43 |
|
33 |
44 |
# we might as well list all files in all QA variables...
|
... | ... | |
42 |
53 |
src_prepare() {
|
43 |
54 |
pushd "${S}/unpack" > /dev/null || die
|
44 |
55 |
# fix ACCESS DENIED issue when installer check the avahi-daemon
|
45 |
|
sed -e "s:avahi-daemon -c:true:g" -i "Unix/Installer/MathInstaller" || die
|
|
56 |
sed -e "s|avahi-daemon -c|true|g" -i "Unix/Installer/MathInstaller" || die
|
46 |
57 |
/bin/sh "Unix/Installer/MathInstaller" -auto "-targetdir=${S}/${M_TARGET}" "-execdir=${S}/opt/bin" || die
|
47 |
58 |
popd > /dev/null || die
|
48 |
59 |
eapply_user
|
... | ... | |
53 |
64 |
|
54 |
65 |
if ! use doc; then
|
55 |
66 |
einfo "Removing documentation"
|
56 |
|
rm -r "${S}/${M_TARGET}/Documentation"
|
|
67 |
rm -r "${S}/${M_TARGET}/Documentation" || die
|
57 |
68 |
fi
|
58 |
69 |
|
59 |
70 |
einfo 'Removing MacOS- and Windows-specific files'
|
60 |
|
find AddOns SystemFiles -type d -\( -name Windows -o -name Windows-x86-64 \
|
61 |
|
-o -name MacOSX -o -name MacOSX-x86-64 -\) -delete
|
|
71 |
find "${S}/${M_TARGET}" -type d -\( -name Windows -o -name Windows-x86-64 \
|
|
72 |
-o -name MacOSX -o -name MacOSX-x86-64 -o -name Macintosh -\) \
|
|
73 |
-exec rm -rv {} + || die
|
|
74 |
|
|
75 |
if ! use cuda; then
|
|
76 |
einfo 'Removing cuda support'
|
|
77 |
rm -r "${S}/${M_TARGET}/SystemFiles/Components/CUDACompileTools/LibraryResources/Linux-x86-64/CUDAExtensions.so" || die
|
|
78 |
fi
|
|
79 |
|
|
80 |
# Linux-x86-64/AllVersions is the supported version, other versions remove
|
|
81 |
einfo 'Removing unsupported RLink versions'
|
|
82 |
rm -r "${S}/${M_TARGET}/SystemFiles/Links/RLink/SystemFiles/Libraries/Linux-x86-64/3.5.0" || die
|
|
83 |
rm -r "${S}/${M_TARGET}/SystemFiles/Links/RLink/SystemFiles/Libraries/Linux-x86-64/3.6.0" || die
|
|
84 |
rm -r "${S}/${M_TARGET}/SystemFiles/Links/RLink/SystemFiles/Libraries/Linux/AllVersions" || die
|
|
85 |
if ! use R; then
|
|
86 |
einfo 'Removing RLink support'
|
|
87 |
rm -r "${S}/${M_TARGET}/SystemFiles/Links/RLink/SystemFiles/Libraries/Linux-x86-64/AllVersions/libjri.so" || die
|
|
88 |
fi
|
|
89 |
|
|
90 |
# fix RPATH
|
|
91 |
while IFS= read -r -d '' i; do
|
|
92 |
# Use \x7fELF header to separate ELF executables and libraries
|
|
93 |
# Skip .o files and static files to avoid surprises
|
|
94 |
[[ $(od -t x1 -N 4 "${i}") == *"7f 45 4c 46"* ]] || continue
|
|
95 |
[[ -f "${i}" && "${i: -2}" != ".o" ]] || continue
|
|
96 |
[[ "$(file "${i}")" == *"dynamically"* ]] || continue
|
|
97 |
einfo "Fixing RPATH of ${i}"
|
|
98 |
patchelf --set-rpath \
|
|
99 |
'/'"${M_TARGET}"'/SystemFiles/Libraries/Linux-x86-64:'\
|
|
100 |
'/'"${M_TARGET}"'/SystemFiles/Libraries/Linux-x86-64/Qt/lib:'\
|
|
101 |
'/'"${M_TARGET}"'/SystemFiles/Java/Linux-x86-64/lib:'\
|
|
102 |
'/'"${M_TARGET}"'/SystemFiles/Java/Linux-x86-64/lib/jli:'\
|
|
103 |
'$ORIGIN' "${i}" || \
|
|
104 |
die "patchelf failed on ${i}"
|
|
105 |
done < <(find "${S}/${M_TARGET}" -type f -print0)
|
|
106 |
|
|
107 |
# fix broken symbolic link
|
|
108 |
ln -sf "/${M_TARGET}/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript" "${S}/${M_TARGET}/Executables/wolframscript" || die
|
62 |
109 |
|
63 |
110 |
# move all over
|
64 |
|
mv "${S}"/opt "${D}"/opt || die
|
|
111 |
mv "${S}"/opt "${ED}"/opt || die
|
65 |
112 |
|
66 |
113 |
# the autogenerated symlinks point into sandbox, remove
|
67 |
|
rm "${D}"/opt/bin/* || die
|
|
114 |
rm "${ED}"/opt/bin/* || die
|
68 |
115 |
|
69 |
116 |
# install wrappers instead
|
70 |
117 |
for name in ${M_BINARIES} ; do
|
71 |
118 |
einfo "Generating wrapper for ${name}"
|
72 |
|
echo '#!/bin/sh' >> "${T}/${name}"
|
73 |
|
echo "LD_PRELOAD=/usr/$(get_libdir)/libfreetype.so.6:/$(get_libdir)/libz.so.1 /${M_TARGET}/Executables/${name} \$*" \
|
74 |
|
>> "${T}/${name}"
|
|
119 |
echo '#!/bin/sh' >> "${T}/${name}" || die
|
|
120 |
echo 'QT_QPA_PLATFORM="wayland;xcb"' >> "${T}/${name}" || die
|
|
121 |
echo "LD_PRELOAD=/usr/$(get_libdir)/libfreetype.so.6:/$(get_libdir)/libz.so.1:/$(get_libdir)/libcrypt.so.1 /${M_TARGET}/Executables/${name} \$*" \
|
|
122 |
>> "${T}/${name}" || die
|
75 |
123 |
dobin "${T}/${name}"
|
76 |
124 |
done
|
77 |
125 |
for name in ${M_BINARIES} ; do
|
... | ... | |
80 |
128 |
done
|
81 |
129 |
|
82 |
130 |
# fix some embedded paths and install desktop files
|
83 |
|
for filename in $(find "${D}/${M_TARGET}/SystemFiles/Installation" -name "wolfram-mathematica*.desktop") ; do
|
84 |
|
echo Fixing "${filename}"
|
85 |
|
sed -e "s:${S}::g" -e 's:^\t\t::g' -i "${filename}"
|
86 |
|
echo "Categories=Physics;Science;Engineering;2DGraphics;Graphics;" >> "${filename}"
|
|
131 |
for filename in $(find "${ED}/${M_TARGET}/SystemFiles/Installation" -name "wolfram-mathematica*.desktop") ; do
|
|
132 |
einfo "Fixing ${filename}"
|
|
133 |
sed -e "s|${S}||g" -e 's|^\t\t||g' -i "${filename}" || die
|
|
134 |
echo "Categories=Physics;Science;Engineering;2DGraphics;Graphics;" >> "${filename}" || die
|
87 |
135 |
domenu "${filename}"
|
88 |
136 |
done
|
89 |
137 |
|
|
138 |
# install icons
|
|
139 |
for iconsize in 16 32 64 128 256; do
|
|
140 |
local iconfile="${ED}/${M_TARGET}/SystemFiles/FrontEnd/SystemResources/X/App-${iconsize}.png"
|
|
141 |
if [ -e "${iconfile}" ]; then
|
|
142 |
newicon -s "${iconsize}" "${iconfile}" wolfram-mathematica.png
|
|
143 |
fi
|
|
144 |
done
|
|
145 |
|
90 |
146 |
# install mime types
|
91 |
147 |
insinto /usr/share/mime/application
|
92 |
|
for filename in $(find "${D}/${M_TARGET}/SystemFiles/Installation" -name "application-*.xml"); do
|
|
148 |
for filename in $(find "${ED}/${M_TARGET}/SystemFiles/Installation" -name "application-*.xml"); do
|
93 |
149 |
basefilename=$(basename "${filename}")
|
94 |
|
mv "${filename}" "${T}/${basefilename#application-}"
|
|
150 |
mv "${filename}" "${T}/${basefilename#application-}" || die
|
95 |
151 |
doins "${T}/${basefilename#application-}"
|
96 |
152 |
done
|
97 |
153 |
}
|