valgrind-vl.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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. Summary: Tool for finding memory management bugs in programs
  24. Summary(ja): プログラムのメモリ管理バグを発見するためのツール
  25. Name: valgrind
  26. Version: 3.23.0
  27. Release: 1%{?_dist_release}
  28. Group: programming
  29. Vendor: Project Vine
  30. Distribution: Vine Linux
  31. License: GPLv2+
  32. URL: https://valgrind.org/
  33. Source0: https://sourceware.org/pub/valgrind/%{name}-%{version}.tar.bz2
  34. # Needs investigation and pushing upstream
  35. Patch1: valgrind-3.9.0-cachegrind-improvements.patch
  36. # Make ld.so supressions slightly less specific.
  37. Patch2: valgrind-3.9.0-ldso-supp.patch
  38. # Add some stack-protector
  39. Patch3: valgrind-3.16.0-some-stack-protector.patch
  40. # Add some -Wl,z,now.
  41. Patch4: valgrind-3.16.0-some-Wl-z-now.patch
  42. # Patches from upstream VALGRIND_3_23_BRANCH
  43. Patch5: 0001-Prepare-NEWS-for-branch-3.23-fixes.patch
  44. Patch6: 0002-486180-MIPS-VexGuestArchState-has-no-member-named-gu.patch
  45. Patch7: 0003-Bug-486293-memccpy-false-positives.patch
  46. Patch8: 0004-Bug-486569-linux-inotify_init-syscall-wrapper-missin.patch
  47. Patch9: 0005-aarch64-frinta-and-frinta-vector-instructions.patch
  48. Patch10: 0006-mips-skip-using-shared-syscall-numbers-for-mips32.patch
  49. Patch11: 0007-Fix-uninitialized-err-in-handle_extension.patch
  50. Patch12: 0008-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch
  51. Patch13: 0009-s390x-Minor-fixes-in-extension-s390x.c.patch
  52. Patch14: 0010-Bug-453044-gbserver_tests-failures-in-aarch64.patch
  53. Patch15: 0011-Linux-regtest-reallocarray-needs-malloc.h.patch
  54. BuildRoot: %{_tmppath}/%{name}-%{version}-root
  55. %if %{build_multilib}
  56. # Ensure glibc{,-devel} is installed for both multilib arches
  57. BuildRequires: compat32-glibc-devel
  58. %endif
  59. BuildRequires: glibc-devel >= 2.14
  60. %if %{build_openmpi}
  61. BuildRequires: openmpi-devel >= 1.3.3
  62. %endif
  63. # For %%build and %%check.
  64. # In case of a software collection, pick the matching gdb and binutils.
  65. BuildRequires: gdb
  66. BuildRequires: binutils
  67. # gdbserver_tests/filter_make_empty uses ps in test
  68. BuildRequires: procps
  69. ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
  70. %ifarch %{ix86}
  71. %define valarch x86
  72. %define valsecarch %{nil}
  73. %endif
  74. %ifarch x86_64
  75. %define valarch amd64
  76. %define valsecarch x86
  77. %endif
  78. %ifarch ppc
  79. %define valarch ppc32
  80. %define valsecarch %{nil}
  81. %endif
  82. %ifarch ppc64
  83. %define valarch ppc64be
  84. %if %{build_multilib}
  85. %define valsecarch ppc32
  86. %else
  87. %define valsecarch %{nil}
  88. %endif
  89. %endif
  90. %ifarch ppc64le
  91. %define valarch ppc64le
  92. %define valsecarch %{nil}
  93. %endif
  94. %ifarch s390x
  95. %define valarch s390x
  96. %define valsecarch %{nil}
  97. %endif
  98. %ifarch armv7hl
  99. %define valarch arm
  100. %define valsecarch %{nil}
  101. %endif
  102. %ifarch aarch64
  103. %define valarch arm64
  104. %define valsecarch %{nil}
  105. %endif
  106. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  107. # DWARF very well and it might read its own vgpreload libraries. Generating
  108. # minisymtabs doesn't really work for the staticly linked tools.
  109. %define _find_debuginfo_dwz_opts %{nil}
  110. %undefine _include_minidebuginfo
  111. %description
  112. Valgrind is a tool to help you find memory-management problems in your
  113. programs. When a program is run under Valgrind's supervision, all
  114. reads and writes of memory are checked, and calls to
  115. malloc/new/free/delete are intercepted. As a result, Valgrind can
  116. detect a lot of problems that are otherwise very hard to
  117. find/diagnose.
  118. %package devel
  119. Summary: Development files for valgrind
  120. Summary(ja): Valgrind の開発用ファイル
  121. Group: programming
  122. Requires: %{name} = %{version}-%{release}
  123. Provides: %{name}-static = %{version}-%{release}
  124. %description devel
  125. Header files and libraries for development of valgrind aware programs
  126. or valgrind plugins.
  127. %package openmpi
  128. Summary: OpenMPI support for valgrind
  129. Summary(ja): Valgrind の OpenMPI サポート
  130. Group: programming
  131. Requires: %{name} = %{version}-%{release}
  132. %description openmpi
  133. A wrapper library for debugging OpenMPI parallel programs with valgrind.
  134. See the section on Debugging MPI Parallel Programs with Valgrind in the
  135. Valgrind User Manual for details.
  136. %debug_package
  137. %prep
  138. %setup -q -n %{name}-%{version}
  139. %autopatch -p1
  140. # Some patches (might) touch Makefile.am or configure.ac files.
  141. # Just always autoreconf so we don't need patches to prebuild files.
  142. ./autogen.sh
  143. %build
  144. # LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
  145. # configure time option, but that doesn't seem to help.
  146. # Disable LTO for now.
  147. %define _lto_cflags %{nil}
  148. CC=gcc
  149. %if %{build_multilib}
  150. # Ugly hack - libgcc 32-bit package might not be installed
  151. mkdir -p shared/libgcc/32
  152. ar r shared/libgcc/32/libgcc_s.a
  153. ar r shared/libgcc/libgcc_s_32.a
  154. CC="gcc -B `pwd`/shared/libgcc/"
  155. %endif
  156. # Old openmpi-devel has version depended paths for mpicc.
  157. %if %{build_openmpi}
  158. %if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
  159. %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/bin/mpicc
  160. %else
  161. %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/*/bin/mpicc
  162. %endif
  163. %else
  164. # We explicitly don't want the libmpi wrapper. So make sure that configure
  165. # doesn't pick some random mpi compiler that happens to be installed.
  166. %define mpiccpath /bin/false
  167. %endif
  168. # Filter out some flags that cause lots of valgrind test failures.
  169. # Also filter away -O2, valgrind adds it wherever suitable, but
  170. # not for tests which should be -O0, as they aren't meant to be
  171. # compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
  172. # Ideally we will change this to only be done for the non-primary build
  173. # and the test suite. Also disable strict symbol checks because the
  174. # vg_preload library will use hidden/undefined symbols from glibc
  175. # like __libc_freeres.
  176. %undefine _hardened_build
  177. %undefine _strict_symbol_defs_build
  178. CFLAGS="`echo " %{optflags} " | sed 's/ -fstack-protector\([-a-z]*\) / / g;s/ -O2 / /g;'`"
  179. LDFLAGS="`echo " %{build_ldflags} " | sed 's/ -Wl,-z,now / / g;'`"
  180. export CFLAGS
  181. export LDFLAGS
  182. %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
  183. --with-mpicc=%{mpiccpath} \
  184. GDB=%{_bindir}/gdb
  185. make %{?_smp_mflags}
  186. %install
  187. rm -rf $RPM_BUILD_ROOT
  188. make DESTDIR=$RPM_BUILD_ROOT install
  189. rm -rf docs/installed
  190. mkdir docs/installed
  191. mv $RPM_BUILD_ROOT%{_datadir}/doc/valgrind/* docs/installed/
  192. rm -f docs/installed/*.ps
  193. # We want the MPI wrapper installed under the openmpi libdir so the script
  194. # generating the MPI library requires picks them up and sets up the right
  195. # openmpi libmpi.so requires. Install symlinks in the original/upstream
  196. # location for backwards compatibility.
  197. %if %{build_openmpi}
  198. pushd $RPM_BUILD_ROOT%{_libdir}
  199. mkdir -p openmpi/valgrind
  200. cd valgrind
  201. mv libmpiwrap-%{valarch}-linux.so ../openmpi/valgrind/
  202. ln -s ../openmpi/valgrind/libmpiwrap-%{valarch}-linux.so
  203. popd
  204. %endif
  205. %if "%{valsecarch}" != ""
  206. pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
  207. rm -f *-%{valsecarch}-* || :
  208. for i in *-%{valarch}-*; do
  209. j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
  210. ln -sf ../../lib/valgrind/$j $j
  211. done
  212. popd
  213. %endif
  214. %if %{build_tools_devel}
  215. %ifarch %{ix86} x86_64
  216. # To avoid multilib clashes in between i?86 and x86_64,
  217. # tweak installed <valgrind/config.h> a little bit.
  218. for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS HAVE_AS_AMD64_FXSAVE64 \
  219. ; do
  220. sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
  221. $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  222. done
  223. %endif
  224. %else
  225. # Remove files we aren't going to package.
  226. # See tools-devel files.
  227. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  228. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/libvex*h
  229. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/pub_tool_*h
  230. rm -rf $RPM_BUILD_ROOT%{_includedir}/valgrind/vki
  231. rm $RPM_BUILD_ROOT%{_libdir}/valgrind/*.a
  232. %endif
  233. # We don't want debuginfo generated for the vgpreload libraries.
  234. # Turn off execute bit so they aren't included in the debuginfo.list.
  235. # We'll turn the execute bit on again in %%files.
  236. chmod 644 $RPM_BUILD_ROOT%{_libexecdir}/valgrind/vgpreload*-*-*so
  237. %if %{with check}
  238. %check
  239. # Make sure a basic binary runs. There should be no errors.
  240. ./vg-in-place --error-exitcode=1 /bin/true --help
  241. # Build the test files with the software collection compiler if available.
  242. %{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
  243. # Make sure no extra CFLAGS, CXXFLAGS or LDFLAGS leak through,
  244. # the testsuite sets all flags necessary. See also configure above.
  245. make %{?_smp_mflags} CFLAGS="" CXXFLAGS="" LDFLAGS="" check
  246. # Workaround https://bugzilla.redhat.com/show_bug.cgi?id=1434601
  247. # for gdbserver tests.
  248. export PYTHONCOERCECLOCALE=0
  249. echo ===============TESTING===================
  250. %if 0%{?run_full_regtest}
  251. make regtest || :
  252. %else
  253. make nonexp-regtest || :
  254. %endif
  255. # Make sure test failures show up in build.log
  256. # Gather up the diffs (at most the first 20 lines for each one)
  257. MAX_LINES=20
  258. diff_files=`find */tests -name '*.diff*' | sort`
  259. if [ z"$diff_files" = z ] ; then
  260. echo "Congratulations, all tests passed!" >> diffs
  261. else
  262. for i in $diff_files ; do
  263. echo "=================================================" >> diffs
  264. echo $i >> diffs
  265. echo "=================================================" >> diffs
  266. if [ `wc -l < $i` -le $MAX_LINES ] ; then
  267. cat $i >> diffs
  268. else
  269. head -n $MAX_LINES $i >> diffs
  270. echo "<truncated beyond $MAX_LINES lines>" >> diffs
  271. fi
  272. done
  273. fi
  274. cat diffs
  275. echo ===============END TESTING===============
  276. %endif
  277. %clean
  278. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  279. %files
  280. %defattr(-,root,root)
  281. %license COPYING
  282. %doc NEWS README_*
  283. %doc docs/installed/html docs/installed/*.pdf
  284. %{_bindir}/*
  285. %dir %{_libexecdir}/%{name}
  286. # Install everything in the libdir except the .so.
  287. # The vgpreload so files might need file mode adjustment.
  288. %{_libexecdir}/valgrind/*[^o]
  289. # Turn on executable bit again for vgpreload libraries.
  290. # Was disabled in %%install to prevent debuginfo stripping.
  291. %attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload*-*-*so
  292. %{_mandir}/man1/*
  293. %files devel
  294. %defattr(-,root,root)
  295. %dir %{_includedir}/valgrind
  296. %{_includedir}/valgrind/valgrind.h
  297. %{_includedir}/valgrind/cachegrind.h
  298. %{_includedir}/valgrind/callgrind.h
  299. %{_includedir}/valgrind/drd.h
  300. %{_includedir}/valgrind/helgrind.h
  301. %{_includedir}/valgrind/memcheck.h
  302. %{_includedir}/valgrind/dhat.h
  303. %{_libdir}/pkgconfig/valgrind.pc
  304. %if %{build_tools_devel}
  305. %files tools-devel
  306. %{_includedir}/valgrind/config.h
  307. %{_includedir}/valgrind/libvex*h
  308. %{_includedir}/valgrind/pub_tool_*h
  309. %{_includedir}/valgrind/vki
  310. %dir %{_libdir}/valgrind
  311. %{_libdir}/valgrind/*.a
  312. %endif
  313. %if %{build_openmpi}
  314. %files openmpi
  315. %defattr(-,root,root)
  316. %dir %{_libdir}/valgrind
  317. %{_libdir}/openmpi/valgrind/libmpiwrap*.so
  318. %{_libdir}/valgrind/libmpiwrap*.so
  319. %endif
  320. %changelog
  321. * Fri Jun 21 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.23.0-1
  322. - new upstream release.
  323. - re-imported all patches from rawhide.
  324. * Sat Sep 23 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.21.0-1
  325. - new upstream release.
  326. - re-imported all patches from rawhide.
  327. * Sat Sep 10 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.19.0-1
  328. - new upstream release.
  329. - re-imported all patches from rawhide.
  330. * Thu Aug 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.17.0-2
  331. - rebuilt with current environment.
  332. * Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.17.0-1
  333. - new upstream release.
  334. - dropped Patch4, 7-10.
  335. - renumbered patches.
  336. * Wed Feb 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.16.1-2
  337. - rebuilt with current environment.
  338. * Wed Aug 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.16.1-1
  339. - new upstream release.
  340. - dropped Patch4-35.
  341. - import Patch4-10 from rawhide.
  342. * Tue Jan 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.14.0-1
  343. - dropped Patch4-19.
  344. - import Patch4-35 from rawhide.
  345. * Fri Dec 22 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.13.0-1
  346. - updated to 3.13.0.
  347. - replaced all Patches (from rawhide).
  348. * Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
  349. - updated valgrind to 3.10.1 based on fedora 3.10.1-6
  350. - replaced all Patches (from fedora)
  351. * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
  352. - updated valgrind to 3.7.0
  353. - replace all Patches (from fedora)
  354. * Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1
  355. - updated valgrind to 3.6.0
  356. - updated BR: glibc-devel <= 2.12
  357. - added BR: gcc <= 4.5
  358. - added RQ: glibc <= 2.12
  359. * Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1
  360. - updated valgrind to 3.5.0
  361. - added BR: glibc-devel >= 2.11
  362. - split %{name}-devel
  363. - added patches (from fedora core 12)
  364. - valgrind-3.5.0-cachegrind-improvements.patch
  365. - valgrind-3.5.0-openat.patch
  366. - valgrind-3.5.0-glibc-2.10.1.patch
  367. - valgrind-3.5.0-ifunc.patch
  368. - valgrind-3.5.0-inotify-init1.patch
  369. - valgrind-3.5.0-mmap-mprotect.patch
  370. - valgrind-3.5.0-dwarf3.patch
  371. - valgrind-3.5.0-pr40659.patch
  372. - valgrind-3.5.0-helgrind-race-supp.patch
  373. - valgrind-3.5.0-ppc-tests.patch
  374. - valgrind-3.5.0-amd64-loopnel.patch
  375. - valgrind-3.5.0-ppc-dwarf3.patch
  376. - valgrind-3.5.0-amd64-adcsbb.patch
  377. - valgrind-3.5.0-syscalls.patch
  378. - valgrind-3.5.0-preadv.patch
  379. - valgrind-3.5.0-glibc-2.11.patch
  380. * Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5
  381. - new upstream release
  382. - changed Group to Development/Tools
  383. * Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5
  384. - packaged new