[Pkg-octave-devel] Integration of dynare-matlab with matlab-support
michael.hanke at gmail.com
Fri Jan 21 00:51:45 UTC 2011
On Thu, Jan 20, 2011 at 05:07:38PM -0500, Sébastien Villemot wrote:
> Your matlab-support package looks promising. When it is accepted, I will
> apply your patch (correcting for the name change to "matlab-support"),
> and if this works fine I will upload a new dynare-matlab package.
> Note that you did not rename the git repository on Alioth to
> matlab-support, but you changed it in the control file of the package
> you uploaded. Also the git repository does not include the renaming.
You're right. Fixed. Thanks.
> In the next upstream release of Dynare (to happen in a few weeks), the
> MEX files will be built using a dedicated autoconf/automake architecture
> (instead of running a MATLAB script calling the "mex" command). Do you
> think this new build system will be compatible with your package ?
The helper allows for arbitray build/clean/install commands, We are
already using it for a package that uses Makefiles to handle extensions.
The only things that comes to mind is that you need to be able to call
'matlab-mex' instead of 'mex' on the commandline (should be easy), or
call mex directly in matlab's install dir.
> The configure script will need the path to the MATLAB installation
> directory, and also the MATLAB version (such as "R2010b") because it
> cannot autodetect it.
Is there a specifc reason why it cannot autodetect it?
There are basically two scenarios: 1) a 'matlab' command is available
from /usr/local/bin, because the Matlab installer placed it there, or 2)
there is no such link. Even in the latter case there will always be a
'matlab' in /usr/bin, because the matlab-support package registered it
In either case something as ugly as the following should give you the
installation directory of the "default" Matlab.
dirname $(dirname $(update-alternatives --query matlab |grep '^Value' |cut -d ' ' -f 2,2))
If you don't trust that, e.g. in case there is a different version that
/usr/local/bin/matlab points to, you can use:
dirname $(dirname $(readlink -f `which matlab`))
(that should always work and is even shorter)
Regarding the version, the matlab-support package uses a two-fold
strategy whose success depends on the actual version of Matlab that is
available. This quick one is
grep "ver='" $(dirname $(readlink -f $(which matlab) ))/mex | cut -d "'" -f 2,2 | head -n1
but doesn't work for all versions. Much slower but more scalable is:
echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | grep -A2 'ans =' | tail -1
Currently the matlab-support package doesn't provide helpers to perform
these queries. If you think I should add that, I'm open for discussion.
More information about the Pkg-octave-devel