build slicot, x13as when building macOS package and make some simplifications
parent
32932ce741
commit
982d6b9de4
|
@ -146,6 +146,9 @@ dynare++/64-bit/
|
|||
# MacOS stuff
|
||||
.DS_Store
|
||||
macOS/pkg/
|
||||
macOS/deps/sources64/
|
||||
macOS/deps/tarballs/
|
||||
macOS/deps/lib64/
|
||||
|
||||
# Emacs stuff
|
||||
scripts/dynare.elc
|
||||
|
|
|
@ -101,7 +101,13 @@ pkg_windows:
|
|||
pkg_macOS:
|
||||
stage: test_and_pkg
|
||||
script:
|
||||
- ln -s ~/tarballs macOS/deps/
|
||||
- make -C macOS
|
||||
cache:
|
||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- macOS/deps/sources64/
|
||||
- macOS/deps/lib64/
|
||||
tags:
|
||||
- macOS
|
||||
artifacts:
|
||||
|
|
|
@ -15,10 +15,22 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
.PHONY: all clean
|
||||
.PHONY: all deps clean-deps clean clean-all build
|
||||
|
||||
all:
|
||||
./build.sh
|
||||
NTHREADS=$(shell nproc)
|
||||
|
||||
all: build
|
||||
|
||||
deps:
|
||||
make -C deps -j$(NTHREADS)
|
||||
|
||||
clean-deps:
|
||||
make -C deps clean-all
|
||||
|
||||
clean:
|
||||
rm -rf pkg
|
||||
|
||||
clean-all: clean-deps clean
|
||||
|
||||
build: deps
|
||||
./build.sh
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
set -ex
|
||||
|
||||
# Set the compilers
|
||||
CC=gcc-9
|
||||
CXX=g++-9
|
||||
|
||||
# Set the number of threads
|
||||
NTHREADS=$(nproc)
|
||||
|
||||
|
@ -35,13 +39,29 @@ if [[ -z $VERSION ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Set dependency directory
|
||||
LIB64="$ROOTDIR"/macOS/deps/lib64
|
||||
|
||||
|
||||
##
|
||||
## Find versions set in deps/versions.mk
|
||||
##
|
||||
while read -r line
|
||||
do
|
||||
if [[ "$line" =~ OCTAVE_VERSION[[:space:]]*=[[:space:]]*([^[:space:]]+) ]]; then
|
||||
OCTAVE_VERSION=${BASH_REMATCH[1]}
|
||||
break
|
||||
fi
|
||||
done < "$ROOTDIR"/macOS/deps/versions.mk
|
||||
[[ -n $OCTAVE_VERSION ]] || { echo "Can't find OCTAVE_VERSION in versions.mk" >&2; exit 1; }
|
||||
|
||||
|
||||
##
|
||||
## Compile Dynare
|
||||
##
|
||||
cd "$ROOTDIR"
|
||||
[[ -f configure ]] || autoreconf -si
|
||||
CC=gcc-9 CXX=g++-9 ./configure --with-matlab=/Applications/MATLAB_R2016b.app MATLAB_VERSION=R2016b --with-matio=/usr/local --with-gsl=/usr/local --with-slicot=/usr/local --disable-octave PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
|
||||
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/without-underscore --disable-octave PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
|
||||
if [[ -z $CI ]]; then
|
||||
# If not in Gitlab CI, clean the source and build the doc
|
||||
make clean
|
||||
|
@ -90,13 +110,16 @@ cp "$ROOTDIR"/dynare++/doc/*.pdf "$PKGFILES"
|
|||
|
||||
cp "$ROOTDIR"/dynare++/src/dynare++ "$PKGFILES"/dynare++
|
||||
|
||||
mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/osx/64
|
||||
cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/osx/64
|
||||
|
||||
|
||||
##
|
||||
## Create mex for Matlab le 2018a
|
||||
## Create mex for MATLAB le 2018a
|
||||
##
|
||||
cd "$ROOTDIR"/mex/build/matlab
|
||||
make clean
|
||||
CC=gcc-9 CXX=g++-9 ./configure --with-matlab=/Applications/MATLAB_R2019b.app MATLAB_VERSION=R2019b --with-matio=/usr/local --with-gsl=/usr/local --with-slicot=/usr/local PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
|
||||
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/without-underscore PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
|
||||
make -j"$NTHREADS"
|
||||
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-9.4-9.7
|
||||
|
||||
|
@ -105,10 +128,10 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"
|
|||
## Create mex for Octave
|
||||
##
|
||||
cd "$ROOTDIR"/mex/build/octave
|
||||
CC=gcc-9 CXX=g++-9 ./configure --with-matio=/usr/local --with-gsl=/usr/local --with-slicot=/usr/local LDFLAGS=-L/usr/local/lib PACKAGE_VERSION="$VERSION" PACKAGE_STRING="dynare $VERSION"
|
||||
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"
|
||||
make -j"$NTHREADS"
|
||||
cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave
|
||||
|
||||
echo -e "function v = supported_octave_version\nv=\"${OCTAVE_VERSION}\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m
|
||||
|
||||
##
|
||||
## Make package
|
||||
|
@ -119,7 +142,7 @@ sed "s/VERSION_READ/$VERSION_READ/g" "$ROOTDIR"/macOS/distribution_template.xml
|
|||
sed "s/VERSION_NO_SPACE/$VERSION/g" distribution_tmp.xml > distribution.xml
|
||||
ln -s "$ROOTDIR"/COPYING "$ROOTDIR"/macOS/
|
||||
productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-new.pkg
|
||||
rm -f *.xml
|
||||
rm -f ./*.xml
|
||||
rm -rf "$PKGFILES"
|
||||
rm "$ROOTDIR"/macOS/COPYING
|
||||
mv "$NAME"-new.pkg "$NAME".pkg
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
# Copyright © 2019 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
include versions.mk
|
||||
|
||||
ROOT_PATH = $(realpath .)
|
||||
|
||||
WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error
|
||||
|
||||
.PHONY: all build octave \
|
||||
build build-slicot build-x13as \
|
||||
clean-lib clean-libslicot clean-x13as-bin \
|
||||
clean-src clean-slicot-src clean-x13as-src \
|
||||
clean-tar clean-slicot-tar clean-x13as-tar \
|
||||
clean-all clean-lib clean-src clean-tar
|
||||
|
||||
all: build
|
||||
|
||||
build: build-slicot build-x13as
|
||||
|
||||
clean-lib: clean-libslicot clean-x13as-bin
|
||||
|
||||
clean-src: clean-slicot-src clean-x13as-src
|
||||
|
||||
clean-tar: clean-slicot-tar clean-x13as-tar
|
||||
|
||||
clean-all: clean-lib clean-src clean-tar
|
||||
|
||||
|
||||
#
|
||||
# Slicot
|
||||
#
|
||||
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: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
||||
rm -rf sources64/slicot-*-with-32bit-integer
|
||||
mkdir -p $@
|
||||
tar xf $< --directory $@ --strip-components=1
|
||||
touch $@
|
||||
|
||||
sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
||||
rm -rf sources64/slicot-*-with-64bit-integer
|
||||
mkdir -p $@
|
||||
tar xf $< --directory $@ --strip-components=1
|
||||
touch $@
|
||||
|
||||
sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
||||
rm -rf sources64/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
|
||||
mkdir -p $@
|
||||
tar xf $< --directory $@ --strip-components=1
|
||||
touch $@
|
||||
|
||||
lib64/Slicot/without-underscore/lib/libslicot_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer
|
||||
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g -fno-underscoring" lib
|
||||
strip -S $</libslicot_pic.a
|
||||
mkdir -p $(dir $@)
|
||||
cp $</libslicot_pic.a $@
|
||||
|
||||
lib64/Slicot/without-underscore/lib/libslicot64_pic.a: sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer
|
||||
make -C $< FORTRAN=gfortran LOADER=gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fno-underscoring -fdefault-integer-8" lib
|
||||
strip -S $</libslicot64_pic.a
|
||||
mkdir -p $(dir $@)
|
||||
cp $</libslicot64_pic.a $@
|
||||
|
||||
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
|
||||
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
|
||||
strip -S $</libslicot64_pic.a
|
||||
mkdir -p $(dir $@)
|
||||
cp $</libslicot64_pic.a $@
|
||||
|
||||
build-slicot: lib64/Slicot/without-underscore/lib/libslicot_pic.a \
|
||||
lib64/Slicot/without-underscore/lib/libslicot64_pic.a \
|
||||
lib64/Slicot/with-underscore/lib/libslicot_pic.a \
|
||||
lib64/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
|
||||
rm -rf sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
|
||||
|
||||
clean-libslicot:
|
||||
rm -rf lib64/Slicot
|
||||
|
||||
clean-slicot-all: clean-slicot-src clean-slicot-tar clean-libslicot
|
||||
|
||||
|
||||
|
||||
#
|
||||
# X13AS
|
||||
#
|
||||
tarballs/x13assrc_V$(X13AS_VERSION).tar.gz:
|
||||
mkdir -p tarballs
|
||||
wget $(WGET_OPTIONS) -O $@ https://www.census.gov/ts/x13as/unix/x13assrc_V$(X13AS_VERSION).tar.gz
|
||||
|
||||
sources64/x13as-$(X13AS_VERSION): tarballs/x13assrc_V$(X13AS_VERSION).tar.gz
|
||||
rm -rf sources64/x13as-*
|
||||
mkdir -p $@
|
||||
tar xf $< --directory $@
|
||||
|
||||
lib64/x13as/x13as: sources64/x13as-$(X13AS_VERSION)
|
||||
cd $< && sed -i '' 's/-static//g' makefile.gf
|
||||
make -C $< -f makefile.gf FC=gfortran LINKER=ld FFLAGS="-O2" LDFLAGS="-macosx_version_min 10.14.0 -lSystem $(shell gfortran -print-file-name=libgfortran.a) $(shell gfortran -print-file-name=libquadmath.a) $(shell gfortran -print-libgcc-file-name) $(shell gfortran -print-file-name=libgcc_eh.a)" PROGRAM=x13as
|
||||
strip $</x13as
|
||||
mkdir -p $(dir $@)
|
||||
cp $</x13as $@
|
||||
|
||||
build-x13as: lib64/x13as/x13as
|
||||
|
||||
clean-x13as-tar:
|
||||
rm -f tarballs/x13assrc_V$(X13AS_VERSION).tar.gz
|
||||
|
||||
clean-x13as-src:
|
||||
rm -rf sources64/x13as-$(X13AS_VERSION)
|
||||
|
||||
clean-x13as-bin:
|
||||
rm -rf lib64/x13as
|
||||
|
||||
clean-x13as-all: clean-x13as-tar clean-x13as-src clean-x13as-bin
|
|
@ -0,0 +1,4 @@
|
|||
SLICOT_VERSION = 5.0+20101122
|
||||
X13AS_VERSION = 1.1_B39
|
||||
|
||||
OCTAVE_VERSION = 5.1.0
|
Loading…
Reference in New Issue