[9437] | 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 |
---|
[521] | 6 | |
---|
[9437] | 7 | %ifarch x86_64 ppc64 |
---|
| 8 | %global build_multilib 1 |
---|
| 9 | %endif |
---|
[1995] | 10 | |
---|
[9437] | 11 | # Vine Linux doesn't have openmpi package |
---|
| 12 | #ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64 |
---|
| 13 | #global build_openmpi 1 |
---|
| 14 | #else |
---|
| 15 | %global build_openmpi 0 |
---|
| 16 | #endif |
---|
[1995] | 17 | |
---|
[9437] | 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 | |
---|
| 24 | Name: valgrind |
---|
| 25 | Version: 3.10.1 |
---|
| 26 | Release: 1%{?_dist_release} |
---|
| 27 | Summary: Tool for finding memory management bugs in programs |
---|
| 28 | Summary(ja): プログラムのメモリ管理バグを発見するためのツール |
---|
| 29 | |
---|
| 30 | License: GPLv2+ |
---|
| 31 | Group: Development/Debuggers |
---|
| 32 | URL: http://valgrind.org/ |
---|
| 33 | |
---|
| 34 | Source0: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2 |
---|
| 35 | |
---|
| 36 | # Needs investigation and pushing upstream |
---|
| 37 | Patch1: valgrind-3.9.0-cachegrind-improvements.patch |
---|
| 38 | # KDE#211352 - helgrind races in helgrind's own mythread_wrapper |
---|
| 39 | Patch2: valgrind-3.9.0-helgrind-race-supp.patch |
---|
| 40 | # undef st_atime, st_mtime and st_ctime. Unknown why this is (still?) needed. |
---|
| 41 | Patch3: valgrind-3.9.0-stat_h.patch |
---|
| 42 | # Make ld.so supressions slightly less specific. |
---|
| 43 | Patch4: valgrind-3.9.0-ldso-supp.patch |
---|
| 44 | # KDE#342795 Internal glibc __GI_mempcpy call should be intercepted |
---|
| 45 | Patch5: valgrind-3.10.1-mempcpy.patch |
---|
| 46 | # KDE#343802 - s390x memcheck reports spurious conditional jump |
---|
| 47 | Patch6: valgrind-3.10-s390-spechelper.patch |
---|
| 48 | # KDE#342038, KDE#343732, KDE#343733, KDE#344007, KDE#344307 |
---|
| 49 | # mbind, get_mempolicy, set_mempolicy, flock, setgid, msgget, msgctl, |
---|
| 50 | # msgrcv, msgsnd, accept4, mount, umount2 |
---|
| 51 | Patch7: valgrind-3.10.1-aarch64-syscalls.patch |
---|
| 52 | # KDE#344007 ppc64 missing accept4 syscall |
---|
| 53 | Patch8: valgrind-3.10.1-ppc64-accept4.patch |
---|
| 54 | # KDE#344279 - syscall sendmmsg on arm64 (269) and ppc32/64 (349) unhandled |
---|
| 55 | # KDE#344295 - syscall recvmmsg on arm64 (243) and ppc32/64 (343) unhandled |
---|
| 56 | # KDE#344318 - socketcall should wrap recvmmsg and sendmmsg |
---|
| 57 | Patch9: valgrind-3.10.1-send-recv-mmsg.patch |
---|
| 58 | # Upstream valgrind svn r14530 |
---|
| 59 | Patch10: valgrind-3.10.1-glibc-version-check.patch |
---|
| 60 | |
---|
| 61 | Buildroot: %{_tmppath}/%{name}-%{version}-root |
---|
| 62 | %if %{build_multilib} |
---|
| 63 | # Ensure glibc{,-devel} is installed for both multilib arches |
---|
| 64 | BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so |
---|
| 65 | %endif |
---|
| 66 | BuildRequires: glibc-devel >= 2.14 |
---|
| 67 | %if %{build_openmpi} |
---|
| 68 | BuildRequires: openmpi-devel >= 1.3.3 |
---|
| 69 | %endif |
---|
| 70 | |
---|
| 71 | # For %%build and %%check. |
---|
| 72 | # In case of a software collection, pick the matching gdb and binutils. |
---|
| 73 | BuildRequires: gdb |
---|
| 74 | BuildRequires: binutils |
---|
| 75 | |
---|
| 76 | # gdbserver_tests/filter_make_empty uses ps in test |
---|
| 77 | BuildRequires: procps |
---|
| 78 | |
---|
| 79 | ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 |
---|
| 80 | %ifarch %{ix86} |
---|
| 81 | %define valarch x86 |
---|
| 82 | %define valsecarch %{nil} |
---|
| 83 | %endif |
---|
| 84 | %ifarch x86_64 |
---|
| 85 | %define valarch amd64 |
---|
| 86 | %define valsecarch x86 |
---|
| 87 | %endif |
---|
| 88 | %ifarch ppc |
---|
| 89 | %define valarch ppc32 |
---|
| 90 | %define valsecarch %{nil} |
---|
| 91 | %endif |
---|
| 92 | %ifarch ppc64 |
---|
| 93 | %define valarch ppc64be |
---|
| 94 | %if %{build_multilib} |
---|
| 95 | %define valsecarch ppc32 |
---|
| 96 | %else |
---|
| 97 | %define valsecarch %{nil} |
---|
| 98 | %endif |
---|
| 99 | %endif |
---|
| 100 | %ifarch ppc64le |
---|
| 101 | %define valarch ppc64le |
---|
| 102 | %define valsecarch %{nil} |
---|
| 103 | %endif |
---|
| 104 | %ifarch s390x |
---|
| 105 | %define valarch s390x |
---|
| 106 | %define valsecarch %{nil} |
---|
| 107 | %endif |
---|
| 108 | %ifarch armv7hl |
---|
| 109 | %define valarch arm |
---|
| 110 | %define valsecarch %{nil} |
---|
| 111 | %endif |
---|
| 112 | %ifarch aarch64 |
---|
| 113 | %define valarch arm64 |
---|
| 114 | %define valsecarch %{nil} |
---|
| 115 | %endif |
---|
| 116 | |
---|
| 117 | # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed |
---|
| 118 | # DWARF very well and it might read its own vgpreload libraries. Generating |
---|
| 119 | # minisymtabs doesn't really work for the staticly linked tools. |
---|
| 120 | %define _find_debuginfo_dwz_opts %{nil} |
---|
| 121 | %undefine _include_minidebuginfo |
---|
| 122 | |
---|
| 123 | |
---|
[521] | 124 | %description |
---|
[1995] | 125 | Valgrind is a tool to help you find memory-management problems in your |
---|
| 126 | programs. When a program is run under Valgrind's supervision, all |
---|
| 127 | reads and writes of memory are checked, and calls to |
---|
| 128 | malloc/new/free/delete are intercepted. As a result, Valgrind can |
---|
| 129 | detect a lot of problems that are otherwise very hard to |
---|
| 130 | find/diagnose. |
---|
[521] | 131 | |
---|
[1995] | 132 | %package devel |
---|
[9437] | 133 | Summary: Development files for valgrind |
---|
| 134 | Summary(ja): Valgrind の開発用ファイル |
---|
| 135 | Group: Development/Libraries |
---|
| 136 | Requires: %{name} = %{version}-%{release} |
---|
| 137 | Provides: %{name}-static = %{version}-%{release} |
---|
[521] | 138 | |
---|
[1995] | 139 | %description devel |
---|
| 140 | Header files and libraries for development of valgrind aware programs |
---|
| 141 | or valgrind plugins. |
---|
[521] | 142 | |
---|
[9437] | 143 | %package openmpi |
---|
| 144 | Summary: OpenMPI support for valgrind |
---|
| 145 | Summary(ja): Valgrind の OpenMPI サポート |
---|
| 146 | Group: Development/Debuggers |
---|
| 147 | Requires: %{name} = %{version}-%{release} |
---|
[1995] | 148 | |
---|
[9437] | 149 | %description openmpi |
---|
| 150 | A wrapper library for debugging OpenMPI parallel programs with valgrind. |
---|
| 151 | See the section on Debugging MPI Parallel Programs with Valgrind in the |
---|
| 152 | Valgrind User Manual for details. |
---|
| 153 | |
---|
| 154 | |
---|
[521] | 155 | %prep |
---|
| 156 | %setup -q -n %{name}-%{version} |
---|
[1995] | 157 | %patch1 -p1 |
---|
| 158 | %patch2 -p1 |
---|
| 159 | %patch3 -p1 |
---|
[6011] | 160 | %patch4 -p1 |
---|
| 161 | %patch5 -p1 |
---|
| 162 | %patch6 -p1 |
---|
| 163 | %patch7 -p1 |
---|
| 164 | %patch8 -p1 |
---|
[1995] | 165 | %patch9 -p1 |
---|
[6011] | 166 | %patch10 -p1 |
---|
[521] | 167 | |
---|
[1995] | 168 | |
---|
[521] | 169 | %build |
---|
[9437] | 170 | CC=gcc |
---|
| 171 | %if %{build_multilib} |
---|
| 172 | # Ugly hack - libgcc 32-bit package might not be installed |
---|
| 173 | mkdir -p shared/libgcc/32 |
---|
| 174 | ar r shared/libgcc/32/libgcc_s.a |
---|
| 175 | ar r shared/libgcc/libgcc_s_32.a |
---|
| 176 | CC="gcc -B `pwd`/shared/libgcc/" |
---|
| 177 | %endif |
---|
| 178 | |
---|
| 179 | %define mpiccpath %{_libdir}/openmpi/*/bin/mpicc |
---|
| 180 | |
---|
| 181 | # Filter out some flags that cause lots of valgrind test failures. |
---|
| 182 | # Also filter away -O2, valgrind adds it wherever suitable, but |
---|
| 183 | # not for tests which should be -O0, as they aren't meant to be |
---|
| 184 | # compiled with -O2 unless explicitely requested. Same for any -mcpu flag. |
---|
| 185 | # Ideally we will change this to only be done for the non-primary build |
---|
| 186 | # and the test suite. |
---|
| 187 | 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/ $//'`" |
---|
| 188 | %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \ |
---|
| 189 | %if %{build_openmpi} |
---|
| 190 | --with-mpicc=%{mpiccpath} \ |
---|
| 191 | %endif |
---|
| 192 | GDB=%{_bindir}/gdb |
---|
| 193 | |
---|
[521] | 194 | make %{?_smp_mflags} |
---|
| 195 | |
---|
[9437] | 196 | # Ensure there are no unexpected file descriptors open, |
---|
| 197 | # the testsuite otherwise fails. |
---|
| 198 | cat > close_fds.c <<EOF |
---|
| 199 | #include <stdlib.h> |
---|
| 200 | #include <unistd.h> |
---|
| 201 | int main (int argc, char *const argv[]) |
---|
| 202 | { |
---|
| 203 | int i, j = sysconf (_SC_OPEN_MAX); |
---|
| 204 | if (j < 0) |
---|
| 205 | exit (1); |
---|
| 206 | for (i = 3; i < j; ++i) |
---|
| 207 | close (i); |
---|
| 208 | execvp (argv[1], argv + 1); |
---|
| 209 | exit (1); |
---|
| 210 | } |
---|
| 211 | EOF |
---|
| 212 | gcc $RPM_OPT_FLAGS -o close_fds close_fds.c |
---|
[521] | 213 | |
---|
| 214 | %install |
---|
| 215 | rm -rf $RPM_BUILD_ROOT |
---|
| 216 | make install DESTDIR=$RPM_BUILD_ROOT |
---|
| 217 | |
---|
| 218 | rm -rf docs.installed |
---|
| 219 | mkdir docs.installed |
---|
[1995] | 220 | mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/* docs.installed/ |
---|
[9437] | 221 | rm -f docs.installed/*.ps |
---|
[521] | 222 | |
---|
[9437] | 223 | %if "%{valsecarch}" != "" |
---|
| 224 | pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/ |
---|
| 225 | rm -f *-%{valsecarch}-* || : |
---|
| 226 | for i in *-%{valarch}-*; do |
---|
| 227 | j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'` |
---|
| 228 | ln -sf ../../lib/valgrind/$j $j |
---|
| 229 | done |
---|
| 230 | popd |
---|
| 231 | %endif |
---|
| 232 | |
---|
[1995] | 233 | # remove unuse files |
---|
[9437] | 234 | rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in |
---|
[521] | 235 | |
---|
[1995] | 236 | |
---|
[9437] | 237 | %ifarch %{ix86} x86_64 |
---|
| 238 | # To avoid multilib clashes in between i?86 and x86_64, |
---|
| 239 | # tweak installed <valgrind/config.h> a little bit. |
---|
| 240 | for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS ; do |
---|
| 241 | sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \ |
---|
| 242 | $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h |
---|
| 243 | done |
---|
| 244 | %endif |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | %check |
---|
| 248 | # Make sure a basic binary runs. |
---|
| 249 | ./vg-in-place /bin/true |
---|
| 250 | |
---|
| 251 | # Make sure no extra CFLAGS leak through, the testsuite sets all flags |
---|
| 252 | # necessary. See also configure above. |
---|
| 253 | make %{?_smp_mflags} CFLAGS="" check || : |
---|
| 254 | |
---|
| 255 | echo ===============TESTING=================== |
---|
| 256 | ./close_fds make regtest || : |
---|
| 257 | |
---|
| 258 | # Make sure test failures show up in build.log |
---|
| 259 | # Gather up the diffs (at most the first 20 lines for each one) |
---|
| 260 | MAX_LINES=20 |
---|
| 261 | diff_files=`find . -name '*.diff' | sort` |
---|
| 262 | if [ z"$diff_files" = z ] ; then |
---|
| 263 | echo "Congratulations, all tests passed!" >> diffs |
---|
| 264 | else |
---|
| 265 | for i in $diff_files ; do |
---|
| 266 | echo "=================================================" >> diffs |
---|
| 267 | echo $i >> diffs |
---|
| 268 | echo "=================================================" >> diffs |
---|
| 269 | if [ `wc -l < $i` -le $MAX_LINES ] ; then |
---|
| 270 | cat $i >> diffs |
---|
| 271 | else |
---|
| 272 | head -n $MAX_LINES $i >> diffs |
---|
| 273 | echo "<truncated beyond $MAX_LINES lines>" >> diffs |
---|
| 274 | fi |
---|
| 275 | done |
---|
| 276 | fi |
---|
| 277 | cat diffs |
---|
| 278 | echo ===============END TESTING=============== |
---|
| 279 | |
---|
| 280 | |
---|
[521] | 281 | %clean |
---|
| 282 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT} |
---|
| 283 | |
---|
| 284 | %files |
---|
| 285 | %defattr(-,root,root) |
---|
[9437] | 286 | %doc COPYING NEWS README_* |
---|
| 287 | %doc docs.installed/html docs.installed/*.pdf |
---|
[521] | 288 | %{_bindir}/* |
---|
[1995] | 289 | %dir %{_libdir}/%{name} |
---|
[9437] | 290 | %{_libdir}/%{name}/*[^ao] |
---|
| 291 | %{_libdir}/%{name}/[^l]*o |
---|
[1995] | 292 | %{_mandir}/man1/* |
---|
[521] | 293 | |
---|
[1995] | 294 | %files devel |
---|
[521] | 295 | %defattr(-,root,root) |
---|
[1995] | 296 | %{_includedir}/%{name} |
---|
[9437] | 297 | %dir %{_libdir}/%{name} |
---|
| 298 | %{_libdir}/%{name}/*.a |
---|
[1995] | 299 | %{_libdir}/pkgconfig/%{name}.pc |
---|
[521] | 300 | |
---|
[9437] | 301 | %if %{build_openmpi} |
---|
| 302 | %files openmpi |
---|
| 303 | %defattr(-,root,root) |
---|
| 304 | %dir %{_libdir}/%{name} |
---|
| 305 | %{_libdir}/%{name}/libmpiwrap*.so |
---|
| 306 | %endif |
---|
[1995] | 307 | |
---|
[9437] | 308 | |
---|
[521] | 309 | %changelog |
---|
[9437] | 310 | * Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1 |
---|
| 311 | - updated valgrind to 3.10.1 based on fedora 3.10.1-6 |
---|
| 312 | - replaced all Patches (from fedora) |
---|
| 313 | |
---|
[6011] | 314 | * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1 |
---|
| 315 | - updated valgrind to 3.7.0 |
---|
| 316 | - replace all Patches (from fedora) |
---|
| 317 | |
---|
[2201] | 318 | * Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1 |
---|
| 319 | - updated valgrind to 3.6.0 |
---|
| 320 | - updated BR: glibc-devel <= 2.12 |
---|
| 321 | - added BR: gcc <= 4.5 |
---|
| 322 | - added RQ: glibc <= 2.12 |
---|
| 323 | |
---|
[1995] | 324 | * Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1 |
---|
| 325 | - updated valgrind to 3.5.0 |
---|
| 326 | - added BR: glibc-devel >= 2.11 |
---|
| 327 | - split %{name}-devel |
---|
| 328 | - added patches (from fedora core 12) |
---|
| 329 | - valgrind-3.5.0-cachegrind-improvements.patch |
---|
| 330 | - valgrind-3.5.0-openat.patch |
---|
| 331 | - valgrind-3.5.0-glibc-2.10.1.patch |
---|
| 332 | - valgrind-3.5.0-ifunc.patch |
---|
| 333 | - valgrind-3.5.0-inotify-init1.patch |
---|
| 334 | - valgrind-3.5.0-mmap-mprotect.patch |
---|
| 335 | - valgrind-3.5.0-dwarf3.patch |
---|
| 336 | - valgrind-3.5.0-pr40659.patch |
---|
| 337 | - valgrind-3.5.0-helgrind-race-supp.patch |
---|
| 338 | - valgrind-3.5.0-ppc-tests.patch |
---|
| 339 | - valgrind-3.5.0-amd64-loopnel.patch |
---|
| 340 | - valgrind-3.5.0-ppc-dwarf3.patch |
---|
| 341 | - valgrind-3.5.0-amd64-adcsbb.patch |
---|
| 342 | - valgrind-3.5.0-syscalls.patch |
---|
| 343 | - valgrind-3.5.0-preadv.patch |
---|
| 344 | - valgrind-3.5.0-glibc-2.11.patch |
---|
| 345 | |
---|
[521] | 346 | * Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5 |
---|
| 347 | - new upstream release |
---|
| 348 | - changed Group to Development/Tools |
---|
| 349 | |
---|
| 350 | * Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5 |
---|
| 351 | - packaged new |
---|
| 352 | |
---|