-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdrcopy.spec
125 lines (92 loc) · 3.22 KB
/
gdrcopy.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
%{!?_release: %define _release 1}
%{!?CUDA: %define CUDA /usr/local/cuda}
%{!?KVERSION: %define KVERSION %(uname -r)}
%global krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g')
%define MODPROBE %(if ( /sbin/modprobe -c | grep -q '^allow_unsupported_modules *0'); then echo -n "/sbin/modprobe --allow-unsupported-modules"; else echo -n "/sbin/modprobe"; fi )
%define driver_install_dir /lib/modules/%{KVERSION}/extra
%global kmod kmod
#modules-%{krelver}
Name: gdrcopy
Version: 1.2
Release: %{_release}%{?dist}
Summary: GDRcopy library and companion kernel-mode driver
Group: System Environment/Libraries
License: MIT
URL: https://github.com/NVIDIA/gdrcopy
Source0: %{name}-%{version}.tar.gz
BuildRequires: gcc kernel-headers
Requires: %{name}-%{kmod}
# to get rid of libcuda/libcudart
AutoReqProv: no
# alternatives, not working on RH6
#%filter_from_provides /libcuda\\.so.*$/d
#%global __provides_exclude ^libcuda\\.so.*$
%package devel
Summary: The development files
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
%package %{kmod}
Summary: The kernel-mode driver
Group: System Environment/Libraries
#Requires: %{name} = %{version}-%{release}
%description
GDRCopy, a low-latency GPU memory copy library and a kernel-mode driver, built on top of the
NVIDIA GPUDirect RDMA technology.
%description devel
GDRCopy, a low-latency GPU memory copy library and a kernel-mode driver, built on top of the
NVIDIA GPUDirect RDMA technology.
%description %{kmod}
Kernel-mode driver for GDRCopy.
%prep
%setup
%build
echo "building"
export KVER=%{KVERSION}
echo $KVER
make %{?_smp_mflags} CUDA=%{CUDA} KVER=%{KVERSION} all
%install
%{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}
%{__mkdir_p} $RPM_BUILD_ROOT%{_prefix}/include
%{__make} PREFIX=$RPM_BUILD_ROOT%{_prefix} DESTLIB=$RPM_BUILD_ROOT%{_libdir} lib_install
install -d $RPM_BUILD_ROOT%{_prefix}/include
#install -m 0755 gdrapi.h $RPM_BUILD_ROOT%{_prefix}/include/gdrapi.h
install -Dpm 755 copybw $RPM_BUILD_ROOT%{_prefix}/bin/copybw
install -Dpm 755 validate $RPM_BUILD_ROOT%{_prefix}/bin/validate
# Install gdrdrv service script
install -d $RPM_BUILD_ROOT/etc/init.d
install -m 0755 $RPM_BUILD_DIR/%{name}-%{version}/init.d/gdrcopy $RPM_BUILD_ROOT/etc/init.d
%{__mkdir_p} $RPM_BUILD_ROOT%{driver_install_dir}
%{__cp} $RPM_BUILD_DIR/%buildsubdir/gdrdrv/gdrdrv.ko $RPM_BUILD_ROOT%{driver_install_dir}
%post
/sbin/depmod -a
%{MODPROBE} -rq gdrdrv||:
%{MODPROBE} gdrdrv||:
if ! ( /sbin/chkconfig --del gdrcopy > /dev/null 2>&1 ); then
true
fi
/sbin/chkconfig --add gdrcopy
%preun
%{MODPROBE} -rq gdrcopy
if ! ( /sbin/chkconfig --del gdrcopy > /dev/null 2>&1 ); then
true
fi
%clean
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
[ "x$RPM_BUILD_ROOT" != "x" ] && rm -rf $RPM_BUILD_ROOT
%files
%{_prefix}/bin/copybw
%{_prefix}/bin/validate
%{_libdir}/libgdrapi.so.?.?
%{_libdir}/libgdrapi.so.?
%{_libdir}/libgdrapi.so
/etc/init.d/gdrcopy
%files devel
%{_libdir}/libgdrapi.so
%{_prefix}/include/gdrapi.h
%doc README.md
%files %{kmod}
%defattr(-,root,root,-)
%{driver_install_dir}/gdrdrv.ko
%changelog
* Thu Sep 15 2016 Davide Rossetti <[email protected]> 1.2-1
- First version of RPM spec