forked from pool/python-fasttext
Accepting request 1206651 from home:jirislaby:branches:devel:languages:python
- switch to cmake + ninja * the former builds a proper lib - package the shared library, fasttext binary and -devel properly (create new %package's for those) - add patches to fit our needs: * no-static-lib.patch * proper-lib-dir.patch * py-link-against-shared.patch OBS-URL: https://build.opensuse.org/request/show/1206651 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fasttext?expand=0&rev=11
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-fasttext
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -16,8 +16,8 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define modname fastText
|
||||
%define sover 0
|
||||
# Using annotation futures and dataclasses
|
||||
%define skip_python36 1
|
||||
%{?sle15_python_module_pythons}
|
||||
@@ -30,12 +30,17 @@ URL: https://github.com/facebookresearch/fastText
|
||||
Source: https://github.com/facebookresearch/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
|
||||
Patch0: reproducible.patch
|
||||
Patch1: gcc13-fix.patch
|
||||
Patch2: no-static-lib.patch
|
||||
Patch3: proper-lib-dir.patch
|
||||
Patch4: py-link-against-shared.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pybind11-devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: ninja
|
||||
BuildRequires: python-rpm-macros
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module numpy}
|
||||
@@ -43,17 +48,44 @@ BuildRequires: %{python_module pybind11 >= 2.2}
|
||||
BuildRequires: %{python_module setuptools >= 0.7.0}
|
||||
# /SECTION
|
||||
BuildRequires: fdupes
|
||||
Requires: fasttext
|
||||
Requires: python-numpy
|
||||
Requires: python-pybind11 >= 2.2
|
||||
Requires: python-setuptools >= 0.7.0
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
fastText is a library for efficient learning of word
|
||||
representations and sentence classification.
|
||||
|
||||
%package -n fasttext
|
||||
Summary: Fast text representation and classification
|
||||
|
||||
%description -n fasttext
|
||||
fastText is a library for efficient learning of word
|
||||
representations and sentence classification.
|
||||
|
||||
This package provides the fasttext binary.
|
||||
|
||||
%package -n fasttext-devel
|
||||
Summary: Development files for fasttext
|
||||
Requires: libfasttext%{sover}
|
||||
|
||||
%description -n fasttext-devel
|
||||
fastText is a library for efficient learning of word
|
||||
representations and sentence classification.
|
||||
|
||||
This package provides the fasttext library development files.
|
||||
|
||||
%package -n libfasttext%{sover}
|
||||
Summary: Library for fast text representation and classification
|
||||
|
||||
%description -n libfasttext%{sover}
|
||||
fastText is a library for efficient learning of word
|
||||
representations and sentence classification.
|
||||
|
||||
This package provides the fasttext library.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n %{modname}-%{version}
|
||||
|
||||
@@ -61,35 +93,46 @@ sed -Ei "1{/^#!\/usr\/bin\/env python/d}" \
|
||||
python/fasttext_module/fasttext/util/util.py
|
||||
|
||||
%build
|
||||
export CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"
|
||||
%make_build
|
||||
pushd .
|
||||
%define __builddir build-cmake
|
||||
%define __builder ninja
|
||||
%cmake
|
||||
%cmake_build
|
||||
popd
|
||||
|
||||
export LDFLAGS=-L%{__builddir}
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%cmake_install
|
||||
%pyproject_install
|
||||
%{python_expand :
|
||||
install -Dpm 0755 fasttext %{buildroot}%{_bindir}/fasttext
|
||||
%python_clone -a %{buildroot}%{_bindir}/fasttext
|
||||
%fdupes %{buildroot}%{$python_sitearch}
|
||||
}
|
||||
|
||||
%check
|
||||
# Tests require 300+MB test data
|
||||
|
||||
%post
|
||||
%python_install_alternative fasttext
|
||||
|
||||
%postun
|
||||
%python_uninstall_alternative fasttext
|
||||
%ldconfig_scriptlets -n libfasttext%{sover}
|
||||
|
||||
%files %{python_files}
|
||||
%doc README.md docs/
|
||||
%license LICENSE
|
||||
# fasttext.pc.in
|
||||
%python_alternative %{_bindir}/fasttext
|
||||
%{python_sitearch}/fasttext
|
||||
%{python_sitearch}/fasttext-%{version}*-info
|
||||
%{python_sitearch}/fasttext_pybind.*.so
|
||||
|
||||
%files -n fasttext
|
||||
%doc README.md docs/
|
||||
%license LICENSE
|
||||
%{_bindir}/fasttext
|
||||
|
||||
%files -n fasttext-devel
|
||||
%dir %{_includedir}/fasttext
|
||||
%{_includedir}/fasttext/*.h
|
||||
%{_libdir}/libfasttext.so
|
||||
%{_libdir}/pkgconfig/fasttext.pc
|
||||
|
||||
%files -n libfasttext%{sover}
|
||||
%{_libdir}/libfasttext.so.%{sover}
|
||||
|
||||
%changelog
|
||||
|
Reference in New Issue
Block a user