Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
Stéphane Adjemian Argos) | 69283baf8f | |
Stéphane Adjemian Argos) | 66c03461c7 | |
Willi Mutschler | f14c6183a8 | |
Willi Mutschler | 342c74fbb0 | |
Willi Mutschler | 9c8463708a | |
Willi Mutschler | 515f8a68e5 |
|
@ -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
|
||||
|
|
84
README.md
84
README.md
|
@ -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.
|
||||
|
@ -116,7 +116,7 @@ Some important options:
|
|||
- `--disable-octave`: skip the compilation of MEX files for Octave
|
||||
- `--disable-doc`: skip the compilation of the documentation (PDF and HTML)
|
||||
|
||||
You may need to specify additional options to the configure script, see the output of the `--help` option, and also the platform specific instructions below. If the configuration goes well, the script will tell you which components are correctly configured and will be built.
|
||||
You may need to specify additional options to the configure script, see the output of the `--help` option, and also the platform specific instructions below. If the configuration goes well, the script will tell you which components are correctly configured and will be built.
|
||||
|
||||
Note that it is possible that some MEX files cannot be compiled, due to missing
|
||||
build dependencies. If you find no way of installing the missing dependencies,
|
||||
|
@ -156,7 +156,7 @@ or only with Octave:
|
|||
```sh
|
||||
make check-octave
|
||||
```
|
||||
Note that running the testsuite with Octave requires the additional packages `pstoedit`, `epstool`, `xfig`, and `gnuplot`.
|
||||
Note that running the testsuite with Octave requires the additional packages `pstoedit`, `epstool`, `xfig`, and `gnuplot`.
|
||||
|
||||
A summary of the results is available in `tests/run_test_matlab_output.txt` or `tests/run_test_octave_output.txt`. Often, it does not make sense to run the complete testsuite. For instance, if you modify codes only related to the perfect foresight model solver, you can decide to run only a subset of the integration tests, with:
|
||||
```sh
|
||||
|
@ -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):
|
||||
```sh
|
||||
softwareupdate --install-rosetta --agree-to-license
|
||||
```
|
||||
|
||||
- Install the Xcode Command Line Tools:
|
||||
```sh
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
- 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
|
||||
export ARCH=arm64
|
||||
export BREWDIR=/opt/homebrew
|
||||
```
|
||||
|
||||
For `x86_64` run the following commands:
|
||||
```sh
|
||||
export ARCH=x86_64
|
||||
export BREWDIR=/usr/local
|
||||
```
|
||||
|
||||
- Install [Homebrew](https://brew.sh/):
|
||||
```sh
|
||||
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
arch -$ARCH /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
```
|
||||
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:
|
||||
- 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
|
||||
alias brew='arch -x86_64 /usr/local/bin/brew'
|
||||
which brew
|
||||
#brew: aliased to arch -x86_64 /usr/local/bin/brew
|
||||
export PATH="$BREWDIR/bin:$PATH"
|
||||
```
|
||||
|
||||
- Install required Homebrew packages and link sphinx-doc:
|
||||
```sh
|
||||
brew install automake bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc wget
|
||||
brew link --force sphinx-doc
|
||||
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
|
||||
```
|
||||
|
||||
- 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:
|
||||
```sh
|
||||
ln -s /Library/TeX/texbin/pdflatex /usr/local/bin/pdflatex
|
||||
ln -s /Library/TeX/texbin/bibtex /usr/local/bin/bibtex
|
||||
```
|
||||
Alternatively, if you don’t want to install MacTeX, you should pass the `--disable-doc` flag to the `configure` command below.
|
||||
- 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. 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 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)
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -57,6 +57,9 @@ else
|
|||
*mexmaci64)
|
||||
ax_cv_matlab_arch=maci64
|
||||
;;
|
||||
*mexmaca64)
|
||||
ax_cv_matlab_arch=maca64
|
||||
;;
|
||||
*)
|
||||
ax_cv_matlab_arch=unknown
|
||||
;;
|
||||
|
|
|
@ -79,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"
|
||||
;;
|
||||
|
|
|
@ -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 sysctl -n hw.ncpu)
|
||||
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
|
||||
|
||||
build: deps
|
||||
./build.sh
|
||||
clean-all: clean-arm64-deps clean-x86_64-deps clean-pkg clean-mex-matlab
|
||||
|
||||
build-arm64: deps-arm64
|
||||
./build.sh arm64
|
||||
|
||||
build-x86_64: deps-x86_64
|
||||
./build.sh x86_64
|
||||
|
|
116
macOS/build.sh
116
macOS/build.sh
|
@ -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.14 \
|
||||
"$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
|
||||
|
||||
|
||||
##
|
||||
## Create mex for MATLAB ≥ 2018a
|
||||
##
|
||||
cd "$ROOTDIR"/mex/build/matlab
|
||||
make clean
|
||||
./configure \
|
||||
PACKAGE_VERSION="$VERSION" \
|
||||
PACKAGE_STRING="dynare $VERSION" \
|
||||
CC=$CC \
|
||||
CXX=$CXX \
|
||||
CPPFLAGS=-I/usr/local/include \
|
||||
LDFLAGS="-static-libgcc -L$QUADMATH_DIR" \
|
||||
--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.14
|
||||
cp -p "$ROOTDIR"/macOS/deps/lib64/"$ARCH"/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
|
||||
|
||||
if [ $ARCH == x86_64 ]; then
|
||||
##
|
||||
## Create mex using MATLAB_VERSION_1
|
||||
##
|
||||
cd "$ROOTDIR"/mex/build/matlab
|
||||
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_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 $<) .
|
||||
|
||||
clean-matio:
|
||||
rm -rf lib64/matio
|
||||
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-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/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
|
||||
lib64/arm64/gsl/lib/libgsl.a: /opt/homebrew/lib/libgsl.a
|
||||
mkdir -p $(dir $@) && ln -sf $< $@
|
||||
|
||||
lib64/gsl/include/gsl/gsl_blas.h: /usr/local/include/gsl/gsl_blas.h
|
||||
lib64/x86_64/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
|
||||
mkdir -p $(dir $@) && ln -sf $< $@
|
||||
|
||||
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 $<) .
|
||||
|
||||
ln-gsl: lib64/gsl/lib/libgsl.a \
|
||||
lib64/gsl/lib/libgslcblas.a \
|
||||
lib64/gsl/include/gsl/gsl_blas.h
|
||||
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 $<) .
|
||||
|
||||
clean-gsl:
|
||||
rm -rf lib64/gsl
|
||||
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
|
||||
|
||||
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/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
||||
rm -rf sources64/slicot-*-with-64bit-integer-and-underscore
|
||||
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 $@
|
||||
|
||||
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/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 $@
|
||||
|
||||
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 $@
|
||||
|
||||
build-slicot: lib64/Slicot/with-underscore/lib/libslicot_pic.a \
|
||||
lib64/Slicot/with-underscore/lib/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-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-x13as-src:
|
||||
rm -rf sources64/x13as-$(X13AS_VERSION)
|
||||
clean-x86_64-x13as-src:
|
||||
rm -rf sources64/x86_64/x13as-$(X13AS_VERSION)
|
||||
|
||||
clean-x13as-bin:
|
||||
rm -rf lib64/x13as
|
||||
clean-arm64-x13as-src:
|
||||
rm -rf sources64/arm64/x13as-$(X13AS_VERSION)
|
||||
|
||||
clean-x13as-all: clean-x13as-tar clean-x13as-src clean-x13as-bin
|
||||
clean-x86_64-x13as-bin:
|
||||
rm -rf lib64/x86_64/x13as
|
||||
|
||||
clean-arm64-x13as-bin:
|
||||
rm -rf lib64/arm64/x13as
|
||||
|
||||
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" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/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
|
|
@ -0,0 +1,96 @@
|
|||
#!/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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue