valgrind-vl.spec 13 KB

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