Add scripts and CI job for building Windows package

The scripts are based the former “dynare-build” project. They have been
overhauled and simplified.

Building a Windows package (both installer and zip archive) is as easy as
running “make -C windows” (provided the right Debian packages are installed,
use the “windows/install-packages.sh” script for that purpose).

The layout of MEX files for Octave in the package has been
changed (mex/octave/win32/ and mex/octave/win64/ instead of mex/octave32/ and
mex/octave/), for consistency with MATLAB MEX.
parent 33f19d35
......@@ -124,6 +124,8 @@ doc/internals/ltxpng
# Windows
/windows/dynare-version.nsi
!/windows/Makefile
!/windows/deps/Makefile
# MacOS stuff
.DS_Store
......
......@@ -2,6 +2,11 @@ variables:
GIT_SUBMODULE_STRATEGY: normal
TERM: linux
stages:
- build
- test_and_pkg
- deploy
build_binaries:
stage: build
script:
......@@ -36,10 +41,34 @@ build_doc:
artifacts:
paths:
- doc/manual/build/
- doc/*.pdf
- doc/*/*.pdf
- dynare++/doc/*.pdf
- preprocessor/doc/*/*.pdf
expire_in: 1 week
pkg_windows:
stage: test_and_pkg
script:
- ln -s ~/tarballs windows/deps/
- make -C windows
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- windows/deps/sources32/
- windows/deps/sources64/
- windows/deps/lib32/
- windows/deps/lib64/
artifacts:
paths:
- windows/exe/*
- windows/zip/*
expire_in: 1 week
dependencies:
- build_doc
.test_matlab_template:
stage: test
stage: test_and_pkg
artifacts:
paths:
- tests/*.m.log
......@@ -73,7 +102,7 @@ test_old_matlab:
when: manual
test_octave:
stage: test
stage: test_and_pkg
variables:
OPENBLAS_NUM_THREADS: 1
script:
......@@ -97,7 +126,7 @@ test_octave:
when: manual
test_dynare++:
stage: test
stage: test_and_pkg
script:
- autoreconf -si
- ./configure --disable-matlab --disable-octave
......
......@@ -33,16 +33,16 @@ EXTRA_DIST = \
scripts \
.dir-locals.el
all-local: preprocessor/src/dynare_m
if file preprocessor/src/dynare_m | grep -q x86.64; then \
all-local: preprocessor/src/dynare_m$(EXEEXT)
if file preprocessor/src/dynare_m$(EXEEXT) | grep -q x86.64; then \
ARCH="64"; \
else \
ARCH="32"; \
fi; \
mkdir -p $(abs_srcdir)/matlab/preprocessor$$ARCH && \
$(LN_S) -f $(abs_srcdir)/preprocessor/src/dynare_m $(abs_srcdir)/matlab/preprocessor$$ARCH && \
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/matlab/preprocessor$$ARCH && \
mkdir -p $(abs_srcdir)/julia/preprocessor$$ARCH && \
$(LN_S) -f $(abs_srcdir)/preprocessor/src/dynare_m $(abs_srcdir)/julia/preprocessor$$ARCH
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/julia/preprocessor$$ARCH
dist-hook:
rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
......
......@@ -119,7 +119,6 @@ AC_CONFIG_FILES([Makefile
doc/dseries-and-reporting/Makefile
tests/Makefile
matlab/dynare_version.m
windows/dynare-version.nsi
dynare++/Makefile
dynare++/parser/cc/Makefile
dynare++/sylv/Makefile
......
......@@ -57,7 +57,7 @@ case ${MATLAB_ARCH} in
# against libwinpthread DLL (which is pulled in by libstdc++, even without
# using threads, since we are using the POSIX threads version of MinGW)
MATLAB_LDFLAGS_NOMAP="-static-libgcc -static-libstdc++ -shared -L$MATLAB/bin/${MATLAB_ARCH} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,-Bdynamic,--no-whole-archive"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP $(pwd)/$srcdir/mex.def"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP \$(abs_top_srcdir)/mex.def"
MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack -lmwblas"
ax_mexopts_ok="yes"
;;
......@@ -68,7 +68,7 @@ case ${MATLAB_ARCH} in
MATLAB_CXXFLAGS="$MATLAB_CFLAGS"
MATLAB_FFLAGS="-fexceptions -fbackslash -arch x86_64"
MATLAB_LDFLAGS_NOMAP="-Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -bundle"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,-exported_symbols_list,$(pwd)/$srcdir/mexFunction-MacOSX.map"
MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,-exported_symbols_list,\$(abs_top_srcdir)/mexFunction-MacOSX.map"
MATLAB_LIBS="-L$MATLAB/bin/maci64 -lmx -lmex -lmat -lmwlapack -lmwblas"
ax_mexopts_ok="yes"
;;
......
function mexpath = add_path_to_mex_files(dynareroot, modifypath)
% Copyright (C) 2015-2017 Dynare Team
% Copyright (C) 2015-2019 Dynare Team
%
% This file is part of Dynare.
%
......@@ -22,13 +22,34 @@ if nargin<2
end
if isoctave
if ispc() && strcmpi(computer(), 'i686-w64-mingw32')
mexpath = {[dynareroot '../mex/octave32/']};
% Add specific paths for Dynare Windows package
if ispc
if strcmpi(computer(), 'i686-w64-mingw32')
tmp = [dynareroot '../mex/octave/win32/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
addpath(mexpath);
end
end
else
tmp = [dynareroot '../mex/octave/win64/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
addpath(mexpath);
end
end
end
end
% Add generic MATLAB path (with higher priority than the previous ones)
if exist('mexpath')
mexpath = { mexpath; [dynareroot '../mex/octave/'] };
else
mexpath = {[dynareroot '../mex/octave/']};
mexpath = { [dynareroot '../mex/octave/'] };
end
if modifypath
addpath(mexpath{1});
addpath([dynareroot '../mex/octave/']);
end
else
% Add win32 specific paths for Dynare Windows package
......
......@@ -16,7 +16,7 @@ all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../matlab
cd $(top_srcdir)/../../matlab && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_srcdir)/$$p $$p; \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done
clean-local:
......
......@@ -23,7 +23,7 @@ all-local: $(PROGRAMS)
$(MKDIR_P) $(top_srcdir)/../../octave
cd $(top_srcdir)/../../octave && \
for p in $(PROGRAMS); do \
$(LN_S) -f $(abs_srcdir)/$$p $$p; \
$(LN_S) -f $(abs_builddir)/$$p $$p; \
done
clean-local:
......
# Copyright © 2017-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/>.
.PHONY: all deps clean-deps clean clean-all install build
NTHREADS=$(shell nproc)
all: build
deps:
make -C deps -j$(NTHREADS)
clean-deps:
make -C deps clean-all
clean:
rm -rf exe/ zip/
clean-all: clean-deps clean
install:
./install-packages.sh
build: deps
./build.sh
#!/bin/bash
# Produces Windows packages of Dynare (Windows installer and zip archive).
#
# The binaries are cross compiled for Windows (32/64bits), Octave and MATLAB
# (all supported versions).
# Copyright © 2017-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/>.
# Exit on first error and print commands as they are executed
set -ex
# Set root directory
ROOT_DIRECTORY=$(dirname "$(readlink -f "$0")")
# Create TMP folder and make sure it is deleted upon exit
TMP_DIRECTORY=$(mktemp -d)
cleanup()
{
[[ -z $TMP_DIRECTORY ]] || rm -rf -- "$TMP_DIRECTORY"
}
trap cleanup EXIT
# Set the number of threads
NTHREADS=$(nproc)
# Set Dynare version
if [[ -n $CI_COMMIT_TAG ]]; then
# Official release tagged through Gitlab
VERSION=$CI_COMMIT_TAG
VERSION_SHORT=$VERSION
else
VERSION=$(grep '^AC_INIT(' ../configure.ac | sed 's/AC_INIT(\[dynare\], \[\(.*\)\])/\1/')
if [[ -n $CI_COMMIT_SHA ]]; then
VERSION_SHORT=$VERSION-$CI_COMMIT_SHORT_SHA
VERSION=$VERSION-$CI_COMMIT_SHA
elif [[ -d ../.git/ ]]; then
VERSION_SHORT=$VERSION-$(git rev-parse --short HEAD)
VERSION=$VERSION-$(git rev-parse HEAD)
else
VERSION_SHORT=$VERSION
fi
fi
BASENAME=dynare-$VERSION_SHORT
# Set directories for dependencies
LIB32="$ROOT_DIRECTORY"/deps/lib32
LIB64="$ROOT_DIRECTORY"/deps/lib64
# Go to source root directory
cd ..
# Autoreconf if needed
[[ -f configure ]] || autoreconf -si
## Compile preprocessor (32-bit), Dynare++ (32-bit) and documentation
./configure --host=i686-w64-mingw32 \
--with-boost="$LIB32"/Boost \
--with-blas="$LIB32"/OpenBLAS/libopenblas.a \
--with-lapack="$LIB32"/OpenBLAS/libopenblas.a \
--with-matio="$LIB32"/matIO \
--disable-octave \
--disable-matlab \
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
make -j"$NTHREADS" pdf html
fi
make -j"$NTHREADS"
i686-w64-mingw32-strip matlab/preprocessor32/dynare_m.exe
i686-w64-mingw32-strip dynare++/src/dynare++.exe
## Compile 64-bit preprocessor
cd preprocessor
make -C src clean # We don't want to clean the doc
./configure --host=x86_64-w64-mingw32 \
--with-boost="$LIB64"/Boost \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS"
x86_64-w64-mingw32-strip src/dynare_m.exe
mkdir -p ../matlab/preprocessor64
mv src/dynare_m.exe ../matlab/preprocessor64
## Define functions for building MEX files
## Note that we do out-of-tree compilation, since we want to do these in
## parallel
# Create Windows 32-bit DLL binaries for MATLAB ≥ R2009b
build_windows_matlab_mex_32 ()
{
mkdir -p "$TMP_DIRECTORY"/matlab-win32/
cd "$TMP_DIRECTORY"/matlab-win32/
"$ROOT_DIRECTORY"/../mex/build/matlab/configure \
--host=i686-w64-mingw32 \
--with-gsl="$LIB32"/Gsl \
--with-matio="$LIB32"/matIO \
--with-slicot="$LIB32"/Slicot/without-underscore \
--with-matlab="$LIB32"/matlab/R2009b \
MATLAB_VERSION=R2009b \
MEXEXT=mexw32 \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS" all
i686-w64-mingw32-strip -- **/*.mexw32
mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win32-7.9-8.6
mv -- **/*.mexw32 "$ROOT_DIRECTORY"/../mex/matlab/win32-7.9-8.6
}
# Create Windows 64-bit DLL binaries for MATLAB ≥ R2009b and ≤ R2017b
build_windows_matlab_mex_64_a ()
{
mkdir -p "$TMP_DIRECTORY"/matlab-win64-a/
cd "$TMP_DIRECTORY"/matlab-win64-a/
"$ROOT_DIRECTORY"/../mex/build/matlab/configure \
--host=x86_64-w64-mingw32 \
--with-gsl="$LIB64"/Gsl \
--with-matio="$LIB64"/matIO \
--with-slicot="$LIB64"/Slicot/without-underscore \
--with-matlab="$LIB64"/matlab/R2009b \
MATLAB_VERSION=R2009b \
MEXEXT=mexw64 \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS" all
x86_64-w64-mingw32-strip -- **/*.mexw64
mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-7.9-9.3
mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-7.9-9.3
}
# Create Windows 64-bit DLL binaries for MATLAB ≥ R2018a
build_windows_matlab_mex_64_b ()
{
mkdir -p "$TMP_DIRECTORY"/matlab-win64-b/
cd "$TMP_DIRECTORY"/matlab-win64-b/
"$ROOT_DIRECTORY"/../mex/build/matlab/configure \
--host=x86_64-w64-mingw32 \
--with-gsl="$LIB64"/Gsl \
--with-matio="$LIB64"/matIO \
--with-slicot="$LIB64"/Slicot/without-underscore \
--with-matlab="$LIB64"/matlab/R2018a \
MATLAB_VERSION=R2018a \
MEXEXT=mexw64 \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS" all
x86_64-w64-mingw32-strip -- **/*.mexw64
mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.6
mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.6
}
# Create Windows DLL binaries for Octave/MinGW (32bit)
build_windows_octave_mex_32 ()
{
mkdir -p "$TMP_DIRECTORY"/octave-32/
cd "$TMP_DIRECTORY"/octave-32/
"$ROOT_DIRECTORY"/../mex/build/octave/configure \
--host=i686-w64-mingw32 \
--with-gsl="$LIB32"/Gsl \
--with-matio="$LIB32"/matIO \
--with-slicot="$LIB32"/Slicot/with-underscore \
MKOCTFILE="$ROOT_DIRECTORY"/deps/mkoctfile32 \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS" all
i686-w64-mingw32-strip -- **/*.mex
mkdir -p "$ROOT_DIRECTORY"/../mex/octave/win32
mv -- **/*.mex "$ROOT_DIRECTORY"/../mex/octave/win32
}
# Create Windows DLL binaries for Octave/MinGW (64bit)
build_windows_octave_mex_64 ()
{
mkdir -p "$TMP_DIRECTORY"/octave-64/
cd "$TMP_DIRECTORY"/octave-64/
"$ROOT_DIRECTORY"/../mex/build/octave/configure \
--host=x86_64-w64-mingw32 \
--with-gsl="$LIB64"/Gsl \
--with-matio="$LIB64"/matIO \
--with-slicot="$LIB64"/Slicot/with-underscore \
MKOCTFILE="$ROOT_DIRECTORY"/deps/mkoctfile64 \
PACKAGE_VERSION="$VERSION" \
PACKAGE_STRING="dynare $VERSION"
make -j"$NTHREADS" all
x86_64-w64-mingw32-strip -- **/*.mex
mkdir -p "$ROOT_DIRECTORY"/../mex/octave/win64
mv -- **/*.mex "$ROOT_DIRECTORY"/../mex/octave/win64
}
## Actually build the MEX files
TASKS=(build_windows_matlab_mex_32 build_windows_matlab_mex_64_a build_windows_matlab_mex_64_b build_windows_octave_mex_32 build_windows_octave_mex_64)
# Reset the number of threads. The mex files for MATLAB/Octave (32-bit and 64-bit) will be built
# in parallel, so we need to account for the number of tasks and lower the value of NTHREADS.
NTHREADS=$((NTHREADS/${#TASKS[@]}))
[[ $NTHREADS -ge 1 ]] || NTHREADS=1 # Ensure that there is at least 1 thread
# Build all the mex files (parallel).
# Some variables and functions need to be available in subshells.
cd "$ROOT_DIRECTORY"
export TMP_DIRECTORY ROOT_DIRECTORY LIB32 LIB64 VERSION NTHREADS
export -f "${TASKS[@]}"
parallel "set -ex;shopt -s globstar;" ::: "${TASKS[@]}"
# Clean up bogus symlinks left by parallel builds of MEX
rm -f ../mex/matlab/*.mexw32 ../mex/matlab/*.mexw64 ../mex/octave/*.mex
# Add supported_octave_version.m (see matlab/dynare.m)
while read -r line
do
if [[ "$line" =~ OCTAVE_VERSION[[:space:]]*=[[:space:]]*([^[:space:]]+) ]]; then
OCTAVE_VERSION=${BASH_REMATCH[1]}
break
fi
done < "$ROOT_DIRECTORY"/deps/versions.mk
[[ -n $OCTAVE_VERSION ]] || { echo "Can't find OCTAVE_VERSION in versions.mk" >&2; exit 1; }
# shellcheck disable=SC1117
echo -e "function v = supported_octave_version\nv=\"${OCTAVE_VERSION}\";\nend" > ../matlab/supported_octave_version.m
## Create Windows installer
makensis -DVERSION="$VERSION" dynare.nsi
mkdir -p exe
mv dynare-"$VERSION"-win.exe "$ROOT_DIRECTORY"/exe/"$BASENAME"-win.exe
## Create .zip file (for those people that are not allowed to download/execute the installer)
# Set name of the root directory in the ZIP archive
ZIPNAME=dynare-$VERSION
ZIPDIR="$TMP_DIRECTORY"/"$ZIPNAME"
mkdir -p "$ZIPDIR"
cd ..
cp -p NEWS "$ZIPDIR"
cp -p VERSION "$ZIPDIR"
cp -p license.txt "$ZIPDIR"
cp -p windows/README.txt "$ZIPDIR"
cp -pr windows/deps/mingw32 "$ZIPDIR"
cp -pr windows/deps/mingw64 "$ZIPDIR"
mkdir -p "$ZIPDIR"/contrib/ms-sbvar/TZcode
cp -pr contrib/ms-sbvar/TZcode/MatlabFiles "$ZIPDIR"/contrib/ms-sbvar/TZcode
mkdir -p "$ZIPDIR"/contrib/jsonlab
cp -pr contrib/jsonlab/* "$ZIPDIR"/contrib/jsonlab
mkdir "$ZIPDIR"/mex
cp -pr mex/octave/ "$ZIPDIR"/mex
cp -pr mex/matlab/ "$ZIPDIR"/mex
cp -pr matlab "$ZIPDIR"
cp -pr examples "$ZIPDIR"
cp -pr scripts "$ZIPDIR"
mkdir "$ZIPDIR"/dynare++
cp -p dynare++/src/dynare++.exe "$ZIPDIR"/dynare++
mkdir -p "$ZIPDIR"/doc/dynare++
mkdir -p "$ZIPDIR"/doc/dynare-manual.html
cp -pr doc/manual/build/html/* "$ZIPDIR"/doc/dynare-manual.html
cp -p doc/*.pdf "$ZIPDIR"/doc
cp -p doc/manual/build/latex/dynare-manual.pdf "$ZIPDIR"/doc
cp -p preprocessor/doc/macroprocessor/macroprocessor.pdf "$ZIPDIR"/doc
cp -p doc/parallel/parallel.pdf "$ZIPDIR"/doc
cp -p preprocessor/doc/preprocessor/preprocessor.pdf "$ZIPDIR"/doc
cp -p doc/gsa/gsa.pdf "$ZIPDIR"/doc
cp -p dynare++/doc/*.pdf "$ZIPDIR"/doc/dynare++
mkdir -p "$ROOT_DIRECTORY"/zip
cd "$TMP_DIRECTORY"
zip -9 -r "$ROOT_DIRECTORY"/zip/"$BASENAME"-win.zip "$ZIPNAME"
# Copyright © 2017-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: clean-openblas-src clean-openblas-tar clean-openblas-all clean-libopenblas \
clean-boost-src clean-boost-tar clean-boost-all clean-libboost \
clean-gsl-src clean-gsl-tar clean-gsl-all clean-libgsl\
clean-slicot-src clean-slicot-tar clean-slicot-all clean-libslicot \
clean-matio-src clean-matio-tar clean-matio-all clean-libmatio\
clean-zlib-src clean-zlib-tar clean-zlib-src clean-libzlib\
clean-src clean-all clean-lib clean-tar \
build build-openblas build-slicot build-matio build-boost build-gsl \
octave matlab mingw
all: build octave matlab mingw
build: build-openblas build-slicot build-matio build-boost build-gsl
clean-lib: clean-libopenblas clean-libgsl clean-libzlib clean-libmatio clean-libslicot clean-libboost clean-matlab clean-octave clean-mingw
clean-src: clean-openblas-src clean-boost-src clean-gsl-src clean-matio-src clean-slicot-src clean-zlib-src
clean-tar: clean-openblas-tar clean-boost-tar clean-gsl-tar clean-matio-tar clean-slicot-tar clean-zlib-tar
clean-all: clean-lib clean-src clean-tar
#
# OpenBLAS library
#
tarballs/openblas-${OPENBLAS_VERSION}.tar.gz:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://github.com/xianyi/OpenBLAS/archive/v${OPENBLAS_VERSION}.tar.gz
sources32/OpenBLAS-${OPENBLAS_VERSION}: tarballs/openblas-${OPENBLAS_VERSION}.tar.gz
mkdir -p sources32
tar xf $< --directory sources32
patch $@/Makefile.rule < patches/openblas-w32.patch
sources64/OpenBLAS-${OPENBLAS_VERSION}: tarballs/openblas-${OPENBLAS_VERSION}.tar.gz
mkdir -p sources64
tar xf $< --directory sources64
patch $@/Makefile.rule < patches/openblas-w64.patch
lib32/OpenBLAS/libopenblas.a: sources32/OpenBLAS-${OPENBLAS_VERSION}
make -C $<
i686-w64-mingw32-strip --strip-debug $</libopenblasp-r${OPENBLAS_VERSION}.a
mkdir -p $(dir $@)
cp $</libopenblasp-r${OPENBLAS_VERSION}.a $@
lib64/OpenBLAS/libopenblas.a: sources64/OpenBLAS-${OPENBLAS_VERSION}
make -C $<
x86_64-w64-mingw32-strip --strip-debug $</libopenblasp-r${OPENBLAS_VERSION}.a
mkdir -p $(dir $@)
cp $</libopenblasp-r${OPENBLAS_VERSION}.a $@
build-openblas: lib32/OpenBLAS/libopenblas.a lib64/OpenBLAS/libopenblas.a
clean-openblas-tar:
rm -f tarballs/openblas-${OPENBLAS_VERSION}.tar.gz
clean-openblas-src:
rm -rf sources32/OpenBLAS-${OPENBLAS_VERSION}
rm -rf sources64/OpenBLAS-${OPENBLAS_VERSION}
clean-libopenblas:
rm -rf lib32/OpenBLAS
rm -rf lib64/OpenBLAS
clean-openblas-all: clean-openblas-src clean-openblas-tar clean-libopenblas
#
# Boost library
#
tarballs/boost_${BOOST_VERSION}.tar.bz2:
mkdir -p tarballs
wget $(WGET_OPTIONS) -O $@ https://dl.bintray.com/boostorg/release/$(subst _,.,${BOOST_VERSION})/source/$(notdir $@)
sources32/boost_${BOOST_VERSION}: tarballs/boost_${BOOST_VERSION}.tar.bz2
mkdir -p sources32
tar xf $< --directory sources32
echo "using gcc : mingw : i686-w64-mingw32-g++ ;" > $@/user-config.jam
sources64/boost_${BOOST_VERSION}: tarballs/boost_${BOOST_VERSION}.tar.bz2
mkdir -p sources64
tar xf $< --directory sources64
echo "using gcc : mingw : x86_64-w64-mingw32-g++ ;" > $@/user-config.jam
lib32/Boost: sources32/boost_${BOOST_VERSION}
rm -rf lib32/Boost
cd $< && ./bootstrap.sh --with-libraries=system,filesystem --prefix=${ROOT_PATH}/lib32/Boost && ./b2 -a -q --user-config=user-config.jam toolset=gcc-mingw target-os=windows address-model=32 variant=release install
lib64/Boost: sources64/boost_${BOOST_VERSION}