valgrind-vl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. # Only arches that are supported upstream as multilib and that the distro
  2. # has multilib builds for should set build_multilib 1. In practice that
  3. # is only x86_64 and ppc64 (but not in fedora 21 and later, and never
  4. # for ppc64le).
  5. %global build_multilib 0
  6. %ifarch x86_64 ppc64
  7. %global build_multilib 1
  8. %endif
  9. # Vine Linux doesn't have openmpi package
  10. #ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64
  11. #global build_openmpi 1
  12. #else
  13. %global build_openmpi 0
  14. #endif
  15. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  16. # DWARF very well and it might read its own vgpreload libraries. Generating
  17. # minisymtabs doesn't really work for the staticly linked tools.
  18. %define _find_debuginfo_dwz_opts %{nil}
  19. %undefine _include_minidebuginfo
  20. Name: valgrind
  21. Version: 3.13.0
  22. Release: 1%{?_dist_release}
  23. Summary: Tool for finding memory management bugs in programs
  24. Summary(ja): プログラムのメモリ管理バグを発見するためのツール
  25. License: GPLv2+
  26. Group: Development/Debuggers
  27. URL: http://valgrind.org/
  28. Source0: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2
  29. # Needs investigation and pushing upstream
  30. Patch1: valgrind-3.9.0-cachegrind-improvements.patch
  31. # KDE#211352 - helgrind races in helgrind's own mythread_wrapper
  32. Patch2: valgrind-3.9.0-helgrind-race-supp.patch
  33. # Make ld.so supressions slightly less specific.
  34. Patch3: valgrind-3.9.0-ldso-supp.patch
  35. # KDE#381272 ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
  36. Patch4: valgrind-3.13.0-ppc64-check-no-vsx.patch
  37. # KDE#381289 epoll_pwait can have a NULL sigmask.
  38. Patch5: valgrind-3.13.0-epoll_pwait.patch
  39. # KDE#381274 powerpc too chatty even with --sigill-diagnostics=no
  40. Patch6: valgrind-3.13.0-ppc64-diag.patch
  41. # KDE#381556 arm64: Handle feature registers access on 4.11 Linux kernel
  42. # Workaround that masks CPUID support in HWCAP on aarch64 (#1464211)
  43. Patch7: valgrind-3.13.0-arm64-hwcap.patch
  44. # RHBZ#1466017 ARM ld.so index warnings.
  45. # KDE#381805 arm32 needs ld.so index hardwire for new glibc security fixes
  46. Patch8: valgrind-3.13.0-arm-index-hardwire.patch
  47. # KDE#381769 Use ucontext_t instead of struct ucontext
  48. Patch9: valgrind-3.13.0-ucontext_t.patch
  49. # valgrind svn r16453 Fix some tests failure with GDB 8.0
  50. Patch10: valgrind-3.13.0-gdb-8-testfix.patch
  51. # valgrind svn r16454. disable vgdb poll in the child after fork
  52. Patch11: valgrind-3.13.0-disable-vgdb-child.patch
  53. # KDE#382998 xml-socket doesn't work
  54. Patch12: valgrind-3.13.0-xml-socket.patch
  55. # KDE#385334
  56. # PPC64, vpermr, xxperm, xxpermr fix Iop_Perm8x16 selector field
  57. # PPC64, revert the change to vperm instruction.
  58. # KDE#385183
  59. # PPC64, Add support for xscmpeqdp, xscmpgtdp, xscmpgedp, xsmincdp instructions
  60. # PPC64, Fix bug in vperm instruction.
  61. # KDE#385210
  62. # PPC64, Re-implement the vpermr instruction using the Iop_Perm8x16.
  63. # KDE#385208
  64. # PPC64, Use the vperm code to implement the xxperm inst.
  65. # PPC64, Replace body of generate_store_FPRF with C helper function.
  66. # PPC64, Add support for the Data Stream Control Register (DSCR)
  67. Patch13: valgrind-3.13.0-ppc64-vex-fixes.patch
  68. # Fix eflags handling in amd64 instruction tests
  69. Patch14: valgrind-3.13.0-amd64-eflags-tests.patch
  70. # KDE#385868 ld.so _dl_runtime_resolve_avx_slow conditional jump warning
  71. Patch15: valgrind-3.13.0-suppress-dl-trampoline-sse-avx.patch
  72. # Implement static TLS code for more platforms
  73. Patch16: valgrind-3.13.0-static-tls.patch
  74. # KDE#386397 PPC64 valgrind truncates powerpc timebase to 32-bits.
  75. Patch17: valgrind-3.13.0-ppc64-timebase.patch
  76. # KDE#387773 - Files in .gnu_debugaltlink should be resolved relative to .debug
  77. Patch18: valgrind-3.13.0-debug-alt-file.patch
  78. # KDE#387712 s390x cgijnl reports Conditional jump depends on uninit value
  79. Patch19: valgrind-3.13.0-s390-cgijnl.patch
  80. Buildroot: %{_tmppath}/%{name}-%{version}-root
  81. %if %{build_multilib}
  82. # Ensure glibc{,-devel} is installed for both multilib arches
  83. BuildRequires: compat32-glibc-devel
  84. %endif
  85. BuildRequires: glibc-devel >= 2.14
  86. %if %{build_openmpi}
  87. BuildRequires: openmpi-devel >= 1.3.3
  88. %endif
  89. # For %%build and %%check.
  90. # In case of a software collection, pick the matching gdb and binutils.
  91. BuildRequires: gdb
  92. BuildRequires: binutils
  93. # gdbserver_tests/filter_make_empty uses ps in test
  94. BuildRequires: procps
  95. ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
  96. %ifarch %{ix86}
  97. %define valarch x86
  98. %define valsecarch %{nil}
  99. %endif
  100. %ifarch x86_64
  101. %define valarch amd64
  102. %define valsecarch x86
  103. %endif
  104. %ifarch ppc
  105. %define valarch ppc32
  106. %define valsecarch %{nil}
  107. %endif
  108. %ifarch ppc64
  109. %define valarch ppc64be
  110. %if %{build_multilib}
  111. %define valsecarch ppc32
  112. %else
  113. %define valsecarch %{nil}
  114. %endif
  115. %endif
  116. %ifarch ppc64le
  117. %define valarch ppc64le
  118. %define valsecarch %{nil}
  119. %endif
  120. %ifarch s390x
  121. %define valarch s390x
  122. %define valsecarch %{nil}
  123. %endif
  124. %ifarch armv7hl
  125. %define valarch arm
  126. %define valsecarch %{nil}
  127. %endif
  128. %ifarch aarch64
  129. %define valarch arm64
  130. %define valsecarch %{nil}
  131. %endif
  132. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  133. # DWARF very well and it might read its own vgpreload libraries. Generating
  134. # minisymtabs doesn't really work for the staticly linked tools.
  135. %define _find_debuginfo_dwz_opts %{nil}
  136. %undefine _include_minidebuginfo
  137. %description
  138. Valgrind is a tool to help you find memory-management problems in your
  139. programs. When a program is run under Valgrind's supervision, all
  140. reads and writes of memory are checked, and calls to
  141. malloc/new/free/delete are intercepted. As a result, Valgrind can
  142. detect a lot of problems that are otherwise very hard to
  143. find/diagnose.
  144. %package devel
  145. Summary: Development files for valgrind
  146. Summary(ja): Valgrind の開発用ファイル
  147. Group: Development/Libraries
  148. Requires: %{name} = %{version}-%{release}
  149. Provides: %{name}-static = %{version}-%{release}
  150. %description devel
  151. Header files and libraries for development of valgrind aware programs
  152. or valgrind plugins.
  153. %package openmpi
  154. Summary: OpenMPI support for valgrind
  155. Summary(ja): Valgrind の OpenMPI サポート
  156. Group: Development/Debuggers
  157. Requires: %{name} = %{version}-%{release}
  158. %description openmpi
  159. A wrapper library for debugging OpenMPI parallel programs with valgrind.
  160. See the section on Debugging MPI Parallel Programs with Valgrind in the
  161. Valgrind User Manual for details.
  162. %prep
  163. %setup -q -n %{name}-%{version}
  164. %patch1 -p1
  165. %patch2 -p1
  166. %patch3 -p1
  167. %patch4 -p1
  168. %patch5 -p1
  169. %patch6 -p1
  170. %patch7 -p1
  171. %patch8 -p1
  172. %patch9 -p1
  173. %patch10 -p1
  174. %patch11 -p1
  175. %patch12 -p1
  176. %patch13 -p1
  177. %patch14 -p1
  178. %patch15 -p1
  179. %patch16 -p1
  180. %patch17 -p1
  181. %patch18 -p1
  182. %patch19 -p1
  183. %build
  184. CC=gcc
  185. %if %{build_multilib}
  186. # Ugly hack - libgcc 32-bit package might not be installed
  187. mkdir -p shared/libgcc/32
  188. ar r shared/libgcc/32/libgcc_s.a
  189. ar r shared/libgcc/libgcc_s_32.a
  190. CC="gcc -B `pwd`/shared/libgcc/"
  191. %endif
  192. %define mpiccpath %{_libdir}/openmpi/*/bin/mpicc
  193. # Filter out some flags that cause lots of valgrind test failures.
  194. # Also filter away -O2, valgrind adds it wherever suitable, but
  195. # not for tests which should be -O0, as they aren't meant to be
  196. # compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
  197. # Ideally we will change this to only be done for the non-primary build
  198. # and the test suite.
  199. OPTFLAGS="`echo " %{optflags} " | sed 's/ -m\(64\|3[21]\) / /g;s/ -fexceptions / /g;s/ -fstack-protector / / g;s/ -Wp,-D_FORTIFY_SOURCE=2 / /g;s/ -O2 / /g;s/ -mcpu=\([a-z0-9]\+\) / /g;s/^ //;s/ $//'`"
  200. %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
  201. %if %{build_openmpi}
  202. --with-mpicc=%{mpiccpath} \
  203. %endif
  204. GDB=%{_bindir}/gdb
  205. make %{?_smp_mflags}
  206. # Ensure there are no unexpected file descriptors open,
  207. # the testsuite otherwise fails.
  208. cat > close_fds.c <<EOF
  209. #include <stdlib.h>
  210. #include <unistd.h>
  211. int main (int argc, char *const argv[])
  212. {
  213. int i, j = sysconf (_SC_OPEN_MAX);
  214. if (j < 0)
  215. exit (1);
  216. for (i = 3; i < j; ++i)
  217. close (i);
  218. execvp (argv[1], argv + 1);
  219. exit (1);
  220. }
  221. EOF
  222. gcc $RPM_OPT_FLAGS -o close_fds close_fds.c
  223. %install
  224. rm -rf $RPM_BUILD_ROOT
  225. make install DESTDIR=$RPM_BUILD_ROOT
  226. rm -rf docs.installed
  227. mkdir docs.installed
  228. mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/* docs.installed/
  229. rm -f docs.installed/*.ps
  230. %if "%{valsecarch}" != ""
  231. pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
  232. rm -f *-%{valsecarch}-* || :
  233. for i in *-%{valarch}-*; do
  234. j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
  235. ln -sf ../../lib/valgrind/$j $j
  236. done
  237. popd
  238. %endif
  239. # remove unuse files
  240. rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in
  241. %ifarch %{ix86} x86_64
  242. # To avoid multilib clashes in between i?86 and x86_64,
  243. # tweak installed <valgrind/config.h> a little bit.
  244. for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS ; do
  245. sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
  246. $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  247. done
  248. %endif
  249. %check
  250. # Make sure a basic binary runs.
  251. ./vg-in-place /bin/true
  252. # Make sure no extra CFLAGS leak through, the testsuite sets all flags
  253. # necessary. See also configure above.
  254. make %{?_smp_mflags} CFLAGS="" check || :
  255. echo ===============TESTING===================
  256. ./close_fds make regtest || :
  257. # Make sure test failures show up in build.log
  258. # Gather up the diffs (at most the first 20 lines for each one)
  259. MAX_LINES=20
  260. diff_files=`find . -name '*.diff' | sort`
  261. if [ z"$diff_files" = z ] ; then
  262. echo "Congratulations, all tests passed!" >> diffs
  263. else
  264. for i in $diff_files ; do
  265. echo "=================================================" >> diffs
  266. echo $i >> diffs
  267. echo "=================================================" >> diffs
  268. if [ `wc -l < $i` -le $MAX_LINES ] ; then
  269. cat $i >> diffs
  270. else
  271. head -n $MAX_LINES $i >> diffs
  272. echo "<truncated beyond $MAX_LINES lines>" >> diffs
  273. fi
  274. done
  275. fi
  276. cat diffs
  277. echo ===============END TESTING===============
  278. %clean
  279. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  280. %files
  281. %defattr(-,root,root)
  282. %doc COPYING NEWS README_*
  283. %doc docs.installed/html docs.installed/*.pdf
  284. %{_bindir}/*
  285. %dir %{_libdir}/%{name}
  286. %{_libdir}/%{name}/*[^ao]
  287. %{_libdir}/%{name}/[^l]*o
  288. %{_mandir}/man1/*
  289. %files devel
  290. %defattr(-,root,root)
  291. %{_includedir}/%{name}
  292. %dir %{_libdir}/%{name}
  293. %{_libdir}/%{name}/*.a
  294. %{_libdir}/pkgconfig/%{name}.pc
  295. %if %{build_openmpi}
  296. %files openmpi
  297. %defattr(-,root,root)
  298. %dir %{_libdir}/%{name}
  299. %{_libdir}/%{name}/libmpiwrap*.so
  300. %endif
  301. %changelog
  302. * Fri Dec 22 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.13.0-1
  303. - updated to 3.13.0.
  304. - replaced all Patches (from rawhide).
  305. * Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
  306. - updated valgrind to 3.10.1 based on fedora 3.10.1-6
  307. - replaced all Patches (from fedora)
  308. * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
  309. - updated valgrind to 3.7.0
  310. - replace all Patches (from fedora)
  311. * Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1
  312. - updated valgrind to 3.6.0
  313. - updated BR: glibc-devel <= 2.12
  314. - added BR: gcc <= 4.5
  315. - added RQ: glibc <= 2.12
  316. * Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1
  317. - updated valgrind to 3.5.0
  318. - added BR: glibc-devel >= 2.11
  319. - split %{name}-devel
  320. - added patches (from fedora core 12)
  321. - valgrind-3.5.0-cachegrind-improvements.patch
  322. - valgrind-3.5.0-openat.patch
  323. - valgrind-3.5.0-glibc-2.10.1.patch
  324. - valgrind-3.5.0-ifunc.patch
  325. - valgrind-3.5.0-inotify-init1.patch
  326. - valgrind-3.5.0-mmap-mprotect.patch
  327. - valgrind-3.5.0-dwarf3.patch
  328. - valgrind-3.5.0-pr40659.patch
  329. - valgrind-3.5.0-helgrind-race-supp.patch
  330. - valgrind-3.5.0-ppc-tests.patch
  331. - valgrind-3.5.0-amd64-loopnel.patch
  332. - valgrind-3.5.0-ppc-dwarf3.patch
  333. - valgrind-3.5.0-amd64-adcsbb.patch
  334. - valgrind-3.5.0-syscalls.patch
  335. - valgrind-3.5.0-preadv.patch
  336. - valgrind-3.5.0-glibc-2.11.patch
  337. * Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5
  338. - new upstream release
  339. - changed Group to Development/Tools
  340. * Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5
  341. - packaged new