]> git.pld-linux.org Git - packages/crash.git/blob - crash.spec
- switch to macro driven module build for multiple kernel versions
[packages/crash.git] / crash.spec
1 # TODO:
2 # - libeppic if anything else (but crash extension) wants to use it
3 #
4 # Conditional build:
5 %bcond_without  dist_kernel     # allow non-distribution kernel
6 %bcond_without  kernel          # don't build kernel modules
7 %bcond_without  userspace       # don't build userspace programs
8 %bcond_with     verbose         # verbose kernel module build (V=1)
9
10 %if %{without kernel}
11 %undefine       with_dist_kernel
12 %endif
13
14 # The goal here is to have main, userspace, package built once with
15 # simple release number, and only rebuild kernel packages with kernel
16 # version as part of release number, without the need to bump release
17 # with every kernel change.
18 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
19 %{error:kernel and userspace cannot be built at the same time on PLD builders}
20 exit 1
21 %endif
22
23 %if "%{_alt_kernel}" != "%{nil}"
24 %if 0%{?build_kernels:1}
25 %{error:alt_kernel and build_kernels are mutually exclusive}
26 exit 1
27 %endif
28 %undefine       with_userspace
29 %global         _build_kernels          %{alt_kernel}
30 %else
31 %global         _build_kernels          %{?build_kernels:,%{?build_kernels}}
32 %endif
33
34 %if %{without userspace}
35 # nothing to be placed to debuginfo package
36 %define         _enable_debug_packages  0
37 %endif
38
39 %define         kpkg    %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
40 %define         bkpkg   %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
41
42 %define         rel             2
43 %define         pname           crash
44 Summary:        Core Analysis Suite
45 Summary(pl.UTF-8):      Zestaw narzędzi do analizy zrzutów pamięci
46 Name:           %{pname}%{_alt_kernel}
47 Version:        7.0.3
48 Release:        %{rel}%{?with_kernel:@%{_kernel_ver_str}}
49 License:        GPL v2+
50 Group:          Libraries
51 Source0:        http://people.redhat.com/anderson/%{pname}-%{version}.tar.gz
52 # Source0-md5:  70d46467f9f2a7115a03cb698fe5125f
53 # git clone https://code.google.com/p/eppic
54 Source1:        eppic.tar.xz
55 # Source1-md5:  a9f80ad71de9d6f5b77534a7ebdbed8e
56 URL:            http://people.redhat.com/anderson/
57 BuildRequires:  rpmbuild(macros) >= 1.678
58 %{?with_dist_kernel:BuildRequires:      kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
59 %if %{with userspace}
60 BuildRequires:  ncurses-devel
61 BuildRequires:  readline-devel
62 BuildRequires:  xz-devel
63 BuildRequires:  zlib-devel
64 %endif
65 ExclusiveArch:  %{ix86} %{x8664} alpha arm ia64 ppc64 s390 s390x
66 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67
68 %description
69 The core analysis suite is a self-contained tool that can be used to
70 investigate either live systems, kernel core dumps created from the
71 netdump and diskdump packages offered by Red Hat, the LKCD kernel
72 patch or the mcore kernel patch available from Mission Critical Linux.
73
74 %description -l pl.UTF-8
75 Narzędzie do analizy zrzutów pamięci to samodzielny program służący do
76 badania systemów działających, zrzutów pamięci jądra utworzonych przez
77 pakiety Red Hata netdump lub diskdump, łatę jądra LKCD lub łatę jądra
78 mcore dostępną w Mission Critical Linuksie.
79
80 %package devel
81 Summary:        Header files for core analysis suite
82 Summary(pl.UTF-8):      Plik nagłówkowy narzędzia do analizy zrzutów pamięci
83 Group:          Development/Libraries
84 # doesn't require base
85
86 %description devel
87 Header files for core analysis suite.
88
89 %description devel -l pl.UTF-8
90 Plik nagłówkowy narzędzia do analizy zrzutów pamięci.
91
92 %define kernel_pkg()\
93 %package -n kernel%{_alt_kernel}-char-crash\
94 Summary:        Memory driver for live system crash sessions\
95 Summary(pl.UTF-8):      Sterownik pamięci dla sesji crash na żywym systemie\
96 Release:        %{rel}@%{_kernel_ver_str}\
97 Group:          Base/Kernel\
98 Requires(post,postun):  /sbin/depmod\
99 %if %{with dist_kernel}\
100 %requires_releq_kernel\
101 Requires(postun):       %releq_kernel\
102 %endif\
103 \
104 %description -n kernel%{_alt_kernel}-char-crash\
105 This package contains /dev/crash memory driver for live system crash\
106 sessions, which may be used when /dev/mem and /proc/kcore are\
107 unavailable.\
108 \
109 %description -n kernel%{_alt_kernel}-char-crash -l pl.UTF-8\
110 Ten pakiet zawiera sterownik pamięci /dev/crash do sesji crash na\
111 żywym systemie. Może być używany do analizy, kiedy /dev/mem i\
112 /proc/kcore nie są dostępne.\
113 \
114 %if %{with kernel}\
115 %files -n kernel%{_alt_kernel}-char-crash\
116 %defattr(644,root,root,755)\
117 %doc memory_driver/README\
118 /lib/modules/%{_kernel_ver}/kernel/drivers/char/crash.ko*\
119 %endif\
120 \
121 %post   -n kernel%{_alt_kernel}-char-crash\
122 %depmod %{_kernel_ver}\
123 \
124 %postun -n kernel%{_alt_kernel}-char-crash\
125 %depmod %{_kernel_ver}\
126 %{nil}
127
128 %define build_kernel_pkg()\
129 %build_kernel_modules -C memory_driver -m crash\
130 %install_kernel_modules -D installed -m memory_driver/crash -d kernel/drivers/char\
131 %{nil}
132
133 %{?with_kernel:%{expand:%kpkg}}
134
135 %prep
136 %setup -q -a1 -n %{pname}-%{version}
137
138 %{__mv} eppic extensions
139
140 %build
141 %{?with_kernel:%{expand:%bkpkg}}
142
143 %if %{with userspace}
144 export CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses"
145 %{__make} -j1 all extensions \
146         ARCH="%{_target_cpu}" \
147         CC="%{__cc}" \
148         CFLAGS="%{rpmcflags} -I/usr/include/ncurses"
149 %endif
150
151 %install
152 rm -rf $RPM_BUILD_ROOT
153
154 %if %{with kernel}
155 install -d $RPM_BUILD_ROOT
156 cp -a installed/* $RPM_BUILD_ROOT
157 %endif
158
159 %if %{with userspace}
160 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man8,%{_libdir}/crash/extensions,%{_includedir}/crash}
161
162 %{__make} install \
163         DESTDIR=$RPM_BUILD_ROOT
164
165 # omitted by make install
166 install extensions/*.so $RPM_BUILD_ROOT%{_libdir}/crash/extensions
167 cp -p crash.8 $RPM_BUILD_ROOT%{_mandir}/man8
168 cp -p defs.h $RPM_BUILD_ROOT%{_includedir}/crash
169 %endif
170
171 %clean
172 rm -rf $RPM_BUILD_ROOT
173
174 %if %{with userspace}
175 %files
176 %defattr(644,root,root,755)
177 %doc README
178 %attr(755,root,root) %{_bindir}/crash
179 %dir %{_libdir}/crash
180 %dir %{_libdir}/crash/extensions
181 %attr(755,root,root) %{_libdir}/crash/extensions/dminfo.so
182 %attr(755,root,root) %{_libdir}/crash/extensions/echo.so
183 %attr(755,root,root) %{_libdir}/crash/extensions/eppic.so
184 %attr(755,root,root) %{_libdir}/crash/extensions/snap.so
185 %attr(755,root,root) %{_libdir}/crash/extensions/trace.so
186 %{_mandir}/man8/crash.8*
187
188 %files devel
189 %defattr(644,root,root,755)
190 %{_includedir}/crash
191 %endif
This page took 0.048494 seconds and 4 git commands to generate.