Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/dmlc-core/
Date: Fri, 17 Mar 2023 12:07:19
Message-Id: 1679054826.2dad60a86a3a0c7bbc038902f91d2076e7c88d9a.andrewammerlaan@gentoo
1 commit: 2dad60a86a3a0c7bbc038902f91d2076e7c88d9a
2 Author: Peter Levine <plevine457 <AT> gmail <DOT> com>
3 AuthorDate: Mon Feb 13 03:25:59 2023 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 17 12:07:06 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dad60a8
7
8 sci-libs/dmlc-core: add 0.5
9
10 - add cpu_flags_x86_sse2 to IUSE
11
12 It's true it only adds an -m flag to CXXFLAGS but so do most uses of
13 CPU_FLAGS_X86. Also, remove automagic from CMakeLists.txt and pass
14 -DSUPPORT_MSSE2 explicitly
15
16 - remove patch
17
18 Appears to be no longer needed.
19
20 - fix dependencies
21
22 Make gtest a proper bdep. The presence of texlive-fontutils appears
23 irrelevant as the generated docs compare the same. curl is only
24 needed for s3.
25
26 - fix testing
27
28 Portage doesn't set LD_LIBRARY_PATH resulting in a leading colon when
29 used in LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BUILD_DIR}". It builds
30 fine with just -L\"${BUILD_DIR}\" and testing runs fine with just
31 LD_LIBRARY_PATH="${BUILD_DIR}".
32
33 It doesn't appear to need tc-export CXX to find the correct
34 compiler.
35
36 GTEST_LIB needs to be changed to the correct libdir. Otherwise it
37 passes -L/lib/ triggering it to build in x86 mode and fail at linking
38 stage. Alter GTEST_INC also for good measure.
39
40 Pass -DGOOGLE_TEST for ctest testing, while also keeping non-ctest
41 tests.
42
43 Pass USE_CXX14_IF_AVAILABLE to cmake and change -std=c++11 to
44 -std=c++14 in the Makefile to support the latest gtest.
45
46 - use emake to build docs and tests in src_compile
47
48 `emake test` is more appropriate in src_compile. And `emake doxygen`
49 works fine to generate docs.
50
51 - add little-endian tests
52
53 Pass DMLC_UNIT_TEST_LITTLE_ENDIAN for a few more tests.
54
55 Closes: https://bugs.gentoo.org/894038
56 Closes: https://github.com/gentoo/gentoo/pull/29572
57 Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
58 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
59
60 sci-libs/dmlc-core/Manifest | 1 +
61 sci-libs/dmlc-core/dmlc-core-0.5.ebuild | 105 ++++++++++++++++++++++++++++++++
62 2 files changed, 106 insertions(+)
63
64 diff --git a/sci-libs/dmlc-core/Manifest b/sci-libs/dmlc-core/Manifest
65 index de2f9fd304d6..6eff176be348 100644
66 --- a/sci-libs/dmlc-core/Manifest
67 +++ b/sci-libs/dmlc-core/Manifest
68 @@ -1 +1,2 @@
69 +DIST dmlc-core-0.5.tar.gz 256340 BLAKE2B 1a2fd548c704e89adbba397b9f4306ad9439b969755bfd4fa24aad2e58855882dbe69b9c0550b830f8a81dfa41139e22c7ceed0ed707608e31fea1868b707ad4 SHA512 e8292bf71f9d7e31f17add69c984473f8f4d51768c5ac1451dceb9ff3c3e607dd85eea7fb3999f00cf34e962c5956ef1426713b7d8baa5fdbc3aa88e58bed66d
70 DIST dmlc-core-0_p20170719.tar.gz 160242 BLAKE2B 2752968c831b5468cb926fbd2783098d1d66f5dd7f06b1abf138e165c637a3c16d477b04b709a05826528ee8e35ed61b563bdaae958fb91c78591dd57761a5f4 SHA512 2e2d79800839652772f07deb5ea3aa470cc5a18d2d0e480b8f4a1598aca72443546a438f3309708268cc49cf2d65684c3366cfc6c33c085baf1b804b4c04f02e
71
72 diff --git a/sci-libs/dmlc-core/dmlc-core-0.5.ebuild b/sci-libs/dmlc-core/dmlc-core-0.5.ebuild
73 new file mode 100644
74 index 000000000000..ae6cb41b64e6
75 --- /dev/null
76 +++ b/sci-libs/dmlc-core/dmlc-core-0.5.ebuild
77 @@ -0,0 +1,105 @@
78 +# Copyright 1999-2023 Gentoo Authors
79 +# Distributed under the terms of the GNU General Public License v2
80 +
81 +EAPI=8
82 +
83 +inherit cmake toolchain-funcs
84 +
85 +DESCRIPTION="Common bricks library for building distributed machine learning"
86 +HOMEPAGE="https://github.com/dmlc/dmlc-core"
87 +
88 +if [[ ${PV} == *9999* ]] ; then
89 + EGIT_REPO_URI="https://github.com/dmlc/${PN}.git"
90 + inherit git-r3
91 +else
92 + SRC_URI="https://github.com/dmlc/${PN}/archive/refs/tags/v${PV}.tar.gz
93 + -> ${P}.tar.gz"
94 +
95 + KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
96 +fi
97 +
98 +LICENSE="Apache-2.0"
99 +SLOT="0"
100 +
101 +# hdfs needs big java hdfs not yet in portage
102 +# azure not yet in portage
103 +IUSE="cpu_flags_x86_sse2 doc openmp s3 test"
104 +RESTRICT="!test? ( test )"
105 +
106 +RDEPEND="s3? ( net-misc/curl[ssl] )"
107 +DEPEND="${RDEPEND}"
108 +BDEPEND="doc? ( app-doc/doxygen[dot] )
109 + test? ( dev-cpp/gtest )"
110 +
111 +pkg_pretend() {
112 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
113 +}
114 +
115 +pkg_setup() {
116 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
117 +}
118 +
119 +src_prepare() {
120 + cmake_src_prepare
121 +
122 + sed -e '/-O3/d' -e '/check_cxx_compiler_flag("-msse2"/d' \
123 + -e '/check_cxx.*SSE2/d' \
124 + -i CMakeLists.txt || die
125 +
126 + # All these hacks below to allow testing
127 + sed -e 's|-O3||' -e 's|-std=c++11|-std=c++14|' \
128 + -e "s|-lm|-lm -L\"${BUILD_DIR}\" -ldmlc|g" \
129 + -i Makefile || die
130 + sed -e "s|libdmlc.a||g" \
131 + -e "/^GTEST_LIB=/s|=.*|=/usr/$(get_libdir)|" \
132 + -e "/^GTEST_INC=/s|=.*|=/usr/include|" \
133 + -i test/dmlc_test.mk test/unittest/dmlc_unittest.mk || die
134 + # Don't ever download gtest
135 + sed -e 's/^if (NOT GTEST_FOUND)$/if (FALSE)/' \
136 + -i test/unittest/CMakeLists.txt || die
137 + cat <<-EOF > config.mk
138 + USE_SSE=$(usex cpu_flags_x86_sse2 1 0)
139 + WITH_FPIC=1
140 + USE_OPENMP=$(usex openmp 1 0)
141 + USE_S3=$(usex s3 1 0)
142 + BUILD_TEST=$(usex test 1 0)
143 + DMLC_CFLAGS=${CXXFLAGS}
144 + DMLC_LDFLAGS=${LDFLAGS}
145 + EOF
146 +}
147 +
148 +src_configure() {
149 + local mycmakeargs=(
150 + -DGOOGLE_TEST=$(usex test)
151 + -DSUPPORT_MSSE2=$(usex cpu_flags_x86_sse2)
152 + -DUSE_CXX14_IF_AVAILABLE=YES # Newer gtest needs C++14 or later
153 + -DUSE_S3=$(usex s3)
154 + -DUSE_OPENMP=$(usex openmp)
155 + )
156 +
157 + cmake_src_configure
158 +}
159 +
160 +src_compile() {
161 + cmake_src_compile
162 +
163 + use doc && emake doxygen
164 + use test && emake test
165 +}
166 +
167 +src_test() {
168 + DMLC_UNIT_TEST_LITTLE_ENDIAN=$([[ $(tc-endian) == little ]] && echo 1 || echo 0) \
169 + LD_LIBRARY_PATH="${BUILD_DIR}" \
170 + test/unittest/dmlc_unittest || die
171 +
172 + cmake_src_test
173 +}
174 +
175 +src_install() {
176 + cmake_src_install
177 +
178 + if use doc; then
179 + dodoc -r doc/doxygen/html
180 + docompress -x /usr/share/doc/${PF}/html
181 + fi
182 +}