Skip to content
This repository has been archived by the owner on Feb 19, 2025. It is now read-only.

Commit

Permalink
Version bump to 2020b
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaserdem committed Sep 21, 2020
1 parent c06ee28 commit 01cb128
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 63 deletions.
8 changes: 5 additions & 3 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgbase = matlab
pkgdesc = A high-level language for numerical computation and visualization
pkgver = 9.8.0.1323502
pkgver = 9.9.0.1467703
pkgrel = 1
url = http://www.mathworks.com
arch = x86_64
Expand Down Expand Up @@ -53,7 +53,9 @@ pkgbase = matlab
depends = x11vnc
depends = sudo
depends = zlib
depends = gcc6
depends = gcc9
depends = gcc9-fortran
depends = gcc9-libs
depends = gconf
depends = glu
depends = gstreamer0.10-base
Expand All @@ -69,7 +71,7 @@ pkgbase = matlab
provides = matlab-licenses
provides = matlab-engine-for-python
provides = matlab-bin
source = matlab.tar.gz
source = matlab.tar
source = matlab.fik
source = matlab.lic
source = matlab.script
Expand Down
84 changes: 28 additions & 56 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Matlab packaging for archlinux

name=MATLAB
version='2020a'
instdir="/opt/tmw/${name}-${version}"
release='r2020b'
instdir="/opt/tmw/${name}-${release}"
pkgname=matlab
pkgver=9.8.0.1323502
pkgver=9.9.0.1467703
pkgrel=1
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; if in case contact the maintainer
# Some of the dependencies are probably not needed; contact the maintainer please
depends=(
'ca-certificates'
'lsb-release'
Expand Down Expand Up @@ -59,9 +59,10 @@ depends=(
'x11vnc'
'sudo'
'zlib')
# These I got from arch before and afraid to play around
# These I got from arch before and afraid to play around.
# GCC: https://www.mathworks.com/support/requirements/supported-compilers.html
depends+=(
'gcc6'
'gcc9' 'gcc9-fortran' 'gcc9-libs'
'gconf'
'glu'
'gstreamer0.10-base'
Expand All @@ -75,7 +76,8 @@ depends+=(
'qt5-x11extras'
'xerces-c')
provides=('matlab-licenses' 'matlab-engine-for-python' 'matlab-bin')
source=("matlab.tar.gz"
source=(
"matlab.tar"
"matlab.fik"
"matlab.lic"
"matlab.script")
Expand All @@ -89,7 +91,9 @@ products=(
#---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
Expand Down Expand Up @@ -138,56 +142,31 @@ prepare() {
--pkgdesc "${pkgdesc}" \
--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'\'
--exec 'matlab -desktop'
#--exec 'sh -c '\''if [ "${MATLAB_INTEL_OVERRIDE}" = "yes" ] ; then exec env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop ; else exec matlab -desktop ; fi'\'
}

build() {
# 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"

# Create spoofing for Python API
# https://aur.archlinux.org/packages/matlab-engine-for-python/
# Build the python API
cd "${srcdir}/build/extern/engines/python"
# Getting appropriate python version for spoofing
_matminor="$(find "${srcdir}/build/extern/engines/python" \
-name 'matlabengineforpython3*.so' |
sort |
sed 's|.*matlabengineforpython3_\([0-9]\)\.so|\1|g' |
tail -1)"
echo 'import sys' > "${srcdir}/sitecustomize.py"
echo "sys.version_info = (3, ${_matminor}, 0)" >> "${srcdir}/sitecustomize.py"

python setup.py build
}

package() {
# Install the python API
# https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
# Package the python API
cd "${srcdir}/build/extern/engines/python"
PYTHONPATH="${srcdir}" python setup.py \
install --root="${pkgdir}" --optimize 1
# Spoofing trick to fool matlab into believing 3.8 is supported
_matminor="$(find "${srcdir}/build/extern/engines/python" \
-name 'matlabengineforpython3*.so' |
sort |
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)')"
# Correct file names
if [[ "${_pytminor}" != "${_matminor}" ]]; then
mv "${pkgdir}/${_prefix}/lib/python3".{"${_matminor}","${_pytminor}"}
_egginfo="$(ls "${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/"*"-py3.${_matminor}.egg-info")"
mv "${_egginfo}" "${_egginfo%py3."${_matminor}".egg-info}py3.${_pytminor}.egg-info"
sed -i "s|sys.version_info|(3, $_matminor, 0)|" \
"${pkgdir}/${_prefix}/lib/python3.${_pytminor}/site-packages/matlab/engine/__init__.py"
fi
python setup.py install --root="${pkgdir}" --optimize 1 --skip-build
# Fix erronous referances in the _arch.txt files
_prefix="$(python -c 'import sys; print(sys.prefix)')"
errstr="${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" \
"${pkgdir}/${_prefix}/lib/python3.8/site-packages/matlab/engine" \
; do
sed -i "s|${errstr}|${trustr}|" "${_dir}/_arch.txt"
done
Expand All @@ -214,46 +193,39 @@ package() {
install -D -m644 "${srcdir}/${pkgname}.desktop" \
"${pkgdir}/usr/share/applications/${pkgname}.desktop"

# Create backup directories
mkdir -p "${pkgdir}/${instdir}/backup/bin/glnxa64/mexopts"
mkdir -p "${pkgdir}/${instdir}/backup/sys/os/glnxa64"

# Link 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-6/g" "${pkgdir}/${instdir}/${sysdir}/gcc_glnxa64.xml"
sed -i "s/gcc/gcc-9/g" "${pkgdir}/${instdir}/${sysdir}/gcc_glnxa64.xml"
cp "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
sed -i "s/g++/g++-6/g" "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml"
sed -i "s/g++/g++-9/g" "${pkgdir}/${instdir}/${sysdir}/g++_glnxa64.xml"
cp "${pkgdir}/${instdir}/${sysdir}/gfortran.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
sed -i "s/gfortran/gfortran-6/g" "${pkgdir}/${instdir}/${sysdir}/gfortran.xml"
sed -i "s/gfortran/gfortran-9/g" "${pkgdir}/${instdir}/${sysdir}/gfortran.xml"
cp "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
sed -i "s/gfortran/gfortran-6/g" "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml"
sed -i "s/gfortran/gfortran-9/g" "${pkgdir}/${instdir}/${sysdir}/gfortran6.xml"

# Remove unused library files
# <MATLABROOT>/sys/os/glnxa64/README.libstdc++
sysdir="sys/os/glnxa64"
mkdir -p "${pkgdir}/${instdir}/backup/${sysdir}"
mv "${pkgdir}/${instdir}/${sysdir}/"{libstdc++.so.6.0.22,libstdc++.so.6} \
install -d -m755 "${pkgdir}/${instdir}/backup/${sysdir}"
mv "${pkgdir}/${instdir}/${sysdir}/"{libstdc++.so.6.0.25,libstdc++.so.6} \
"${pkgdir}/${instdir}/backup/${sysdir}/"
mv "${pkgdir}/${instdir}/${sysdir}/libgcc_s.so.1" \
"${pkgdir}/${instdir}/backup/${sysdir}/"
mv "${pkgdir}/${instdir}/${sysdir}/"{libgfortran.so.3.0.0,libgfortran.so.3} \
mv "${pkgdir}/${instdir}/${sysdir}/"{libgfortran.so.5.0.0,libgfortran.so.5} \
"${pkgdir}/${instdir}/backup/${sysdir}/"
mv "${pkgdir}/${instdir}/${sysdir}/"{libquadmath.so.0.0.0,libquadmath.so.0} \
"${pkgdir}/${instdir}/backup/${sysdir}/"

# make sure MATLAB can find libgfortran.so.3
# make sure MATLAB can find proper libraries 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 gcc6 | awk '{print $2}' | cut -d- -f1)'"|g' "${pkgdir}/${instdir}/bin/matlab"

# https://bbs.archlinux.org/viewtopic.php?id=236821
# These steps were deleted cause matlab switched to new freetype
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 gcc9 | 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"
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ Follow the steps;
* 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)
* Download the files to an empty directory called `matlab`
* After downloading; from the parent directory; do
`tar --create --verbose --file matlab.tar.gz .../matlab`
`tar --create --verbose --file matlab.tar matlab`
to create the tarball.

# Tips

## Large files

To transport large files in fat32 media (most flash drives); use split and cat;
Expand Down
File renamed without changes.

0 comments on commit 01cb128

Please sign in to comment.