diff options
author | Peter Levine <plevine457@gmail.com> | 2023-02-12 22:25:59 -0500 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2023-03-17 13:07:06 +0100 |
commit | 2dad60a86a3a0c7bbc038902f91d2076e7c88d9a (patch) | |
tree | 402ef54bb63dd1369251e242b9ec93eaea59a638 /sci-libs | |
parent | sys-kernel/gentoo-sources: add 6.2.7 (diff) | |
download | gentoo-2dad60a86a3a0c7bbc038902f91d2076e7c88d9a.tar.gz gentoo-2dad60a86a3a0c7bbc038902f91d2076e7c88d9a.tar.bz2 gentoo-2dad60a86a3a0c7bbc038902f91d2076e7c88d9a.zip |
sci-libs/dmlc-core: add 0.5
- add cpu_flags_x86_sse2 to IUSE
It's true it only adds an -m flag to CXXFLAGS but so do most uses of
CPU_FLAGS_X86. Also, remove automagic from CMakeLists.txt and pass
-DSUPPORT_MSSE2 explicitly
- remove patch
Appears to be no longer needed.
- fix dependencies
Make gtest a proper bdep. The presence of texlive-fontutils appears
irrelevant as the generated docs compare the same. curl is only
needed for s3.
- fix testing
Portage doesn't set LD_LIBRARY_PATH resulting in a leading colon when
used in LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BUILD_DIR}". It builds
fine with just -L\"${BUILD_DIR}\" and testing runs fine with just
LD_LIBRARY_PATH="${BUILD_DIR}".
It doesn't appear to need tc-export CXX to find the correct
compiler.
GTEST_LIB needs to be changed to the correct libdir. Otherwise it
passes -L/lib/ triggering it to build in x86 mode and fail at linking
stage. Alter GTEST_INC also for good measure.
Pass -DGOOGLE_TEST for ctest testing, while also keeping non-ctest
tests.
Pass USE_CXX14_IF_AVAILABLE to cmake and change -std=c++11 to
-std=c++14 in the Makefile to support the latest gtest.
- use emake to build docs and tests in src_compile
`emake test` is more appropriate in src_compile. And `emake doxygen`
works fine to generate docs.
- add little-endian tests
Pass DMLC_UNIT_TEST_LITTLE_ENDIAN for a few more tests.
Closes: https://bugs.gentoo.org/894038
Closes: https://github.com/gentoo/gentoo/pull/29572
Signed-off-by: Peter Levine <plevine457@gmail.com>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/dmlc-core/Manifest | 1 | ||||
-rw-r--r-- | sci-libs/dmlc-core/dmlc-core-0.5.ebuild | 105 |
2 files changed, 106 insertions, 0 deletions
diff --git a/sci-libs/dmlc-core/Manifest b/sci-libs/dmlc-core/Manifest index de2f9fd304d6..6eff176be348 100644 --- a/sci-libs/dmlc-core/Manifest +++ b/sci-libs/dmlc-core/Manifest @@ -1 +1,2 @@ +DIST dmlc-core-0.5.tar.gz 256340 BLAKE2B 1a2fd548c704e89adbba397b9f4306ad9439b969755bfd4fa24aad2e58855882dbe69b9c0550b830f8a81dfa41139e22c7ceed0ed707608e31fea1868b707ad4 SHA512 e8292bf71f9d7e31f17add69c984473f8f4d51768c5ac1451dceb9ff3c3e607dd85eea7fb3999f00cf34e962c5956ef1426713b7d8baa5fdbc3aa88e58bed66d DIST dmlc-core-0_p20170719.tar.gz 160242 BLAKE2B 2752968c831b5468cb926fbd2783098d1d66f5dd7f06b1abf138e165c637a3c16d477b04b709a05826528ee8e35ed61b563bdaae958fb91c78591dd57761a5f4 SHA512 2e2d79800839652772f07deb5ea3aa470cc5a18d2d0e480b8f4a1598aca72443546a438f3309708268cc49cf2d65684c3366cfc6c33c085baf1b804b4c04f02e diff --git a/sci-libs/dmlc-core/dmlc-core-0.5.ebuild b/sci-libs/dmlc-core/dmlc-core-0.5.ebuild new file mode 100644 index 000000000000..ae6cb41b64e6 --- /dev/null +++ b/sci-libs/dmlc-core/dmlc-core-0.5.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake toolchain-funcs + +DESCRIPTION="Common bricks library for building distributed machine learning" +HOMEPAGE="https://github.com/dmlc/dmlc-core" + +if [[ ${PV} == *9999* ]] ; then + EGIT_REPO_URI="https://github.com/dmlc/${PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/dmlc/${PN}/archive/refs/tags/v${PV}.tar.gz + -> ${P}.tar.gz" + + KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +fi + +LICENSE="Apache-2.0" +SLOT="0" + +# hdfs needs big java hdfs not yet in portage +# azure not yet in portage +IUSE="cpu_flags_x86_sse2 doc openmp s3 test" +RESTRICT="!test? ( test )" + +RDEPEND="s3? ( net-misc/curl[ssl] )" +DEPEND="${RDEPEND}" +BDEPEND="doc? ( app-doc/doxygen[dot] ) + test? ( dev-cpp/gtest )" + +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +src_prepare() { + cmake_src_prepare + + sed -e '/-O3/d' -e '/check_cxx_compiler_flag("-msse2"/d' \ + -e '/check_cxx.*SSE2/d' \ + -i CMakeLists.txt || die + + # All these hacks below to allow testing + sed -e 's|-O3||' -e 's|-std=c++11|-std=c++14|' \ + -e "s|-lm|-lm -L\"${BUILD_DIR}\" -ldmlc|g" \ + -i Makefile || die + sed -e "s|libdmlc.a||g" \ + -e "/^GTEST_LIB=/s|=.*|=/usr/$(get_libdir)|" \ + -e "/^GTEST_INC=/s|=.*|=/usr/include|" \ + -i test/dmlc_test.mk test/unittest/dmlc_unittest.mk || die + # Don't ever download gtest + sed -e 's/^if (NOT GTEST_FOUND)$/if (FALSE)/' \ + -i test/unittest/CMakeLists.txt || die + cat <<-EOF > config.mk + USE_SSE=$(usex cpu_flags_x86_sse2 1 0) + WITH_FPIC=1 + USE_OPENMP=$(usex openmp 1 0) + USE_S3=$(usex s3 1 0) + BUILD_TEST=$(usex test 1 0) + DMLC_CFLAGS=${CXXFLAGS} + DMLC_LDFLAGS=${LDFLAGS} + EOF +} + +src_configure() { + local mycmakeargs=( + -DGOOGLE_TEST=$(usex test) + -DSUPPORT_MSSE2=$(usex cpu_flags_x86_sse2) + -DUSE_CXX14_IF_AVAILABLE=YES # Newer gtest needs C++14 or later + -DUSE_S3=$(usex s3) + -DUSE_OPENMP=$(usex openmp) + ) + + cmake_src_configure +} + +src_compile() { + cmake_src_compile + + use doc && emake doxygen + use test && emake test +} + +src_test() { + DMLC_UNIT_TEST_LITTLE_ENDIAN=$([[ $(tc-endian) == little ]] && echo 1 || echo 0) \ + LD_LIBRARY_PATH="${BUILD_DIR}" \ + test/unittest/dmlc_unittest || die + + cmake_src_test +} + +src_install() { + cmake_src_install + + if use doc; then + dodoc -r doc/doxygen/html + docompress -x /usr/share/doc/${PF}/html + fi +} |