DEBIAN-MATLAB-MEXHELPER(1)

πŸ’… DEBIAN-MATLAB-MEXHELPER πŸ’…

okay bestie, welcome to the debian-matlab-mexhelper manual page β€” it lives in the User Commands corner of the Debian man-verse and honestly? she's a little legend. sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

debian-matlab-mexhelper β€” the lil helper that builds Matlab extensions on Debian 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

debian-matlab-mexhelper [OPTIONS] <package name> <mode>

🌸 DESCRIPTION 🌸

so basically πŸ’– this is a small helper that makes building and installing MEX extensions for Matlab toolbox packages in Debian binary packages so much easier. and why do we even need her? because β€” for obvious reasons β€” these packages literally can't build-depend on Matlab. so instead they have to compile their extensions at installation time, using whatever local Matlab installation is vibing on the machine. it's giving resourceful. πŸ‘‘

the helper is kinda flexible like that: she supports custom build, install and clean commands, plus custom source and destination directories. she also deals with moving extensions into library directories and automatically symlinks them into the toolbox directory. no cap. ✨

there are two major modes:

  • install β€” build, install and symlink extensions. super useful in postinst. πŸ› οΈ
  • clean β€” remove installed extensions and symlinks. super useful in prerm. 🧹

the command that builds the extensions gets invoked in the source directory. by default that's /usr/src/matlab/<package name>, but you can override it with the --src-dir option. and any optional install (--install-cmd) and clean (--clean-cmd) commands? yeah, those get invoked in the source directory too. πŸ’«

moreover β€” and this is the iconic part β€” this helper will also take any installed extensions from a default installation path /usr/share/matlab/site/m/<package name>, move them into /usr/lib/matlab/site/<package name>, and then symlink back to the original location. those locations can be configured with the --m-dir and --mex-dir options respectively. again, this step is optional and only happens if a package actually installs extensions into this location. so if your package doesn't, don't stress, she just skips it. πŸ™ˆ


πŸŽ€ OPTIONS πŸŽ€

one bullet per flag, bestie, let's go:

  • -h β€” print usage summary and option list. the quick lil "hey what do you do" ✨
  • --help β€” print full help. the whole story, no skimping. πŸ“–
  • --version β€” print version information and exit. iykyk. πŸ’…
  • --build-cmd β€” command to build the extensions in the source directory. πŸ”¨
  • --install-cmd β€” command to install the extensions after building. πŸ“¦
  • --clean-cmd β€” command to clean the source tree after installation. > heads up: this is NOT the command that gets executed in clean mode, bestie. don't get it twisted. 😭
  • --src-dir β€” directory with the extension sources. this is also the directory in which build, install and clean commands get invoked. πŸ—‚οΈ
  • --mex-dir β€” target directory into which binary extensions get moved. 🚚
  • --m-dir β€” target directory in which symlinks to binary extensions get created. πŸ”—
  • --make β€” set default commands for build-cmd (make), install-cmd (make install DESTDIR=$m_dir) and clean-cmd (make distclean) if no specific command has been provided via the respective options. 🌈

πŸ”₯ EXAMPLES πŸ”₯

the "point me at my sources" era

the following call can be used in a package's postinst script if it comes with a Matlab script build_matlab.m that builds and installs its extension into the desired locations. the --src-dir option is used to point to a non-standard location of the extension sources. ✨

debian-matlab-mexhelper somepackagename install --src-dir /usr/src/dynare-matlab/mex/sources --build-cmd 'matlab -nodesktop -nodisplay -nojvm -r build_matlab'

the "makefile girlies" era

if a package installs extension sources into the standard location and builds its extensions using a Makefile that supports the DESTDIR for installing the built extensions and a distclean target, it is sufficient to run the following. 🫢

debian-matlab-mexhelper somepackagename install --make

the "difficultpackage" era

otherwise it is also possible to fully customize all the commands. 😀

debian-matlab-mexhelper difficultpackage install --build-cmd 'make -C src all toolbox MEXBIN="matlab-mex"' --install-cmd 'make -C src install && find . ! -wholename "./src" -name "*.mex?*" -print0 | xargs -0 -I {} cp -v --parent {} /usr/share/difficultpackage' --clean-cmd 'make -C src distclean toolbox-distclean && find . -name "*.mex?*" -delete'

the "okay actually remove it" era

if a package uses debian-matlab-mexhelper to install extensions into the standard location, it can also be used to remove all MEX extensions and created symlinks when a package is removed from a system. to achieve this, simply put the following call into a package's prerm script. 🧹

debian-matlab-mexhelper packagename clean

πŸ’œ AUTHOR πŸ’œ

written by Michael Hanke. πŸ‘‘ (yes, an actual icon.)


copyright Β© 2010-2011 Michael Hanke <michael.hanke@gmail.com> πŸ’Œ

licensed under GNU General Public License version 3 or later.

this is free software; see the source for copying conditions. there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 🫠


and that's the whole page, bestie β€” debian-matlab-mexhelper version 0.0.21.1, dated April 2026, straight from the Debian User Commands section. go build those extensions, you absolute main character. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from