1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
... | ... | |
12 |
12 |
EGIT_REPO_URI="https://github.com/dmlc/${PN}.git"
|
13 |
13 |
inherit git-r3
|
14 |
14 |
else
|
15 |
|
SRC_URI="https://github.com/dmlc/${PN}/archive/refs/tags/v${PV}.tar.gz
|
16 |
|
-> ${P}.tar.gz"
|
|
15 |
MY_COMMIT="54db57d5d1b2a7b93319053011802888b827a539"
|
|
16 |
inherit vcs-snapshot
|
|
17 |
SRC_URI="https://github.com/dmlc/dmlc-core/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
|
17 |
18 |
|
18 |
19 |
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
|
19 |
20 |
fi
|
... | ... | |
23 |
24 |
|
24 |
25 |
# hdfs needs big java hdfs not yet in portage
|
25 |
26 |
# azure not yet in portage
|
26 |
|
IUSE="cpu_flags_x86_sse2 doc openmp s3 test"
|
|
27 |
IUSE="doc openmp s3 test"
|
27 |
28 |
RESTRICT="!test? ( test )"
|
28 |
29 |
|
29 |
|
RDEPEND="s3? ( net-misc/curl[ssl] )"
|
30 |
|
DEPEND="${RDEPEND}"
|
31 |
|
BDEPEND="doc? ( app-doc/doxygen[dot] )
|
|
30 |
RDEPEND="net-misc/curl[ssl]"
|
|
31 |
DEPEND="${RDEPEND}
|
32 |
32 |
test? ( dev-cpp/gtest )"
|
|
33 |
BDEPEND="doc? (
|
|
34 |
app-doc/doxygen
|
|
35 |
dev-texlive/texlive-fontutils
|
|
36 |
)"
|
|
37 |
|
|
38 |
PATCHES=( "${FILESDIR}"/${PN}-install-dirs.patch )
|
33 |
39 |
|
34 |
40 |
pkg_pretend() {
|
35 |
41 |
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
... | ... | |
42 |
48 |
src_prepare() {
|
43 |
49 |
cmake_src_prepare
|
44 |
50 |
|
45 |
|
sed -e '/-O3/d' -e '/check_cxx_compiler_flag("-msse2"/d' \
|
|
51 |
# Respect user flags (SSE2 does nothing more than adding -msse2)
|
|
52 |
# Also doc installs everything, so remove
|
|
53 |
sed -e '/-O3/d' \
|
46 |
54 |
-e '/check_cxx.*SSE2/d' \
|
47 |
55 |
-i CMakeLists.txt || die
|
48 |
56 |
|
49 |
57 |
# All these hacks below to allow testing
|
50 |
|
sed -e 's|-O3||' -e 's|-std=c++11|-std=c++14|' \
|
51 |
|
-e "s|-lm|-lm -L\"${BUILD_DIR}\" -ldmlc|g" \
|
52 |
|
-i Makefile || die
|
|
58 |
sed -e 's|-O3||' -e 's|-lm|-lm -L$(LD_LIBRARY_PATH) -ldmlc|g' -i Makefile || die
|
53 |
59 |
sed -e "s|libdmlc.a||g" \
|
54 |
|
-e "/^GTEST_LIB=/s|=.*|=/usr/$(get_libdir)|" \
|
55 |
|
-e "/^GTEST_INC=/s|=.*|=/usr/include|" \
|
56 |
60 |
-i test/dmlc_test.mk test/unittest/dmlc_unittest.mk || die
|
57 |
|
# Don't ever download gtest
|
58 |
|
sed -e 's/^if (NOT GTEST_FOUND)$/if (FALSE)/' \
|
59 |
|
-i test/unittest/CMakeLists.txt || die
|
60 |
61 |
cat <<-EOF > config.mk
|
61 |
|
USE_SSE=$(usex cpu_flags_x86_sse2 1 0)
|
|
62 |
USE_SSE=0
|
62 |
63 |
WITH_FPIC=1
|
63 |
|
USE_OPENMP=$(usex openmp 1 0)
|
64 |
|
USE_S3=$(usex s3 1 0)
|
65 |
|
BUILD_TEST=$(usex test 1 0)
|
|
64 |
USE_OPENMP=$(use openmp && echo 1 || echo 0)
|
|
65 |
USE_S3=$(use s3 && echo 1 || echo 0)
|
|
66 |
BUILD_TEST=$(use test && echo 1 || echo 0)
|
66 |
67 |
DMLC_CFLAGS=${CXXFLAGS}
|
67 |
68 |
DMLC_LDFLAGS=${LDFLAGS}
|
68 |
69 |
EOF
|
... | ... | |
70 |
71 |
|
71 |
72 |
src_configure() {
|
72 |
73 |
local mycmakeargs=(
|
73 |
|
-DGOOGLE_TEST=$(usex test)
|
74 |
|
-DSUPPORT_MSSE2=$(usex cpu_flags_x86_sse2)
|
75 |
|
-DUSE_CXX14_IF_AVAILABLE=YES # Newer gtest needs C++14 or later
|
76 |
74 |
-DUSE_S3=$(usex s3)
|
77 |
75 |
-DUSE_OPENMP=$(usex openmp)
|
78 |
76 |
)
|
... | ... | |
83 |
81 |
src_compile() {
|
84 |
82 |
cmake_src_compile
|
85 |
83 |
|
86 |
|
use doc && emake doxygen
|
87 |
|
use test && emake test
|
|
84 |
if use doc; then
|
|
85 |
doxygen doc/Doxyfile || die
|
|
86 |
fi
|
88 |
87 |
}
|
89 |
88 |
|
90 |
89 |
src_test() {
|
91 |
|
DMLC_UNIT_TEST_LITTLE_ENDIAN=$([[ $(tc-endian) == little ]] && echo 1 || echo 0) \
|
92 |
|
LD_LIBRARY_PATH="${BUILD_DIR}" \
|
93 |
|
test/unittest/dmlc_unittest || die
|
|
90 |
tc-export CXX
|
|
91 |
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BUILD_DIR}"
|
|
92 |
|
|
93 |
emake test
|
94 |
94 |
|
95 |
|
cmake_src_test
|
|
95 |
test/unittest/dmlc_unittest || die
|
96 |
96 |
}
|
97 |
97 |
|
98 |
98 |
src_install() {
|