From 3918d4b5683afd58d0170f9972854929cd4303cc Mon Sep 17 00:00:00 2001 From: Marcin Deranek Date: Sun, 8 Jan 2023 15:43:43 +0100 Subject: Initial ebuild for dev-libs/fastText --- dev-libs/fastText/Manifest | 2 + dev-libs/fastText/fastText-0.9.2.ebuild | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 dev-libs/fastText/Manifest create mode 100644 dev-libs/fastText/fastText-0.9.2.ebuild (limited to 'dev-libs') diff --git a/dev-libs/fastText/Manifest b/dev-libs/fastText/Manifest new file mode 100644 index 0000000..4d7f44a --- /dev/null +++ b/dev-libs/fastText/Manifest @@ -0,0 +1,2 @@ +DIST fastText-0.9.2.gh.tar.gz 4036722 BLAKE2B ea3af92ce18d04241128cfb28773f0785a006e79c861d718c2c6ad788d776ad60b0543a42eb8be5a865cbc12283355521431fe2fba48544399e4a2b1520ff3f1 SHA512 8f0f6e78b3c6b3c7e7d107778952f340cc208b8e0b920dd118a57884cca8ef7007ea88b6f3352cb7e08289a64743f507309e1e1259c785f810af7f5fa09f2656 +EBUILD fastText-0.9.2.ebuild 1745 BLAKE2B 1462b4a1b7a700c6b5cfac636b2a7b237d147f6137c7858ed95bf25fc1d0c6d4c4dfab929b16ea90217d140d791f03a9c1f0f312e58efd6f683f72a3c54888d6 SHA512 786b52ec8088d8045ad6b1f3bc583d1e12e9414ba9597673a61ff30b1d2ca75d11ca152b2d93dfc8cc52c03d6557e2fe23f59fb32333ce82cc7ce3b49f7770a8 diff --git a/dev-libs/fastText/fastText-0.9.2.ebuild b/dev-libs/fastText/fastText-0.9.2.ebuild new file mode 100644 index 0000000..c9636f9 --- /dev/null +++ b/dev-libs/fastText/fastText-0.9.2.ebuild @@ -0,0 +1,74 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python3_{8..11} ) + +inherit cmake distutils-r1 + +DESCRIPTION="Library for fast text representation and classification" +HOMEPAGE="https://github.com/facebookresearch/fastText" +SRC_URI="https://github.com/facebookresearch/${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="python" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +CDEPEND="dev-python/numpy[${PYTHON_USEDEP}]" +RDEPEND="python? ( ${PYTHON_DEPS} + ${CDEPEND} )" +DEPEND="python? ( ${CDEPEND} )" +BDEPEND="python? ( dev-python/pybind11[${PYTHON_USEDEP}] )" + +src_prepare() { + cmake_src_prepare + use python && distutils-r1_src_prepare + + sed -i -e "/CMAKE_CXX_FLAGS/d" \ + -e "s/\(DESTINATION\) lib/\1 $(get_libdir)/g" \ + CMakeLists.txt || die "sed failed for CMakeLists.txt" + sed -i "/extra_compile_args=/,+1d" setup.py \ + || die "sed failed for setup.py" +} + +python_prepare_all() { + # fix QA + sed -i '/description/s/-/_/' setup.cfg || die "sed failed for setup.cfg" + distutils-r1_python_prepare_all +} + +src_configure() { + cmake_src_configure + use python && distutils-r1_src_configure +} + +src_compile() { + cmake_src_compile + use python && distutils-r1_src_compile +} + +src_test() { + use python && distutils-r1_src_test +} + +python_test() { + "${EPYTHON}" runtests.py -u || die "test fails" +} + +src_install() { + cmake_src_install + use python && distutils-r1_src_install + + find "${ED}" -name '*.a' -delete || die "find failed" +} + +python_install_all() { + distutils-r1_python_install_all + find "${ED}" -type d -name "tests" -exec rm -rv {} + \ + || die "test removing failed" +} -- cgit v1.2.3