SHA256
8
0
forked from pool/libsvm

Accepting request 879538 from home:aaronpuchert

- Fix build by adding missing python-rpm-macros dependency.
- Build Python bindings for current Python version.
- Make sure we're actually using the compiler flags.
- Fix shebangs.

OBS-URL: https://build.opensuse.org/request/show/879538
OBS-URL: https://build.opensuse.org/package/show/science/libsvm?expand=0&rev=17
This commit is contained in:
2021-03-20 17:07:11 +00:00
committed by Git OBS Bridge
parent 970770d7e6
commit 2309e060ee
2 changed files with 31 additions and 12 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Mar 16 23:03:23 UTC 2021 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- Fix build by adding missing python-rpm-macros dependency.
- Build Python bindings for current Python version.
- Make sure we're actually using the compiler flags.
- Fix shebangs.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Sep 11 11:54:50 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de> Wed Sep 11 11:54:50 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package libsvm # spec file for package libsvm
# #
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -25,12 +25,13 @@ Release: 0
URL: https://www.csie.ntu.edu.tw/~cjlin/libsvm/ URL: https://www.csie.ntu.edu.tw/~cjlin/libsvm/
Source0: https://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{version}.tar.gz Source0: https://www.csie.ntu.edu.tw/~cjlin/libsvm/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{python_module devel}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: java-devel BuildRequires: java-devel
BuildRequires: javapackages-tools BuildRequires: javapackages-tools
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: python-devel BuildRequires: python-rpm-macros
%description %description
LIBSVM is an integrated software for support vector classification, LIBSVM is an integrated software for support vector classification,
@@ -67,14 +68,14 @@ Conflicts: vpp-devel
This package contains the libraries and header files needed for This package contains the libraries and header files needed for
developing applications with libsvm. developing applications with libsvm.
%package -n python-svm %package -n %{python_prefix}-svm
Summary: Python bindings for libsvm Summary: Python bindings for libsvm
Group: Development/Languages/Python Group: Development/Languages/Python
Requires: gnuplot Requires: gnuplot
Requires: svm-tools = %{version} Requires: svm-tools = %{version}
BuildArch: noarch BuildArch: noarch
%description -n python-svm %description -n %{python_prefix}-svm
This package contains the Python bindings for libsvm. This package contains the Python bindings for libsvm.
%package java %package java
@@ -94,10 +95,12 @@ This package contains the Java bindings for libsvm.
%setup -q %setup -q
%build %build
export CFLAGS="%{optflags} -Wconversion -fPIC" # We can't override CFLAGS, we have to patch the Makefile.
make sed -i '
make all s/^CFLAGS = .*$/CFLAGS = %{optflags} -Wall -Wconversion -fPIC/g
make lib s/$(CXX) $${SHARED_LIB_FLAG}/$(CXX) %{optflags} $${SHARED_LIB_FLAG}/g
' Makefile
make %{_smp_mflags} all lib
rm -f java/libsvm.jar rm -f java/libsvm.jar
make -C java make -C java
@@ -121,10 +124,18 @@ ln -s %{_libdir}/libsvm.so.2 %{buildroot}%{_libdir}/libsvm.so
mv ./python/README README-python mv ./python/README README-python
mv ./tools/README README-python-tools mv ./tools/README README-python-tools
install -m 755 ./python/svm.py %{buildroot}%{python_sitelib}/svm # Don't use env in shebangs, and prefer the default Python.
install -m 755 ./python/svmutil.py %{buildroot}%{python_sitelib}/svm # (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors)
sed -i '1s|/usr/bin/env *|%{_bindir}/|;1s|/usr/bin/python$|%{_bindir}/python%python_bin_suffix|' \
%{buildroot}%{_bindir}/svm-*
install -m 644 ./python/svm.py %{buildroot}%{python_sitelib}/svm
install -m 644 ./python/svmutil.py %{buildroot}%{python_sitelib}/svm
touch %{buildroot}%{python_sitelib}/svm/__init__.py touch %{buildroot}%{python_sitelib}/svm/__init__.py
# Remove unnecessary shebangs.
sed -i '/^#!\/usr\/bin\/env .*$/d' %{buildroot}%{python_sitelib}/svm/*
install -m 755 ./java/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar install -m 755 ./java/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
%fdupes -s %{buildroot} %fdupes -s %{buildroot}
@@ -140,14 +151,14 @@ install -m 755 ./java/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
%{_bindir}/svm-predict %{_bindir}/svm-predict
%files -n libsvm2 %files -n libsvm2
%doc COPYRIGHT %license COPYRIGHT
%{_libdir}/libsvm.so.2 %{_libdir}/libsvm.so.2
%files devel %files devel
%{_includedir}/libsvm %{_includedir}/libsvm
%{_libdir}/libsvm.so %{_libdir}/libsvm.so
%files -n python-svm %files -n %{python_prefix}-svm
%doc README-python README-python-tools %doc README-python README-python-tools
%{_bindir}/svm-checkdata %{_bindir}/svm-checkdata
%{_bindir}/svm-grid %{_bindir}/svm-grid