<pre style='margin:0'>
Herby Gillot (herbygillot) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/ec1004cf29dfb7245402e4334595fb4e669a9a83">https://github.com/macports/macports-ports/commit/ec1004cf29dfb7245402e4334595fb4e669a9a83</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit ec1004cf29dfb7245402e4334595fb4e669a9a83
</span>Author: Sergey Fedorov <vital.had@gmail.com>
AuthorDate: Thu Mar 23 17:27:58 2023 +0700
<span style='display:block; white-space:pre;color:#404040;'> R-xgboost: new port
</span>---
R/R-xgboost/Portfile | 53 +++++++++++++++++++++++++++++
R/R-xgboost/files/patch-fix-OpenMP.diff | 40 ++++++++++++++++++++++
R/R-xgboost/files/patch-unbreak-32-bit.diff | 11 ++++++
3 files changed, 104 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/R/R-xgboost/Portfile b/R/R-xgboost/Portfile
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..7973fa97e1d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/R/R-xgboost/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,53 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup R 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+R.setup cran dmlc xgboost 1.7.3.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+categories-append math
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+maintainers {@barracuda156 gmail.com:vital.had} openmaintainer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license Apache-2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description Extreme Gradient Boosting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description {*}${description}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 4dda5cefce05ccedfe79ceb961045cd18445418d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 3ced2ca30efaa86a9e93bc28e5cd3cc6df93bd68a550751ecf3a9f488ea438a5 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 1081078
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_build-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ path:bin/cmake:cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_lib-append port:R-data.table \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-jsonlite
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles patch-unbreak-32-bit.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch-fix-OpenMP.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/dmlc/xgboost/issues/8946
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# For now, do not make using OpenMP a default.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@OMP_PREFIX@,${prefix}," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[string match macports-clang* ${configure.compiler}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@OMP@,-lomp," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@INC@,include/libomp," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@LIB@,lib/libomp," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {[string match macports-gcc* ${configure.compiler}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@OMP@,-lgomp," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@INC@,," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s,@LIB@,lib/libgcc," ${worksrcpath}/configure
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_test-append port:R-Ckmeans.1d.dp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-crayon \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-knitr \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-rmarkdown \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-ggplot2 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-DiagrammeR \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-vcd \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-testthat \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-lintr \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-igraph \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-float \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:R-titanic
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+test.run yes
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/R/R-xgboost/files/patch-fix-OpenMP.diff b/R/R-xgboost/files/patch-fix-OpenMP.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..01d18547241
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/R/R-xgboost/files/patch-fix-OpenMP.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,40 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- configure.orig 2023-01-15 03:07:58.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ configure 2023-03-23 16:37:35.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2834,15 +2834,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test `uname -s` = "Darwin"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if command -v brew &> /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- HOMEBREW_LIBOMP_PREFIX=`brew --prefix libomp`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- # Homebrew not found
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- HOMEBREW_LIBOMP_PREFIX=''
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- OPENMP_CXXFLAGS="-Xpreprocessor -fopenmp -I${HOMEBREW_LIBOMP_PREFIX}/include"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- OPENMP_LIB="-lomp -L${HOMEBREW_LIBOMP_PREFIX}/lib"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ LIBOMP_PREFIX=@OMP_PREFIX@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ OPENMP_CXXFLAGS="-Xpreprocessor -fopenmp -I${LIBOMP_PREFIX}/@INC@"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ OPENMP_LIB="-L${LIBOMP_PREFIX}/@LIB@ @OMP@"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ac_pkg_openmp=no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether OpenMP will work in a package" >&5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ printf %s "checking whether OpenMP will work in a package... " >&6; }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2857,7 +2851,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _ACEOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- ${CC} -o conftest conftest.c ${CPPFLAGS} ${LDFLAGS} ${OPENMP_LIB} ${OPENMP_CXXFLAGS} 2>/dev/null && ./conftest && ac_pkg_openmp=yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ${CXX} -o conftest conftest.cpp ${CPPFLAGS} ${LDFLAGS} ${OPENMP_LIB} ${OPENMP_CXXFLAGS} 2>/dev/null && ./conftest && ac_pkg_openmp=yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${ac_pkg_openmp}" >&5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ printf "%s\n" "${ac_pkg_openmp}" >&6; }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "${ac_pkg_openmp}" = no; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2865,8 +2859,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ OPENMP_LIB=''
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo '*****************************************************************************************'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo ' OpenMP is unavailable on this Mac OSX system. Training speed may be suboptimal.'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- echo ' To use all CPU cores for training jobs, you should install OpenMP by running\n'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- echo ' brew install libomp'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ echo ' To use all CPU cores for training jobs, you should install OpenMP.'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo '*****************************************************************************************'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/R/R-xgboost/files/patch-unbreak-32-bit.diff b/R/R-xgboost/files/patch-unbreak-32-bit.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..146af91d4fb
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/R/R-xgboost/files/patch-unbreak-32-bit.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/src/collective/communicator-inl.h.orig 2023-01-15 03:02:17.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/src/collective/communicator-inl.h 2023-03-23 15:20:46.000000000 +0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -197,7 +197,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ template <Operation op, typename T,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typename = std::enable_if_t<std::is_same<size_t, T>{} && !std::is_same<uint64_t, T>{}> >
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ inline void Allreduce(T *send_receive_buffer, size_t count) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- static_assert(sizeof(T) == sizeof(uint64_t), "");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// static_assert(sizeof(T) == sizeof(uint64_t), "");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Communicator::Get()->AllReduce(send_receive_buffer, count, DataType::kUInt64, op);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span></pre><pre style='margin:0'>
</pre>