aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Rubin2022-04-19 17:45:18 +0200
committerMarco Rubin2022-04-19 17:45:18 +0200
commit8acbc683888f8acd45f8099116ca0771e4e578d2 (patch)
treeaafe7cd55803a386e5b29642f1f08b73b2ddf0ea
parent04100d8083b1adda32a93ce9a294a35f8289cbfd (diff)
downloadaur-8acbc683888f8acd45f8099116ca0771e4e578d2.tar.gz
Update to 2022a
-rw-r--r--.SRCINFO90
-rw-r--r--PKGBUILD261
-rw-r--r--README.md127
-rw-r--r--install.sh11
-rw-r--r--matlab.script9
5 files changed, 328 insertions, 170 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8c3c26e39c58..b188594ecb1f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,14 @@
pkgbase = matlab
pkgdesc = A high-level language for numerical computation and visualization
- pkgver = 9.9.0.1467703
- pkgrel = 4
+ pkgver = 9.12.0.1903524
+ pkgrel = 1
url = http://www.mathworks.com
arch = x86_64
license = custom
+ makedepends = findutils
makedepends = gendesk
+ makedepends = icoutils
makedepends = python
- makedepends = findutils
- makedepends = libselinux
depends = ca-certificates
depends = lsb-release
depends = alsa-lib
@@ -34,6 +34,7 @@ pkgbase = matlab
depends = libx11
depends = libxcb
depends = libxcomposite
+ depends = libxcrypt-compat
depends = libxcursor
depends = libxdamage
depends = libxext
@@ -53,12 +54,9 @@ pkgbase = matlab
depends = x11vnc
depends = sudo
depends = zlib
- depends = gcc8
- depends = gcc8-fortran
- depends = gcc8-libs
depends = gconf
depends = glu
- depends = gstreamer0.10-base
+ depends = gstreamer
depends = libunwind
depends = libxp
depends = libxpm
@@ -68,14 +66,80 @@ pkgbase = matlab
depends = qt5-websockets
depends = qt5-x11extras
depends = xerces-c
- provides = matlab-licenses
- provides = matlab-engine-for-python
provides = matlab-bin
- source = matlab.script
+ provides = matlab
+ provides = python-matlabengine
md5sums = SKIP
md5sums = SKIP
md5sums = SKIP
- md5sums = b6651d0199305f18ab8c0c464b86a9c7
-pkgname = matlab
+pkgname = python-matlabengine
+ depends = ca-certificates
+ depends = lsb-release
+ depends = alsa-lib
+ depends = atk
+ depends = libcap
+ depends = libcups
+ depends = libdbus
+ depends = fontconfig
+ depends = libgcrypt
+ depends = gdk-pixbuf2
+ depends = gst-plugins-base
+ depends = gstreamer
+ depends = gtk2
+ depends = krb5
+ depends = nspr
+ depends = nss
+ depends = pam
+ depends = pango
+ depends = cairo
+ depends = libselinux
+ depends = libsm
+ depends = libsndfile
+ depends = libx11
+ depends = libxcb
+ depends = libxcomposite
+ depends = libxcrypt-compat
+ depends = libxcursor
+ depends = libxdamage
+ depends = libxext
+ depends = libxfixes
+ depends = libxft
+ depends = libxi
+ depends = libxmu
+ depends = libxrandr
+ depends = libxrender
+ depends = libxslt
+ depends = libxss
+ depends = libxt
+ depends = libxtst
+ depends = libxxf86vm
+ depends = procps-ng
+ depends = xorg-server-xvfb
+ depends = x11vnc
+ depends = sudo
+ depends = zlib
+ depends = gconf
+ depends = glu
+ depends = gstreamer
+ depends = libunwind
+ depends = libxp
+ depends = libxpm
+ depends = portaudio
+ depends = qt5-svg
+ depends = qt5-webkit
+ depends = qt5-websockets
+ depends = qt5-x11extras
+ depends = xerces-c
+ depends = python
+ depends = matlab
+pkgname = matlab
+ optdepends = gcc9: For MEX support
+ optdepends = gcc8-fortran: For MEX support
+ optdepends = gcc8: For MEX support
+ optdepends = gcc8-fortran: For MEX support
+ optdepends = gcc6: For MEX support
+ optdepends = gcc6-fortran: For MEX support
+ optdepends = gcc49: For MEX support
+ optdepends = gcc47: For MEX support
diff --git a/PKGBUILD b/PKGBUILD
index bd47559e35f6..dd29510a951c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,19 +1,21 @@
-# Maintainer: Batuhan Baserdem <lastname dot firstname at gmail>
-# Matlab packaging for archlinux
-
-name=MATLAB
-release='r2020b'
-instdir="/opt/tmw/${name}-${release}"
-pkgname=matlab
-pkgver=9.9.0.1467703
-pkgrel=4
+# Maintainer: Marco Rubin <marco.rubin@protonmail.com>
+# Maintainer: sukanka <su975853527[AT]gmail.com>
+# Contributor: Batuhan Baserdem <lastname dot firstname at gmail>
+
+pkgbase=matlab
+pkgname=('python-matlabengine' 'matlab')
+pkgrel=1
+# No need to modify the pkgver here, it will be determined by the script
+# in the offline installer.
+pkgver=9.12.0.1903524
pkgdesc='A high-level language for numerical computation and visualization'
arch=('x86_64')
url='http://www.mathworks.com'
license=(custom)
-makedepends=('gendesk' 'python' 'findutils' 'libselinux')
-# For 2020a; from https://hub.docker.com/r/mathworks/matlab-deps/dockerfile
-# Some of the dependencies are probably not needed; contact the maintainer please
+makedepends=('findutils' 'gendesk' 'icoutils' 'python')
+# Some of the dependencies probably are not needed.
+# If you play around with them and find which one can be removed,
+# please contact the maintainers.
depends=(
'ca-certificates'
'lsb-release'
@@ -40,6 +42,7 @@ depends=(
'libx11'
'libxcb'
'libxcomposite'
+ 'libxcrypt-compat'
'libxcursor'
'libxdamage'
'libxext'
@@ -59,13 +62,12 @@ depends=(
'x11vnc'
'sudo'
'zlib')
-# These I got from arch before and afraid to play around.
+# We should check even these ones.
# GCC: https://www.mathworks.com/support/requirements/supported-compilers.html
depends+=(
- 'gcc8' 'gcc8-fortran' 'gcc8-libs'
'gconf'
'glu'
- 'gstreamer0.10-base'
+ 'gstreamer'
'libunwind'
'libxp'
'libxpm'
@@ -75,93 +77,87 @@ depends+=(
'qt5-websockets'
'qt5-x11extras'
'xerces-c')
-provides=('matlab-licenses' 'matlab-engine-for-python' 'matlab-bin')
+provides=('matlab-bin' 'matlab' 'python-matlabengine')
source=(
- "matlab.tar"
- "matlab.fik"
- "matlab.lic"
- "matlab.script")
-md5sums=(SKIP SKIP SKIP 'b6651d0199305f18ab8c0c464b86a9c7')
+ 'matlab.tar'
+ 'matlab.fik'
+ 'matlab.lic'
+)
+md5sums=(SKIP SKIP SKIP)
-# Limit products to lower size, set this to true to do a partial install
+# Set this to `true` to do a partial install, otherwise install all products.
partialinstall=false
-# Example list of products for a partial install; check README.md for details
+# Example list of products for a partial install. Check the README for details.
products=(
"MATLAB"
- #---MATLAB Product Family---#
- "Curve_Fitting_Toolbox" # Math and Optimization
- "Database_Toolbox" # Database Access and Reporting
- "Deep_Learning_HDL_Toolbox"
- "Deep_Learning_Toolbox"
- "DSP_System_Toolbox"
- "Global_Optimization_Toolbox"
- "GPU_Coder"
- "MATLAB_Coder" # Code Generation
- "MATLAB_Compiler" # Application Deployement
- "MATLAB_Compiler_SDK"
- "Optimization_Toolbox"
- "Parallel_Computing_Toolbox" # Parallel computing
- "Partial_Differential_Equation_Toolbox"
- "Reinforcement_Learning_Toolbox"
- "Statistics_and_Machine_Learning_Toolbox" # AI, Data Science, Statistics
- "Symbolic_Math_Toolbox"
- "Text_Analytics_Toolbox"
- #---Application Products---#
- "Audio_Toolbox"
- "Bioinformatics_Toolbox" # Computational Biology
- "Computer_Vision_Toolbox"
- "Image_Processing_Toolbox" # Image Processing and Computer Vision
- "Signal_Processing_Toolbox" # Signal Processing
- "Wavelet_Toolbox"
+ "Simulink"
)
+instdir="usr/lib/${pkgbase}"
+
+pkgver() {
+ cat "${srcdir}/${pkgbase}/VersionInfo.xml" | grep "<version>" | sed "s|\s*<version>\(.*\)</version>\s*|\1|g"
+}
+
prepare() {
# Extract file installation key
- _fik=$(grep -o '[0-9-]*' "${srcdir}/${pkgname}.fik")
+ release=$(cat "${srcdir}/${pkgbase}/VersionInfo.xml" | grep "<release>" | sed "s|\s*<release>\(.*\)</release>\s*|\1|g")
- # Modify the installer settings'
- _set="${srcdir}/${pkgname}/installer_input.txt"
+ msg2 "Release from tarball: ${release}"
+
+ _fik=$(grep -o '[0-9-]*' "${srcdir}/${pkgbase}.fik")
+
+ msg2 "Modifying installer settings..."
+
+ _set="${srcdir}/${pkgbase}/installer_input.txt"
sed -i "s|^# destinationFolder=|destinationFolder=${srcdir}/build|" "${_set}"
- sed -i "s|^# fileInstallationKey=|fileInstallationKey=${_fik}|" "${_set}"
- sed -i "s|^# agreeToLicense=|agreeToLicense=yes|" "${_set}"
- sed -i "s|^# licensePath=|licensePath=${srcdir}/matlab.lic|" "${_set}"
+ sed -i "s|^# fileInstallationKey=|fileInstallationKey=${_fik}|" "${_set}"
+ sed -i "s|^# agreeToLicense=|agreeToLicense=yes|" "${_set}"
+ sed -i "s|^# improveMATLAB=yes|improveMATLAB=no|" "${_set}"
+ sed -i "s|^# licensePath=|licensePath=${srcdir}/matlab.lic|" "${_set}"
- # Select products if partialinstall is set
+ # Install specified products if partialinstall is set to 'true'.
if [ "${partialinstall}" = 'true' ]; then
for _prod in "${products[@]}"; do
sed -i 's|^#\(product.'"${_prod}"'\)|\1|' "${_set}"
done
fi
- # Desktop file
- # Implemented a fix for intel gpus with mesa 20;
+ msg2 "Generating the desktop file..."
+
+ # Add a fix for Intel GPUs with mesa 20, see:
# https://wiki.archlinux.org/index.php/MATLAB#OpenGL_acceleration
# https://wiki.archlinux.org/index.php/Intel_graphics#Old_OpenGL_Driver_(i965)
gendesk -f -n \
- --pkgname "${pkgname}" \
+ --pkgname "${pkgbase}" \
--pkgdesc "${pkgdesc}" \
+ --name "MATLAB" \
--categories "Development;Education;Science;Mathematics;IDE" \
--mimetypes "application/x-matlab-data;text/x-matlab" \
- --exec 'sh -c '\''if [ "${MATLAB_INTEL_OVERRIDE}" = "yes" ] ; then exec env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop ; else exec matlab -desktop ; fi'\'
+ --icon "${pkgbase}" \
+ --exec 'sh -c '\''if [ "${MATLAB_INTEL_OVERRIDE}" = "yes" ] ; then exec env MESA_LOADER_DRIVER_OVERRIDE=i965 GTK_PATH=/usr/lib/gtk-2.0 matlab -desktop ; else exec env GTK_PATH=/usr/lib/gtk-2.0 matlab -desktop ; fi'\'
+
}
build() {
+ msg2 "Installing with the original installer..."
# Using the installer with the -inputFile parameter will automatically
- # cause the installation to be non-interactive
- "${srcdir}/${pkgname}/install" -inputFile "${srcdir}/${pkgname}/installer_input.txt"
+ # cause the installation to be non-interactive
+ "${srcdir}/${pkgbase}/install" -inputFile "${srcdir}/${pkgbase}/installer_input.txt"
+
+ msg2 "Building the python API..."
- # Build the python API
cd "${srcdir}/build/extern/engines/python"
- # Checking supported vs existing matlab versions
+ msg2 "Checking supported vs existing matlab versions..."
_matminor="$(find "${srcdir}/build/extern/engines/python" \
-name 'matlabengineforpython3*.so' |
sort |
- sed 's|.*matlabengineforpython3_\([0-9]\)\.so|\1|g' |
+ sed 's|.*matlabengineforpython3_\([0-9]\+\)\.so|\1|g' |
tail -1)"
_pytminor="$(python -c 'import sys; print(sys.version_info.minor)')"
- # Spoof version compatibility if not applicable
+ msg2 "Spoofing version compatibility if not applicable..."
if [[ "${_pytminor}" != "${_matminor}" ]]; then
_matcustom="${srcdir}/sitecustomize.py"
touch "${_matcustom}"
@@ -169,22 +165,33 @@ build() {
echo "sys.version_info = (3, ${_matminor}, 0)" >> "${_matcustom}"
fi
PYTHONPATH="${srcdir}" python setup.py build
+
+ msg2 "Removing build licenses..."
+ rm -rf "${srcdir}/build/licenses/*"
}
-package() {
- # Package the python API
+
+package_python-matlabengine() {
+ depends+=("python" "matlab")
+
+ msg2 "Installing the license..."
+ install -D -m644 "${srcdir}/${pkgbase}/license_agreement.txt" \
+ "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ msg2 "Packaging the python API..."
cd "${srcdir}/build/extern/engines/python"
PYTHONPATH="${srcdir}" python setup.py install --root="${pkgdir}" --optimize 1 --skip-build
- # Spoofing trick to fool matlab into believing 3.9 is supported
+ msg2 "Spoofing trick to fool MATLAB into believing current Python version is supported..."
_matminor="$(find "${srcdir}/build/extern/engines/python" \
-name 'matlabengineforpython3*.so' |
sort |
- sed 's|.*matlabengineforpython3_\([0-9]\)\.so|\1|g' |
+ sed 's|.*matlabengineforpython3_\([0-9]\+\)\.so|\1|g' |
tail -1)"
_prefix="$(python -c 'import sys; print(sys.prefix)')"
_pytminor="$(python -c 'import sys; print(sys.version_info.minor)')"
- # Change around locations if spoofing is needed
+
+ msg2 "Changing around locations if spoofing is needed..."
if [[ "${_pytminor}" != "${_matminor}" ]]; then
mv "${pkgdir}/${_prefix}/lib/python3".{"${_matminor}","${_pytminor}"}
_egginfo="$(ls "${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/"*"-py3.${_matminor}.egg-info")"
@@ -193,61 +200,111 @@ package() {
"${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/matlab/engine/__init__.py"
fi
- # Fix erronous referances in the _arch.txt files
- errstr="${srcdir}/build/extern/engines/python/"
- trustr="${instdir}/extern/engines/python/"
+ msg2 "Fixing erroneous references in the _arch.txt files..."
+ errstr=$(realpath "${srcdir}/build/extern/engines/python/")
+ trustr="/${instdir}/extern/engines/python/"
for _dir in \
"${srcdir}/build/extern/engines/python/build/lib/matlab/engine" \
"${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/matlab/engine" \
; do
sed -i "s|${errstr}|${trustr}|" "${_dir}/_arch.txt"
done
+}
+
+package_matlab() {
+ # Compilers should be optional depends
+ msg2 "Determining compiler versions..."
+ if [ "$(vercmp ${pkgver} "9.10" )" -ge "0" ]; then
+ optdepends+=('gcc9: For MEX support'
+ 'gcc8-fortran: For MEX support')
+ gccexc="gcc-9"
+ gppexc="g++-9"
+ gfortranlib="gcc8-fortran"
+ gfortranexc="gfortran-8"
+ elif [ "$(vercmp ${pkgver} "9.9" )" -ge "0" ]; then
+ optdepends+=('gcc8: For MEX support'
+ 'gcc8-fortran: For MEX support')
+ gccexc="gcc-8"
+ gppexc="g++-8"
+ gfortranlib="gcc8-fortran"
+ gfortranexc="gfortran-8"
+ elif [ "$(vercmp ${pkgver} "9.4" )" -ge "0" ]; then
+ optdepends+=('gcc6: For MEX support'
+ 'gcc6-fortran: For MEX support')
+ gccexc="gcc-6"
+ gppexc="g++-6"
+ gfortranlib="gcc6-fortran"
+ gfortranexc="gfortran-6"
+ elif [ "$(vercmp ${pkgver} "9.1" )" -ge "0" ]; then
+ optdepends+=('gcc49: For MEX support')
+ gccexc="gcc-49"
+ gppexc="g++-49"
+ gfortranlib="gcc49"
+ gfortranexc="gfortran-49"
+ elif [ "$(vercmp ${pkgver} "8.2" )" -ge "0" ]; then
+ optdepends+=('gcc47: For MEX support')
+ gccexc="gcc-47"
+ gppexc="g++-47"
+ gfortranlib="gcc47"
+ gfortranexc="gfortran-47"
+ else
+ msg2 "You need to install the GCC for MEX support yourself."
+ msg2 "Visit here to determine your needed GCC version."
+ msg2 "https://www.mathworks.com/support/requirements/previous-releases.html"
+ msg2 "Create your own GCC package with name \"gcc-matlab\", and link these excutables to /usr/bin:"
+ msg2 "gcc-matlab g++-matlab gfortran-matlab"
+ gccexc="gcc-matlab"
+ gppexc="g++-matlab"
+ gfortranlib="gcc-matlab"
+ gfortranexc="gfortran-matlab"
+ fi
- # Moving files from build area
- install -dm 0755 "$(dirname "${pkgdir}/${instdir}")"
+ msg2 "Moving files from build area..."
+ install -dm755 "${pkgdir}/usr/lib/"
mv "${srcdir}/build" "${pkgdir}/${instdir}"
- # Copying license
- install -D -m644 "${srcdir}/${pkgname}/license_agreement.txt" \
+ msg2 "Installing the license..."
+ install -D -m644 "${srcdir}/${pkgbase}/license_agreement.txt" \
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
- # Symlink executables'
+ msg2 "Symlinking executables..."
install -d -m755 "${pkgdir}/usr/bin/"
for _executable in deploytool matlab mbuild activate_matlab.sh; do
- ln -s "${instdir}/bin/${_executable}" "${pkgdir}/usr/bin/${_executable}"
+ ln -s "/${instdir}/bin/${_executable}" "${pkgdir}/usr/bin/${_executable}"
done
- # This would otherwise conflict with mixtex
- ln -s "${instdir}/bin/mex" "${pkgdir}/usr/bin/mex-${pkgname}"
- # This would otherwise conflict with mathematica
- ln -s "${instdir}/bin/mcc" "${pkgdir}/usr/bin/mcc-${pkgname}"
- # Allow external software to find MATLAB linter binary
- ln -s "${instdir}/bin/glnxa64/mlint" "${pkgdir}/usr/bin/mlint"
-
- # Install desktop files
- install -D -m644 "${srcdir}/${pkgname}.desktop" \
- "${pkgdir}/usr/share/applications/${pkgname}.desktop"
-
- # Link mex options to ancient libraries
+ # This would otherwise conflict with mixtex.
+ ln -s "/${instdir}/bin/mex" "${pkgdir}/usr/bin/mex-${pkgbase}"
+ # This would otherwise conflict with Mathematica.
+ ln -s "/${instdir}/bin/mcc" "${pkgdir}/usr/bin/mcc-${pkgbase}"
+ # Allow external software to find the MATLAB linter binary.
+ ln -s "/${instdir}/bin/glnxa64/mlint" "${pkgdir}/usr/bin/mlint"
+
+ msg2 "Installing desktop files..."
+ install -D -m644 "${srcdir}/${pkgbase}.desktop" \
+ "${pkgdir}/usr/share/applications/${pkgbase}.desktop"
+ install -Dm644 "${srcdir}/${pkgbase}/bin/glnxa64/cef_resources/matlab_icon.png" "$pkgdir/usr/share/pixmaps/$pkgbase.png"
+
+ msg2 "Linking mex options to ancient libraries..."
sysdir="bin/glnxa64/mexopts"
mkdir -p "${pkgdir}/${instdir}/backup/${sysdir}"
cp "${pkgdir}/${instdir}/${sysdir}/gcc_glnxa64.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
- sed -i "s/gcc/gcc-8/g" "${pkgdir}/${instdir}/${sysdir}/gcc_glnxa64.xml"
+ sed -i "s/gcc/${gccexc}/g" "${pkgdir}/${instdir}/${sysdir}/gcc_glnxa64.xml"
cp "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
- sed -i "s/g++/g++-8/g" "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml"
+ sed -i "s/g++/${gppexc}/g" "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml"
cp "${pkgdir}/${instdir}/${sysdir}/gfortran.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
- sed -i "s/gfortran/gfortran-8/g" "${pkgdir}/${instdir}/${sysdir}/gfortran.xml"
+ sed -i "s/gfortran/${gfortranexc}/g" "${pkgdir}/${instdir}/${sysdir}/gfortran.xml"
cp "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
- sed -i "s/gfortran/gfortran-8/g" "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml"
+ sed -i "s/gfortran/${gfortranexc}/g" "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml"
- # Remove unused library files
+ msg2 "Removing unused library files..."
# <MATLABROOT>/sys/os/glnxa64/README.libstdc++
sysdir="sys/os/glnxa64"
install -d -m755 "${pkgdir}/${instdir}/backup/${sysdir}"
- mv "${pkgdir}/${instdir}/${sysdir}/"{libstdc++.so.6.0.25,libstdc++.so.6} \
+ mv "${pkgdir}/${instdir}/${sysdir}/"{libstdc++.so.6.0.28,libstdc++.so.6} \
"${pkgdir}/${instdir}/backup/${sysdir}/"
mv "${pkgdir}/${instdir}/${sysdir}/libgcc_s.so.1" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
@@ -256,11 +313,11 @@ package() {
mv "${pkgdir}/${instdir}/${sysdir}/"{libquadmath.so.0.0.0,libquadmath.so.0} \
"${pkgdir}/${instdir}/backup/${sysdir}/"
- # make sure MATLAB can find proper libraries libgfortran.so.3
+ # Make sure MATLAB can find the proper library libgfortran.so.3.
mkdir -p "${pkgdir}/${instdir}/backup/bin"
cp "${pkgdir}/${instdir}/bin/matlab" "${pkgdir}/${instdir}/backup/bin"
- sed -i 's|LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`"|LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`:/usr/lib/gcc/x86_64-pc-linux-gnu/'$(pacman -Q gcc8 | awk '{print $2}' | cut -d- -f1)'"|g' "${pkgdir}/${instdir}/bin/matlab"
-
- # Install the script file to make scripting easier with matlab
- install -Dm 0755 "${srcdir}/matlab.script" "${pkgdir}/usr/bin/matscript"
+ # The GCC dependency should be determined at runtime.
+ sed -i "1s#^#if pacman -Q "${gfortranlib}' > /dev/null 2>&1 ; then \n export GCCVERSION=$(pacman -Q '${gfortranlib}" | awk '{print \$2}' | cut -d- -f1) \nfi\n\n#" "${pkgdir}/${instdir}/bin/matlab"
+ sed -i "1s/^/# Check the optional GCC dependency.\n/" "${pkgdir}/${instdir}/bin/matlab"
+ sed -i 's|LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`"|if [ -n "${GCCVERSION}" ]; then \n LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`:/usr/lib/gcc/x86_64-pc-linux-gnu/${GCCVERSION}"; \n else \n LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`" \n fi \n|g' "${pkgdir}/${instdir}/bin/matlab"
}
diff --git a/README.md b/README.md
index a3dd357eb66f..c25e8e1f2a22 100644
--- a/README.md
+++ b/README.md
@@ -1,69 +1,104 @@
-# MATLAB: Archlinux integration
+# MATLAB with Arch Build System
-This PKGBUILD creates an Arch Linux package for MATLAB
-Additionally; it also builds python engine.
+This PKGBUILD creates an Arch Linux package for MATLAB.
-***WARNING***, this package NEEDS you to obtain the files; as the files are too large to host elsewhere.
+Additionally, it also builds the Python engine. They are stored in `matlab` and `python-matlabengine` packages separately.
+
+**WARNING**: this package NEEDS you to obtain the original off-line installer, as unauthorized distributions are not permitted by the license agreement.
## Tips
-* You probably want to run this locally; since the package will be large.
-If you are managing your own repos; depending on bandwidth and size constrants;
-exclude this package from your workflow.
-(Partial install is around 8 GB; and full install about 16 GB)
-* Turn off compression if this package will only be installed on the build machine;
-this cuts a fair amount of time from the build and compression is unneccessary on local machines.
+* You probably want to run this locally, since the package will be large. Turn off compression if this package will only be installed on the build machine.
+ This cuts a fair amount of time from the build and compression is unnecessary on local machines.
+* You may also use `tar` instead of packing it into `zst` and modify the PKGBUILD when preparing the off-line installer.
+* If you are managing your own repos, depending on bandwidth and size constants,
+ exclude this package from your work-flow.
+ (Partial install is over 8 GB, and full install is about 12 GB)
* Set `MATLAB_INTEL_OVERRIDE='yes'` in your environment if hardware acceleration
does not work on your Intel GPU.
-# Requirements
+## Requirements
+
+To successfully launch the MATLAB installer, you need to install `freetype2` and `libxcrypt-compat` (see [here](https://bbs.archlinux.org/viewtopic.php?id=274160)).
-Besides the dependencies; the source files MUST be present at the directory.
-The user MUST supply;
+Besides the PKGBUILD dependencies, by the end of this procedure these source files MUST be present in the PKGBUILD directory:
-* **matlab.fik**: Plain text file installation key
-* **matlab.lic**: License file
-* **matlab.tar**: Software tarball
+* `matlab.fik`: installation key in a plain-text file.
+* `matlab.lic`: license file.
+* `matlab.tar`: off-line installer.
-Then run `makepkg -s` from the PKGBUILD directory to build the package.
+Then run `makepkg -s` from the same directory to build the package. It will take a lot of time, so make sure to bring with you a cup of coffee.
-## File Installation Key & Licence File:
+### File installation key & license file
-[Here is the current link to the instructions](https://www.mathworks.com/help/install/ug/install-using-a-file-installation-key.html)
+[Here](https://www.mathworks.com/help/install/ug/install-using-a-file-installation-key.html) are the instructions by MathWorks.
-File installation key identifies this specific installation of matlab.
+The file installation key identifies this specific installation of MATLAB.
The license file authorizes that this key can use the toolboxes.
-Follow the steps;
+Follow these steps:
+
+* Head over to the [License center](https://www.mathworks.com/licensecenter) on MathWorks.
+* On the `Install and activate` tab, select or create an appropriate license:
+ * If no license is listed because you're using your organization's license and this is your first time installing MATLAB, click the link for manual activation. Insert the MAC address of a network card on your PC in the Host ID field, as for the username, it'll have to be the one of the account (on your Arch installation) that will be using MATLAB.
+* Navigate to download the license file and the file installation key.
+* Download the **license file** and put the file in the repository with the correct name.
+* Copy and paste the **file installation key** in a plain text file.
+
+If MATLAB is distributed through your organization’s network rather than your own use, the file installation key and license file would be invalid on other computers. When MATLAB recognizes an invalid license, it won't start at all.
+
+It may help if you remove your license for building, i. e. uncomment the lines at the end of `build()` of the PKGBUILD. When you start MATLAB for the first time, the activation program will pop out, guiding you through the activation process.
+
+It still can be activated by running `activate_matlab.sh` after the install, no matter the license has been removed or not. The script will activate it and put the correct license file under `.matlab/licenses` in your home folder.
+
+### Off-line installer
+
+From here on it will be assumed all the following operations are performed from the PKGBUILD directory, and that the PKGBUILD directory contains exactly one MATLAB on-line installer archive.
+
+If your MATLAB installation follows the exact steps listed down here, you can run the `install.sh` script provided with the PKGBUILD and let it do everything, you will only have to interact with the MATLAB installer.
+
+1. [Download](https://www.mathworks.com/downloads) the MATLAB on-line installer archive; it will be named something like `matlab_R{YEAR}{a,b}_glnxa64.zip`.
+
+2. Unpack the archive with:
+ ```sh
+ unzip -X -K matlab_*_glnxa64.zip -d MATLABROOT
+ ```
+ (see [here](https://www.mathworks.com/matlabcentral/answers/513162-matlab-2020a-installation-problem-in-linux#answer_423072) for an explanation of the flags).
-* Go to [License center](https://www.mathworks.com/licensecenter) on mathworks
-* On install and activate tab; select (or create) an appropriate license
-* Navigate to download the license file and the file installation key
-* Download the **license file** and put the file in the repository
-* Copy and paste the **file installation key** in a plain text file
+3. Make the installer use the FreeType system library instead of its own (see [here](https://www.reddit.com/r/archlinux/comments/tkas9q/matlab_stopped_working_after_system_update/i2h3r5t/) for an explanation):
+ ```sh
+ mv MATLABROOT/bin/glnxa64/libfreetype.so.6 \
+ MATLABROOT/bin/glnxa64/libfreetype.so.6.MATLAB
+ ```
-## Tarball
+4. Launch the installer with:
+ ```sh
+ ./matlab/install
+ ```
+5. After having logged in and accepted the license agreement, select
+`Advanced Options` → `I want to download without installing`
+from the top-right drop-down menu.
+6. Set the download location to an empty directory called `matlab`, contained inside the PKGBUILD directory.
+7. Select `Linux` as the target platform.
+8. Select the toolboxes you want. If you are not going to install them all, on the PKGBUILD set the `partialinstall` variable to `true`, and update the `products` array to reflect your choices, using the names at the end of `MATLABROOT/installer_input.txt`.
+9. Download the files and close the installer.
+10. Move the files from the directory `matlab/YYYY_MM_DD` to `matlab`, then delete the `matlab/YYYY_MM_DD` directory.
+11. Create the tarball with:
+ ```sh
+ tar -I zstd -cvf matlab.tar matlab
+ ```
-**To run the installer, libselinux is needed!**
+If you acquire the off-line installer by other means, make sure the files have the correct permissions, as unzipping the archive without the proper flags could drop them, otherwise the installer won't run correctly.
-* [Download the matlab installer](https://www.mathworks.com/downloads)
-* Unpack and launch the installer
-* After logging in and accepting license; select
-`Advanced Options > I want to download without installing`
-from the top dropdown menu.
-* Set the download location to an empty directory called `matlab`
-* Select the toolboxes you want in the `PKGBUILD`.
-(Alternatively install them all)
-* After downloading; from the parent directory; do
-`tar --create --verbose --file matlab.tar matlab`
-to create the tarball.
+### Transmitting large files
-## Large files
+To transmit large files in FAT32 media (most flash drives), first split the tarball:
-To transport large files in fat32 media (most flash drives); use split and cat;
-* **Split**: `split --bytes 3G --numeric-suffixes=0 matlab.tar.gz matlab.tar.gz.`
-* **Concatenate**: `cat matlab.tar.gz.* > matlab.tar.gz`
+```sh
+split --bytes 3G --numeric-suffixes=0 matlab.tar matlab.tar
+```
-## Modules
+Then recreate it by concatenating the parts:
-Matlab comes with a [lot of products](https://www.mathworks.com/products.html).
-Most are not needed; check PKGBUILD to pick and choose appropriately.
+```sh
+cat matlab.tar.* > matlab.tar
+```
diff --git a/install.sh b/install.sh
new file mode 100644
index 000000000000..126a3966e93f
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+unzip -X -K matlab_*_glnxa64.zip -d MATLABROOT
+mv MATLABROOT/bin/glnxa64/libfreetype.so.6 \
+ MATLABROOT/bin/glnxa64/libfreetype.so.6.MATLAB
+./MATLABROOT/install
+date_dir=`echo matlab/*`
+mv $date_dir/* matlab/
+rmdir $date_dir
+tar -I zstd -cvf matlab.tar matlab
+makepkg -s
diff --git a/matlab.script b/matlab.script
deleted file mode 100644
index b9195d2581c8..000000000000
--- a/matlab.script
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/dash
-# vim:ft=sh
-
-if [ -n "$1" ] && [ -x "$1" ]; then
- matlab -batch "$1"
-else
- echo 'Need executable file as an argument'
- exit 1
-fi