Verified Commit 0c77f7e9 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

macOS packaging: compile against the version of Octave distributed via...

macOS packaging: compile against the version of Octave distributed via https://octave-app.org (currently 4.4.1)
parent 651b400f
...@@ -97,14 +97,8 @@ Note that several versions of Dynare can coexist (by default in ...@@ -97,14 +97,8 @@ Note that several versions of Dynare can coexist (by default in
``/Applications/Dynare``), as long as you correctly adjust your path ``/Applications/Dynare``), as long as you correctly adjust your path
settings (see :ref:`words-warning`). settings (see :ref:`words-warning`).
To install Dynare for Octave, first install Homebrew following the Dynare for Octave works with Octave installed via the package located here:
instructions on their site: `https://brew.sh/ `https://octave-app.org <https://octave-app.org>`__.
<https://brew.sh/>`__. Then install Octave, issuing the command ``brew
install octave`` at the Terminal prompt. You can then install the
latest stable version of Dynare by typing ``brew install dynare`` at
the Terminal prompt. You can also pass options to the installation
command. These options can be viewed by typing ``brew info dynare`` at
the Terminal prompt.
For other systems For other systems
...@@ -209,10 +203,10 @@ command; the packaging does it for you. Under Arch Linux, you need to do:: ...@@ -209,10 +203,10 @@ command; the packaging does it for you. Under Arch Linux, you need to do::
octave:1> addpath /usr/lib/dynare/matlab octave:1> addpath /usr/lib/dynare/matlab
Under macOS, assuming that you have installed Dynare and Octave via Under macOS, assuming you have installed Octave via `https://octave-app.org
Homebrew, type:: <https://octave-app.org>`__, type::
octave:1> addpath /usr/local/opt/dynare/lib/dynare/matlab octave:1> addpath /Applications/Dynare/4.x.y/matlab
If you don’t want to type this command every time you run Octave, you If you don’t want to type this command every time you run Octave, you
can put it in a file called ``.octaverc`` in your home directory can put it in a file called ``.octaverc`` in your home directory
......
...@@ -152,15 +152,18 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES" ...@@ -152,15 +152,18 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"
## Create mex for Octave ## Create mex for Octave
## ##
cd "$ROOTDIR"/mex/build/octave cd "$ROOTDIR"/mex/build/octave
CC=$CC CXX=$CXX ./configure \ OCTAVE_VERSION=$(grep OCTAVE_VERSION "$ROOTDIR"/macOS/deps/versions.mk | cut -d'=' -f2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
OCTAVE_USR_DIR="/Applications/Octave-$OCTAVE_VERSION.app/Contents/Resources/usr"
OCTAVE_BIN_DIR="$OCTAVE_USR_DIR/Cellar/octave-octave-app@$OCTAVE_VERSION/$OCTAVE_VERSION/bin"
PATH="$OCTAVE_BIN_DIR:$PATH" CC=$CC CXX=$CXX ./configure \
PACKAGE_VERSION="$VERSION" \ PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \ PACKAGE_STRING="dynare $VERSION" \
CXXFLAGS=-I/usr/local/include \ CXXFLAGS=-I/usr/local/include \
LDFLAGS="-static-libgcc -L/usr/local/lib" \ LDFLAGS="-static-libgcc -L$OCTAVE_USR_DIR/lib " \
--with-gsl="$LIB64"/gsl \ --with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \ --with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore --with-slicot="$LIB64"/Slicot/with-underscore
make -j"$NTHREADS" PATH="$OCTAVE_BIN_DIR:$PATH" make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave
echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m
......
SLICOT_VERSION = 5.0+20101122 SLICOT_VERSION = 5.0+20101122
X13AS_VERSION = 1.1_B39 X13AS_VERSION = 1.1_B39
OCTAVE_VERSION = 4.4.1
...@@ -32,6 +32,14 @@ FFLAGS="$($MKOCTFILE -p FFLAGS) -Wall" ...@@ -32,6 +32,14 @@ FFLAGS="$($MKOCTFILE -p FFLAGS) -Wall"
CXXFLAGS="$($MKOCTFILE -p CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast" CXXFLAGS="$($MKOCTFILE -p CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast"
LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)" LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)"
AC_CANONICAL_HOST
case ${host_os} in
darwin*)
CXXFLAGS="$($MKOCTFILE -p ALL_CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast -O2"
LDFLAGS+="$($MKOCTFILE -p OCTAVE_LIBS)"
;;
esac
OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //') OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least (or disable Octave support with --disable-octave).])]) AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least (or disable Octave support with --disable-octave).])])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment