Skip to content
Snippets Groups Projects
Verified Commit 0bdb04ba authored by Houtan Bastani's avatar Houtan Bastani
Browse files

macOS snapshot: statically link to `libmatio` and dependencies, `gsl`, and `gcc` libraries

* The macOS snapshot until this point did not work unless the user had already installed `libmatio`, `gsl`, and `gcc` via Homebrew.
* We are not modifying `m4/ax_matio.m4` as we want to still be able to compile against shared libraries in development
parent 39ef80e3
Branches
Tags
No related merge requests found
Pipeline #2171 passed
......@@ -46,6 +46,8 @@ AC_ARG_WITH(matio, AC_HELP_STRING([--with-matio=DIR], [prefix to MATIO installat
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])
AC_CHECK_HEADER([matio.h], [], [has_matio=no])
......
......@@ -44,11 +44,20 @@ LIB64="$ROOTDIR"/macOS/deps/lib64
##
## Compile Dynare
## Compile Dynare doc, dynare++, preprocessor, mex for MATLAB < 2018a
##
cd "$ROOTDIR"
[[ -f configure ]] || autoreconf -si
CC=$CC CXX=$CXX ./configure --with-matlab=/Applications/MATLAB_R2016b.app MATLAB_VERSION=R2016b --with-matio=/usr/local --with-gsl=/usr/local --with-slicot="$LIB64"/Slicot/with-underscore --disable-octave PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
CC=$CC CXX=$CXX ./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CXXFLAGS=-I/usr/local/include \
LDFLAGS=-static-libgcc \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--disable-octave \
--with-matlab=/Applications/MATLAB_R2016b.app MATLAB_VERSION=R2016b
if [[ -z $CI ]]; then
# If not in Gitlab CI, clean the source and build the doc
make clean
......@@ -102,11 +111,19 @@ cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"
##
## Create mex for MATLAB le 2018a
## Create mex for MATLAB 2018a
##
cd "$ROOTDIR"/mex/build/matlab
make clean
CC=$CC CXX=$CXX ./configure --with-matlab=/Applications/MATLAB_R2019b.app MATLAB_VERSION=R2019b --with-matio=/usr/local --with-gsl=/usr/local --with-slicot="$LIB64"/Slicot/with-underscore PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
CC=$CC CXX=$CXX ./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CXXFLAGS=-I/usr/local/include \
LDFLAGS=-static-libgcc \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore \
--with-matlab=/Applications/MATLAB_R2019b.app MATLAB_VERSION=R2019b
make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-9.4-9.7
......@@ -115,7 +132,14 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"
## Create mex for Octave
##
cd "$ROOTDIR"/mex/build/octave
CC=$CC CXX=$CXX ./configure --with-matio=/usr/local --with-gsl=/usr/local --with-slicot="$LIB64"/Slicot/with-underscore LDFLAGS=-L/usr/local/lib PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
CC=$CC CXX=$CXX ./configure \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION" \
CXXFLAGS=-I/usr/local/include \
LDFLAGS="-static-libgcc -L/usr/local/lib" \
--with-gsl="$LIB64"/gsl \
--with-matio="$LIB64"/matio \
--with-slicot="$LIB64"/Slicot/with-underscore
make -j"$NTHREADS"
cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave
echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m
......
......@@ -30,7 +30,7 @@ WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --re
all: build
build: build-slicot build-x13as
build: build-slicot build-x13as ln-matio ln-gsl
clean-lib: clean-libslicot clean-x13as-bin
......@@ -41,6 +41,48 @@ clean-tar: clean-slicot-tar clean-x13as-tar
clean-all: clean-lib clean-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
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libhdf5.a: /usr/local/lib/libhdf5.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/matio/lib/libsz.a: /usr/local/lib/libsz.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/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
clean-matio:
rm -rf lib64/matio
# GSL
lib64/gsl/lib/libgsl.a: /usr/local/lib/libgsl.a
mkdir -p $(dir $@) && ln -sf $< $@
lib64/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
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
clean-gsl:
rm -rf lib64/gsl
#
# Slicot
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment