[liblinear/el5] adaptions for new Python-guidelines generate .pc-file on-the-fly minor cleanup

Björn Esser besser82 at fedoraproject.org
Wed Oct 2 13:43:27 UTC 2013


commit 92cffa2d997a8c579acc7bb7b780dc7d75b48b36
Author: Björn Esser <bjoern.esser at gmail.com>
Date:   Wed Oct 2 15:35:56 2013 +0200

    adaptions for new Python-guidelines
    generate .pc-file on-the-fly
    minor cleanup

 liblinear.pc.in |   14 ----------
 liblinear.spec  |   75 +++++++++++++++++++++++++++++++-----------------------
 2 files changed, 43 insertions(+), 46 deletions(-)
---
diff --git a/liblinear.spec b/liblinear.spec
index c5780c5..1fb8210 100644
--- a/liblinear.spec
+++ b/liblinear.spec
@@ -1,19 +1,23 @@
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%global __python_sitearch %{python2_sitearch}
+%else
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%global __python_sitearch %{python_sitearch}
+%endif
 
 Name:		liblinear
 Version:	1.93
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	Library for Large Linear Classification
 %{?el5:Group:	System Environment/Libraries}
 
 License:	BSD
 URL:		http://www.csie.ntu.edu.tw/~cjlin/%{name}
 Source0:	%{url}/%{name}-%{version}.tar.gz
-Source1:	%{name}.pc.in
-Source2:	%{url}/index.html
-Source3:	%{url}/FAQ.html
-Source4:	%{url}/exp.html
-Source5:	http://www.csie.ntu.edu.tw/~cjlin/papers/%{name}.pdf
+Source1:	%{url}/index.html
+Source2:	%{url}/FAQ.html
+Source3:	%{url}/exp.html
+Source4:	http://www.csie.ntu.edu.tw/~cjlin/papers/%{name}.pdf
 
 # simple fixes, not needed by upstream
 Patch0:		liblinear-adapt_makefile.patch
@@ -68,7 +72,7 @@ applications that use %{name}.
 Summary:	Documentation files for %{name}
 %{?el5:Group:	Documentation}
 
-%{?!el5:BuildArch:	noarch}
+%{!?el5:BuildArch:	noarch}
 
 %description doc
 The %{name}-doc package contains some brief documentation for developing
@@ -92,7 +96,6 @@ For further information read "README.python" included in the
 %if 0%{?fedora} || 0%{?rhel} >= 7
 %package -n python3-%{name}
 Summary:	Python3 bindings for %{name}
-
 Requires:	%{name}%{?_isa} = %{version}-%{release}
 
 %description  -n python3-%{name}
@@ -106,28 +109,32 @@ For further information read "README.python" included in the
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 
-# pull in SourceX
-install -pm 0644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} .
+# pull in other sources
+install -pm 0644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
 
 # remove bundled stuff
 rm -rf blas/ matlab/ windows/ Makefile.*
 
-# create dummy-configure
-echo '#!/bin/sh' > configure
-chmod +x ./configure
+# add pkg-config file
+cat << EOF >> %{name}.pc
+#################################
+# Pkg-Config file for %{name} #
+#################################
 
-# configure pkg-config file
-sed	-e 's!@url@!%{url}!g' \
-	-e 's!@version@!%{version}!g' \
-	-e 's!@prefix@!%{_prefix}!g' \
-	-e 's!@includedir@!%{_includedir}!g' \
-< %{name}.pc.in \
-> %{name}.pc
+Name: %{name}
+Description: Library for Large Linear Classification
+URL: %{url}
+Version: %{version}
 
-# apply patches
-%patch0 -p1
-%patch1 -p1
+prefix=%{_prefix}
+includedir=%{_includedir}
+
+Cflags: -I\$\{includedir\}/liblinear
+Libs: -llinear
+EOF
 
 # rename python/README for inclusion in doc
 mv python/README README.python
@@ -137,7 +144,7 @@ sed -i -e '/#!\//d' python/*.py
 
 
 %build
-%configure
+%configure ||:
 make %{?_smp_mflags}
 
 
@@ -145,11 +152,10 @@ make %{?_smp_mflags}
 %{?el5:rm -rf %{buildroot}}
 
 # no install-target in Makefile
-mkdir -p	%{buildroot}%{_bindir} \
-		%{buildroot}%{_libdir}/pkgconfig \
-		%{buildroot}%{_includedir}/%{name} \
-		%{buildroot}%{python_sitearch} \
-		%{buildroot}%{python3_sitearch}
+mkdir -p %{buildroot}%{_bindir}			\
+	%{buildroot}%{_libdir}/pkgconfig	\
+	%{buildroot}%{_includedir}/%{name}	\
+	%{buildroot}%{__python_sitearch}
 
 install -pm 0755 predict %{buildroot}%{_bindir}/%{name}-predict
 install -pm 0755 train %{buildroot}%{_bindir}/%{name}-train
@@ -158,9 +164,10 @@ ln -s %{name}.so.1 %{buildroot}%{_libdir}/%{name}.so
 install -pm 0644 %{name}.pc %{buildroot}%{_libdir}/pkgconfig
 install -pm 0644 {linear,tron}.h %{buildroot}%{_includedir}/%{name}
 
-install -pm 0644 python/*.py %{buildroot}%{python_sitearch}
+install -pm 0644 python/*.py %{buildroot}%{__python_sitearch}
 
 %if 0%{?fedora} || 0%{?rhel} >= 7
+mkdir -p %{buildroot}%{python3_sitearch}
 install -pm 0644 python/*.py %{buildroot}%{python3_sitearch}
 %endif
 
@@ -170,7 +177,6 @@ install -pm 0644 python/*.py %{buildroot}%{python3_sitearch}
 
 
 %post -p /sbin/ldconfig
-
 %postun -p /sbin/ldconfig
 
 
@@ -191,7 +197,7 @@ install -pm 0644 python/*.py %{buildroot}%{python3_sitearch}
 %doc COPYRIGHT README* {predict,train}.c *.html *.pdf
 
 %files -n python-%{name}
-%{python_sitearch}/*
+%{__python_sitearch}/*
 
 %if 0%{?fedora} || 0%{?rhel} >= 7
 %files -n python3-%{name}
@@ -200,6 +206,11 @@ install -pm 0644 python/*.py %{buildroot}%{python3_sitearch}
 
 
 %changelog
+* Wed Oct 02 2013 Björn Esser <bjoern.esser at gmail.com> - 1.93-3
+- adaptions for new Python-guidelines
+- generate .pc-file on-the-fly
+- minor cleanup
+
 * Mon Aug 12 2013 Björn Esser <bjoern.esser at gmail.com> - 1.93-2
 - build arched python-plugins
 - nuke hashbang from python-plugins


More information about the ml mailing list