Skip to content

Instantly share code, notes, and snippets.

@JP-Ellis JP-Ellis/PKGBUILD.sh
Last active Oct 15, 2016

Embed
What would you like to do?
# Maintainer: kjslag <kjslag at gmail dot com>
# Contributor: Michael Pusterhofer <pusterhofer at student dot tugraz dot at>
# Contributor: Raphael Scholer <rscholer@gmx.de>
# Contributor: Anish Tondwalkar <anish@tjhsst.edu>
# Contributor: Ghost91 <m_graeb11@cs.uni-kl.de>
# Contributor: teratomata <teratomat@gmail.com>
# Contributor: Joshua Ellis <josh@jpellis.me>
pkgname=mathematica
pkgver=11.0.1
pkgrel=1
pkgdesc="A computational software program used in scientific, engineering, and mathematical fields and other areas of technical computing."
arch=('i686' 'x86_64')
url="http://www.wolfram.com/mathematica/"
license=('proprietary')
depends=('ttf-bitstream-vera' 'libxcursor' 'alsa-lib' 'libxml2')
optdepends=('glxinfo: optimized graphics capabilities')
source=("local://Mathematica_${pkgver}_LINUX.sh")
md5sums=('444f096c9e058d8a4f8555c06ccc0233')
install='mathematica.install'
options=('!strip')
PKGEXT=".pkg.tar"
# To build this package you need to place the mathematica-installer into your startdir
# If you don't own the installer you can download a trial version at http://www.wolfram.com/mathematica/trial
prepare() {
if df $pkgdir | grep -q tmpfs; then
warning "Mathematica takes uses 8GB of space"
warning "Building in a tmpfs (such as /tmp) may not work"
fi
}
package() {
if [[ $(echo "${srcdir}" | wc -w) -ne 1 ]]; then
msg2 "ERROR: The Mathematica installer doesn't support directory names with spaces."
msg2 "Try building from a directory without spaces."
msg2 "Current build directory: ${srcdir}"
false
fi
chmod +x ${srcdir}/Mathematica_${pkgver}_LINUX.sh
msg2 "Running Mathematica installer"
# https://reference.wolfram.com/language/tutorial/InstallingMathematica.html#650929293
${srcdir}/Mathematica_${pkgver}_LINUX.sh -- \
-execdir=${pkgdir}/usr/bin \
-targetdir=${pkgdir}/opt/Mathematica \
-auto
msg2 "Fixing symbolic links"
cd ${pkgdir}/usr/bin
rm *
ln -s /opt/Mathematica/Executables/math
ln -s /opt/Mathematica/Executables/mathematica
ln -s /opt/Mathematica/Executables/Mathematica
ln -s /opt/Mathematica/Executables/MathKernel
ln -s /opt/Mathematica/Executables/mcc
ln -s /opt/Mathematica/Executables/wolfram
ln -s /opt/Mathematica/Executables/WolframKernel
msg2 "Linking MathematicaScript"
if [ "${CARCH}" = "x86_64" ]; then
ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux-x86-64/MathematicaScript
ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframScript
else
ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux/MathematicaScript
ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux/WolframScript
fi
msg2 "Copying menu and mimetype information"
mkdir -p ${pkgdir}/usr/share/applications
mkdir -p ${pkgdir}/usr/share/desktop-directories
mkdir -p ${pkgdir}/usr/share/mime/packages
cd ${pkgdir}/opt/Mathematica/SystemFiles/Installation
desktopFile='wolfram-mathematica.desktop'
sed -Ei 's|^(\s*TryExec=).*|\1/usr/bin/Mathematica|g' $desktopFile
sed -Ei 's|^(\s*Exec=).*|\1/usr/bin/Mathematica %F|g' $desktopFile
cp $desktopFile ${pkgdir}/usr/share/applications/
echo -e 'Categories=Science;Math;NumericalAnalysis;DataVisualization;' >> ${pkgdir}/usr/share/applications/$desktopFile
cp wolfram-all.directory ${pkgdir}/usr/share/desktop-directories/
cp *.xml ${pkgdir}/usr/share/mime/packages/
msg2 "Copying icons"
mkdir -p ${pkgdir}/usr/share/icons/hicolor/{32x32,64x64,128x128}/{apps,mimetypes}
cd ${pkgdir}/opt/Mathematica/SystemFiles/FrontEnd/SystemResources/X
for i in "32" "64" "128"; do
cp App-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/wolfram-mathematica.png
cp vnd.wolfram.cdf-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.cdf.png
cp vnd.wolfram.mathematica.package-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.mathematica.package.png
cp vnd.wolfram.nb-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.nb.png
cp vnd.wolfram.player-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.player.png
cp vnd.wolfram.wl-${i}.png \
${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.wl.png
done
msg2 "Copying man pages"
mkdir -p ${pkgdir}/usr/share/man/man1
cd ${pkgdir}/opt/Mathematica/SystemFiles/SystemDocumentation/Unix
cp *.1 ${pkgdir}/usr/share/man/man1
msg2 "Fixing file permissions"
chmod go-w -R ${pkgdir}/*
}
# vim:set ts=2 sw=2 et:
# Local Variables:
# mode: sh
# End:
@nmboffi

This comment has been minimized.

Copy link

commented Oct 2, 2016

Thanks for making this.

I downloaded this and put it in a folder with Mathematica_11.01_LINUX.sh. Ran makepkg and everything went swell for a while, but then I received the error "installation failed: see /opt/Mathematica/InstallErrors". InstallErrors reads:

xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
xdg-icon-resource: No writable system icon directory found.
mkdir: cannot create directory ‘/applications-merged’: Permission denied
xdg-desktop-menu: No writable system menu directory found.

Any input?

@JP-Ellis

This comment has been minimized.

Copy link
Owner Author

commented Oct 15, 2016

@thereisnoquarter Sorry I didn't check this earlier (I didn't get a notification for some reason?) I get these errors too and I believe it is because Mathematica tries to install icons to system directories, but it cannot as it doesn't have root access. The PKGBUILD should take care of that though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.