diff --git a/science/opensph/Makefile b/science/opensph/Makefile index e6251857ecac..3be2e90bfb20 100644 --- a/science/opensph/Makefile +++ b/science/opensph/Makefile @@ -1,80 +1,84 @@ PORTNAME= OpenSPH DISTVERSION= 0.4.1 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= science MAINTAINER= yuri@FreeBSD.org COMMENT= Library and graphical tools for running SPH and N-body simulations WWW= https://gitlab.com/sevecekp/sph LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE -ONLY_FOR_ARCHS= amd64 i386 +ONLY_FOR_ARCHS= aarch64 amd64 i386 ONLY_FOR_ARCHS_REASON= unconditional use of -msse4.1 and inclusion of immintrin.h +BUILD_DEPENDS_aarch64= ${LOCALBASE}/include/sse2neon.h:devel/sse2neon +BUILD_DEPENDS+= ${BUILD_DEPENDS_${ARCH}} TEST_DEPENDS= catch>0:devel/catch USES= compiler:c++17-lang qmake qt:5 USE_GITLAB= yes USE_WX= 3.2 GL_SITE= https://gitlab.com GL_ACCOUNT= sevecekp GL_PROJECT= sph GL_TAGNAME= a7f6f781059d8d19e6f24b1115e7ad3ad71678a8 QMAKE_SOURCE_PATH= ${WRKSRC}/sph.pro QMAKE_ARGS= CONFIG+=release CXXFLAGS+= -DSPH_CONFIG_SET +CXXFLAGS_amd64= -msse4.1 +CXXFLAGS_i386= -msse4.1 TEST_WRKSRC= ${WRKDIR}/test BINARY_ALIAS= wx-config=${LOCALBASE}/bin/wxgtk3u-3.2-config PLIST_FILES= bin/opensph bin/opensph-cli bin/opensph-info OPTIONS_DEFINE= CHAISCRIPT EIGEN HDF5 OPENMP TBB VDB OPTIONS_DEFAULT= CHAISCRIPT EIGEN HDF5 OPENMP TBB VDB CHAISCRIPT_DESC= Be able to read and modify particle data from a script CHAISCRIPT_QMAKE_ON= CONFIG+=use_chaiscript CHAISCRIPT_BUILD_DEPENDS= ${LOCALBASE}/include/chaiscript/chaiscript.hpp:lang/chaiscript EIGEN_DESC= Eigen for additional methods to set up initial conditions EIGEN_QMAKE_ON= CONFIG+=use_eigen EIGEN_USES= eigen:3 HDF5_DESC= Be able to read files generated by miluphcuda code HDF5_QMAKE_ON= CONFIG+=use_hdf5 HDF5_LIB_DEPENDS= libhdf5.so:science/hdf5 OPENMP_QMAKE_ON= CONFIG+=use_openmp TBB_DESC= Parallelize with Intel Threading Building Blocks TBB_QMAKE_ON= CONFIG+=use_tbb TBB_LIB_DEPENDS= libtbb.so:devel/onetbb VDB_DESC= Use OpenVDB for converting particles to volumetric data VDB_QMAKE_ON= CONFIG+=use_vdb VDB_LIB_DEPENDS= libImath.so:math/Imath \ libopenvdb.so:misc/openvdb \ libtbb.so:devel/onetbb post-patch: # workaround for https://gitlab.com/sevecekp/sph/-/issues/48 - @${FIND} ${WRKSRC} -name "*.pro" | ${XARGS} ${REINPLACE_CMD} -e 's|c++14|c++17|' + @${FIND} ${WRKSRC} -name "*.pro" | ${XARGS} ${REINPLACE_CMD} -e 's|c++14|c++17|' -e 's|-msse4.1||' do-test: @${REINPLACE_CMD} -e 's|Path(.*|Path("${TEST_WRKSRC}");|' ${WRKSRC}/test/utils/Config.h @${MKDIR} ${TEST_WRKSRC} @cd ${_QMAKE_WRKSRC} && \ ${SETENV} ${QMAKE_ENV} ${_QMAKE} ${QMAKE_ARGS} \ ${WRKSRC}/test.pro \ ${QMAKE_CONFIGURE_ARGS:?--:} ${QMAKE_CONFIGURE_ARGS} @cd ${BUILD_WRKSRC} && \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${_MAKE_JOBS} ${MAKE_ARGS} @cd ${TEST_WRKSRC} && \ ${WRKSRC}/test/test .include diff --git a/science/opensph/files/patch-core_objects_containers_BasicAllocators.h b/science/opensph/files/patch-core_objects_containers_BasicAllocators.h new file mode 100644 index 000000000000..bb1fc5a255de --- /dev/null +++ b/science/opensph/files/patch-core_objects_containers_BasicAllocators.h @@ -0,0 +1,13 @@ +--- core/objects/containers/BasicAllocators.h.orig 2024-10-15 17:04:09 UTC ++++ core/objects/containers/BasicAllocators.h +@@ -6,7 +6,9 @@ + /// \date 2016-2021 + + #include "common/Assert.h" +-#ifndef SPH_WIN ++#if defined(__arm__) || defined(__aarch64__) ++#include ++#elif !defined(SPH_WIN) + #include + #else + #include diff --git a/science/opensph/files/patch-core_objects_geometry_Vector.h b/science/opensph/files/patch-core_objects_geometry_Vector.h new file mode 100644 index 000000000000..8cb10a70ecec --- /dev/null +++ b/science/opensph/files/patch-core_objects_geometry_Vector.h @@ -0,0 +1,17 @@ +--- core/objects/geometry/Vector.h.orig 2024-10-15 17:00:09 UTC ++++ core/objects/geometry/Vector.h +@@ -9,9 +9,13 @@ + #include "objects/containers/Tuple.h" + #include "objects/geometry/Generic.h" + #include "objects/wrappers/Interval.h" +-#include + #include ++#if defined(__arm__) || defined(__aarch64__) ++#include ++#else ++#include + #include ++#endif + + NAMESPACE_SPH_BEGIN + diff --git a/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h b/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h new file mode 100644 index 000000000000..c07146ada5cc --- /dev/null +++ b/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h @@ -0,0 +1,13 @@ +--- core/objects/wrappers/AlignedStorage.h.orig 2024-10-15 17:05:35 UTC ++++ core/objects/wrappers/AlignedStorage.h +@@ -7,7 +7,9 @@ + + #include "common/Assert.h" + #include "common/Traits.h" +-#ifndef SPH_WIN ++#if defined(__arm__) || defined(__aarch64__) ++#include ++#elif !defined(SPH_WIN) + #include + #else + #include diff --git a/science/opensph/files/patch-core_system_Platform.cpp b/science/opensph/files/patch-core_system_Platform.cpp index 54324cc45a0c..6f25b44906e2 100644 --- a/science/opensph/files/patch-core_system_Platform.cpp +++ b/science/opensph/files/patch-core_system_Platform.cpp @@ -1,40 +1,40 @@ ---- core/system/Platform.cpp.orig 2021-04-08 21:23:28 UTC +--- core/system/Platform.cpp.orig 2022-11-16 12:31:25 UTC +++ core/system/Platform.cpp -@@ -102,14 +106,18 @@ class CpuUsage { (private) +@@ -117,14 +117,18 @@ class CpuUsage { (public) public: CpuUsage() { +#if !defined(__FreeBSD__) FILE* file; +#endif struct tms timeSample; +#if !defined(__FreeBSD__) char line[128]; +#endif lastCpu = times(&timeSample); lastSysCpu = timeSample.tms_stime; lastUserCpu = timeSample.tms_utime; - +#if !defined(__FreeBSD__) file = fopen("/proc/cpuinfo", "r"); numProcessors = 0; while (fgets(line, 128, file) != NULL) { -@@ -117,6 +125,8 @@ class CpuUsage { (private) +@@ -132,6 +136,8 @@ class CpuUsage { (public) numProcessors++; } fclose(file); +#endif + numProcessors = 8; // TODO } Optional getUsage() { -@@ -150,7 +160,7 @@ bool isDebuggerPresent() { +@@ -176,7 +182,7 @@ bool isDebuggerPresent() { char buf[1024]; bool debuggerPresent = false; - int status_fd = open("/proc/self/status", O_RDONLY); + int status_fd = open("/proc/curproc/status", O_RDONLY); if (status_fd == -1) { return false; }