1
%define modname pciDriver
3
%{!?__python2: %global __python2 /usr/bin/python2}
4
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
5
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
7
Summary: Universal PCI driver
9
Version: ${CPACK_PACKAGE_VERSION}
12
Group: Development/Libraries
13
Source: ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
14
BuildRoot: %{_tmppath}/%{name}-%{version}-root
15
URL: http://darksoft.org
18
BuildRequires: libfastwriter-devel libxml2-devel uthash
19
BuildRequires: python python-devel swig
20
BuildRequires: kernel-devel dkms
21
BuildRequires: doxygen
22
BuildRequires: pkg-config libtool cmake
23
Vendor: Institute for Data Processing and Electronics, KIT
24
Packager: Suren A. Chilingaryan <csa@suren.me>
27
pcitool is a command line tool to manipulate PCI hardware. It provides ability
28
to get/set registers, read/write data using DMA engine, and debug hardware
31
%package -n libpcilib${PCILIB_ABI_VERSION}
32
Summary: User-space PCI library
33
Group: Development/Libraries
34
Requires: pcilib-python >= %{version}
35
Requires: pcilib-dkms >= %{version}
37
%description -n libpcilib${PCILIB_ABI_VERSION}
38
pcilib is a user-space library providing structured access to the PCI hardware.
39
API exposes 4 API layers.
40
- PCI memory access - allows to map PCI bar memory into the address space of
41
user application and manipulate it directly.
42
- Register access - allows to read and write device registers. The register
43
model is defined using XML. Besides the direct hardware access, the register
44
values can be filtered using Python scripts. This allows to convert hardware
45
reading to standard units, make consistency checking, and create meta registers
46
setting multiple registers from a single parameter.
47
- DMA engine - allows high-speed reading and writting using DMA. The DMA
48
engines are implemented in user-space as plugins.
49
- Event engine - allows polling for hardware events and grabbing the data
50
associated with the event in multiple supported formats. The event engines
51
are implemented as plugins and are not part of this package.
53
%package -n libpcilib-devel
54
Summary: Development files for pcilib
55
Group: Development/Libraries
56
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
58
%description -n libpcilib-devel
59
Development files for user-space PCI library
61
%package -n pcilib-test
62
Summary: Testing files for pcilib
63
Group: Development/Libraries
64
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
66
%description -n pcilib-test
67
Sample XML register model and a few applications for testing pcilib
69
%package -n pcilib-python
70
Summary: Python wrapper for pcilib
71
Group: Development/Libraries
72
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
74
%description -n pcilib-python
75
Python wrapper for pcilib. The python wrapper is used
76
- By register scripts which are used to convert hardware reading to standard
77
units, make consistency checking, and create meta registers setting multiple
78
registers from a single parameter.
79
- pcilib web api which used to provide register and dma access from remote
82
%package -n pcilib-dkms
83
Summary: Kernel module providing low-level PCI access
84
Group: Development/Libraries
85
Requires: dkms bash gcc make
87
%description -n pcilib-dkms
88
Minimalistic driver used by pcilib to
90
- Map PCI regions into the user space
91
- Allocate persistent page-locked memory for DMA operations
92
and map it into the user-space
93
- Ensure access syncrhonization between multiple applications
95
%package -n pcilib-server
96
Summary: Pcilib Web API
97
Group: Development/Libraries
98
Requires: pcilib-python = %{version}
101
%description -n pcilib-server
102
Pcilib Web API and small demo web server.
105
%setup -q -n pcitool-%{version}
108
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
109
-DPCILIB_PLUGIN_DIR=%{_libdir}/pcilib${PCILIB_ABI_VERSION}/ -DPCILIB_DATA_DIR=%{_datadir}/pcilib${PCILIB_ABI_VERSION}/ \
110
-DLIB_INSTALL_DIR=%{_libdir} -DBIN_INSTALL_DIR=%{_bindir} -DDATA_INSTALL_DIR=%{_datadir} -DINCLUDE_INSTALL_DIR=%{_includedir} -DPYTHON_INSTALL_DIR=%{python2_sitearch} .
115
rm -rf $RPM_BUILD_ROOT
116
make install DESTDIR=$RPM_BUILD_ROOT
117
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pcilib${PCILIB_ABI_VERSION}/
120
install -m 755 tests/reload.sh $RPM_BUILD_ROOT/%{_bindir}/pci-reload
123
mkdir -p $RPM_BUILD_ROOT/usr/lib/udev/rules.d
124
install -m 644 misc/50-pcidriver.rules $RPM_BUILD_ROOT/%{_udevrulesdir}
127
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/linux/
128
install -m 644 driver/ioctl.h $RPM_BUILD_ROOT/%{_includedir}/linux/pcidriver.h
129
mkdir -p $RPM_BUILD_ROOT/usr/src/%{modname}-%{version}/pcilib/
130
install -m 644 misc/dkms.conf $RPM_BUILD_ROOT/%{_prefix}/src/%{modname}-%{version}/
131
install -m 644 pcilib/*.h $RPM_BUILD_ROOT/%{_prefix}/src/%{modname}-%{version}/pcilib/
132
cp -r driver $RPM_BUILD_ROOT/usr/src/%{modname}-%{version}/
135
cp -r xml/test $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/
138
cp -r pyserver $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/
141
rm -rf $RPM_BUILD_ROOT
143
%post -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig
145
%postun -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig
148
if [ -z "`dkms status -m %{modname} -v %{version}`" ]; then
149
echo "Add module source to dkms"
150
dkms add -m %{modname} -v %{version} --rpm_safe_upgrade
152
echo "Build module with dkms"
153
dkms build -m %{modname} -v %{version}
154
dkms install -m %{modname} -v %{version}
158
%preun -n pcilib-dkms
159
/usr/sbin/dkms remove -m %{modname} -v %{version} --all --rpm_safe_upgrade
163
%defattr(-, root, root)
165
%{_bindir}/pci-reload
167
%files -n libpcilib${PCILIB_ABI_VERSION}
168
%defattr(-, root, root)
171
%dir %{_libdir}/pcilib${PCILIB_ABI_VERSION}/
172
%dir %{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/
173
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/*.xsd
174
%{_libdir}/libpcilib.so.*
176
%files -n libpcilib-devel
177
%defattr(-, root, root)
179
%{_includedir}/linux/pcidriver.h
180
%{_includedir}/pcilib.h
181
%{_includedir}/pcilib/
183
%{_libdir}/pkgconfig/*.pc
185
%files -n pcilib-test
186
%defattr(-, root, root)
187
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/test
189
%files -n pcilib-dkms
190
%defattr(-, root, root)
192
%{_prefix}/src/%{modname}-%{version}/
194
%files -n pcilib-python
195
%defattr(-, root, root)
196
%{python2_sitearch}/*
198
%files -n pcilib-server
199
%defattr(-, root, root)
200
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/pyserver
203
* Fri Mar 4 2016 Suren A. Chilingaryan <csa@suren.me> - ${CPACK_PACKAGE_VERSION}
204
- Added spec file to the sources