valgrind-vl.spec 15 KB

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