fix build

This commit is contained in:
sukanka 2024-06-22 01:22:10 +08:00
parent e992f229c5
commit ca733a258c
3 changed files with 67 additions and 35 deletions

View file

@ -4,42 +4,58 @@
pkgname='stanc'
pkgdesc="A package for obtaining Bayesian inference using the No-U-Turn sampler, a variant of Hamiltonian Monte Carlo."
pkgver=2.35.0
_mathver=4.9.0
pkgrel=1
arch=('i686' 'x86_64' 'aarch64')
url='https://mc-stan.org/'
license=('BSD')
depends=('gcc-libs')
makedepends=('texlive-bin' 'texlive-core' 'doxygen'
# needed if compile against system library
'gtest' 'benchmark' 'sundials' 'boost' 'eigen' 'stanmath'
'python-cpplint' 'opencl-headers' 'rapidjson'
'cli11' 'tbb'
'inetutils'
makedepends=(
# needed if compile against system library
'sundials'
'eigen'
'rapidjson'
'boost'
'cli11'
'tbb'
# needed when making doc
'doxygen'
)
provides=("cmdstan")
source=("stanc-${pkgver}.tar.gz::https://github.com/stan-dev/cmdstan/archive/refs/tags/v${pkgver}.tar.gz"
"stan-${pkgver}.tar.gz::https://github.com/stan-dev/stan/archive/refs/tags/v${pkgver}.tar.gz"
local
cli11.patch
"stan-${pkgver}.tar.gz::https://github.com/stan-dev/stan/archive/refs/tags/v${pkgver}.tar.gz"
"stanmath-${_mathver}.tar.gz::https://github.com/stan-dev/math/archive/refs/tags/v${_mathver}.tar.gz"
cli11.patch
local
)
sha512sums=('6d4305abcab29bb352530795f32f9a85d6f85dc9373059ea14782272f6ac92dd13cfcb1f13f6af79514d51566c1e7bb64d62ff58d26118d62c53c2df1f3c41d8'
'36a6694c7fbebb3e7bb659ba754ae7a95703750a23b6ec1a0130cf39d251bae68662da74dd21e687bb81d9d2881cdbc5688973af103ae7fcf769f2c0aeb4eec3'
'83d164dc8ac6f53980874ee2654dc5a88610ec58763624534cdd169cec0e1639875a2eb470bbf00c4ad5073dc37aea070f87c137c8f080d817fd0983f262acd6'
'fff32eedf0f2044c3ffdd0e6e83927d1b6b535f7d2f960ff20a2f6e84b5b825ec90ea3db5c7bd5cf67f6b2079fe1a7fac2529d5379af931175cefac44681700b')
'36a6694c7fbebb3e7bb659ba754ae7a95703750a23b6ec1a0130cf39d251bae68662da74dd21e687bb81d9d2881cdbc5688973af103ae7fcf769f2c0aeb4eec3'
'43749bbf7504821b56638db56063e4da62a019b93216609c9f6b8e024ba8037a861eb8224dabe46a403e0938df01a97d731158dfb50c5ef8c8096507a4068c8a'
'c9ad30e8dcb9264315c7078f8f4495417e6937b0207b043776e1fab2acd10704d5518ae04aa535827d17178311014bbe1555692aec0833b7c039e9af1e6c5ad5'
'SKIP'
)
prepare(){
prepare() {
cp -rf "${srcdir}/stan-${pkgver/_/-}"/* "${srcdir}/cmdstan-${pkgver/_/-}/stan/"
sed -i "${srcdir}/math-${_mathver/_/-}"/stan/math/rev/functor/kinsol_data.hpp \
-e "s|sundials_context.h>|sundials_context.hpp>|"
sed -i "${srcdir}/math-${_mathver/_/-}"/stan/math/rev/functor/cvodes_integrator{,_adjoint}.hpp \
-e "s|realtype|sunrealtype|g"
sed -i "${srcdir}/math-${_mathver/_/-}"/stan/math/rev/functor/idas_service.hpp \
-e "s|RCONST|SUN_RCONST|g"
cd "${srcdir}/cmdstan-${pkgver/_/-}"
patch --strip=1 < ../cli11.patch
patch --strip=1 <${srcdir}/cli11.patch
cp -rf "${srcdir}/math-${_mathver/_/-}"/* stan/lib/stan_math
cp ${srcdir}/local make/local
cp ${srcdir}/local stan/make/local
sed -i 's|CLI11/CLI11.hpp|CLI/CLI.hpp|g' src/cmdstan/stansummary.cpp
}
build() {
cd "${srcdir}/cmdstan-${pkgver/_/-}"
export LDFLAGS="-ltbb"
export CXXFLAGS="-fPIC -Isrc -Istan/src -I/usr/include/eigen3 -D_REENTRANT -DTBB_INTERFACE_NEW"
make build
cd stan
make doxygen
}
package() {
@ -47,15 +63,18 @@ package() {
# Stan's makefile doesn't have a make install command...
# Install binaries:
install -dm755 "${pkgdir}/usr/bin"
install -m755 bin/stanc "${pkgdir}/usr/bin"
ln -s /usr/bin/stanc "${pkgdir}/usr/bin/cmdstan"
install -Tm755 bin/diagnose "${pkgdir}/usr/bin/standiagnose"
install -Tm755 bin/print "${pkgdir}/usr/bin/stanprint"
install -Tm755 bin/stansummary "${pkgdir}/usr/bin/stansummary"
install -dm755 "${pkgdir}/usr/bin"
install -m755 bin/stanc "${pkgdir}/usr/bin"
ln -s /usr/bin/stanc "${pkgdir}/usr/bin/cmdstan"
install -Tm755 bin/diagnose "${pkgdir}/usr/bin/standiagnose"
install -Tm755 bin/print "${pkgdir}/usr/bin/stanprint"
install -Tm755 bin/stansummary "${pkgdir}/usr/bin/stansummary"
install -d ${pkgdir}/usr/share/doc
install -d "${pkgdir}/usr/include/stan"
install -d "${pkgdir}/usr/include/cmdstan"
cp -rf stan/doc ${pkgdir}/usr/share/doc/stan
install -d "${pkgdir}/usr/include/stan"
install -d "${pkgdir}/usr/include/cmdstan"
cd "stan/src"
find . -iregex './stan.*.hpp$' -type f -exec install -DTm644 "{}" "${pkgdir}/usr/include/{}" \;
cd ../..
@ -64,6 +83,6 @@ package() {
cd ..
# Install LICENSE file:
install -dm755 "${pkgdir}/usr/share/licenses/stan"
install -dm755 "${pkgdir}/usr/share/licenses/stan"
cp -r "stan/licenses/." "${pkgdir}/usr/share/licenses/stan/."
}

View file

@ -1,9 +1,9 @@
diff --git a/src/cmdstan/stansummary.cpp b/src/cmdstan/stansummary.cpp
index eec4f5b2..a5e0b475 100644
index a0cf2b1..e51b8f8 100644
--- a/src/cmdstan/stansummary.cpp
+++ b/src/cmdstan/stansummary.cpp
@@ -52,18 +52,21 @@ Options:
std::vector<std::string> filenames;
@@ -57,21 +57,23 @@ Options:
std::vector<std::string> requested_params_vec;
CLI::App app{"Allowed options"};
- app.add_option("--sig_figs,-s", sig_figs, "Significant figures, default 2.",
@ -23,9 +23,22 @@ index eec4f5b2..a5e0b475 100644
->check(CLI::NonexistentPath);
- app.add_option("--percentiles,-p", percentiles_spec, "Percentiles to report.",
- true);
- app.add_option("input_files", filenames, "Sampler csv files.", true)
+ app.add_option("--percentiles,-p", percentiles_spec, "Percentiles to report.")
+ ->capture_default_str();
app.add_option("--include_param,-i", requested_params_vec,
"Include the named parameter in the output. By default all "
- "are included.",
- true)
+ "are included.")
+ ->capture_default_str()
->transform([](auto str) {
// allow both 'theta.1' and 'theta[1]' style.
std::string token(str);
@@ -79,7 +81,8 @@ Options:
return token;
})
->take_all();
- app.add_option("input_files", filenames, "Sampler csv files.", true)
+ app.add_option("input_files", filenames, "Sampler csv files.")
+ ->capture_default_str()
->required()

12
local
View file

@ -1,11 +1,11 @@
MATH = /usr/include/stan/
BOOST = /usr/include/boost
#MATH = /usr/include/stan/
BOOST = /usr/include
EIGEN = /usr/include/eigen3
OPENCL = /usr/include/CL
TBB = /usr/include/
SUNDIALS = /usr/include/sundials
BENCHMARK = /usr/include/benchmark
GTEST = /usr/include/gtest
CPPLINT = /usr/lib/python3.11/site-packages/
RAPIDJSON = /usr/include/rapidjson/
CLI11 = /usr/include/
SUNDIALS_TARGETS =
TBB_INC = /usr/include
TBB_LIB = /usr/lib
CXXFLAGS+=-fPIC -DTBB_INTERFACE_NEW