Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • chskcau/dynare-doc-fixes
27 results
Select Git revision
Show changes
Commits on Source (63)
Showing
with 568 additions and 198 deletions
......@@ -80,8 +80,10 @@ doc/internals/ltxpng
*.mexa64
*.mexw32
*.mexw64
*.mexmaca64
*.mexmaci
*.mexmaci64
*.mexmaca64
/mex/matlab/
/mex/octave/
......@@ -128,9 +130,13 @@ windows/zip/
# MacOS stuff
.DS_Store
macOS/pkg/
macOS/deps/sources64/
macOS/deps/tarballs/
macOS/deps/sources64/
macOS/deps/sources64/arm64/
macOS/deps/sources64/x86_64/
macOS/deps/lib64/
macOS/deps/lib64/arm64/
macOS/deps/lib64/x86_64/
# Emacs stuff
scripts/dynare.elc
......
variables:
GIT_SUBMODULE_STRATEGY: recursive
TERM: linux
MATLAB_VERSION: R2022b
MATLAB_VERSION: R2023a
OLD_MATLAB_VERSION: R2014a
OCTAVE_VERSION: 7.3.0
# The next stanza creates the version number used for the source tarball and the
# binary packages. Here are the following possible cases:
......@@ -29,7 +28,7 @@ build_binaries:
stage: build
script:
- autoreconf -si
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION --with-octave=/usr/local/octave/$OCTAVE_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
- make -j $(nproc) LN_S="cp -p"
artifacts:
paths:
......@@ -57,7 +56,7 @@ pkg_source:
- rm doc/manual/source/_static/mathjax && sed -i "/^mathjax_path *=/d" doc/manual/source/conf.py
- 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done'
- autoreconf -si
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION --with-octave=/usr/local/octave/$OCTAVE_VERSION
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION
- make dist
artifacts:
paths:
......@@ -138,7 +137,7 @@ test_octave:
OPENBLAS_NUM_THREADS: 1
script:
- autoreconf -si
- ./configure --disable-matlab --with-octave=/usr/local/octave/$OCTAVE_VERSION
- ./configure --disable-matlab
- make -j $(nproc) -C tests check-octave
artifacts:
paths:
......
Announcement for Dynare 5.4 (on 2023-03-22)
===========================================
We are pleased to announce the release of Dynare 5.4.
This maintenance release fixes various bugs.
The Windows, macOS and source packages are already available for download at
[the Dynare website](https://www.dynare.org/download/).
All users are strongly encouraged to upgrade.
This release is compatible with MATLAB versions ranging from 8.3 (R2014a) to
9.14 (R2023a), and with GNU Octave version 8.1.0 (under Windows).
Note for macOS users with an Apple Silicon processor, and who are also MATLAB
users: the official MATLAB version for use on those processors is still the
Intel version (running through Rosetta 2), so the official Dynare package for
download on our website is built for Intel only. However, since Mathworks has
released a beta version of MATLAB for Apple Silicon, we created a beta package
of Dynare that you can try with it. See this forum thread for more details:
https://forum.dynare.org/t/testers-wanted-release-of-dynare-5-x-beta-for-apple-silicon-m1-m2-chips/20499
Here is a list of the problems identified in version 5.3 and that have been
fixed in version 5.4:
* Files installed through the Windows installer had too weak permissions and
could be modified by unpriviledged local users, if the default installation
location (`c:\dynare\`) had been chosen
* Estimation:
+ the `load_results_after_load_mh` option would not find the location of the
results file
+ the computation of prior/posterior statistics would crash if the value of
the `filter step_ahead` option was greater than 1 without requesting a
`forecast` or the `smoother`
+ NaN or complex parameters returned by steady state files were not correctly
handled
+ `analytical_derivation` could be triggered with `endogenous_prior` but
would not take the endogenous prior into account for the Jacobian and
Hessian
* OccBin:
+ running the `calib_smoother` command with `smoother_inversion_filter` would
crash unless `likelihood_inversion_filter` was also specified
+ running the piecewise Kalman smoother would crash if an error was
encountered during computation of the decision rules
* PAC equation estimation through iterative OLS would crash if the auxiliary
model contained a constant
* The variable label was incorrect for leads and lags of exogenous variables in
the display of decision rules and in the `model_info` command
* Declaring a `trend_var` variable while not having a `var(deflator=...)`
statement would cause the preprocessor to crash
* Macro processor: error messages following a `@#define`, `@#include` or
`@#includepath` directive could in some cases point to a line number off by 1
* Perfect foresight simulations: the `debug` option would not preserve
sparsity, causing out of memory errors
Announcement for Dynare 5.3 (on 2022-11-21)
===========================================
......
......@@ -45,8 +45,8 @@ determine the type of your MATLAB/Octave installation, type:
```matlab
>> computer
```
at the MATLAB/Octave prompt. Under MATLAB, if it returns `PCWIN64`, `GLNX64` or
`MACI64`, then it is a 64-bit MATLAB; if it returns `PCWIN`, `MACI` or `GLNX`,
at the MATLAB/Octave prompt. Under MATLAB, if it returns `PCWIN64`, `GLNX64`,
`MACA64` or `MACI64`, then it is a 64-bit MATLAB; if it returns `PCWIN`, `MACI` or `GLNX`,
then it is a 32-bit MATLAB. Under Octave, if it returns a string that begins
with `x86_64`, it is a 64-bit Octave; if the strings begins with `i686`, it is
a 32-bit Octave.
......@@ -410,46 +410,49 @@ create a temporary alias to ensure that `brew` points to the Intel packages.
For the following steps open Terminal.app and enter the commands listed below.
The following commands install all requirements and Dynare from source.
They should be entered at the command prompt in Terminal.app.
### Preparatory work
- Install Rosetta 2 (Apple Silicon only):
- Install the Xcode Command Line Tools:
```sh
softwareupdate --install-rosetta --agree-to-license
xcode-select --install
```
- Install the Xcode Command Line Tools:
- Create environmental variables for which platform you want to compile for, i.e. either `arm64` or `x86_64`:
For `arm64` run the following commands:
```sh
xcode-select --install
export ARCH=arm64
export BREWDIR=/opt/homebrew
```
- Install [Homebrew](https://brew.sh/):
For `x86_64` run the following commands:
```sh
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export ARCH=x86_64
export BREWDIR=/usr/local
```
The prefix `arch -x86_64` makes sure that you are using Rosetta 2 to install Homebrew.
- Apple Silicon only: Make a (temporary) alias to run `brew` under Rosetta 2:
- Install [Homebrew](https://brew.sh/):
```sh
alias brew='arch -x86_64 /usr/local/bin/brew'
which brew
#brew: aliased to arch -x86_64 /usr/local/bin/brew
arch -$ARCH /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
- Install required Homebrew packages and link sphinx-doc:
- Make sure that you are running `brew` correctly either from `/opt/homebrew/bin` or from `/usr/local/bin` by temporarily (!) prepending it to the path:
```sh
brew install automake bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc wget
brew link --force sphinx-doc
export PATH="$BREWDIR/bin:$PATH"
```
- Install [MacTeX](http://www.tug.org/mactex/index.html) using the universal installer. MacTeX runs natively on both ARM and Intel machines. On Apple Silicon, we need to put `pdflatex` and `bibtex` into our path:
- Install required Homebrew packages and link sphinx-doc:
```sh
ln -s /Library/TeX/texbin/pdflatex /usr/local/bin/pdflatex
ln -s /Library/TeX/texbin/bibtex /usr/local/bin/bibtex
arch -$ARCH $BREWDIR/bin/brew install automake bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc wget
arch -$ARCH $BREWDIR/bin/brew link --force sphinx-doc
```
Alternatively, if you don’t want to install MacTeX, you should pass the `--disable-doc` flag to the `configure` command below.
- Install MATLAB and additional toolboxes. We recommend, but don't require, the following: Optimization, Global Optimization, Statistics and Machine Learning, Econometrics, and Control System. As there is no ARM version of MATLAB yet, Rosetta 2 will be used on Apple Silicon machines. Don't forget to run MATLAB at least once to make sure you have a valid license.
- Install [MacTeX](http://www.tug.org/mactex/index.html) using the universal installer. MacTeX runs natively on both ARM and Intel machines. Alternatively, if you don’t want to install MacTeX, you should pass the `--disable-doc` flag to the `configure` command below.
- Install MATLAB and additional toolboxes. We recommend, but don't require, the following: Optimization, Global Optimization, Statistics and Machine Learning, Econometrics, and Control System. Currently, MATLAB offers a native Apple silicon version of R2022a as an open beta. You can sign up and install it (including Azul Zulu OpenJDK 8) using [the official instructions](https://de.mathworks.com/support/apple-silicon-r2022a-beta.html). Unfortunately, no toolboxes are ported yet. Don't forget to run MATLAB at least once to make sure you have a valid license.
- Compile and install SLICOT, needed for the `kalman_steady_state` MEX file.
```sh
......@@ -458,11 +461,11 @@ cd $HOME/dynare/slicot
wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
tar xf slicot_5.0+20101122.orig.tar.gz
cd slicot-5.0+20101122
make -j$(sysctl -n hw.ncpu) FORTRAN=gfortran OPTS="-O2" LOADER=gfortran lib
cp slicot.a /usr/local/lib/libslicot_pic.a
make -j$(sysctl -n hw.physicalcpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2" LOADER=gfortran lib
cp slicot.a $BREWDIR/lib/libslicot_pic.a
make clean
make -j$(sysctl -n hw.ncpu) FORTRAN=gfortran OPTS="-O2 -fdefault-integer-8" LOADER=gfortran lib
cp slicot.a /usr/local/lib/libslicot64_pic.a
make -j$(sysctl -n hw.physicalcpu) FORTRAN=$BREWDIR/bin/gfortran OPTS="-O2 -fdefault-integer-8" LOADER=gfortran lib
cp slicot.a $BREWDIR/lib/libslicot64_pic.a
cd $HOME/dynare
```
......@@ -473,42 +476,41 @@ cd $HOME/dynare/x13as
wget https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v1-1-b59.tar.gz
tar xf x13as_asciisrc-v1-1-b59.tar.gz
sed -i '' 's/-static//g' makefile.gf
make -j$(sysctl -n hw.ncpu) -f makefile.gf FC=gfortran LINKER=gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
cp x13as /usr/local/bin/x13as
make -j$(sysctl -n hw.physicalcpu) -f makefile.gf FC=$BREWDIR/bin/gfortran LINKER=$BREWDIR/bin/gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
cp x13as $BREWDIR/bin/x13as
cd ;
x13as
```
### Compile Dynare from source
The following commands will download the Dynare source code and compile
it. They should be entered at the command prompt in Terminal.app from the
folder where you want Dynare installed. Apple Silicon: make sure `brew`
points towards `/usr/local/bin/brew` (see above).
The following commands will download the Dynare source code and compile it.
- Prepare the Dynare sources for the unstable version:
```sh
mkdir -p $HOME/dynare/unstable
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git $HOME/dynare/unstable
cd $HOME/dynare/unstable
arch -x86_64 autoreconf -si
arch -$ARCH autoreconf -si
```
You can also choose a specific version of Dynare by checking out the corresponding branch or a specific tag with git.
- Configure Dynare from the source directory:
```sh
arch -x86_64 ./configure CC=gcc-12 CXX=g++-12 CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LEX=/usr/local/opt/flex/bin/flex YACC=/usr/local/opt/bison/bin/bison --with-matlab=/Applications/MATLAB_R2021b.app
arch -$ARCH ./configure CC=gcc-12 CXX=g++-12 CPPFLAGS=-I$BREWDIR/include --prefix=$BREWDIR LDFLAGS=-L$BREWDIR/lib LEX=$BREWDIR/opt/flex/bin/flex YACC=$BREWDIR/opt/bison/bin/bison --with-matlab=/Applications/MATLAB_R2022a.app
```
where you need to adapt the path to MATLAB. If you don’t have MATLAB, simply replace `--with-matlab=<…>` by `--disable-matlab`. Check the output of the command whether Dynare is configured for building everything except the internal docs of Dynare and M2HTML.
- Compile:
```sh
arch -x86_64 make -j$(sysctl -n hw.ncpu)
arch -$ARCH make -j$(sysctl -n hw.physicalcpu)
```
### Optional: pass the full PATH to MATLAB to run system commands
If you start MATLAB from a terminal, you will get the PATH inherited from the shell. However, when you click on the icon in macOS, you are not running at the terminal: the program is run by launcher, which does not go through a shell login session. You get the system default PATH which includes `/usr/bin:/bin:/usr/sbin:/sbin`, but not `/usr/local/bin` or `$HOME/.local/bin`. So if you want to use system commands like `pdflatex` or `x13as` you should either call them by their full path (e.g `/Library/TeX/texbin/pdflatex`) or append the PATH in MATLAB by running `setenv('PATH', [getenv('PATH') ':/usr/local/bin:$HOME/.local/bin:/Library/TeX/texbin']);`. Alternatively, you can create a `startup.m` file or change the system default PATH in the `/etc/paths` file.
If you start MATLAB from a terminal, you will get the PATH inherited from the shell. However, when you click on the application icon in macOS, you are not running at the terminal level: the program is run by launcher, which does not go through a shell login session. You get the system default PATH which includes `/usr/bin:/bin:/usr/sbin:/sbin`, but not `/usr/local/bin` or `$HOME/.local/bin`. So if you want to use system commands like `pdflatex` or `x13as` you should either call them by their full path (e.g `/Library/TeX/texbin/pdflatex`) or append the PATH in MATLAB by running `setenv('PATH', [getenv('PATH') ':/usr/local/bin:$HOME/.local/bin:/Library/TeX/texbin']);`. Alternatively, you can create a `startup.m` file or change the system default PATH in the `/etc/paths` file.
Tested on
- macOS Monterey 12.1 (Apple M1 Virtual Machine)
- macOS Monterey 12.1 (MacBook Air Intel)
- macOS Monterey 12.1 (MacBook Air M1)
- macOS Monterey 12.1-12.4 (Apple M1 Virtual Machine)
- macOS Monterey 12.1-12.4 (MacBook Air Intel)
- macOS Monterey 12.1-12.4 (MacBook Air M1)
- macOS Ventura 13.1 (MacBook Air M2)
......@@ -14,8 +14,8 @@ compilation steps are necessary in that case.
In order to run Dynare, you need one of the following:
* MATLAB, any version ranging from 8.3 (R2014a) to 9.13 (R2022b);
* GNU Octave, any version ranging from 6.2.0 to 7.3.0, with the statistics package
* MATLAB, any version ranging from 8.3 (R2014a) to 9.14 (R2023a);
* GNU Octave, any version ranging from 6.2.0 to 8.1.0, with the statistics package
from `Octave-Forge`_. Note however that the Dynare installer for Windows
requires a more specific version of Octave, as indicated on the download
page.
......
......@@ -315,7 +315,7 @@ by the ``dynare`` command.
Prevent Dynare from printing the output of the steps leading up to the
preprocessor as well as the preprocessor output itself.
.. option:: mexext=mex|mexw32|mexw64|mexmaci64|mexa64
.. option:: mexext=mex|mexw32|mexw64|mexmaca64|mexmaci64|mexa64
The mex extension associated with your platform to be used
when compiling output associated with :opt:`use_dll`.
......
......@@ -3625,8 +3625,9 @@ speed-up on large models.
 
``0``
 
Newton method to solve simultaneously all the equations for
every period, using sparse matrices (Default).
Use a Newton algorithm with a direct sparse LU solver at each
iteration, applied on the stacked system of all the equations at
every period (Default).
 
``1``
 
......@@ -7259,6 +7260,17 @@ observed variables.
Ratto, and Rossi (2015)*. Note that ``'slice'`` is
incompatible with ``prior_trunc=0``.
 
Whereas one Metropolis-Hastings iteration requires one
evaluation of the posterior, one slice iteration requires :math:`neval`
evaluations, where as a rule of thumb :math:`neval=7\times npar` with
:math:`npar` denoting the number of estimated parameters. Spending
the same computational budget of :math:`N` posterior evaluations in the
slice sampler then implies setting ``mh_replic=N/neval``.
Note that the slice sampler will typically return less autocorrelated Monte Carlo Markov
Chain draws than the MH-algorithm. Its relative (in)efficiency can be investigated via
the reported inefficiency factors.
.. option:: posterior_sampler_options = (NAME, VALUE, ...)
 
A list of NAME and VALUE pairs. Can be used to set options for
......
dnl Detect the MATIO Library.
dnl
dnl Copyright © 2012-2021 Dynare Team
dnl Copyright © 2012-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
......@@ -22,6 +22,8 @@ AC_DEFUN([AX_MATIO],
AC_ARG_WITH(matio, AS_HELP_STRING([--with-matio=DIR], [prefix to MATIO installation]),
matio_prefix="$withval", matio_prefix="")
AC_REQUIRE([AC_CANONICAL_HOST])
has_matio=yes
if test -n "$matio_prefix"; then
......@@ -40,15 +42,19 @@ AC_ARG_WITH(matio, AS_HELP_STRING([--with-matio=DIR], [prefix to MATIO installat
CPPFLAGS="$CPPFLAGS_MATIO $CPPFLAGS"
LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
dnl Workaround for the matio from RHEL 6 + EPEL 6
dnl If detected, libz and libhdf5 are added to LIBS, used for matio test
dnl Under Windows and macOS, add hdf5 and its dependencies since we are linking statically
case ${host_os} in
*mingw32*)
dnl Partly inspired by /mingw64/lib/pkgconfig/{hdf5,libcurl}.pc (in particular for the system libraries)
LIBS="-lhdf5 -lcurl -lnghttp2 -lidn2 -lssh2 -lpsl -lunistring -liconv -lbcrypt -ladvapi32 -lcrypt32 -lbcrypt -lgdi32 -lwldap32 -lzstd -lbrotlidec -lbrotlicommon -lssl -lcrypto -lws2_32 -lz -lsz"
;;
*darwin*)
LIBS="-lhdf5 -lz -lsz"
;;
*)
LIBS=""
AC_CHECK_LIB([z], [compress])
dnl szip is needed under MSYS2
AC_CHECK_LIB([szip], [SZ_Compress])
dnl szip is needed for static linking on macOS (it's called libsz on macOS)
AC_CHECK_LIB([sz], [SZ_Compress])
AC_CHECK_LIB([hdf5], [H5Fcreate])
;;
esac
AC_CHECK_HEADER([matio.h], [], [has_matio=no])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no])
......
......@@ -57,6 +57,9 @@ else
*mexmaci64)
ax_cv_matlab_arch=maci64
;;
*mexmaca64)
ax_cv_matlab_arch=maca64
;;
*)
ax_cv_matlab_arch=unknown
;;
......
dnl Copyright © 2009-2022 Dynare Team
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
......@@ -44,6 +44,9 @@ fi
if test -n "$MATLAB_VERSION"; then
dnl Convert a release number (Rnnnnx) into a version number (x.y)
case $MATLAB_VERSION in
*2023a | *2023A)
MATLAB_VERSION="9.14"
;;
*2022b | *2022B)
MATLAB_VERSION="9.13"
;;
......
......@@ -51,9 +51,19 @@ case ${MATLAB_ARCH} in
# using threads, since we are using the POSIX threads version of MinGW)
MATLAB_LDFLAGS_NOMAP="-static-libgcc -static-libstdc++ -static-libgfortran -Wl,-Bstatic,--whole-archive -lquadmath -Wl,-Bdynamic,--no-whole-archive -shared -L$MATLAB/bin/win64 -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,-Bdynamic,--no-whole-archive"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP \$(abs_top_srcdir)/mex.def"
MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack -lmwblas"
# Hack for static linking of libgomp, needed for OpenMP
OPENMP_LDFLAGS="-Wl,-Bstatic,--whole-archive -lgomp -Wl,-Bdynamic,--no-whole-archive"
# Hack for libssp, which is pulled in by -fstack-protector
# (curiously only on some MEX files), see windows/build.sh.
# Note that the link against libssp should not happen with compilers
# from MSYS2, see:
# https://www.msys2.org/news/#2022-10-10-libssp-is-no-longer-required
# But it happens with Debian’s cross compilers (as of Debian “bookworm” 12).
# Also note that the -lssp must come by the end of the link command
# (otherwise it will have to be enclosed within --whole-archive).
MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack -lmwblas -Wl,-Bstatic -lssp -Wl,-Bdynamic"
# Hack for static linking of libgomp, needed for OpenMP.
# Should come by the end of the link command
# (otherwise it will have to be enclosed within --whole-archive).
OPENMP_LIBS="-Wl,-Bstatic -lgomp -Wl,-Bdynamic"
ax_mexopts_ok="yes"
;;
maci64)
......@@ -69,6 +79,19 @@ case ${MATLAB_ARCH} in
MATLAB_LIBS="-L$MATLAB/bin/maci64 -lmx -lmex -lmat -lmwlapack -lmwblas"
ax_mexopts_ok="yes"
;;
maca64)
MATLAB_DEFS="-DNDEBUG"
MATLAB_CFLAGS="-fno-common -fexceptions"
MATLAB_CXXFLAGS="-fno-common -fexceptions"
MATLAB_FCFLAGS="-fexceptions -fbackslash"
MATLAB_LDFLAGS_NOMAP="-Wl,-twolevel_namespace -undefined error -bundle"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,-exported_symbols_list,\$(abs_top_srcdir)/mexFunction-MacOSX.map"
# This -L flag is put here, hence later on the linker command line, so as
# to avoid linking against the HDF5 shipped by MATLAB (which would
# otherwise override the HDF5 from Homebrew)
MATLAB_LIBS="-L$MATLAB/bin/maca64 -lmx -lmex -lmat -lmwlapack -lmwblas"
ax_mexopts_ok="yes"
;;
*)
ax_mexopts_ok="no"
;;
......@@ -121,5 +144,5 @@ AC_SUBST([MATLAB_CXXFLAGS])
AC_SUBST([MATLAB_FCFLAGS])
AC_SUBST([MATLAB_LDFLAGS])
AC_SUBST([MATLAB_LIBS])
AC_SUBST([OPENMP_LDFLAGS])
AC_SUBST([OPENMP_LIBS])
])
# Copyright © 2019 Dynare Team
# Copyright © 2019-2023 Dynare Team
#
# This file is part of Dynare.
#
......@@ -15,22 +15,38 @@
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <https://www.gnu.org/licenses/>.
.PHONY: all deps clean-deps clean clean-all build
.PHONY: all clean-all clean-pkg clean-mex-matlab\
deps-arm64 deps-x86_64 \
clean-arm64-deps clean-x86_64-deps \
build-arm64 build-x86_64
NTHREADS=$(shell nproc)
NTHREADS=$(shell sysctl -n hw.physicalcpu)
all: build
all: build-arm64 build-x86_64
deps:
make -C deps -j$(NTHREADS)
deps-arm64:
make -C deps -j$(NTHREADS) build-arm64
clean-deps:
make -C deps clean-all
deps-x86_64:
make -C deps -j$(NTHREADS) build-x86_64
clean:
clean-arm64-deps:
make -C deps clean-arm64-all
clean-x86_64-deps:
make -C deps clean-x86_64-all
clean-pkg:
rm -rf pkg
clean-all: clean-deps clean
clean-mex-matlab:
# make sure there are no symbolic links left to possibly missing mexmaca64 or mexmaci64 files
rm -rf ../mex/matlab
clean-all: clean-arm64-deps clean-x86_64-deps clean-pkg clean-mex-matlab
build-arm64: deps-arm64
./build.sh arm64
build: deps
./build.sh
build-x86_64: deps-x86_64
./build.sh x86_64
......@@ -21,6 +21,24 @@ set -ex
ROOTDIR=$(pwd)/..
# Set arch, base dir of homebrew, and versions of MATLAB to be used
ARCH=$1
path_remove () { export $1="`echo -n ${!1} | awk -v RS=: -v ORS=: '$1 != "'$2'"' | sed 's/:$//'`"; }
path_prepend () { path_remove $1 $2; export $1="$2:${!1}"; }
if [ $ARCH == arm64 ]; then
BREWDIR=/opt/homebrew
# make sure /opt/homebrew/bin is set first in PATH (as it might come last)
path_prepend PATH /opt/homebrew/bin
MATLAB_VERSION_0=MATLAB_R2022a_Beta
else
BREWDIR=/usr/local
# remove /opt/homebrew/bin from PATH, so it does not intervene with the x86_64 compilations below
path_remove PATH /opt/homebrew/bin
# on x86_64 we need to differentiate between MATLAB < 2018a and MATLAB ≥ 2018a
MATLAB_VERSION_0=MATLAB_R2016b
MATLAB_VERSION_1=MATLAB_R2019b
fi
# Set the GCC version
GCC_VERSION=12
......@@ -29,10 +47,10 @@ CC=gcc-$GCC_VERSION
CXX=g++-$GCC_VERSION
# Set the number of threads
NTHREADS=$(sysctl -n hw.ncpu)
NTHREADS=$(sysctl -n hw.physicalcpu)
# Set dependency directory
LIB64="$ROOTDIR"/macOS/deps/lib64
LIB64="$ROOTDIR"/macOS/deps/lib64/"$ARCH"
##
......@@ -64,6 +82,10 @@ else
LOCATION=$(echo "$VERSION" | cut -f1 -d"-" | cut -c 1-5)-"$DATE"
fi
# Make sure arch is appended to LOCATION and VERSION
VERSION="$VERSION"-"$ARCH"
LOCATION="$LOCATION"-"$ARCH"
## Hack for statically linking libquadmath, similar to the one used in
## deps/Makefile for several libraries (there is no -static-libquadmath flag,
## see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539).
......@@ -73,36 +95,36 @@ fi
## - libgfortran.spec does not include --as-needed on macOS, hence it will link the library anyways
## Also, it does not seem possible to override libgfortran.spec with the --specs option.
QUADMATH_DIR=$(mktemp -d)
ln -s /usr/local/opt/gcc/lib/gcc/$GCC_VERSION/libquadmath.a $QUADMATH_DIR
ln -s "$BREWDIR"/opt/gcc/lib/gcc/$GCC_VERSION/libquadmath.a $QUADMATH_DIR
##
## Compile Dynare doc, preprocessor, mex for MATLAB < 2018a
## Compile Dynare doc, dynare++, preprocessor, mex using MATLAB_VERSION_0
##
## NB: In Homebrew, -static-libgfortran is implied by -static-libgcc (see “gfortran -dumpspecs”)
## NB2: We use the hack for libquadmath in LDFLAGS
cd "$ROOTDIR"
[[ -f configure ]] || autoreconf -si
./configure \
arch -$ARCH autoreconf -si
arch -$ARCH ./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CC=$CC \
CXX=$CXX \
CPPFLAGS=-I/usr/local/include \
CPPFLAGS=-I"$BREWDIR"/include \
LDFLAGS="-static-libgcc -L$QUADMATH_DIR" \
LEX=/usr/local/opt/flex/bin/flex \
YACC=/usr/local/opt/bison/bin/bison \
LEX="$BREWDIR"/opt/flex/bin/flex \
YACC="$BREWDIR"/opt/bison/bin/bison \
--prefix="$BREWDIR" \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--disable-octave \
--with-matlab=/Applications/MATLAB_R2016b.app
--with-matlab=/Applications/"$MATLAB_VERSION_0".app
if [[ -z $CI ]]; then
# If not in Gitlab CI, clean the source and build the doc
make clean
make -j"$NTHREADS" pdf html
arch -$ARCH make clean
arch -$ARCH make pdf html
fi
make -j"$NTHREADS"
arch -$ARCH make -j"$NTHREADS"
##
## Create package
......@@ -111,11 +133,16 @@ NAME=dynare-"$VERSION"
PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
mkdir -p \
"$PKGFILES"/preprocessor \
"$PKGFILES"/mex/matlab/maci64-8.3-9.3 \
"$PKGFILES"/mex/matlab/maci64-9.4-9.13 \
"$PKGFILES"/doc \
"$PKGFILES"/doc/dynare++ \
"$PKGFILES"/dynare++ \
"$PKGFILES"/scripts \
"$PKGFILES"/contrib/ms-sbvar/TZcode
if [ $ARCH == arm64 ]; then
mkdir -p "$PKGFILES"/mex/matlab/maca64-9.12
else
mkdir -p "$PKGFILES"/mex/matlab/maci64-8.3-9.3
mkdir -p "$PKGFILES"/mex/matlab/maci64-9.4-9.12
fi
if [[ $VERSION == *-unstable* ]]; then
echo "$SHA" > "$PKGFILES"/sha.txt
......@@ -134,7 +161,11 @@ cp -p "$ROOTDIR"/preprocessor/src/dynare-preprocessor "$PKGFILES"
rm -f "$ROOTDIR"/matlab/preprocessor64/dynare_m
ln -sf ../../preprocessor/dynare-preprocessor "$PKGFILES"/matlab/preprocessor64/dynare_m
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-8.3-9.3
if [ $ARCH == arm64 ]; then
cp -L "$ROOTDIR"/mex/matlab/*.mexmaca64 "$PKGFILES"/mex/matlab/maca64-9.12
else
cp -L "$ROOTDIR"/mex/matlab/**.mexmaci64 "$PKGFILES"/mex/matlab/maci64-8.3-9.3
fi
cp -p "$ROOTDIR"/scripts/dynare.el "$PKGFILES"/scripts
cp -pr "$ROOTDIR"/contrib/ms-sbvar/TZcode/MatlabFiles "$PKGFILES"/contrib/ms-sbvar/TZcode
......@@ -150,28 +181,29 @@ cp "$ROOTDIR"/doc/manual/build/latex/dynare-manual.pdf "$PKGFILES"
cp -r "$ROOTDIR"/doc/manual/build/html "$PKGFILES"/doc/dynare-manual.html
mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
cp -p "$ROOTDIR"/macOS/deps/lib64/"$ARCH"/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
if [ $ARCH == x86_64 ]; then
##
## Create mex for MATLAB ≥ 2018a
## Create mex using MATLAB_VERSION_1
##
cd "$ROOTDIR"/mex/build/matlab
make clean
./configure \
arch -$ARCH make clean
arch -$ARCH ./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CC=$CC \
CXX=$CXX \
CPPFLAGS=-I/usr/local/include \
LDFLAGS="-static-libgcc -L$QUADMATH_DIR" \
--prefix=/usr/local \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--with-matlab=/Applications/MATLAB_R2022b.app
make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-9.4-9.13
--with-matlab=/Applications/"$MATLAB_VERSION_1".app
arch -$ARCH make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/matlab/*.mexmaci64 "$PKGFILES"/mex/matlab/maci64-9.4-9.12
fi
##
## Make package
......@@ -179,12 +211,12 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"
cd "$ROOTDIR"/macOS/pkg
# Dynare option
pkgbuild --root "$PKGFILES" --identifier org.dynare --version "$VERSION" --install-location /Applications/Dynare/"$LOCATION" "$NAME".pkg
arch -$ARCH pkgbuild --root "$PKGFILES" --identifier org.dynare --version "$VERSION" --install-location /Applications/Dynare/"$LOCATION" "$NAME".pkg
# GCC option
# Create dummy payload for GCC package; otherwise the size is displayed as 0 bytes in the installer
dd if=/dev/zero of="$ROOTDIR"/macOS/brewfiles/dummy bs=1m count=800
pkgbuild --root "$ROOTDIR"/macOS/brewfiles --identifier org.dynare.gcc --version "$VERSION" --scripts "$ROOTDIR"/macOS/scripts --install-location /Applications/Dynare/"$LOCATION" "$NAME"-gcc.pkg
arch -$ARCH pkgbuild --root "$ROOTDIR"/macOS/brewfiles --identifier org.dynare.gcc --version "$VERSION" --scripts "$ROOTDIR"/macOS/scripts/"$ARCH" --install-location /Applications/Dynare/"$LOCATION" "$NAME"-gcc.pkg
# Replace variables in displayed files
sed "s/VERSION_READ/$VERSION/g" "$ROOTDIR"/macOS/distribution_template.xml > distribution_tmp.xml
......@@ -194,7 +226,7 @@ sed "s/VERSION_NO_SPACE/$VERSION/g" "$ROOTDIR"/macOS/welcome.html > "$ROOTDIR"/m
sed "s/DATE/$DATELONG/g" "$ROOTDIR"/macOS/welcome_tmp.html > "$ROOTDIR"/macOS/welcome.html
# Create installer
productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-new.pkg
arch -$ARCH productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-new.pkg
# cleanup
rm -f ./*.xml
......
......@@ -22,66 +22,118 @@ ROOT_PATH = $(realpath .)
WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error
.PHONY: all build build-slicot build-x13as \
clean-lib clean-libslicot clean-x13as-bin \
clean-src clean-slicot-src clean-x13as-src \
.PHONY: all clean_all\
build-x86_64 build-x86_64-slicot build-x86_64-x13as \
build-arm64 build-arm64-slicot build-arm64-x13as \
clean-x86_64-lib clean-x86_64-libslicot clean-x86_64-x13as-bin \
clean-arm64-lib clean-arm64-libslicot clean-arm64-x13as-bin \
clean-x86_64-src clean-x86_64-slicot-src clean-x86_64-x13as-src \
clean-arm64-src clean-arm64-slicot-src clean-arm64-x13as-src \
clean-tar clean-slicot-tar clean-x13as-tar \
clean-all clean-lib clean-src clean-tar
clean-x86_64-all clean-x86_64-lib clean-x86_64-src \
clean-arm64-all clean-arm64-lib clean-arm64-src \
ln-x86_64-matio ln-x86_64-gsl \
ln-arm64-matio ln-arm64-gsl
all: build
all: build-x86_64 build-arm64
build: build-slicot build-x13as ln-matio ln-gsl
clean_all: clean-x86_64-all clean-arm64-all
clean-lib: clean-libslicot clean-x13as-bin
build-x86_64: build-x86_64-slicot build-x86_64-x13as ln-x86_64-matio ln-x86_64-gsl
clean-src: clean-slicot-src clean-x13as-src
build-arm64: build-arm64-slicot build-arm64-x13as ln-arm64-matio ln-arm64-gsl
clean-x86_64-lib: clean-x86_64-libslicot clean-x86_64-x13as-bin
clean-arm64-lib: clean-arm64-libslicot clean-arm64-x13as-bin
clean-x86_64-src: clean-x86_64-slicot-src clean-x86_64-x13as-src
clean-arm64-src: clean-arm64-slicot-src clean-arm64-x13as-src
clean-tar: clean-slicot-tar clean-x13as-tar
clean-all: clean-lib clean-src clean-tar
clean-x86_64-all: clean-x86_64-lib clean-x86_64-src clean-tar
clean-arm64-all: clean-arm64-lib clean-arm64-src clean-tar
#
# Matio & GSL
# (done to link only to static Matio and GSL libraries)
# Matio
lib64/matio/lib/libmatio.a: /usr/local/lib/libmatio.a
lib64/x86_64/matio/lib/libmatio.a: /usr/local/lib/libmatio.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libhdf5.a: /usr/local/lib/libhdf5.a
lib64/arm64/matio/lib/libmatio.a: /opt/homebrew/lib/libmatio.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libsz.a: /usr/local/lib/libsz.a
lib64/x86_64/matio/lib/libhdf5.a: /usr/local/lib/libhdf5.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/include/matio.h: /usr/local/include/matio.h
lib64/arm64/matio/lib/libhdf5.a: /opt/homebrew/lib/libhdf5.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/x86_64/matio/lib/libsz.a: /usr/local/lib/libsz.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/arm64/matio/lib/libsz.a: /opt/homebrew/lib/libsz.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/x86_64/matio/include/matio.h: /usr/local/include/matio.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf include && ln -sf $(dir $<) .
ln-matio: lib64/matio/lib/libmatio.a \
lib64/matio/lib/libhdf5.a \
lib64/matio/lib/libsz.a \
lib64/matio/include/matio.h
lib64/arm64/matio/include/matio.h: /opt/homebrew/include/matio.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf include && ln -sf $(dir $<) .
ln-x86_64-matio: lib64/x86_64/matio/lib/libmatio.a \
lib64/x86_64/matio/lib/libhdf5.a \
lib64/x86_64/matio/lib/libsz.a \
lib64/x86_64/matio/include/matio.h
ln-arm64-matio: lib64/arm64/matio/lib/libmatio.a \
lib64/arm64/matio/lib/libhdf5.a \
lib64/arm64/matio/lib/libsz.a \
lib64/arm64/matio/include/matio.h
clean-matio:
rm -rf lib64/matio
clean-x86_64-matio:
rm -rf lib64/x86_64/matio
clean-arm64-matio:
rm -rf lib64/arm64/matio
# GSL
lib64/gsl/lib/libgsl.a: /usr/local/lib/libgsl.a
lib64/x86_64/gsl/lib/libgsl.a: /usr/local/lib/libgsl.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/arm64/gsl/lib/libgsl.a: /opt/homebrew/lib/libgsl.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
lib64/x86_64/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/gsl/include/gsl/gsl_blas.h: /usr/local/include/gsl/gsl_blas.h
lib64/arm64/gsl/lib/libgslcblas.a: /opt/homebrew/lib/libgslcblas.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/x86_64/gsl/include/gsl/gsl_blas.h: /usr/local/include/gsl/gsl_blas.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf gsl && ln -sf $(dir $<) .
lib64/arm64/gsl/include/gsl/gsl_blas.h: /opt/homebrew/include/gsl/gsl_blas.h
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf gsl && ln -sf $(dir $<) .
ln-gsl: lib64/gsl/lib/libgsl.a \
lib64/gsl/lib/libgslcblas.a \
lib64/gsl/include/gsl/gsl_blas.h
ln-x86_64-gsl: lib64/x86_64/gsl/lib/libgsl.a \
lib64/x86_64/gsl/lib/libgslcblas.a \
lib64/x86_64/gsl/include/gsl/gsl_blas.h
clean-gsl:
rm -rf lib64/gsl
ln-arm64-gsl: lib64/arm64/gsl/lib/libgsl.a \
lib64/arm64/gsl/lib/libgslcblas.a \
lib64/arm64/gsl/include/gsl/gsl_blas.h
clean-x86_64-gsl:
rm -rf lib64/x86_64/gsl
clean-arm64-gsl:
rm -rf lib64/arm64/gsl
#
# Slicot
......@@ -90,43 +142,78 @@ tarballs/slicot-$(SLICOT_VERSION).tar.gz:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://deb.debian.org/debian/pool/main/s/slicot/slicot_$(SLICOT_VERSION).orig.tar.gz
sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/slicot-*-with-32bit-integer-and-underscore
sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/x86_64/slicot-*-with-32bit-integer-and-underscore
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/arm64/slicot-*-with-32bit-integer-and-underscore
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/slicot-*-with-64bit-integer-and-underscore
sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/x86_64/slicot-*-with-64bit-integer-and-underscore
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
lib64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
rm -rf sources64/arm64/slicot-*-with-64bit-integer-and-underscore
mkdir -p $@
tar xf $< --directory $@ --strip-components=1
touch $@
lib64/x86_64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
make -C $< FORTRAN=/usr/local/bin/gfortran LOADER=/usr/local/bin/gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
strip -S $</libslicot_pic.a
mkdir -p $(dir $@)
cp $</libslicot_pic.a $@
lib64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
lib64/arm64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
make -C $< FORTRAN=/opt/homebrew/bin/gfortran LOADER=/opt/homebrew/bin/gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
strip -S $</libslicot_pic.a
mkdir -p $(dir $@)
cp $</libslicot_pic.a $@
lib64/x86_64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
make -C $< FORTRAN=/usr/local/bin/gfortran LOADER=/usr/local/bin/gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
strip -S $</libslicot64_pic.a
mkdir -p $(dir $@)
cp $</libslicot64_pic.a $@
lib64/arm64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
make -C $< FORTRAN=/opt/homebrew/bin/gfortran LOADER=/opt/homebrew/bin/gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
strip -S $</libslicot64_pic.a
mkdir -p $(dir $@)
cp $</libslicot64_pic.a $@
build-slicot: lib64/Slicot/with-underscore/lib/libslicot_pic.a \
lib64/Slicot/with-underscore/lib/libslicot64_pic.a
build-x86_64-slicot: lib64/x86_64/Slicot/with-underscore/lib/libslicot_pic.a \
lib64/x86_64/Slicot/with-underscore/lib/libslicot64_pic.a
build-arm64-slicot: lib64/arm64/Slicot/with-underscore/lib/libslicot_pic.a \
lib64/arm64/Slicot/with-underscore/lib/libslicot64_pic.a
clean-slicot-tar:
rm -f tarballs/slicot-$(SLICOT_VERSION).tar.gz
clean-slicot-src:
rm -rf sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
clean-x86_64-slicot-src:
rm -rf sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
rm -rf sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
clean-libslicot:
rm -rf lib64/Slicot
clean-arm64-slicot-src:
rm -rf sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
rm -rf sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
clean-slicot-all: clean-slicot-src clean-slicot-tar clean-libslicot
clean-x86_64-libslicot:
rm -rf lib64/x86_64/Slicot
clean-arm64-libslicot:
rm -rf lib64/arm64/Slicot
clean-slicot-all: clean-x86_64-slicot-src clean-arm64-slicot-src clean-slicot-tar clean-x86_64-libslicot clean-arm64-libslicot
......@@ -137,36 +224,47 @@ tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
sources64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
rm -rf sources64/x13as-*
sources64/x86_64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
rm -rf sources64/x86_64/x13as-*
mkdir -p $@
tar xf $< --directory $@
lib64/x13as/x13as: sources64/x13as-$(X13AS_VERSION)
# Statically link x13as (see #1865).
# Using -static is not possible, it does not work under Darwin.
# Implement an ugly workaround in the absence of -static-libquadmath flag.
# In particular, gcc must be used as the linker, because gfortran does not
# honour static linking of libquadmath.
# Once the -static-libquadmath flag is added (GCC 13? ; see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539), go back to using
# gfortran as the linker with -static-libgfortran and
# -static-libquadmath flags, and drop the GCC_VERSION variable.
sources64/arm64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
rm -rf sources64/arm64/x13as-*
mkdir -p $@
tar xf $< --directory $@
lib64/x86_64/x13as/x13as: sources64/x86_64/x13as-$(X13AS_VERSION)
cd $< && sed -i '' 's/-static//g' makefile.gf
make -C $< -f makefile.gf FC=gfortran LINKER=gcc-$(GCC_VERSION) FFLAGS="-O2 -std=legacy" LDFLAGS=-static-libgcc LIBS="/usr/local/lib/gcc/current/libgfortran.a /usr/local/lib/gcc/current/libquadmath.a" PROGRAM=x13as
arch -x86_64 make -C $< -f makefile.gf FC=/usr/local/bin/gfortran LINKER=/usr/local/bin/gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
strip $</x13as
mkdir -p $(dir $@)
cp $</x13as $@
build-x13as: lib64/x13as/x13as
lib64/arm64/x13as/x13as: sources64/arm64/x13as-$(X13AS_VERSION)
cd $< && sed -i '' 's/-static//g' makefile.gf
arch -arm64 make -C $< -f makefile.gf FC=/opt/homebrew/bin/gfortran LINKER=/opt/homebrew/bin/gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
strip $</x13as
mkdir -p $(dir $@)
cp $</x13as $@
build-x86_64-x13as: lib64/x86_64/x13as/x13as
build-arm64-x13as: lib64/arm64/x13as/x13as
clean-x13as-tar:
rm -f tarballs/x13assrc_V$(X13AS_VERSION).tar.gz
rm -f tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
clean-x86_64-x13as-src:
rm -rf sources64/x86_64/x13as-$(X13AS_VERSION)
clean-arm64-x13as-src:
rm -rf sources64/arm64/x13as-$(X13AS_VERSION)
clean-x13as-src:
rm -rf sources64/x13as-$(X13AS_VERSION)
clean-x86_64-x13as-bin:
rm -rf lib64/x86_64/x13as
clean-x13as-bin:
rm -rf lib64/x13as
clean-arm64-x13as-bin:
rm -rf lib64/arm64/x13as
clean-x13as-all: clean-x13as-tar clean-x13as-src clean-x13as-bin
clean-x13as-all: clean-x13as-tar clean-x86_64-x13as-src clean-arm64-x13as-src clean-x86_64-x13as-bin clean-arm64-x13as-bin
......@@ -6,7 +6,7 @@
<welcome file="welcome.html" mime-type="text/html" />
<license file="gpl-3.0-standalone.html" mime-type="text/html" />
<pkg-ref id="org.dynare" />
<options customize="allow" require-scripts="false" hostArchitectures="x86_64" />
<options customize="allow" require-scripts="false" hostArchitectures="x86_64,arm64" />
<choices-outline>
<line choice="org.dynare" />
<line choice="org.dynare.gcc" />
......
#!/usr/bin/env bash
# Copyright © 2019-2021 Dynare Team
# Copyright © 2019-2022 Dynare Team
#
# This file is part of Dynare.
#
......@@ -82,7 +82,7 @@ curl -\# -L "$BREW_URL"/tarball/"$BREW_BRANCH" | tar xz -m --strip 1 -C "$BREWDI
# Change ownership of Dynare directory
chown -R "$USER":staff "$2"
sudo -u "$USER" "$BREWDIR"/bin/brew tap homebrew/core
sudo -u "$USER" arch -arm64 "$BREWDIR"/bin/brew tap homebrew/core
HOMEBREW_CACHE="$HOME"/Library/Caches/Homebrew-Dynare
HOMEBREW_NO_AUTO_UPDATE=1
[[ -z "${HOMEBREW_NO_ANALYTICS}" ]] && HOMEBREW_NO_ANALYTICS=1
......@@ -91,6 +91,6 @@ HOMEBREW_NO_AUTO_UPDATE=1
mv "$2"/*.rb "$BREWDIR"/Library/Taps/homebrew/homebrew-core/Formula
# Install GCC & deps
sudo -u "$USER" "$BREWDIR"/bin/brew install gcc -v --force-bottle
sudo -u "$USER" arch -arm64 "$BREWDIR"/bin/brew install gcc -v --force-bottle
exit 0
#!/usr/bin/env bash
# Copyright © 2019-2022 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <https://www.gnu.org/licenses/>.
set -ex
set -o errexit
readonly LOG_FILE="$2"/install.log
sudo touch "$LOG_FILE"
exec 1>"$LOG_FILE"
exec 2>&1
# Remove dummy payload
rm -f "$2"/dummy
# Test for Internet connection
if ! curl -s -m 4 https://github.com >/dev/null; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to connect to github.com. Either you are not connected to the internet or github.com is blocked where you are.\n\nAccess to GitHub is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo "No internet connection to github.com"
exit 1
fi
# Install Command Line Tools
# Checking that “xcode-select -print-path” returns a valid path is not enough, because
# the contents of that directory might have been removed (this is the official way of
# uninstalling CLT, see https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_CAN_I_UNINSTALL_THE_COMMAND_LINE_TOOLS_)
# Hence we also check that the directory contains the git binary.
if ! xcpath=$(/usr/bin/xcode-select -print-path) || [[ ! -x "$xcpath"/usr/bin/git ]]; then
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
SUC=$(softwareupdate -l |
grep "\*.*Command Line" |
grep -m1 "" |
awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')
# On macOS 10.15 softwareupdate output is preceded by "Label: "
[[ $SUC == Label:* ]] && SUC=${SUC#"Label: "}
softwareupdate -i "$SUC" --verbose
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
softwareupdate -l
fi
# If CLT installation didn't work, exit
if ! xcpath=$(/usr/bin/xcode-select -print-path) || [[ ! -x "$xcpath"/usr/bin/git ]]; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Command Line Tools.\n\nCommand Line Tools is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo "Command Line Tools not installed"
exit 1
fi
# Ensure git is in the path
if ! which git >/dev/null; then
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Git even though the Command Line Tools have already been installed. This is likely a problem with your PATH environment variable.\n\nGit is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'
echo $PATH
echo "Git not found in PATH"
exit 1
fi
# Install Homebrew
BREWDIR="$2"/.brew
[ -d "$BREWDIR" ] || mkdir -p "$BREWDIR"
BREW_URL="https://github.com/Homebrew/brew"
BREW_BRANCH="master"
curl -\# -L "$BREW_URL"/tarball/"$BREW_BRANCH" | tar xz -m --strip 1 -C "$BREWDIR"
# Change ownership of Dynare directory
chown -R "$USER":staff "$2"
sudo -u "$USER" arch -x86_64 "$BREWDIR"/bin/brew tap homebrew/core
HOMEBREW_CACHE="$HOME"/Library/Caches/Homebrew-Dynare
HOMEBREW_NO_AUTO_UPDATE=1
[[ -z "${HOMEBREW_NO_ANALYTICS}" ]] && HOMEBREW_NO_ANALYTICS=1
# Move modified formulas to Homebrew Formula directory
mv "$2"/*.rb "$BREWDIR"/Library/Taps/homebrew/homebrew-core/Formula
# Install GCC & deps
sudo -u "$USER" arch -x86_64 "$BREWDIR"/bin/brew install gcc -v --force-bottle
exit 0
......@@ -10,6 +10,6 @@
<p>Installing GCC will require an active internet connection with the ability to connect to the Apple servers and GitHub. The installation will take anywhere from a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
<p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under <tt>/usr/local</tt>, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
<p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under either <tt>/opt/homebrew/bin</tt> for Apple Silicon or <tt>/usr/local/bin</tt> for Intel systems, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
</body>
</html>
function mexpath = add_path_to_mex_files(dynareroot, modifypath)
% Copyright © 2015-2022 Dynare Team
% Copyright © 2015-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -60,7 +60,7 @@ else
end
end
else
tmp = [dynareroot '../mex/matlab/win64-9.4-9.13/'];
tmp = [dynareroot '../mex/matlab/win64-9.4-9.14/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......@@ -70,9 +70,9 @@ else
end
end
% Add macOS paths for Dynare Mac package
if strcmp(computer, 'MACI64')
if strcmp(computer, 'MACI64') || strcmp(computer, 'MACA64')
if matlab_ver_less_than('9.4')
tmp = [dynareroot '../mex/matlab/maci64-8.3-9.3/'];
tmp = [dynareroot '../mex/matlab/' lower(computer) '-8.3-9.3/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......@@ -80,7 +80,7 @@ else
end
end
else
tmp = [dynareroot '../mex/matlab/maci64-9.4-9.13'];
tmp = [dynareroot '../mex/matlab/maci64-9.4-9.14/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......
......@@ -2,7 +2,7 @@ function aggregate(ofile, dynopt, rootfolder, varargin)
% Agregates cherry-picked models.
% Copyright © 2019-2021 Dynare Team
% Copyright © 2019-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -21,7 +21,9 @@ function aggregate(ofile, dynopt, rootfolder, varargin)
MAX_NUMBER_OF_ELEMENTS = 10000;
if ~isoctave && matlab_ver_less_than('9.14') % Warning removed in R2023a
warning off MATLAB:subscripting:noSubscriptsSpecified
end
if ~isempty(dynopt)
% Should be a list of options for the preprocessor in a cell
......@@ -263,6 +265,7 @@ end
if ~isempty(firstline)
fprintf(fid, '%s\n\n', firstline);
end
% Print list of endogenous variables.
fprintf(fid, 'var\n');
for i=1:rows(elist)
if size(elist,2)==1 || isempty(elist{i,2})
......@@ -272,15 +275,18 @@ for i=1:rows(elist)
end
end
if ~isempty(plist)
% Print list of parameters.
fprintf(fid, ';\n\n');
fprintf(fid, 'parameters\n');
for i=1:length(plist)
fprintf(fid, '\t%s\n', plist{i});
end
fprintf(fid, ';\n\n');
% Print calibration.
fprintf(fid, calibration);
end
if ~isempty(xlist)
% Print list of exogenous variables.
fprintf(fid, '\n\n');
fprintf(fid, 'varexo\n');
for i=1:rows(xlist)
......@@ -291,7 +297,17 @@ if ~isempty(xlist)
end
end
end
fprintf(fid, ';\n\n');
fprintf(fid, ';\n');
skipline(1, fid)
% Provide an interface to flip endogenous and exogenous variables. Active if only macrovariable
% InvertModel is set to True. The calls to the change_type command must be provided in the file
% model-inversion-setup.inc (in the current folder).
fprintf(fid, '@#ifdef InvertModel\n');
fprintf(fid, ' @#if InvertModel\n');
fprintf(fid, ' @#include "model-inversion-setup.inc"\n');
fprintf(fid, ' @#endif\n');
fprintf(fid, '@#endif\n');
skipline(1, fid)
fprintf(fid, 'model;\n\n');
for i=1:rows(eqlist)
if isempty(eqlist{i,4})
......@@ -304,8 +320,9 @@ end
fprintf(fid, 'end;');
fclose(fid);
if ~isoctave && matlab_ver_less_than('9.14')
warning on MATLAB:subscripting:noSubscriptsSpecified
end
function b = isequationtag(str)
b = true;
......