/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcitool.spec.in

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-04 15:43:14 UTC
  • Revision ID: csa@suren.me-20160304154314-uor59rrkaw2hexm7
RPM generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
7
Summary: Universal PCI driver
 
8
Name: pcitool
 
9
Version: ${CPACK_PACKAGE_VERSION}
 
10
Release: csa
 
11
License: GPL-3.0
 
12
Group: Development/Libraries
 
13
Source: ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
 
14
BuildRoot: %{_tmppath}/%{name}-%{version}-root
 
15
URL: http://darksoft.org
 
16
Prefix: %{_prefix}
 
17
Docdir: %{_docdir}
 
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>
 
25
 
 
26
%description 
 
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 
 
29
operation. 
 
30
 
 
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}
 
36
 
 
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.
 
52
 
 
53
%package -n libpcilib-devel
 
54
Summary: Development files for pcilib
 
55
Group: Development/Libraries 
 
56
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
 
57
 
 
58
%description -n libpcilib-devel
 
59
Development files for user-space PCI library
 
60
 
 
61
%package -n pcilib-test
 
62
Summary: Testing files for pcilib
 
63
Group: Development/Libraries 
 
64
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
 
65
 
 
66
%description -n pcilib-test
 
67
Sample XML register model and a few applications for testing pcilib
 
68
 
 
69
%package -n pcilib-python
 
70
Summary: Python wrapper for pcilib
 
71
Group: Development/Libraries 
 
72
Requires: libpcilib${PCILIB_ABI_VERSION} = %{version}
 
73
 
 
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
 
80
 applications.
 
81
 
 
82
%package -n pcilib-dkms
 
83
Summary: Kernel module providing low-level PCI access
 
84
Group: Development/Libraries 
 
85
Requires: dkms bash gcc make
 
86
 
 
87
%description -n pcilib-dkms
 
88
Minimalistic driver used by pcilib to 
 
89
 - Handle interrupts
 
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
 
94
 
 
95
%package -n pcilib-server
 
96
Summary: Pcilib Web API
 
97
Group: Development/Libraries 
 
98
Requires: pcilib-python = %{version}
 
99
Requires: python
 
100
 
 
101
%description -n pcilib-server
 
102
Pcilib Web API and small demo web server.
 
103
 
 
104
%prep
 
105
%setup -q -n pcitool-%{version}
 
106
 
 
107
%build
 
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} .
 
111
make
 
112
make docs
 
113
 
 
114
%install
 
115
rm -rf $RPM_BUILD_ROOT
 
116
make install DESTDIR=$RPM_BUILD_ROOT
 
117
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pcilib${PCILIB_ABI_VERSION}/
 
118
 
 
119
# scripts
 
120
install -m 755 tests/reload.sh $RPM_BUILD_ROOT/%{_bindir}/pci-reload
 
121
 
 
122
# udev
 
123
mkdir -p $RPM_BUILD_ROOT/usr/lib/udev/rules.d
 
124
install -m 644 misc/50-pcidriver.rules $RPM_BUILD_ROOT/%{_udevrulesdir}
 
125
 
 
126
# DKMS
 
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}/
 
133
 
 
134
# Sample model
 
135
cp -r xml/test $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/
 
136
 
 
137
# Servers
 
138
cp -r pyserver $RPM_BUILD_ROOT/%{_datadir}/pcilib${PCILIB_ABI_VERSION}/
 
139
 
 
140
%clean
 
141
rm -rf $RPM_BUILD_ROOT
 
142
 
 
143
%post -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig
 
144
 
 
145
%postun -n libpcilib${PCILIB_ABI_VERSION} -p /sbin/ldconfig
 
146
 
 
147
%post -n pcilib-dkms
 
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
 
151
 
 
152
        echo "Build module with dkms"
 
153
        dkms build -m %{modname} -v %{version}
 
154
        dkms install -m %{modname} -v %{version}
 
155
fi
 
156
exit 0
 
157
 
 
158
%preun -n pcilib-dkms
 
159
/usr/sbin/dkms remove -m %{modname} -v %{version} --all --rpm_safe_upgrade
 
160
exit 0
 
161
 
 
162
%files
 
163
%defattr(-, root, root)
 
164
%{_bindir}/pci
 
165
%{_bindir}/pci-reload
 
166
 
 
167
%files -n libpcilib${PCILIB_ABI_VERSION}
 
168
%defattr(-, root, root)
 
169
%doc docs/README 
 
170
%doc docs/HARDWARE
 
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.*
 
175
 
 
176
%files -n libpcilib-devel
 
177
%defattr(-, root, root)  
 
178
%doc docs/html
 
179
%{_includedir}/linux/pcidriver.h
 
180
%{_includedir}/pcilib.h
 
181
%{_includedir}/pcilib/
 
182
%{_libdir}/lib*.so
 
183
%{_libdir}/pkgconfig/*.pc
 
184
 
 
185
%files -n pcilib-test
 
186
%defattr(-, root, root)  
 
187
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/models/test
 
188
 
 
189
%files -n pcilib-dkms
 
190
%defattr(-, root, root)  
 
191
%{_udevrulesdir}
 
192
%{_prefix}/src/%{modname}-%{version}/
 
193
 
 
194
%files -n pcilib-python
 
195
%defattr(-, root, root)
 
196
%{python2_sitearch}/*
 
197
 
 
198
%files -n pcilib-server
 
199
%defattr(-, root, root)  
 
200
%{_datadir}/pcilib${PCILIB_ABI_VERSION}/pyserver
 
201
 
 
202
%changelog
 
203
* Fri Mar  4 2016 Suren A. Chilingaryan <csa@suren.me> - ${CPACK_PACKAGE_VERSION}
 
204
- Added spec file to the sources