Debian Codegraph @

windows/deps/Makefile

raw
1 # Copyright © 2017-2026 Dynare Team
2 #
3 # This file is part of Dynare.
4 #
5 # Dynare is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Dynare is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Dynare. If not, see <https://www.gnu.org/licenses/>.
17
18 include versions.mk
19
20 ROOT_PATH = $(realpath .)
21
22 WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error
23
24 .PHONY: all clean clean-all
25
26 all: sysroot-matlab sysroot-octave gcc x13as src/suitesparse
27
28 # Clean everything except downloaded tarballs
29 clean:
30 rm -rf src octave sysroot-matlab sysroot-octave gcc x13as panua-pardiso
31
32 # Clean everything (including downloaded tarballs)
33 clean-all: clean
34 rm -rf tarballs
35
36 #
37 # Slicot
38 #
39
40 tarballs/slicot-$(SLICOT_VERSION).tar.gz:
41 mkdir -p tarballs
42 wget $(WGET_OPTIONS) -O $@ https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v$(SLICOT_VERSION).tar.gz
43
44 src/slicot-matlab/build/lib/libslicot64.a: tarballs/slicot-$(SLICOT_VERSION).tar.gz
45 rm -rf $(realpath $(dir $@)/../..)
46 mkdir -p $(dir $@)/../..
47 tar xf $< --directory $(dir $@)/../.. --strip-components=1
48 patch -d $(dir $@)/../.. -p1 < slicot-no-blas-lapack-lookup.patch
49 # NB: -fno-underscoring is passed in FFLAGS, and is prepended to CMAKE_Fortran_FLAGS_INIT from the toolchain file.
50 # We don’t put it in that latter variable, so that the toolchain file can be shared with Octave.
51 FFLAGS="-fno-underscoring" cmake -S $(dir $@)/../.. -B $(dir $@)/.. -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/toolchain-mingw64.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DSLICOT_TESTING=OFF -DSLICOT_INTEGER8=ON
52 cmake --build $(dir $@)/.. --verbose
53
54 src/slicot-octave/build/lib/libslicot.a: tarballs/slicot-$(SLICOT_VERSION).tar.gz
55 rm -rf $(realpath $(dir $@)/../..)
56 mkdir -p $(dir $@)/../..
57 tar xf $< --directory $(dir $@)/../.. --strip-components=1
58 patch -d $(dir $@)/../.. -p1 < slicot-no-blas-lapack-lookup.patch
59 cmake -S $(dir $@)/../.. -B $(dir $@)/.. -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/toolchain-mingw64.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DSLICOT_TESTING=OFF -DSLICOT_INTEGER8=OFF
60 cmake --build $(dir $@)/.. --verbose
61
62
63 #
64 # Octave
65 #
66
67 tarballs/octave-${OCTAVE_VERSION}${OCTAVE_W64_BUILD}-w64.7z:
68 mkdir -p $(dir $@)
69 wget $(WGET_OPTIONS) -O $@ https://ftpmirror.gnu.org/gnu/octave/windows/$(notdir $@)
70
71 octave: tarballs/octave-${OCTAVE_VERSION}${OCTAVE_W64_BUILD}-w64.7z
72 rm -rf $@
73 7zr x $< > /dev/null
74 mv octave-${OCTAVE_VERSION}-w64 $@
75 touch $@
76
77 #
78 # MATLAB
79 #
80
81 tarballs/matlab%.tar.xz:
82 mkdir -p $(dir $@)
83 wget $(WGET_OPTIONS) -O [email protected] https://www.dynare.org/pkg-build/$(notdir $@).gpg
84 gpg --output $@ --decrypt [email protected]
85 rm [email protected]
86
87 #
88 # The three root directories:
89 # - for building MATLAB MEX
90 # - for builing Octave MEX
91 # - the embedded GCC compiler (for use_dll)
92 #
93
94 MSYS2_EXCLUDES := --exclude .MTREE --exclude .BUILDINFO --exclude .PKGINFO
95
96 tarballs/mingw-w64-ucrt-x86_64-%-any.pkg.tar.zst:
97 mkdir -p $(dir $@)
98 wget $(WGET_OPTIONS) -O $@ https://www.dynare.org/windows-pkg-build/msys2/7.x/$(notdir $@)
99
100 MATLAB_MSYS2_DEPS := \
101 tarballs/mingw-w64-ucrt-x86_64-boost-$(MSYS2_BOOST_VERSION)-any.pkg.tar.zst
102
103 sysroot-matlab: tarballs/matlab64-$(MATLAB64_VERSION).tar.xz $(MATLAB_MSYS2_DEPS) src/slicot-matlab/build/lib/libslicot64.a panua-pardiso
104 rm -rf $@
105 mkdir $@
106 for f in $(MATLAB_MSYS2_DEPS); do tar xf $$f --directory $@ $(MSYS2_EXCLUDES); done
107 mkdir $@/MATLAB
108 tar xf $< --directory $@/MATLAB/
109 cp src/slicot-matlab/build/lib/libslicot64.a $@/ucrt64/lib/libslicot64_pic.a
110 cp panua-pardiso/lib/libpardiso.dll $@/ucrt64/lib
111 touch $@
112
113 OCTAVE_MSYS2_DEPS := \
114 tarballs/mingw-w64-ucrt-x86_64-boost-$(MSYS2_BOOST_VERSION)-any.pkg.tar.zst
115
116 sysroot-octave: octave $(OCTAVE_MSYS2_DEPS) src/slicot-octave/build/lib/libslicot.a panua-pardiso
117 rm -rf $@
118 mkdir $@
119 for f in $(OCTAVE_MSYS2_DEPS); do tar xf $$f --directory $@ $(MSYS2_EXCLUDES); done
120 cp src/slicot-octave/build/lib/libslicot.a $@/ucrt64/lib/libslicot_pic.a
121 cp -R octave/mingw64/include/octave-* octave/mingw64/include/suitesparse $@/ucrt64/include
122 cp -R octave/mingw64/lib/octave $@/ucrt64/lib
123 cp octave/mingw64/lib/libblas.dll.a octave/mingw64/lib/liblapack.dll.a octave/mingw64/lib/libumfpack.dll.a octave/mingw64/lib/libopenblas.dll.a $@/ucrt64/lib
124 mkdir -p $@/ucrt64/lib/pkgconfig
125 cp octave/mingw64/lib/pkgconfig/UMFPACK.pc octave/mingw64/lib/pkgconfig/AMD.pc octave/mingw64/lib/pkgconfig/SuiteSparse_config.pc octave/mingw64/lib/pkgconfig/openblas.pc $@/ucrt64/lib/pkgconfig
126 cp panua-pardiso/lib/libpardiso.dll $@/ucrt64/lib
127 patch -p0 < octave-pkgconfig.patch
128 touch $@
129
130 GCC_MSYS2_DEPS := \
131 tarballs/mingw-w64-ucrt-x86_64-gcc-$(MSYS2_GCC_VERSION)-any.pkg.tar.zst \
132 tarballs/mingw-w64-ucrt-x86_64-gcc-libs-$(MSYS2_GCC_VERSION)-any.pkg.tar.zst \
133 tarballs/mingw-w64-ucrt-x86_64-gmp-$(MSYS2_GMP_VERSION)-any.pkg.tar.zst \
134 tarballs/mingw-w64-ucrt-x86_64-binutils-$(MSYS2_BINUTILS_VERSION)-any.pkg.tar.zst \
135 tarballs/mingw-w64-ucrt-x86_64-headers-$(MSYS2_HEADERS_VERSION)-any.pkg.tar.zst \
136 tarballs/mingw-w64-ucrt-x86_64-crt-$(MSYS2_CRT_VERSION)-any.pkg.tar.zst \
137 tarballs/mingw-w64-ucrt-x86_64-winpthreads-$(MSYS2_WINPTHREADS_VERSION)-any.pkg.tar.zst \
138 tarballs/mingw-w64-ucrt-x86_64-libwinpthread-$(MSYS2_WINPTHREADS_VERSION)-any.pkg.tar.zst \
139 tarballs/mingw-w64-ucrt-x86_64-zlib-$(MSYS2_ZLIB_VERSION)-any.pkg.tar.zst \
140 tarballs/mingw-w64-ucrt-x86_64-zstd-$(MSYS2_ZSTD_VERSION)-any.pkg.tar.zst \
141 tarballs/mingw-w64-ucrt-x86_64-isl-$(MSYS2_ISL_VERSION)-any.pkg.tar.zst \
142 tarballs/mingw-w64-ucrt-x86_64-mpc-$(MSYS2_MPC_VERSION)-any.pkg.tar.zst \
143 tarballs/mingw-w64-ucrt-x86_64-mpfr-$(MSYS2_MPFR_VERSION)-any.pkg.tar.zst \
144 tarballs/mingw-w64-ucrt-x86_64-libiconv-$(MSYS2_LIBICONV_VERSION)-any.pkg.tar.zst \
145 tarballs/mingw-w64-ucrt-x86_64-windows-default-manifest-$(MSYS2_WINDOWS_DEFAULT_MANIFEST_VERSION)-any.pkg.tar.zst \
146 tarballs/mingw-w64-ucrt-x86_64-gettext-runtime-$(MSYS2_GETTEXT_RUNTIME_VERSION)-any.pkg.tar.zst
147
148 gcc: $(GCC_MSYS2_DEPS)
149 rm -rf $@
150 mkdir $@
151 for f in $(GCC_MSYS2_DEPS); do tar xf $$f --directory $@ $(MSYS2_EXCLUDES); done
152 touch $@
153
154 #
155 # X13AS
156 #
157
158 tarballs/x13as_ascii-v$(X13AS_VERSION).zip:
159 mkdir -p $(dir $@)
160 wget $(WGET_OPTIONS) -O $@ https://www.dynare.org/pkg-build/x13as/windows/$(notdir $@)
161
162 x13as: tarballs/x13as_ascii-v$(X13AS_VERSION).zip
163 rm -rf $@
164 unzip -o $<
165 mv $@/x13as_ascii.exe $@/x13as.exe
166 touch $@
167
168 #
169 # Panua PARDISO
170 #
171
172 tarballs/panua-pardiso-%-win.zip:
173 mkdir -p $(dir $@)
174 wget $(WGET_OPTIONS) -O [email protected] https://www.dynare.org/pkg-build/$(notdir $@).gpg
175 gpg --output $@ --decrypt [email protected]
176 rm [email protected]
177
178 panua-pardiso: tarballs/panua-pardiso-$(PANUA_PARDISO_VERSION)-win.zip
179 rm -rf $@
180 unzip -o $<
181 mv $(basename $(notdir $<)) $@
182 touch $@
183
184 #
185 # SuiteSparse
186 #
187
188 tarballs/SuiteSparse-$(SUITESPARSE_VERSION).tar.gz:
189 wget $(WGET_OPTIONS) -O $@ https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v$(SUITESPARSE_VERSION).tar.gz
190
191 src/suitesparse: tarballs/SuiteSparse-$(SUITESPARSE_VERSION).tar.gz
192 rm -rf $@
193 mkdir -p $@
194 tar xf $< --directory $@ --strip-components=1
195 touch $@