From cba66feec7f4f3fb5c0937b6b22d89393849bc1f Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Fri, 13 Dec 2024 14:41:12 +0800 Subject: [PATCH 1/3] sci-libs/lightgbm: new package, add 4.5.0 Signed-off-by: Yiyang Wu --- sci-libs/lightgbm/Manifest | 5 ++ .../files/lightgbm-4.5.0-eigen3.patch | 13 +++++ .../files/lightgbm-4.5.0-libdir.patch | 36 ++++++++++++++ sci-libs/lightgbm/lightgbm-4.5.0.ebuild | 49 +++++++++++++++++++ sci-libs/lightgbm/metadata.xml | 13 +++++ 5 files changed, 116 insertions(+) create mode 100644 sci-libs/lightgbm/Manifest create mode 100644 sci-libs/lightgbm/files/lightgbm-4.5.0-eigen3.patch create mode 100644 sci-libs/lightgbm/files/lightgbm-4.5.0-libdir.patch create mode 100644 sci-libs/lightgbm/lightgbm-4.5.0.ebuild create mode 100644 sci-libs/lightgbm/metadata.xml diff --git a/sci-libs/lightgbm/Manifest b/sci-libs/lightgbm/Manifest new file mode 100644 index 00000000000..8f43f6e6caa --- /dev/null +++ b/sci-libs/lightgbm/Manifest @@ -0,0 +1,5 @@ +DIST LightGBM-4.5.0.tar.gz 6163768 BLAKE2B ad5c737bd18b60617e5b7a8f95845b4e0f5ff522a0a16d995b12109e73aa3dc224dd32f621500196b465842aeeb3bd62c483d0f8646ec53cc43bf90788da8b95 SHA512 f968f984a0881a5eadd898dded367b799b619e3cc80415dec8b623897e84d7e1e1034f20179125354b93759ea1b8a3e334cfa506427442810ef098bc93fd4634 +DIST compute-36350b7d.tar.gz 377161 BLAKE2B cf9ed88b147fc07d7d0c562f699d5ea660c085860c6a44de2fb8585cd2574141a48aa939024fbbbbe9a0ded38de955f3f3be31b7b8481edfaf22ff14ce842956 SHA512 66ab1b8182e0a06f8a1fb3e59b2fb94bae89e7b72f8ec8d14d40811751768721d399c00cbacb74c6d55c11d91cc8b827409be07d8411a0f4c9daf3be57238bee +DIST double-conversion-f4cb2384.tar.gz 7027061 BLAKE2B d08b61b51728ff3ee01a1bd6c4aaed70c1afca6e8202920f4b01f79f6500a1ab230e4daf73fe0fd24f79e2135853051c8600ea89e8e331f36bd70875871af57d SHA512 8a0dfabe25b40d13a00417df0779a86477ce994e98ce7dfc7196464bf83fd8f29fbb8153a1419be9354b2afbb04645b41a0d103bfe847468de0cc9800644b7ba +DIST fast_double_parser-efec0353.tar.gz 636133 BLAKE2B 5a0244b4ddf1a0eae52cc26ae0749c2ca34f76f665160635eea94da4db0915b4d848cf2ba09c7173c058e2da305a89f6e90517d703e36a2ed565eabc264811de SHA512 2917167f05a270253b4c6360b598a69df43e8305601abb59d12c4085dd5db0b93b0e8725f61595a0424f0a26b59ec1a97d58df1ab33674ce36f0da9bd818c485 +DIST fmt-f5e54359.tar.gz 851890 BLAKE2B 025d29873ea8c65580c4681410d03d3dfaddde6daf18c436bf4a3f97be53d73439cf41e32e051095cb5b838560ddcd22f986c66300753155fd3e10dff16034d3 SHA512 0810d7d96d96aea0d02648eb5d201f8bed22d0b0ddc0ed22e7d4f4dd11ea05bf90fc23e067c274f16e1ff566d0326942ccd55696cdab1a4a9ba01e6553280999 diff --git a/sci-libs/lightgbm/files/lightgbm-4.5.0-eigen3.patch b/sci-libs/lightgbm/files/lightgbm-4.5.0-eigen3.patch new file mode 100644 index 00000000000..5ada8179f73 --- /dev/null +++ b/sci-libs/lightgbm/files/lightgbm-4.5.0-eigen3.patch @@ -0,0 +1,13 @@ +Index: LightGBM/src/treelearner/linear_tree_learner.cpp +=================================================================== +--- LightGBM.orig/src/treelearner/linear_tree_learner.cpp ++++ LightGBM/src/treelearner/linear_tree_learner.cpp +@@ -4,7 +4,7 @@ + */ + #include "linear_tree_learner.h" + +-#include ++#include "eigen3/Eigen/Dense" + + #include + diff --git a/sci-libs/lightgbm/files/lightgbm-4.5.0-libdir.patch b/sci-libs/lightgbm/files/lightgbm-4.5.0-libdir.patch new file mode 100644 index 00000000000..42ae8d05ad2 --- /dev/null +++ b/sci-libs/lightgbm/files/lightgbm-4.5.0-libdir.patch @@ -0,0 +1,36 @@ +From 9512c085f7a453a40ce85ce86233c5c6d32c7aaf Mon Sep 17 00:00:00 2001 +From: Yiyang Wu +Date: Fri, 8 Nov 2024 20:23:00 +0800 +Subject: [PATCH] Use cmake default install location + +Install 64bit dynamic and static libs to lib is not allowed in some +distributions + +Reference: https://cmake.org/cmake/help/latest/command/install.html#signatures +Signed-off-by: Yiyang Wu +--- + CMakeLists.txt | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 183ef62b..b558b67b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -829,13 +829,7 @@ if(APPLE AND USE_OPENMP AND NOT BUILD_STATIC_LIB) + ) + endif() + +-install( +- TARGETS _lightgbm +- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin +- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib +- ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib +-) +- ++install( TARGETS _lightgbm ) + if(INSTALL_HEADERS) + install( + DIRECTORY ${LightGBM_HEADER_DIR}/LightGBM +-- +2.47.0 + diff --git a/sci-libs/lightgbm/lightgbm-4.5.0.ebuild b/sci-libs/lightgbm/lightgbm-4.5.0.ebuild new file mode 100644 index 00000000000..0e9ec540ee6 --- /dev/null +++ b/sci-libs/lightgbm/lightgbm-4.5.0.ebuild @@ -0,0 +1,49 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake cuda + +DESCRIPTION="Gradient boosting framework (GBM) based on decision tree algorithms" +HOMEPAGE="https://github.com/microsoft/LightGBM" +SRC_URI="https://github.com/microsoft/LightGBM/archive/refs/tags/v${PV}.tar.gz -> LightGBM-${PV}.tar.gz + https://github.com/boostorg/compute/archive/36350b7d.tar.gz -> compute-36350b7d.tar.gz + https://github.com/google/double-conversion/archive/f4cb2384.tar.gz -> double-conversion-f4cb2384.tar.gz + https://github.com/lemire/fast_double_parser/archive/efec0353.tar.gz -> fast_double_parser-efec0353.tar.gz + https://github.com/fmtlib/fmt/archive/f5e54359.tar.gz -> fmt-f5e54359.tar.gz" +S="${WORKDIR}/LightGBM-${PV}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="cuda" + +RDEPEND="cuda? ( >=dev-util/nvidia-cuda-toolkit-11 )" +DEPEND=">=dev-cpp/eigen-3.4" + +PATCHES=( "${FILESDIR}"/${PN}-4.5.0-eigen3.patch + "${FILESDIR}"/${PN}-4.5.0-libdir.patch ) + +src_prepare() { + rmdir external_libs/compute && ln -sv "${WORKDIR}"/compute-36350b7de849300bd3d72a05d8bf890ca405a014 external_libs/compute || die + rmdir external_libs/fast_double_parser/benchmarks/dependencies/double-conversion && ln -sv "${WORKDIR}"/double-conversion-f4cb2384efa55dee0e6652f8674b05763441ab09 external_libs/fast_double_parser/benchmarks/dependencies/double-conversion || die + rmdir external_libs/fast_double_parser && ln -sv "${WORKDIR}"/fast_double_parser-efec03532ef65984786e5e32dbc81f6e6a55a115 external_libs/fast_double_parser || die + rmdir external_libs/fmt && ln -sv "${WORKDIR}"/fmt-f5e54359df4c26b6230fc61d38aa294581393084 external_libs/fmt || die + cmake_src_prepare + use cuda && cuda_src_prepare +} + +src_configure() { + local mycmakeargs=() + if use cuda; then + # Host compiler should also be nvcc compatible, + # or error occur in the final linking + # CMakeLists also ensures that, so configure fails if we just set CMAKE_CUDA_FLAGS + PATH="$(cuda_gccdir):${PATH}" + mycmakeargs+=( + -DUSE_CUDA=ON + ) + fi + cmake_src_configure +} diff --git a/sci-libs/lightgbm/metadata.xml b/sci-libs/lightgbm/metadata.xml new file mode 100644 index 00000000000..0edac4ac190 --- /dev/null +++ b/sci-libs/lightgbm/metadata.xml @@ -0,0 +1,13 @@ + + + + + xgreenlandforwyy@gmail.com + + + heroxbd@gentoo.org + + + microsoft/LightGBM + + From 710b668293f97a25d7e3ab78c2f10694f93730a7 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Fri, 13 Dec 2024 14:41:27 +0800 Subject: [PATCH 2/3] dev-python/lightgbm: new package, add 4.5.0 Signed-off-by: Yiyang Wu --- dev-python/lightgbm/Manifest | 1 + .../files/lightgbm-4.5.0-loadlib.patch | 14 +++++++++ dev-python/lightgbm/lightgbm-4.5.0.ebuild | 30 +++++++++++++++++++ dev-python/lightgbm/metadata.xml | 11 +++++++ 4 files changed, 56 insertions(+) create mode 100644 dev-python/lightgbm/Manifest create mode 100644 dev-python/lightgbm/files/lightgbm-4.5.0-loadlib.patch create mode 100644 dev-python/lightgbm/lightgbm-4.5.0.ebuild create mode 100644 dev-python/lightgbm/metadata.xml diff --git a/dev-python/lightgbm/Manifest b/dev-python/lightgbm/Manifest new file mode 100644 index 00000000000..1e5899e62da --- /dev/null +++ b/dev-python/lightgbm/Manifest @@ -0,0 +1 @@ +DIST lightgbm-4.5.0.tar.gz 1701072 BLAKE2B 1323d27ad7f34b43699c7d6605d34a6cbca4c85ace1ffdecfd3d169132c6bf97ae23b48634957af093d235f37c85d7ad157a16d93b15eab4ad5bae38ac938aff SHA512 66cf32bd9dc9cd74629052e59b6fe8e404c264a9ef529d40b073685c5ded9a1deb028e78b7ccff48cfe78f29fcc9746ec957a38b14d86c7fa89fd3ed88fbf6ac diff --git a/dev-python/lightgbm/files/lightgbm-4.5.0-loadlib.patch b/dev-python/lightgbm/files/lightgbm-4.5.0-loadlib.patch new file mode 100644 index 00000000000..89fac71f06d --- /dev/null +++ b/dev-python/lightgbm/files/lightgbm-4.5.0-loadlib.patch @@ -0,0 +1,14 @@ +Index: lightgbm-4.5.0/lightgbm/basic.py +=================================================================== +--- lightgbm-4.5.0.orig/lightgbm/basic.py ++++ lightgbm-4.5.0/lightgbm/basic.py +@@ -261,8 +261,7 @@ def _log_callback(msg: bytes) -> None: + + def _load_lib() -> ctypes.CDLL: + """Load LightGBM library.""" +- lib_path = find_lib_path() +- lib = ctypes.cdll.LoadLibrary(lib_path[0]) ++ lib = ctypes.cdll.LoadLibrary("lib_lightgbm.so") + lib.LGBM_GetLastError.restype = ctypes.c_char_p + callback = ctypes.CFUNCTYPE(None, ctypes.c_char_p) + lib.callback = callback(_log_callback) # type: ignore[attr-defined] diff --git a/dev-python/lightgbm/lightgbm-4.5.0.ebuild b/dev-python/lightgbm/lightgbm-4.5.0.ebuild new file mode 100644 index 00000000000..9d012f662df --- /dev/null +++ b/dev-python/lightgbm/lightgbm-4.5.0.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +DISTUTILS_USE_PEP517=scikit-build-core + +inherit distutils-r1 pypi + +DESCRIPTION="LightGBM Python Package" +HOMEPAGE="https://github.com/microsoft/LightGBM" +SRC_URI="$(pypi_sdist_url "${PN^}" "${PV}")" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND="dev-python/wheel[${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/scipy[${PYTHON_USEDEP}] + dev-python/scikit-learn[${PYTHON_USEDEP}] + sci-libs/lightgbm" +distutils_enable_tests pytest + +PATCHES=( "${FILESDIR}/${PN}-4.5.0-loadlib.patch" ) + +python_compile() { + SKBUILD_WHEEL_CMAKE=false distutils-r1_python_compile +} diff --git a/dev-python/lightgbm/metadata.xml b/dev-python/lightgbm/metadata.xml new file mode 100644 index 00000000000..14d853470db --- /dev/null +++ b/dev-python/lightgbm/metadata.xml @@ -0,0 +1,11 @@ + + + + + heroxbd@gentoo.org + + + microsoft/LightGBM + Lightgbm + + From 40585ea39ceb9ecf72548d08cbcdfbdd0bd29f88 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Sun, 15 Dec 2024 12:13:11 +0800 Subject: [PATCH 3/3] dev-python/lightgbm: add myself as a maintainer Signed-off-by: Yiyang Wu --- dev-python/lightgbm/metadata.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev-python/lightgbm/metadata.xml b/dev-python/lightgbm/metadata.xml index 14d853470db..35dd5ba0061 100644 --- a/dev-python/lightgbm/metadata.xml +++ b/dev-python/lightgbm/metadata.xml @@ -1,6 +1,9 @@ + + xgreenlandforwyy@gmail.com + heroxbd@gentoo.org