Last active
January 16, 2024 11:26
-
-
Save jdujava/a9c9d769e2a7ec0be7c111ec5935cfdd to your computer and use it in GitHub Desktop.
Patches for Mathematica AUR package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d3c382d68f13ed76792c223328baf19e64ecc730 Mon Sep 17 00:00:00 2001 | |
From: Jonas Dujava <jonas.dujava@gmail.com> | |
Date: Tue, 16 Jan 2024 11:20:08 +0100 | |
Subject: [PATCH 1/3] Fix: use bash for bash scripts | |
--- | |
PKGBUILD | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 5440a78..3fe21b5 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -18,7 +18,7 @@ license=('proprietary') | |
depends=( | |
'openmp' | |
) | |
-makedepends=('rsync') | |
+makedepends=('bash' 'rsync') | |
optdepends=( | |
## The following list of dependencies was inferred from namcap's output. If | |
## you believe there is an error, please let me know. Also feel free to | |
@@ -124,13 +124,13 @@ prepare() { | |
package() { | |
msg2 "Running Mathematica installer" | |
# https://reference.wolfram.com/language/tutorial/InstallingMathematica.html#650929293 | |
- sh "${srcdir}/bundle/Unix/Installer/MathInstaller" \ | |
+ bash "${srcdir}/bundle/Unix/Installer/MathInstaller" \ | |
-execdir="${pkgdir}/usr/bin" \ | |
-targetdir="${pkgdir}/opt/Mathematica" \ | |
-auto | |
# Install documentation | |
- sh "${srcdir}/bundle/Unix/.bundle/Unix/Installer/MathInstaller" \ | |
+ bash "${srcdir}/bundle/Unix/.bundle/Unix/Installer/MathInstaller" \ | |
-targetdir="${pkgdir}/tmp" \ | |
-auto | |
rsync -a --remove-source-files "${pkgdir}/tmp/Documentation/English" "${pkgdir}/opt/Mathematica/Documentation" | |
-- | |
2.43.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f0ff5f6620909684681d781f4a24825ceab04031 Mon Sep 17 00:00:00 2001 | |
From: Jonas Dujava <jonas.dujava@gmail.com> | |
Date: Tue, 16 Jan 2024 11:24:24 +0100 | |
Subject: [PATCH 2/3] Chore: remove outdated comments | |
--- | |
PKGBUILD | 7 ------- | |
1 file changed, 7 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 3fe21b5..b935f38 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -89,13 +89,6 @@ md5sums=('2e9479b7622ea8d09d465ffc53a753c4' | |
'14df424ec93fad057604378c2b5c24c2') | |
options=("!strip") | |
-## 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 | |
- | |
-## The documentation takes up the majority of the disk space. If you do not wish | |
-## to keep it, uncomment the relevant lines at the bottom of this PKGBUILD. | |
- | |
## The final package can be very large (especially if documentation is kept) and | |
## compression can be quite slow. In most cases, the package is installed | |
## straight away and the package need not be kept, so compression is disabled. | |
-- | |
2.43.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4ece779ee24ef6e1b7688493687df3cacf1fbc64 Mon Sep 17 00:00:00 2001 | |
From: Jonas Dujava <jonas.dujava@gmail.com> | |
Date: Wed, 27 Dec 2023 15:58:09 +0100 | |
Subject: [PATCH 3/3] Feat: easily change the installation directory | |
--- | |
PKGBUILD | 45 ++++++++++++++++++++++++--------------------- | |
1 file changed, 24 insertions(+), 21 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index b935f38..a0234ac 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -94,6 +94,9 @@ options=("!strip") | |
## straight away and the package need not be kept, so compression is disabled. | |
# PKGEXT='.pkg.tar' | |
+## Here you can change the installation directory. The default is '/opt/Mathematica'. | |
+_installdir='/opt/Mathematica' | |
+ | |
prepare() { | |
warning "Building Mathematica takes more than 24GiB of space for 'makepkg'." | |
warning "Building in a tmpfs (e.g. /tmp when mounted into RAM) may not work." | |
@@ -119,43 +122,43 @@ package() { | |
# https://reference.wolfram.com/language/tutorial/InstallingMathematica.html#650929293 | |
bash "${srcdir}/bundle/Unix/Installer/MathInstaller" \ | |
-execdir="${pkgdir}/usr/bin" \ | |
- -targetdir="${pkgdir}/opt/Mathematica" \ | |
+ -targetdir="${pkgdir}${_installdir}" \ | |
-auto | |
# Install documentation | |
bash "${srcdir}/bundle/Unix/.bundle/Unix/Installer/MathInstaller" \ | |
-targetdir="${pkgdir}/tmp" \ | |
-auto | |
- rsync -a --remove-source-files "${pkgdir}/tmp/Documentation/English" "${pkgdir}/opt/Mathematica/Documentation" | |
+ rsync -a --remove-source-files "${pkgdir}/tmp/Documentation/English" "${pkgdir}${_installdir}/Documentation" | |
rm -rf "${pkgdir}/tmp" | |
- if [ -s "${pkgdir}/opt/Mathematica/InstallErrors" ]; then | |
+ if [ -s "${pkgdir}${_installdir}/InstallErrors" ]; then | |
msg2 "Review installation errors:" | |
- cat "${pkgdir}/opt/Mathematica/InstallErrors" | |
+ cat "${pkgdir}${_installdir}/InstallErrors" | |
fi | |
- rm -f "${pkgdir}/opt/Mathematica/InstallErrors" | |
+ rm -f "${pkgdir}${_installdir}/InstallErrors" | |
msg2 "Fixing symbolic links" | |
- cd ${pkgdir}/opt/Mathematica/Executables | |
+ cd ${pkgdir}${_installdir}/Executables | |
rm wolframscript | |
- ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript | |
+ ln -s ${_installdir}/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript | |
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 | |
- ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux-x86-64/ELProver | |
- ln -s /opt/Mathematica/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript | |
+ ln -s ${_installdir}/Executables/math | |
+ ln -s ${_installdir}/Executables/mathematica | |
+ ln -s ${_installdir}/Executables/Mathematica | |
+ ln -s ${_installdir}/Executables/MathKernel | |
+ ln -s ${_installdir}/Executables/mcc | |
+ ln -s ${_installdir}/Executables/wolfram | |
+ ln -s ${_installdir}/Executables/WolframKernel | |
+ ln -s ${_installdir}/SystemFiles/Kernel/Binaries/Linux-x86-64/ELProver | |
+ ln -s ${_installdir}/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript | |
msg2 "Setting up WolframScript" | |
mkdir -p ${srcdir}/WolframScript | |
mkdir -p ${pkgdir}/usr/share/ | |
cd ${srcdir}/WolframScript | |
- bsdtar -xf ${pkgdir}/opt/Mathematica/SystemFiles/Installation/wolframscript_*_amd64.deb data.tar.xz | |
+ bsdtar -xf ${pkgdir}${_installdir}/SystemFiles/Installation/wolframscript_*_amd64.deb data.tar.xz | |
tar -xf data.tar.xz -C ${pkgdir}/usr/share/ --strip=3 ./usr/share/ | |
@@ -164,7 +167,7 @@ package() { | |
${pkgdir}/usr/share/applications \ | |
${pkgdir}/usr/share/desktop-directories \ | |
${pkgdir}/usr/share/mime/packages | |
- cd ${pkgdir}/opt/Mathematica/SystemFiles/Installation | |
+ cd ${pkgdir}${_installdir}/SystemFiles/Installation | |
desktopFile="com.wolfram.Mathematica.${_pkgver}.desktop" | |
sed -Ei "s|^(\s*TryExec=).*|\1/usr/bin/Mathematica|g" $desktopFile | |
sed -Ei "s|^(\s*Exec=).*|\1/usr/bin/Mathematica --name com.wolfram.mathematica.${_pkgver} %F|g" $desktopFile | |
@@ -175,7 +178,7 @@ package() { | |
msg2 "Copying icons" | |
mkdir -p ${pkgdir}/usr/share/icons/hicolor/{32x32,64x64,128x128}/{apps,mimetypes} | |
- cd ${pkgdir}/opt/Mathematica/SystemFiles/FrontEnd/SystemResources/X | |
+ cd ${pkgdir}${_installdir}/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 | |
for mimetype in $(ls vnd.* | cut -d '-' -f1 | uniq); do | |
@@ -185,12 +188,12 @@ package() { | |
msg2 "Copying man pages" | |
mkdir -p ${pkgdir}/usr/share/man/man1 | |
- cd ${pkgdir}/opt/Mathematica/SystemFiles/SystemDocumentation/Unix | |
+ cd ${pkgdir}${_installdir}/SystemFiles/SystemDocumentation/Unix | |
cp *.1 ${pkgdir}/usr/share/man/man1 | |
msg2 "Copying license" | |
mkdir -p ${pkgdir}/usr/share/licenses/Mathematica/ | |
- cp ${pkgdir}/opt/Mathematica/LICENSE.txt ${pkgdir}/usr/share/licenses/Mathematica/license.txt | |
+ cp ${pkgdir}${_installdir}/LICENSE.txt ${pkgdir}/usr/share/licenses/Mathematica/license.txt | |
msg2 "Fixing file permissions" | |
chmod go-w -R ${pkgdir}/* | |
-- | |
2.43.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment