source: projects/specs/trunk/v/valgrind/valgrind-vl.spec @ 12020

Revision 12020, 15.3 KB checked in by tomop, 5 years ago (diff)

update toolchain

Line 
1%bcond_with check
2
3# Only arches that are supported upstream as multilib and that the distro
4# has multilib builds for should set build_multilib 1. In practice that
5# is only x86_64 and ppc64 (but not in fedora 21 and later, and never
6# for ppc64le).
7%global build_multilib 0
8
9%ifarch x86_64 ppc64
10%global build_multilib 1
11%endif
12
13# Vine Linux doesn't have openmpi package
14#ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64
15#global build_openmpi 1
16#else
17%global build_openmpi 0
18#endif
19
20%global run_full_regtest 0
21%global build_tools_devel 0
22
23# Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
24# DWARF very well and it might read its own vgpreload libraries. Generating
25# minisymtabs doesn't really work for the staticly linked tools.
26%define _find_debuginfo_dwz_opts %{nil}
27%undefine _include_minidebuginfo
28
29Name:           valgrind
30Version:        3.14.0
31Release:        1%{?_dist_release}
32Summary:        Tool for finding memory management bugs in programs
33Summary(ja):    プログラムのメモリ管理バグを発見するためのツール
34
35Vendor:         Project Vine
36Distribution:   Vine Linux
37
38License:        GPLv2+
39Group:          Development/Debuggers
40URL:            http://valgrind.org/
41
42Source0:        http://valgrind.org/downloads/%{name}-%{version}.tar.bz2
43
44# Needs investigation and pushing upstream
45Patch1: valgrind-3.9.0-cachegrind-improvements.patch
46
47# KDE#211352 - helgrind races in helgrind's own mythread_wrapper
48Patch2: valgrind-3.9.0-helgrind-race-supp.patch
49
50# Make ld.so supressions slightly less specific.
51Patch3: valgrind-3.9.0-ldso-supp.patch
52
53# KDE#400490 s390x: Fix register allocation for VRs vs FPRs
54Patch4: valgrind-3.14.0-s390x-fix-reg-alloc-vr-vs-fpr.patch
55
56# KDE#400491 s390x: Sign-extend immediate operand of LOCHI and friends
57Patch5: valgrind-3.14.0-s390x-sign-extend-lochi.patch
58
59# KDE#397187 s390x: Add vector register support for vgdb
60Patch6: valgrind-3.14.0-s390x-vec-reg-vgdb.patch
61
62# KDE#385411 s390x: z13 vector floating-point instructions not implemented
63Patch7: valgrind-3.14.0-s390x-vec-float-point-code.patch
64Patch8: valgrind-3.14.0-s390x-vec-float-point-tests.patch
65
66# KDE#401277 More bugs in z13 support
67Patch9: valgrind-3.14.0-s390z-more-z13-fixes.patch
68
69# KDE#386945 Bogus memcheck errors on ppc64(le) when using strcmp
70Patch10: valgrind-3.14.0-get_otrack_shadow_offset_wrk-ppc.patch
71Patch11: valgrind-3.14.0-new-strlen-IROps.patch
72Patch12: valgrind-3.14.0-ppc-instr-new-IROps.patch
73Patch13: valgrind-3.14.0-memcheck-new-IROps.patch
74Patch14: valgrind-3.14.0-ppc-frontend-new-IROps.patch
75Patch15: valgrind-3.14.0-transform-popcount64-ctznat64.patch
76Patch16: valgrind-3.14.0-enable-ppc-Iop_Sar_Shr8.patch
77
78# KDE#401627 memcheck errors with glibc avx2 optimized wcsncmp
79Patch17: valgrind-3.14.0-wcsncmp.patch
80
81# KDE#402006 mark helper regs defined in final_tidyup before freeres_wrapper
82# Prereq for KDE#386945
83Patch18: valgrind-3.14.0-final_tidyup.patch
84
85# KDE#386945 Bogus memcheck errors on ppc64(le) when using strcmp
86# See also patches 10 to 16 (yes, there are this many...)
87Patch19: valgrind-3.14.0-ppc64-ldbrx.patch
88Patch20: valgrind-3.14.0-ppc64-unaligned-words.patch
89Patch21: valgrind-3.14.0-ppc64-lxvd2x.patch
90Patch22: valgrind-3.14.0-ppc64-unaligned-vecs.patch
91Patch23: valgrind-3.14.0-ppc64-lxvb16x.patch
92Patch24: valgrind-3.14.0-set_AV_CR6.patch
93Patch25: valgrind-3.14.0-undef_malloc_args.patch
94
95# KDE#401822 none/tests/ppc64/jm-vmx fails and produces assembler warnings
96Patch26: valgrind-3.14.0-jm-vmx-constraints.patch
97
98# commit 0c701ba2a Fix sigkill.stderr.exp for glibc-2.28.
99Patch27: valgrind-3.14.0-sigkill.patch
100
101# KDE#402048 Implement minimal ptrace support for ppc64[le]-linux.
102Patch28: valgrind-3.14.0-ppc64-ptrace.patch
103
104# commit 43fe4bc23 arm64: Fix PTRACE_TRACEME
105Patch29: valgrind-3.14.0-arm64-ptrace-traceme.patch
106
107# KDE#402134 - assert fail mc_translate.c (noteTmpUsesIn) Iex_VECRET on arm64
108Patch30: valgrind-3.14.0-mc_translate-vecret.patch
109
110# KDE#402481 vbit-test fails on x86 for Iop_CmpEQ64 iselInt64Expr Sar64
111Patch31: valgrind-3.14.0-vbit-test-sec.patch
112Patch32: valgrind-3.14.0-x86-Iop_Sar64.patch
113
114# KDE#402519 POWER 3.0 addex instruction incorrectly implemented
115Patch33: valgrind-3.14.0-power9-addex.patch
116
117# KDE#402480  Do not use %rsp in clobber list
118Patch34: valgrind-3.14.0-rsp-clobber.patch
119
120# commit 3528f8 Accept DW_TAG_subrange_type with DW_AT_count
121Patch35: valgrind-3.14.0-subrange_type-count.patch
122
123Buildroot:      %{_tmppath}/%{name}-%{version}-root
124%if %{build_multilib}
125# Ensure glibc{,-devel} is installed for both multilib arches
126BuildRequires:  compat32-glibc-devel
127%endif
128BuildRequires:  glibc-devel >= 2.14
129%if %{build_openmpi}
130BuildRequires: openmpi-devel >= 1.3.3
131%endif
132
133# For %%build and %%check.
134# In case of a software collection, pick the matching gdb and binutils.
135BuildRequires:  gdb
136BuildRequires:  binutils
137
138# gdbserver_tests/filter_make_empty uses ps in test
139BuildRequires:  procps
140
141ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
142%ifarch %{ix86}
143%define valarch x86
144%define valsecarch %{nil}
145%endif
146%ifarch x86_64
147%define valarch amd64
148%define valsecarch x86
149%endif
150%ifarch ppc
151%define valarch ppc32
152%define valsecarch %{nil}
153%endif
154%ifarch ppc64
155  %define valarch ppc64be
156  %if %{build_multilib}
157    %define valsecarch ppc32
158  %else
159    %define valsecarch %{nil}
160  %endif
161%endif
162%ifarch ppc64le
163%define valarch ppc64le
164%define valsecarch %{nil}
165%endif
166%ifarch s390x
167%define valarch s390x
168%define valsecarch %{nil}
169%endif
170%ifarch armv7hl
171%define valarch arm
172%define valsecarch %{nil}
173%endif
174%ifarch aarch64
175%define valarch arm64
176%define valsecarch %{nil}
177%endif
178
179# Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
180# DWARF very well and it might read its own vgpreload libraries. Generating
181# minisymtabs doesn't really work for the staticly linked tools.
182%define _find_debuginfo_dwz_opts %{nil}
183%undefine _include_minidebuginfo
184
185
186%description
187Valgrind is a tool to help you find memory-management problems in your
188programs. When a program is run under Valgrind's supervision, all
189reads and writes of memory are checked, and calls to
190malloc/new/free/delete are intercepted. As a result, Valgrind can
191detect a lot of problems that are otherwise very hard to
192find/diagnose.
193
194%package devel
195Summary:        Development files for valgrind
196Summary(ja):    Valgrind の開発用ファイル
197Group:          Development/Libraries
198Requires:       %{name} = %{version}-%{release}
199Provides:       %{name}-static = %{version}-%{release}
200
201%description devel
202Header files and libraries for development of valgrind aware programs
203or valgrind plugins.
204
205%package openmpi
206Summary:        OpenMPI support for valgrind
207Summary(ja):    Valgrind の OpenMPI サポート
208Group:          Development/Debuggers
209Requires:       %{name} = %{version}-%{release}
210
211%description openmpi
212A wrapper library for debugging OpenMPI parallel programs with valgrind.
213See the section on Debugging MPI Parallel Programs with Valgrind in the
214Valgrind User Manual for details.
215
216
217%prep
218%setup -q -n %{name}-%{version}
219%patch1 -p1
220%patch2 -p1
221%patch3 -p1
222%patch4 -p1
223%patch5 -p1
224%patch6 -p1
225%patch7 -p1
226%patch8 -p1
227%patch9 -p1
228%patch10 -p1
229%patch11 -p1
230%patch12 -p1
231%patch13 -p1
232%patch14 -p1
233%patch15 -p1
234%patch16 -p1
235%patch17 -p1
236%patch18 -p1
237%patch19 -p1
238%patch20 -p1
239%patch21 -p1
240%patch22 -p1
241%patch23 -p1
242%patch24 -p1
243%patch25 -p1
244%patch26 -p1
245%patch27 -p1
246%patch28 -p1
247%patch29 -p1
248%patch30 -p1
249%patch31 -p1
250%patch32 -p1
251%patch33 -p1
252%patch34 -p1
253%patch35 -p1
254
255%build
256CC=gcc
257%if %{build_multilib}
258# Ugly hack - libgcc 32-bit package might not be installed
259mkdir -p shared/libgcc/32
260ar r shared/libgcc/32/libgcc_s.a
261ar r shared/libgcc/libgcc_s_32.a
262CC="gcc -B `pwd`/shared/libgcc/"
263%endif
264
265# Old openmpi-devel has version depended paths for mpicc.
266%if %{build_openmpi}
267%if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
268%define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/bin/mpicc
269%else
270%define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/*/bin/mpicc
271%endif
272%else
273# We explicitly don't want the libmpi wrapper. So make sure that configure
274# doesn't pick some random mpi compiler that happens to be installed.
275%define mpiccpath /bin/false
276%endif
277
278# Filter out some flags that cause lots of valgrind test failures.
279# Also filter away -O2, valgrind adds it wherever suitable, but
280# not for tests which should be -O0, as they aren't meant to be
281# compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
282# Ideally we will change this to only be done for the non-primary build
283# and the test suite. Also disable strict symbol checks because the
284# vg_preload library will use hidden/undefined symbols from glibc
285# like __libc_freeres.
286%undefine _hardened_build
287%undefine _strict_symbol_defs_build
288OPTFLAGS="`echo " %{optflags} " | sed 's/ -m\(64\|3[21]\) / /g;s/ -fexceptions / /g;s/ -fstack-protector\([-a-z]*\) / / g;s/ -Wp,-D_FORTIFY_SOURCE=2 / /g;s/ -O2 / /g;s/ -mcpu=\([a-z0-9]\+\) / /g;s/^ //;s/ $//'`"
289%configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
290  --with-mpicc=%{mpiccpath} \
291  GDB=%{_bindir}/gdb
292
293make %{?_smp_mflags}
294
295# Ensure there are no unexpected file descriptors open,
296# the testsuite otherwise fails.
297cat > close_fds.c <<EOF
298#include <stdlib.h>
299#include <unistd.h>
300int main (int argc, char *const argv[])
301{
302  int i, j = sysconf (_SC_OPEN_MAX);
303  if (j < 0)
304    exit (1);
305  for (i = 3; i < j; ++i)
306    close (i);
307  execvp (argv[1], argv + 1);
308  exit (1);
309}
310EOF
311gcc $RPM_OPT_FLAGS -o close_fds close_fds.c
312
313%install
314rm -rf $RPM_BUILD_ROOT
315make DESTDIR=$RPM_BUILD_ROOT install
316mkdir docs/installed
317mv $RPM_BUILD_ROOT%{_datadir}/doc/valgrind/* docs/installed/
318rm -f docs/installed/*.ps
319
320
321# We want the MPI wrapper installed under the openmpi libdir so the script
322# generating the MPI library requires picks them up and sets up the right
323# openmpi libmpi.so requires. Install symlinks in the original/upstream
324# location for backwards compatibility.
325%if %{build_openmpi}
326pushd $RPM_BUILD_ROOT%{_libdir}
327mkdir -p openmpi/valgrind
328cd valgrind
329mv libmpiwrap-%{valarch}-linux.so ../openmpi/valgrind/
330ln -s ../openmpi/valgrind/libmpiwrap-%{valarch}-linux.so
331popd
332%endif
333
334%if "%{valsecarch}" != ""
335pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
336rm -f *-%{valsecarch}-* || :
337for i in *-%{valarch}-*; do
338  j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
339  ln -sf ../../lib/valgrind/$j $j
340done
341popd
342%endif
343
344# remove unuse files
345rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in
346
347%if %{build_tools_devel}
348%ifarch %{ix86} x86_64
349# To avoid multilib clashes in between i?86 and x86_64,
350# tweak installed <valgrind/config.h> a little bit.
351for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS HAVE_AS_AMD64_FXSAVE64 \
352         ; do
353  sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
354    $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
355done
356%endif
357%else
358# Remove files we aren't going to package.
359# See tools-devel files.
360rm $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
361rm $RPM_BUILD_ROOT%{_includedir}/valgrind/libvex*h
362rm $RPM_BUILD_ROOT%{_includedir}/valgrind/pub_tool_*h
363rm -rf $RPM_BUILD_ROOT%{_includedir}/valgrind/vki
364rm $RPM_BUILD_ROOT%{_libdir}/valgrind/*.a
365%endif
366
367# We don't want debuginfo generated for the vgpreload libraries.
368# Turn off execute bit so they aren't included in the debuginfo.list.
369# We'll turn the execute bit on again in %%files.
370chmod 644 $RPM_BUILD_ROOT%{_libdir}/valgrind/vgpreload*-%{valarch}-*so
371
372
373%if %{with check}
374%check
375# Make sure a basic binary runs. There should be no errors.
376./vg-in-place --error-exitcode=1 /bin/true
377
378# Build the test files with the software collection compiler if available.
379%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
380# Make sure no extra CFLAGS, CXXFLAGS or LDFLAGS leak through,
381# the testsuite sets all flags necessary. See also configure above.
382make %{?_smp_mflags} CFLAGS="" CXXFLAGS="" LDFLAGS="" check
383
384# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=1434601
385# for gdbserver tests.
386export PYTHONCOERCECLOCALE=0
387
388echo ===============TESTING===================
389%if 0%{?run_full_regtest}
390  ./close_fds make regtest || :
391%else
392  ./close_fds make nonexp-regtest || :
393%endif
394
395# Make sure test failures show up in build.log
396# Gather up the diffs (at most the first 20 lines for each one)
397MAX_LINES=20
398diff_files=`find */tests -name '*.diff*' | sort`
399if [ z"$diff_files" = z ] ; then
400   echo "Congratulations, all tests passed!" >> diffs
401else
402   for i in $diff_files ; do
403      echo "=================================================" >> diffs
404      echo $i                                                  >> diffs
405      echo "=================================================" >> diffs
406      if [ `wc -l < $i` -le $MAX_LINES ] ; then
407         cat $i                                                >> diffs
408      else
409         head -n $MAX_LINES $i                                 >> diffs
410         echo "<truncated beyond $MAX_LINES lines>"            >> diffs
411      fi
412   done
413fi
414cat diffs
415echo ===============END TESTING===============
416
417%endif
418
419
420%clean
421[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
422
423%files
424%defattr(-,root,root)
425%license COPYING
426%doc NEWS README_*
427%doc docs/installed/html docs/installed/*.pdf
428%{_bindir}/*
429%dir %{_libdir}/%{name}
430%{_libdir}/%{name}/*[^ao]
431%{_libdir}/%{name}/[^l]*o
432%{_mandir}/man1/*
433
434%files devel
435%defattr(-,root,root)
436%dir %{_includedir}/valgrind
437%{_includedir}/valgrind/valgrind.h
438%{_includedir}/valgrind/callgrind.h
439%{_includedir}/valgrind/drd.h
440%{_includedir}/valgrind/helgrind.h
441%{_includedir}/valgrind/memcheck.h
442%{_libdir}/pkgconfig/valgrind.pc
443
444%if %{build_tools_devel}
445%files tools-devel
446%{_includedir}/valgrind/config.h
447%{_includedir}/valgrind/libvex*h
448%{_includedir}/valgrind/pub_tool_*h
449%{_includedir}/valgrind/vki
450%dir %{_libdir}/valgrind
451%{_libdir}/valgrind/*.a
452%endif
453
454%if %{build_openmpi}
455%files openmpi
456%defattr(-,root,root)
457%dir %{_libdir}/valgrind
458%{_libdir}/openmpi/valgrind/libmpiwrap*.so
459%{_libdir}/valgrind/libmpiwrap*.so
460%endif
461
462
463%changelog
464* Tue Jan 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.14.0-1
465- dropped Patch4-19.
466- import Patch4-35 from rawhide.
467
468* Fri Dec 22 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.13.0-1
469- updated to 3.13.0.
470- replaced all Patches (from rawhide).
471
472* Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
473- updated valgrind to 3.10.1 based on fedora 3.10.1-6
474- replaced all Patches (from fedora)
475
476* Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
477- updated valgrind to 3.7.0
478- replace all Patches (from fedora)
479
480* Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1
481- updated valgrind to 3.6.0
482- updated BR: glibc-devel <= 2.12
483- added BR: gcc <= 4.5
484- added RQ: glibc <= 2.12
485
486* Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1
487- updated valgrind to 3.5.0
488- added BR: glibc-devel >= 2.11
489- split %{name}-devel
490- added patches (from fedora core 12)
491  - valgrind-3.5.0-cachegrind-improvements.patch
492  - valgrind-3.5.0-openat.patch
493  - valgrind-3.5.0-glibc-2.10.1.patch
494  - valgrind-3.5.0-ifunc.patch
495  - valgrind-3.5.0-inotify-init1.patch
496  - valgrind-3.5.0-mmap-mprotect.patch
497  - valgrind-3.5.0-dwarf3.patch
498  - valgrind-3.5.0-pr40659.patch
499  - valgrind-3.5.0-helgrind-race-supp.patch
500  - valgrind-3.5.0-ppc-tests.patch
501  - valgrind-3.5.0-amd64-loopnel.patch
502  - valgrind-3.5.0-ppc-dwarf3.patch
503  - valgrind-3.5.0-amd64-adcsbb.patch
504  - valgrind-3.5.0-syscalls.patch
505  - valgrind-3.5.0-preadv.patch
506  - valgrind-3.5.0-glibc-2.11.patch
507
508* Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5
509- new upstream release
510- changed Group to Development/Tools
511
512* Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5
513- packaged new
514
Note: See TracBrowser for help on using the repository browser.