File ltrace.spec of Package ltrace

#
# spec file for package ltrace
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           ltrace
BuildRequires:  binutils-devel
BuildRequires:  dejagnu
BuildRequires:  gcc-c++
BuildRequires:  libelf-devel
Url:            http://ltrace.org/
# bug437293
%ifarch ppc64
Obsoletes:      ltrace-64bit
%endif
#
Summary:        Trace the Library and System Calls a Program Makes
License:        GPL-2.0+
Group:          Development/Tools/Debuggers
Version:        0.7.2
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 s390 s390x ppc ppc64 ppc64le %arm x86_64 alpha ia64 m68k
Prefix:         /usr
Source:         ltrace-%{version}.tar.bz2
Source2:        baselibs.conf

# Patches needed for ppc64 little endian
# These patches are corresponding to the retrofit of
# eea4ad2cce289753aaa35b4e0258a76d8f8f367c  upstream patch
# (ppc64le support) on version 0.7.2.8.10
Patch0:         ltrace-ppc64le_configure.patch
#379    653085a32cdc89f5215c2d70249b58c9fe6aebb7
Patch1:         ltrace-ppc64le_git1.patch
#338    d7e4ca82e1cf20bb2605befb1da74dd1688c706e
Patch2:         ltrace-ppc64le_git2.patch
#337    2718e3fdab7a3ac75dad45c6969f1aeb4a159a68
Patch3:         ltrace-ppc64le_git3.patch
#295    567399a16ca50e59332293bb34ee37660d4068c9
Patch4:         ltrace-ppc64le_git4.patch
#220    982cbca34b2b49a158086ff5f43eb9bba89edead        
Patch5:         ltrace-ppc64le_git5.patch
#137    7a29f9e7a2bd5849886519eb82e9c043d24c6a40
Patch6:         ltrace-ppc64le_git6.patch
#136    b420a226cd2fc5d6028adcaf236c512a1f1fb437
Patch7:         ltrace-ppc64le_git7.patch
#134    a186b0e5c469156b9af66e88dca12d208418195c
Patch8:         ltrace-ppc64le_git8.patch
#125    88070a85ddaf5d2f4c6e89b5fbb5db5124049b4b
Patch9:         ltrace-ppc64le_git9.patch
#119    673ff510953b65b844a58478aa434120f457c014
Patch10:        ltrace-ppc64le_git10.patch
#118    b061bae322edd4894f14ea2aea6baec36d32eda8
Patch11:        ltrace-ppc64le_git11.patch
#115    73b85aadbf377541ac336914e5ff8ec521226a97
Patch12:        ltrace-ppc64le_git12.patch
#110    54bb64cf2eae7a0daa4d17e980b743b8ae69413b        
Patch13:        ltrace-ppc64le_git13.patch
#108    97d13666cd84589135ba593fa43a800d098026d0        
Patch14:        ltrace-ppc64le_git14.patch
#107    fa844db00b61b9f61c9ae8c6f4165aa5fff3a5d7
Patch15:        ltrace-ppc64le_git15.patch
#72     35742523e3daa0e59de0c1c3fdd8e5ff52891967
Patch16:        ltrace-ppc64le_git16.patch
#4      eea4ad2cce289753aaa35b4e0258a76d8f8f367c  (ppc64le)
Patch17:        ltrace-ppc64le_git17.patch
#	a2c270e86913ab93c41cdd61055d7c2b71b10fa1  (dict.c part)
Patch18:        ltrace-ppc64le_git18.patch

%description
Ltrace is a program that runs the specified command until it exits. It
intercepts and records the dynamic library calls that are called by the
executed process and the signals that are received by that process. It
can also intercept and print the system calls executed by the program.

The program to trace need not be recompiled for this, so you can use
ltrace on binaries for which you do not have access to the source.

This is still a work in progress, so, for example, the tracking to
child processes may fail or some things may not work as expected.

%prep
%setup -q
# ppc64le patches
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
%patch17
%patch18 -p1

%build
export CFLAGS="%{optflags} -Wall -Wno-unused-local-typedefs"
./configure --prefix=/usr \
	    --sysconfdir=/etc \
	    --mandir=%{_mandir} \
  	    --disable-shared \
%ifarch armv4l
	    --build=arm-suse-linux
%else
	    --build=%{_target_cpu}-suse-linux
%endif
make
%if 1
if make check
then
	echo 'no make check errors' > testresults.txt
else
	for file in `find testsuite -name "*.ltrace"`
	do
		echo
		echo $file
		echo
		cat $file
		echo
	done >> testresults.txt
fi
mv testresults.txt %{_target_cpu}-testresults.txt
ln testsuite/testrun.sum testsuite/%{_target_cpu}-testrun.sum
%else
echo no make check > %{_target_cpu}-testresults.txt
echo no make check > testsuite/%{_target_cpu}-testrun.sum
%endif

%install
make install DESTDIR=%{buildroot}
rm -rf %{buildroot}/usr/share/doc/ltrace

%files
%defattr(-,root,root)
%doc COPYING README %{_target_cpu}-testresults.txt testsuite/%{_target_cpu}-testrun.sum
%{_bindir}/ltrace
%{_mandir}/man1/ltrace.1.gz
%{_mandir}/man5/ltrace.conf.5.gz
%config /etc/ltrace.conf

%changelog