Build the python3 bindings and add a subpackage for them.
- Remove the CMakeLists patch file in favor of built-in CMake python library search configuration, which also allows building for both python3 and python2. - Add missing requires to -devel on the python bindings to ensure the included examples can be ran. - Do not include byte-compiled files for python scripts.
This commit is contained in:
parent
e294c33cda
commit
654187c77e
@ -1,13 +0,0 @@
|
||||
--- python/CMakeLists.txt~ 2016-05-20 01:53:12.000000000 -0500
|
||||
+++ python/CMakeLists.txt 2016-06-14 14:07:30.001554507 -0500
|
||||
@@ -12,8 +12,8 @@
|
||||
set ( SWIG_FOUND TRUE )
|
||||
endif ()
|
||||
endif ()
|
||||
- find_package ( PythonLibs )
|
||||
- find_package ( PythonInterp )
|
||||
+ find_package ( PythonLibs 2.7 REQUIRED )
|
||||
+ find_package ( PythonInterp 2.7 REQUIRED )
|
||||
endif ()
|
||||
|
||||
if ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
|
52
libftdi.spec
52
libftdi.spec
@ -1,13 +1,12 @@
|
||||
Name: libftdi
|
||||
Version: 1.3
|
||||
Release: 9%{?dist}
|
||||
Release: 10%{?dist}
|
||||
Summary: Library to program and control the FTDI USB controller
|
||||
|
||||
Group: System Environment/Libraries
|
||||
License: LGPLv2
|
||||
URL: http://www.intra2net.com/de/produkte/opensource/ftdi/
|
||||
Source0: http://www.intra2net.com/en/developer/%{name}/download/%{name}1-%{version}.tar.bz2
|
||||
Patch0: libftdi-python-version.patch
|
||||
|
||||
BuildRequires: boost-devel
|
||||
BuildRequires: cmake
|
||||
@ -15,7 +14,9 @@ BuildRequires: doxygen
|
||||
BuildRequires: libconfuse-devel
|
||||
BuildRequires: libusbx-devel
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: swig
|
||||
BuildRequires: gcc-c++
|
||||
Requires: systemd
|
||||
|
||||
|
||||
@ -27,6 +28,7 @@ FT232BM and FT245BM type chips including the popular bitbang mode.
|
||||
Summary: Header files and static libraries for libftdi
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: python3-%{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: pkgconfig
|
||||
|
||||
%description devel
|
||||
@ -45,6 +47,15 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
%description -n python2-libftdi
|
||||
Libftdi Python Language bindings.
|
||||
|
||||
%package -n python3-libftdi
|
||||
%{?python_provide:%python_provide python3-libftdi}
|
||||
Summary: Libftdi library Python 3 binding
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description -n python3-libftdi
|
||||
Libftdi Python 3 Language bindings.
|
||||
|
||||
%package c++
|
||||
Summary: Libftdi library C++ binding
|
||||
Group: Development/Libraries
|
||||
@ -67,21 +78,37 @@ for building C++ applications with libftdi.
|
||||
%prep
|
||||
%setup -q -n %{name}1-%{version}
|
||||
|
||||
%patch0 -p0
|
||||
|
||||
#kernel does not provide usb_device anymore
|
||||
sed -i -e 's/usb_device/usb/g' packages/99-libftdi.rules
|
||||
sed -i -e 's/GROUP="plugdev"/TAG+="uaccess"/g' packages/99-libftdi.rules
|
||||
|
||||
%build
|
||||
export CMAKE_PREFIX_PATH=/usr
|
||||
%{cmake} .
|
||||
|
||||
mkdir build-py2
|
||||
pushd build-py2
|
||||
%{cmake} -DPython_ADDITIONAL_VERSIONS=%{python2_version} ..
|
||||
make %{?_smp_mflags}
|
||||
popd
|
||||
|
||||
mkdir build-py3
|
||||
pushd build-py3
|
||||
%{cmake} -DPython_ADDITIONAL_VERSIONS=%{python3_version} ..
|
||||
make %{?_smp_mflags}
|
||||
popd
|
||||
|
||||
# Fix python sheband lines
|
||||
find python/examples -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} +
|
||||
|
||||
%install
|
||||
# Install python2, since we'll prefer python3 with the second install.
|
||||
pushd build-py2
|
||||
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
popd
|
||||
|
||||
pushd build-py3
|
||||
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
|
||||
popd
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/lib/udev/rules.d/
|
||||
install -p -m 644 packages/99-libftdi.rules $RPM_BUILD_ROOT/lib/udev/rules.d/69-libftdi.rules
|
||||
@ -91,7 +118,7 @@ find $RPM_BUILD_ROOT -type f -name "*.a" -delete
|
||||
|
||||
#no man install
|
||||
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3
|
||||
install -p -m 644 doc/man/man3/*.3 $RPM_BUILD_ROOT%{_mandir}/man3
|
||||
install -p -m 644 build-py3/doc/man/man3/*.3 $RPM_BUILD_ROOT%{_mandir}/man3
|
||||
|
||||
# Cleanup examples
|
||||
rm -f $RPM_BUILD_ROOT/%{_bindir}/simple
|
||||
@ -120,7 +147,7 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/libftdi1/example.conf
|
||||
/lib/udev/rules.d/69-libftdi.rules
|
||||
|
||||
%files devel
|
||||
%doc doc/html
|
||||
%doc build-py3/doc/html
|
||||
%doc %{_datadir}/libftdi/examples
|
||||
%{_bindir}/ftdi_eeprom
|
||||
%{_bindir}/libftdi1-config
|
||||
@ -128,10 +155,16 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/libftdi1/example.conf
|
||||
%{_includedir}/libftdi1
|
||||
%{_libdir}/pkgconfig/libftdi1.pc
|
||||
%{_mandir}/man3/*
|
||||
# Don't include byte-compiled files for python scripts.
|
||||
%exclude %{_datadir}/libftdi/examples/*.pyc
|
||||
%exclude %{_datadir}/libftdi/examples/*.pyo
|
||||
|
||||
%files -n python2-libftdi
|
||||
%{python2_sitearch}/*
|
||||
|
||||
%files -n python3-libftdi
|
||||
%{python3_sitearch}/*
|
||||
|
||||
%files c++
|
||||
%{_libdir}/libftdipp1.so.2*
|
||||
|
||||
@ -147,6 +180,11 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/libftdi1/example.conf
|
||||
%postun c++ -p /sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Mon Oct 09 2017 Troy Curtis, Jr <troycurtisjr@gmail.com> - 1.3-10
|
||||
- Add python3 subpackage.
|
||||
- Drop patch0 in favor of built-in cmake config methods.
|
||||
- Don't include bytecompiled files for the example python scripts.
|
||||
|
||||
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.3-9
|
||||
- Add Provides for the old name without %%_isa
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user