]> git.pld-linux.org Git - packages/sysdig.git/blob - sysdig.spec
use system curl and openssl
[packages/sysdig.git] / sysdig.spec
1 # TODO
2 # - fix kernel build
3 #    Reason: /usr/src/BUILD/sysdig-0.5.1/driver/main.c:51:27: fatal error: driver_config.h: No such file or directory
4 # - fix downloading extra deps
5 # - fix userspace openssl build
6 #
7 # NOTES:
8 # - https://github.com/draios/sysdig/wiki/How-to-Install-Sysdig-from-the-Source-Code
9 #
10 # Conditional build:
11 %bcond_without  kernel          # don't build kernel modules
12 %bcond_without  userspace       # don't build userspace programs
13 %bcond_without  dkms            # build dkms package
14
15 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
16 %{error:kernel and userspace cannot be built at the same time on PLD builders}
17 exit 1
18 %endif
19
20 %if %{without userspace}
21 %undefine       with_dkms
22 # nothing to be placed to debuginfo package
23 %define         _enable_debug_packages  0
24 %endif
25
26 %define         rel     0.1
27 %define         pname   sysdig
28 Summary:        sysdig, a system-level exploration and troubleshooting tool
29 Name:           %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
30 Version:        0.5.1
31 Release:        %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
32 License:        GPL v2
33 Group:          Applications/System
34 Source0:        https://github.com/draios/sysdig/archive/%{version}/%{pname}-%{version}.tar.gz
35 # Source0-md5:  deba174d3c15639382fe6ec8e0fe70d5
36 Patch0:         buildflags.patch
37 URL:            http://www.sysdig.org/
38 BuildRequires:  rpmbuild(macros) >= 1.701
39 %if %{with userspace}
40 BuildRequires:  cmake >= 2.8.2
41 BuildRequires:  curl-devel >= 7.45.0
42 BuildRequires:  jsoncpp-devel
43 BuildRequires:  libstdc++-devel >= 6:4.4
44 BuildRequires:  luajit-devel >= 2.0.3
45 BuildRequires:  ncurses-devel >= 5.9
46 BuildRequires:  openssl-devel >= 1.0.2
47 BuildRequires:  zlib-devel >= 1.2.8
48 ExclusiveArch:  %{ix86} %{x8664}
49 %else
50 ExclusiveArch:  %{ix86} %{x8664} x32
51 %endif
52 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
53 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54
55 # constify %{name}
56 %{expand:%%global name %{pname}}
57
58 %define         zshdir %{_datadir}/zsh/site-functions
59
60 %description
61 Sysdig instruments your physical and virtual machines at the OS level
62 by installing into the Linux kernel and capturing system calls and
63 other OS events. Then, using sysdig's command line interface, you can
64 filter and decode these events in order to extract useful information.
65 Sysdig can be used to inspect systems live in real-time, or to
66 generate trace files that can be analyzed at a later stage.
67
68 %package -n dkms-%{name}
69 Summary:        DKMS-ready driver for sysdig
70 License:        GPL v2+
71 Group:          Base/Kernel
72 Requires(pre,post):     dkms >= 2.1.0.0
73 %if "%{_rpmversion}" >= "5"
74 BuildArch:      noarch
75 %endif
76
77 %description -n dkms-%{name}
78 This package contains a DKMS-ready driver for sysdig.
79
80 %package -n bash-completion-%{name}
81 Summary:        bash-completion for sysdig
82 Summary(pl.UTF-8):      Bashowe dopeÅ‚nianie skÅ‚adni dla sysdig
83 Group:          Applications/Shells
84 Requires:       %{name} = %{version}-%{rel}
85 Requires:       bash-completion
86 %if "%{_rpmversion}" >= "5"
87 BuildArch:      noarch
88 %endif
89
90 %description -n bash-completion-%{name}
91 bash-completion for sysdig.
92
93 %package -n zsh-completion-%{name}
94 Summary:        zsh-completion for sysdig
95 Group:          Applications/Shells
96 Requires:       %{name} = %{version}-%{rel}
97 %if "%{_rpmversion}" >= "5"
98 BuildArch:      noarch
99 %endif
100
101 %description -n zsh-completion-%{name}
102 zsh-completion for sysdig.
103
104 %define kernel_pkg()\
105 %package -n kernel%{_alt_kernel}-misc-%{pname}\
106 Summary:        Linux driver for sysdig\
107 Release:        %{rel}@%{_kernel_ver_str}\
108 Group:          Base/Kernel\
109 Requires(post,postun):  /sbin/depmod\
110 %requires_releq_kernel\
111 Requires(postun):       %releq_kernel\
112 \
113 %description -n kernel%{_alt_kernel}-misc-%{pname}\
114 This is driver for sysdig-probe for Linux.\
115 \
116 This package contains Linux module.\
117 \
118 %if %{with kernel}\
119 %files -n kernel%{_alt_kernel}-misc-%{pname}\
120 %defattr(644,root,root,755)\
121 /lib/modules/%{_kernel_ver}/misc/*.ko*\
122 %endif\
123 \
124 %post   -n kernel%{_alt_kernel}-misc-%{pname}\
125 %depmod %{_kernel_ver}\
126 \
127 %postun -n kernel%{_alt_kernel}-misc-%{pname}\
128 %depmod %{_kernel_ver}\
129 %{nil}
130
131 %define build_kernel_pkg()\
132 %build_kernel_modules -C driver -m sysdig-probe\
133 %install_kernel_modules -D installed -m driver/sysdig-probe -d misc\
134 %{nil}
135
136 %{?with_kernel:%{expand:%create_kernel_packages}}
137
138 %prep
139 %setup -q -n %{pname}-%{version}
140 %patch0 -p1
141
142 # we need just obj-m from the file
143 cp driver/Makefile{.in,}
144 %{__sed} -i -e 's/@KBUILD_FLAGS@//' driver/Makefile
145
146 %build
147 %{?with_kernel:%{expand:%build_kernel_packages}}
148
149 %if %{with userspace}
150 install -d build
151 cd build
152 %cmake \
153         -DDIR_ETC=%{_sysconfdir} \
154         -DSYSDIG_VERSION=%{version}-%{rel} \
155         -DBUILD_DRIVER=OFF \
156         -DUSE_BUNDLED_CURL=OFF \
157         -DUSE_BUNDLED_JSONCPP=OFF \
158         -DUSE_BUNDLED_LUAJIT=OFF \
159         -DUSE_BUNDLED_NCURSES=OFF \
160         -DUSE_BUNDLED_OPENSSL=OFF \
161         -DUSE_BUNDLED_ZLIB=OFF \
162         ..
163 %{__make}
164 %endif
165
166 %install
167 rm -rf $RPM_BUILD_ROOT
168 %if %{with userspace}
169 %{__make} -C build install \
170         DESTDIR=$RPM_BUILD_ROOT
171
172 # already installed as %{zshdir}/_sysdig
173 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zsh/vendor-completions/_sysdig
174 %endif
175
176 %if %{with kernel}
177 install -d $RPM_BUILD_ROOT
178 cp -a installed/* $RPM_BUILD_ROOT
179 %endif
180
181 %clean
182 rm -rf $RPM_BUILD_ROOT
183
184 %post -n dkms-%{name}
185 %{_sbindir}/dkms add -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade && \
186 %{_sbindir}/dkms build -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade && \
187 %{_sbindir}/dkms install -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade || :
188
189 %preun -n dkms-%{name}
190 %{_sbindir}/dkms remove -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade --all || :
191
192 %if %{with userspace}
193 %files
194 %defattr(644,root,root,755)
195 %doc README.md
196 %attr(755,root,root) %{_bindir}/csysdig
197 %attr(755,root,root) %{_bindir}/sysdig
198 %attr(755,root,root) %{_bindir}/sysdig-probe-loader
199 %{_mandir}/man8/csysdig.8*
200 %{_mandir}/man8/sysdig.8*
201 %{_datadir}/%{name}
202
203 %files -n bash-completion-%{name}
204 %defattr(644,root,root,755)
205 /etc/bash_completion.d/sysdig
206
207 %files -n zsh-completion-%{name}
208 %defattr(644,root,root,755)
209 %{zshdir}/_sysdig
210 %endif
211
212 %if %{with dkms}
213 %files -n dkms-%{name}
214 %defattr(644,root,root,755)
215 %{_usrsrc}/%{name}-%{version}-%{rel}
216 %endif
This page took 0.192592 seconds and 4 git commands to generate.