Correct const-ness of write to agree with ftdi.h
[libftdi] / libftdi1.spec.in
1 %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
2
3 Summary:   Library to program and control the FTDI USB controller
4 Name:      libftdi1
5 Version:   @VERSION@
6 Release:   1
7 License:   LGPL for libftdi and GPLv2+linking exception for the C++ wrapper
8 Group:     System Environment/Libraries
9 Vendor:    Intra2net AG
10 Source:    https://www.intra2net.com/en/developer/libftdi/download/%{name}-%{version}.tar.bz2
11 Buildroot: /tmp/%{name}-%{version}-root
12 Requires:  libusb1
13 BuildRequires: libusb1, libusb1-devel, pkgconfig, doxygen
14 BuildRequires: swig python-devel
15 Prefix:    /usr
16 URL:       https://www.intra2net.com/en/developer/libftdi
17
18 %package   devel
19 Summary:   Header files and static libraries for libftdi1
20 Group:     Development/Libraries
21 Requires:  libftdi1 = %{version}, libusb1-devel
22
23 %package python
24 Summary: Python bindings for libftdi
25 License: LGPL
26 Group: Development/Libraries
27 Requires: %{name} = %{version}-%{release}
28
29 %description 
30 Library to program and control the FTDI USB controller
31
32 %description devel
33 Header files and static libraries for libftdi1
34
35 %description python
36 Python bindings for libftdi1 generated by SWIG
37
38 %prep
39 %setup -q
40
41 %build
42
43 mkdir build
44 cd build
45
46 export CFLAGS="$RPM_OPT_FLAGS"
47 export CXXFLAGS="$RPM_OPT_FLAGS"
48 cmake -DCMAKE_INSTALL_PREFIX="%{prefix}" ../
49
50 make %{?_smp_mflags}
51
52 %install
53 cd build
54 make DESTDIR=$RPM_BUILD_ROOT install
55
56 # Remove example programs
57 rm -f $RPM_BUILD_ROOT/usr/bin/simple
58 rm -f $RPM_BUILD_ROOT/usr/bin/bitbang
59 rm -f $RPM_BUILD_ROOT/usr/bin/bitbang2
60 rm -f $RPM_BUILD_ROOT/usr/bin/bitbang_ft2232
61 rm -f $RPM_BUILD_ROOT/usr/bin/bitbang_cbus
62 rm -f $RPM_BUILD_ROOT/usr/bin/find_all
63 rm -f $RPM_BUILD_ROOT/usr/bin/find_all_pp
64 rm -f $RPM_BUILD_ROOT/usr/bin/serial_test
65 rm -f $RPM_BUILD_ROOT/usr/bin/baud_test
66
67 # Clean python compiled files in examples dir
68 find $RPM_BUILD_ROOT%{prefix}/share/libftdi/examples -name "*.pyc" -or -name "*.pyo" -exec rm -f \{\} \;
69
70 # move documentation to version specific directory
71 # Is there an easy way in cmake to set the DOCDIR?
72 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/doc/%{name}-%{version}
73 mv $RPM_BUILD_ROOT%{prefix}/share/doc/%{name}/* $RPM_BUILD_ROOT%{prefix}/share/doc/%{name}-%{version}
74
75 %clean
76 rm -fr $RPM_BUILD_ROOT
77
78 %files
79 %defattr(-,root,root)
80 %doc COPYING.LIB COPYING.GPL LICENSE
81 %{_libdir}/libftdi1*.so*
82 %{_libdir}/libftdipp1*.so*
83
84 %files devel
85 %defattr(-,root,root)
86 %doc build/doc/html build/doc/man
87 %{_bindir}/ftdi_eeprom
88 %{_bindir}/libftdi1-config
89 %{prefix}/include/libftdi1/*.h
90 %{prefix}/include/libftdi1/*.hpp
91 %{prefix}/share/libftdi/examples/*
92 %{_libdir}/libftdi1*.*a
93 %{_libdir}/libftdipp1*.*a
94 %{_libdir}/pkgconfig/*.pc
95 %{_libdir}/cmake/libftdi1/*
96
97 %files python
98 %defattr(-,root,root,-)
99 %attr(755,root,root) %{python_sitearch}/_ftdi1.so
100 %{python_sitearch}/ftdi1.py*