Date: Thu, 22 Apr 2021 22:16:48 GMT From: Yuri Victorovich <yuri@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: c4254019d8e8 - main - science/mbdyn: Unbreak build by properly implementing get_nprocs() for FreeBSD. Message-ID: <202104222216.13MMGmgt078397@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=c4254019d8e8aa636db96bcea5702e0a39880048 commit c4254019d8e8aa636db96bcea5702e0a39880048 Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2021-04-22 22:12:26 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2021-04-22 22:16:46 +0000 science/mbdyn: Unbreak build by properly implementing get_nprocs() for FreeBSD. It looks like it was only built for one CPU before and didn't fail. Some change in the underlying libraries triggered the build to become multi-CPU and it began failing because get_nprocs() wasn't available for FreeBSD and also was't properly linked to the surrounding code. Reported by: fallout --- science/mbdyn/Makefile | 9 +++-- .../files/patch-libraries_libobjs_get__nprocs.c | 39 ++++++++++++++++++++++ science/mbdyn/files/patch-mbdyn_base_invsolver.cc | 11 ++++++ science/mbdyn/files/patch-mbdyn_base_readlinsol.cc | 11 ++++++ science/mbdyn/files/patch-mbdyn_base_rtsolver.cc | 11 ++++++ science/mbdyn/files/patch-mbdyn_base_solver.cc | 10 ++++++ science/mbdyn/pkg-descr | 2 +- 7 files changed, 89 insertions(+), 4 deletions(-) diff --git a/science/mbdyn/Makefile b/science/mbdyn/Makefile index 006b0d124aa3..cd6b63780a8c 100644 --- a/science/mbdyn/Makefile +++ b/science/mbdyn/Makefile @@ -1,8 +1,8 @@ # Created by: Kay Lehmann <kay_lehmann@web.de> PORTNAME= mbdyn -PORTVERSION= 1.7.3 -PORTREVISION= 1 +DISTVERSION= 1.7.3 +PORTREVISION= 3 CATEGORIES= science MASTER_SITES= https://www.mbdyn.org/userfiles/downloads/ @@ -20,12 +20,15 @@ LIB_DEPENDS= libltdl.so:devel/libltdl \ libarpack.so:math/arpack-ng \ libumfpack.so:math/suitesparse -GNU_CONFIGURE= yes USES= compiler:c++11-lib fortran gmake libtool:build localbase USE_LDCONFIG= yes + CPPFLAGS+= -fpermissive -I${LOCALBASE}/include/suitesparse + +GNU_CONFIGURE= yes CONFIGURE_ARGS= --program-prefix='' --enable-multithread --with-mpi=no \ --with-ginac=no + INSTALL_TARGET= install-strip OPTIONS_DEFINE= METIS CHACO diff --git a/science/mbdyn/files/patch-libraries_libobjs_get__nprocs.c b/science/mbdyn/files/patch-libraries_libobjs_get__nprocs.c new file mode 100644 index 000000000000..9aaa6e62bd02 --- /dev/null +++ b/science/mbdyn/files/patch-libraries_libobjs_get__nprocs.c @@ -0,0 +1,39 @@ +--- libraries/libobjs/get_nprocs.c.orig 2021-04-22 19:18:04 UTC ++++ libraries/libobjs/get_nprocs.c +@@ -39,10 +39,28 @@ + + #ifndef HAVE_GET_NPROCS + ++#if defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <stdio.h> ++#include <stdlib.h> ++#endif ++ + /* GNU libc */ + int + get_nprocs(void) + { ++#if defined(__FreeBSD__) ++ static int name[2] = {CTL_HW, HW_NCPU}; ++ int32_t ncpu; ++ size_t size = sizeof(ncpu); ++ if (sysctl(name, sizeof(name)/sizeof(*name), &ncpu, &size, NULL, 0)) { ++ perror("unable to determine number of CPUs"); ++ abort(); ++ } ++ return (int)ncpu; ++ ++#else + #warning "pippero!!!" + #if defined(_SC_NPROCESSORS_ONLN) + /* POSIX.1. */ +@@ -65,6 +83,7 @@ get_nprocs(void) + #endif + /* we assume that there is at least one :) */ + return 1; ++#endif + } + + #endif /* HAVE_GET_NPROCS */ diff --git a/science/mbdyn/files/patch-mbdyn_base_invsolver.cc b/science/mbdyn/files/patch-mbdyn_base_invsolver.cc new file mode 100644 index 000000000000..63e116306104 --- /dev/null +++ b/science/mbdyn/files/patch-mbdyn_base_invsolver.cc @@ -0,0 +1,11 @@ +--- mbdyn/base/invsolver.cc.orig 2017-09-09 09:20:12 UTC ++++ mbdyn/base/invsolver.cc +@@ -76,6 +76,8 @@ + + #include "solver_impl.h" + ++extern "C" {int get_nprocs(void);} ++ + InverseSolver::InverseSolver(MBDynParser& HPar, + const std::string& sInFName, + const std::string& sOutFName, diff --git a/science/mbdyn/files/patch-mbdyn_base_readlinsol.cc b/science/mbdyn/files/patch-mbdyn_base_readlinsol.cc new file mode 100644 index 000000000000..2154c6d46aaf --- /dev/null +++ b/science/mbdyn/files/patch-mbdyn_base_readlinsol.cc @@ -0,0 +1,11 @@ +--- mbdyn/base/readlinsol.cc.orig 2021-04-22 19:28:15 UTC ++++ mbdyn/base/readlinsol.cc +@@ -35,6 +35,8 @@ + #include "dataman.h" + #include "readlinsol.h" + ++extern "C" {int get_nprocs(void);} ++ + void + ReadLinSol(LinSol& cs, HighParser &HP, bool bAllowEmpty) + { diff --git a/science/mbdyn/files/patch-mbdyn_base_rtsolver.cc b/science/mbdyn/files/patch-mbdyn_base_rtsolver.cc new file mode 100644 index 000000000000..bc93ef8cfb6d --- /dev/null +++ b/science/mbdyn/files/patch-mbdyn_base_rtsolver.cc @@ -0,0 +1,11 @@ +--- mbdyn/base/rtsolver.cc.orig 2021-04-22 19:28:55 UTC ++++ mbdyn/base/rtsolver.cc +@@ -38,6 +38,8 @@ + #include "rtaisolver.h" + #include "rtposixsolver.h" + #include "ac/sys_sysinfo.h" ++ ++extern "C" {int get_nprocs(void);} + + /* RTSolverBase - begin */ + diff --git a/science/mbdyn/files/patch-mbdyn_base_solver.cc b/science/mbdyn/files/patch-mbdyn_base_solver.cc new file mode 100644 index 000000000000..92675d27ae77 --- /dev/null +++ b/science/mbdyn/files/patch-mbdyn_base_solver.cc @@ -0,0 +1,10 @@ +--- mbdyn/base/solver.cc.orig 2021-04-22 19:30:51 UTC ++++ mbdyn/base/solver.cc +@@ -85,6 +85,7 @@ + #include "ac/arpack.h" + #include "eigjdqz.h" + ++extern "C" {int get_nprocs(void);} + + #ifdef HAVE_SIGNAL + /* diff --git a/science/mbdyn/pkg-descr b/science/mbdyn/pkg-descr index 14cc6838c91c..68a8e27e7369 100644 --- a/science/mbdyn/pkg-descr +++ b/science/mbdyn/pkg-descr @@ -8,4 +8,4 @@ o a commercial tool o a completely supported software -WWW: http://www.mbdyn.org +WWW: https://www.mbdyn.org/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104222216.13MMGmgt078397>