bzr branch
http://darksoft.org/webbzr/alps/pcitool
370
by Suren A. Chilingaryan
RPM generation |
1 |
%define modname pciDriver |
2 |
||
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))")} |
|
6 |
||
374
by Suren A. Chilingaryan
Handle build.h in releases |
7 |
%{?!_udevrulesdir: %global _udevrulesdir %{_prefix}/lib/udev/rules.d/ } |
8 |
%{?!_unitdir: %global _unitdir %{_prefix}/lib/systemd/system/ } |
|
9 |
%{?!_dkmsdir: %global _dkmsdir /var/lib/dkms } |
|
10 |
||
370
by Suren A. Chilingaryan
RPM generation |
11 |
Summary: Universal PCI driver |
12 |
Name: pcitool |
|
13 |
Version: ${CPACK_PACKAGE_VERSION} |
|
14 |
Release: csa |
|
15 |
License: GPL-3.0 |
|
16 |
Group: Development/Libraries |
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
17 |
Vendor: Institute for Data Processing and Electronics, KIT |
18 |
Packager: Suren A. Chilingaryan <csa@suren.me> |
|
370
by Suren A. Chilingaryan
RPM generation |
19 |
Source: ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 |
20 |
URL: http://darksoft.org |
|
405.1.1
by Suren A. Chilingaryan
Require uthash-devel instead of uthash |
21 |
BuildRequires: libfastwriter-devel libxml2-devel uthash-devel |
370
by Suren A. Chilingaryan
RPM generation |
22 |
BuildRequires: python python-devel swig |
374
by Suren A. Chilingaryan
Handle build.h in releases |
23 |
BuildRequires: dkms |
370
by Suren A. Chilingaryan
RPM generation |
24 |
BuildRequires: doxygen |
25 |
BuildRequires: pkg-config libtool cmake |
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
26 |
BuildRoot: %{_tmppath}/%{name}-%{version}-root |
27 |
Prefix: %{_prefix} |
|
28 |
Docdir: %{_docdir} |
|
370
by Suren A. Chilingaryan
RPM generation |
29 |
|
30 |
%description |
|
31 |
pcitool is a command line tool to manipulate PCI hardware. It provides ability |
|
32 |
to get/set registers, read/write data using DMA engine, and debug hardware |
|
33 |
operation. |
|
34 |
||
35 |
%package -n libpcilib${PCILIB_ABI_VERSION} |
|
36 |
Summary: User-space PCI library |
|
37 |
Group: Development/Libraries |
|
377.1.1
by Suren A. Chilingaryan
Fix dkms configuration |
38 |
Provides: pcilib = %{version} |
370
by Suren A. Chilingaryan
RPM generation |
39 |
Requires: pcilib-python >= %{version} |
40 |
Requires: pcilib-dkms >= %{version} |
|
41 |
||
42 |
%description -n libpcilib${PCILIB_ABI_VERSION} |
|
43 |
pcilib is a user-space library providing structured access to the PCI hardware. |
|
44 |
API exposes 4 API layers. |
|
45 |
- PCI memory access - allows to map PCI bar memory into the address space of |
|
46 |
user application and manipulate it directly. |
|
47 |
- Register access - allows to read and write device registers. The register |
|
48 |
model is defined using XML. Besides the direct hardware access, the register |
|
49 |
values can be filtered using Python scripts. This allows to convert hardware |
|
50 |
reading to standard units, make consistency checking, and create meta registers |
|
51 |
setting multiple registers from a single parameter. |
|
52 |
- DMA engine - allows high-speed reading and writting using DMA. The DMA |
|
53 |
engines are implemented in user-space as plugins. |
|
54 |
- Event engine - allows polling for hardware events and grabbing the data |
|
55 |
associated with the event in multiple supported formats. The event engines |
|
56 |
are implemented as plugins and are not part of this package. |
|
57 |
||
58 |
%package -n libpcilib-devel |
|
59 |
Summary: Development files for pcilib |
|
60 |
Group: Development/Libraries |
|
61 |
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version} |
|
405.1.1
by Suren A. Chilingaryan
Require uthash-devel instead of uthash |
62 |
Requires: uthash-devel |
370
by Suren A. Chilingaryan
RPM generation |
63 |
|
64 |
%description -n libpcilib-devel |
|
65 |
Development files for user-space PCI library |
|
66 |
||
67 |
%package -n pcilib-test |
|
68 |
Summary: Testing files for pcilib |
|
69 |
Group: Development/Libraries |
|
70 |
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version} |
|
71 |
||
72 |
%description -n pcilib-test |
|
73 |
Sample XML register model and a few applications for testing pcilib |
|
74 |
||
75 |
%package -n pcilib-python |
|
76 |
Summary: Python wrapper for pcilib |
|
77 |
Group: Development/Libraries |
|
78 |
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version} |
|
79 |
||
80 |
%description -n pcilib-python |
|
81 |
Python wrapper for pcilib. The python wrapper is used |
|
82 |
- By register scripts which are used to convert hardware reading to standard |
|
83 |
units, make consistency checking, and create meta registers setting multiple |
|
84 |
registers from a single parameter. |
|
85 |
- pcilib web api which used to provide register and dma access from remote |
|
86 |
applications. |
|
87 |
||
88 |
%package -n pcilib-dkms |
|
89 |
Summary: Kernel module providing low-level PCI access |
|
90 |
Group: Development/Libraries |
|
91 |
Requires: dkms bash gcc make |
|
92 |
||
93 |
%description -n pcilib-dkms |
|
94 |
Minimalistic driver used by pcilib to |
|
95 |
- Handle interrupts |
|
96 |
- Map PCI regions into the user space |
|
97 |
- Allocate persistent page-locked memory for DMA operations |
|
98 |
and map it into the user-space |
|
99 |
- Ensure access syncrhonization between multiple applications |
|
100 |
||
101 |
%package -n pcilib-server |
|
102 |
Summary: Pcilib Web API |
|
103 |
Group: Development/Libraries |
|
104 |
Requires: pcilib-python = %{version} |
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
105 |
Requires: pcilib-test = %{version} |
370
by Suren A. Chilingaryan
RPM generation |
106 |
Requires: python |
107 |
||
374
by Suren A. Chilingaryan
Handle build.h in releases |
108 |
%if %{defined suse_version} |
109 |
Prereq: %fillup_prereq |
|
110 |
%endif |
|
111 |
||
112 |
||
370
by Suren A. Chilingaryan
RPM generation |
113 |
%description -n pcilib-server |
114 |
Pcilib Web API and small demo web server. |
|
115 |
||
116 |
%prep |
|
117 |
%setup -q -n pcitool-%{version} |
|
118 |
||
119 |
%build |
|
400
by Suren A. Chilingaryan
Further fixes for out-of-source compilation |
120 |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DPCILIB_DYNAMIC_HEADERS_INC="" \ |
370
by Suren A. Chilingaryan
RPM generation |
121 |
-DPCILIB_PLUGIN_DIR=%{_libdir}/pcilib${PCILIB_ABI_VERSION}/ -DPCILIB_DATA_DIR=%{_datadir}/pcilib${PCILIB_ABI_VERSION}/ \ |
388
by Suren A. Chilingaryan
Use GNUInstallDirs |
122 |
-DPCILIB_PYTHON_SITEDIR=%{python2_sitearch} \ |
123 |
-DCMAKE_INSTALL_LIBDIR=%{_libdir} -DCMAKE_INSTALL_BINDIR=%{_bindir} -DCMAKE_INSTALL_DATADIR=%{_datadir} -DCMAKE_INSTALL_DATAROOTDIR=%{_datadir} -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} . |
|
124 |
||
370
by Suren A. Chilingaryan
RPM generation |
125 |
make
|
126 |
make docs |
|
127 |
||
128 |
%install |
|
129 |
rm -rf $RPM_BUILD_ROOT |
|
130 |
make install DESTDIR=$RPM_BUILD_ROOT |
|
131 |
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pcilib${PCILIB_ABI_VERSION}/ |
|
132 |
||
133 |
# scripts
|
|
134 |
install -m 755 tests/reload.sh $RPM_BUILD_ROOT/%{_bindir}/pci-reload |
|
135 |
||
136 |
# udev
|
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
137 |
mkdir -p $RPM_BUILD_ROOT/%{_udevrulesdir} |
370
by Suren A. Chilingaryan
RPM generation |
138 |
install -m 644 misc/50-pcidriver.rules $RPM_BUILD_ROOT/%{_udevrulesdir} |
139 |
||
140 |
# DKMS
|
|
141 |
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/linux/ |
|
142 |
install -m 644 driver/ioctl.h $RPM_BUILD_ROOT/%{_includedir}/linux/pcidriver.h |
|
143 |
mkdir -p $RPM_BUILD_ROOT/usr/src/%{modname}-%{version}/pcilib/ |
|
144 |
install -m 644 misc/dkms.conf $RPM_BUILD_ROOT/%{_prefix}/src/%{modname}-%{version}/ |
|
377.1.1
by Suren A. Chilingaryan
Fix dkms configuration |
145 |
install -m 755 misc/dkms-postbuild.sh $RPM_BUILD_ROOT/%{_prefix}/src/%{modname}-%{version}/ |
370
by Suren A. Chilingaryan
RPM generation |
146 |
install -m 644 pcilib/*.h $RPM_BUILD_ROOT/%{_prefix}/src/%{modname}-%{version}/pcilib/ |
147 |
cp -r driver $RPM_BUILD_ROOT/usr/src/%{modname}-%{version}/ |
|
148 |
||
149 |
# Sample model
|
|
150 |
cp -r xml/test $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/ |
|
379
by Suren A. Chilingaryan
Support XML configuration of device models |
151 |
cp -r xml/devices $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/ |
152 |
||
153 |
# Default configuration
|
|
154 |
install -m 644 misc/ipedevices.xml $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/devices/ |
|
370
by Suren A. Chilingaryan
RPM generation |
155 |
|
156 |
# Servers
|
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
157 |
mkdir -p $RPM_BUILD_ROOT/%{_unitdir} |
158 |
install -m 644 misc/pcilib_api.service $RPM_BUILD_ROOT/%{_unitdir} |
|
159 |
install -m 644 misc/pcilib_html.service $RPM_BUILD_ROOT/%{_unitdir} |
|
160 |
||
161 |
%if %{defined suse_version} |
|
162 |
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates/ |
|
163 |
install -m 644 misc/pcilib.sysconfig $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.pcilib |
|
164 |
%else |
|
165 |
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig |
|
166 |
install -m 644 misc/pcilib.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/pcilib |
|
167 |
%endif |
|
168 |
||
370
by Suren A. Chilingaryan
RPM generation |
169 |
cp -r pyserver $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/ |
170 |
||
374
by Suren A. Chilingaryan
Handle build.h in releases |
171 |
|
370
by Suren A. Chilingaryan
RPM generation |
172 |
%clean |
173 |
rm -rf $RPM_BUILD_ROOT |
|
174 |
||
175 |
%post -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig |
|
176 |
||
177 |
%postun -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig |
|
178 |
||
179 |
%post -n pcilib-dkms |
|
180 |
if [ -z "`dkms status -m %{modname} -v %{version}`" ]; then |
|
181 |
echo "Add module source to dkms" |
|
182 |
dkms add -m %{modname} -v %{version} --rpm_safe_upgrade |
|
183 |
||
184 |
echo "Build module with dkms" |
|
185 |
dkms build -m %{modname} -v %{version} |
|
186 |
dkms install -m %{modname} -v %{version} |
|
187 |
fi
|
|
188 |
exit 0 |
|
189 |
||
190 |
%preun -n pcilib-dkms |
|
191 |
/usr/sbin/dkms remove -m %{modname} -v %{version} --all --rpm_safe_upgrade |
|
192 |
exit 0 |
|
193 |
||
374
by Suren A. Chilingaryan
Handle build.h in releases |
194 |
%post -n pcilib-server |
195 |
||
196 |
%if %{defined suse_version} |
|
197 |
%fillup_and_insserv -i |
|
198 |
%endif |
|
199 |
||
200 |
||
370
by Suren A. Chilingaryan
RPM generation |
201 |
%files |
202 |
%defattr(-, root, root) |
|
203 |
%{_bindir}/pci |
|
204 |
%{_bindir}/pci-reload |
|
205 |
||
206 |
%files -n libpcilib${PCILIB_ABI_VERSION} |
|
207 |
%defattr(-, root, root) |
|
208 |
%doc docs/README |
|
209 |
%doc docs/HARDWARE |
|
210 |
%dir %{_libdir}/pcilib${PCILIB_ABI_VERSION}/ |
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
211 |
%dir %{_datadir}/pcilib${PCILIB_ABI_VERSION}/ |
379
by Suren A. Chilingaryan
Support XML configuration of device models |
212 |
%dir %{_datadir}/pcilib${PCILIB_ABI_VERSION}/devices/ |
370
by Suren A. Chilingaryan
RPM generation |
213 |
%dir %{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/ |
379
by Suren A. Chilingaryan
Support XML configuration of device models |
214 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/*.xsd |
370
by Suren A. Chilingaryan
RPM generation |
215 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/*.xsd |
379
by Suren A. Chilingaryan
Support XML configuration of device models |
216 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/devices/ipedevices.xml |
370
by Suren A. Chilingaryan
RPM generation |
217 |
%{_libdir}/libpcilib.so.* |
218 |
||
219 |
%files -n libpcilib-devel |
|
220 |
%defattr(-, root, root) |
|
221 |
%doc docs/html |
|
222 |
%{_includedir}/linux/pcidriver.h |
|
223 |
%{_includedir}/pcilib.h |
|
224 |
%{_includedir}/pcilib/ |
|
225 |
%{_libdir}/lib*.so |
|
226 |
%{_libdir}/pkgconfig/*.pc |
|
227 |
||
228 |
%files -n pcilib-test |
|
229 |
%defattr(-, root, root) |
|
230 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/test |
|
379
by Suren A. Chilingaryan
Support XML configuration of device models |
231 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/devices/testdevice.xml |
370
by Suren A. Chilingaryan
RPM generation |
232 |
|
233 |
%files -n pcilib-dkms |
|
234 |
%defattr(-, root, root) |
|
235 |
%{_udevrulesdir} |
|
236 |
%{_prefix}/src/%{modname}-%{version}/ |
|
237 |
||
238 |
%files -n pcilib-python |
|
239 |
%defattr(-, root, root) |
|
240 |
%{python2_sitearch}/* |
|
241 |
||
242 |
%files -n pcilib-server |
|
243 |
%defattr(-, root, root) |
|
374
by Suren A. Chilingaryan
Handle build.h in releases |
244 |
%if %{defined suse_version} |
245 |
/var/adm/fillup-templates/sysconfig.* |
|
246 |
%else |
|
377.1.1
by Suren A. Chilingaryan
Fix dkms configuration |
247 |
%config %{_sysconfdir}/sysconfig/* |
374
by Suren A. Chilingaryan
Handle build.h in releases |
248 |
%endif |
249 |
%{_unitdir}/* |
|
370
by Suren A. Chilingaryan
RPM generation |
250 |
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/pyserver |
251 |
||
252 |
%changelog |
|
253 |
* Fri Mar 4 2016 Suren A. Chilingaryan <csa@suren.me> - ${CPACK_PACKAGE_VERSION} |
|
254 |
- Added spec file to the sources |