File itrace.spec of Package itrace

#
# spec file for package itrace (Version 0.9)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           itrace
Version:        0.9
Release:        172.<RELEASE1>
%if 0%{?suse_version} > 1020
BuildRequires:  binutils-devel
BuildRequires:  zlib-devel
%endif
BuildRequires:  kernel-source
# for System.map
BuildRequires:  kernel-ppc64
BuildRequires:  kernel-ppc64-base
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
Url:            http://perfinsp.sourceforge.net/itrace_ppc.html
Summary:        Instruction Tracing Tool
License:        GPL v2 or later
Group:          Development/Tools/Debuggers
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  ppc ppc64
Requires:       itrace-kmp-ppc64
Source0:        Dpiperf.dynamic.4.2.tar.bz2
Patch0:         itrace-scripts.patch
Patch1:         itrace-add-doc.patch
Patch2:         it-modprobe.patch
Patch3:         itrace.bfd.patch
Patch4:         itrace-SLES11-build.patch
Patch5:         itrace-on_each_cpu-fix.patch
Patch6:         itrace-nopage.patch
Patch7:         itrace-miscellaneous-fixes_for-upstream.patch
Patch8:         itrace-d_path.patch
Patch9:         itrace.itrace_only.patch
Patch10:        itrace-driver-makefile-remove-objs.patch
Patch11:        it-hooks-target.patch
Patch12:        it-revert-dyn_patching.patch
Patch13:        itrace.buildchecksfix.patch
%suse_kernel_module_package kdump um xen xenpae default smp debug bigsmp iseries64

%description
ITrace is a software tracing mechanism that runs on Linux. ITrace
traces through application and kernel code and can produce
human-readable ASCII output or qtrace output suitable for analysis by
packages, such as the IBM Performance Simulator for Linux on POWER
(simppc).



Authors:
--------
    Jimmy DeWitt
    Enio Pineda 
    Bob Urquhart
    Scott T. Jones
    Frank Levine
    Craig Chaney
    John Kacur

%package KMP
Summary:        Instruction Tracing Tool
License:        GPL v2 or later
Group:          Development/Tools/Debuggers

%description KMP
ITrace is a software tracing mechanism that runs on Linux. ITrace
traces through application and kernel code and can produce
human-readable ASCII output or qtrace output suitable for analysis by
packages, such as the IBM Performance Simulator for Linux on POWER
(simppc).



Authors:
--------
    Jimmy DeWitt
    Enio Pineda 
    Bob Urquhart
    Scott T. Jones
    Frank Levine
    Craig Chaney
    John Kacur

%prep
%setup -q -n Dpiperf
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1

%build
cp ./bin/pi_*.sh ./scripts
autoreconf -i --force
export LDFLAGS="-L$PWD/src/a2n -L$PWD/src/perfutil"
export CFLAGS="$RPM_OPT_FLAGS -lz"
%ifarch ppc
export HOSTTYPE=ppc64
%else
export HOSTTYPE=%{_arch}
%endif
%configure \
%ifarch ppc
            --enable-lib32on64 \
%endif
	--disable-build_stap
make %{?jobs:-j%jobs}
# build kernel modules
function doit_a() {
	make \
		%{?jobs:-j%jobs} \
		V=1 \
		-k \
		-C $PWD/obj/$flavor \
		$*
}
function doit_b() {
	make \
		%{?jobs:-j%jobs} \
		V=1 \
		-k \
		-C /usr/src/linux-obj/%_target_cpu/$flavor modules \
		M=$PWD/obj/$flavor \
		$*
}
mkdir obj
export ITRACE_DIR=$PWD
for flavor in %flavors_to_build; do
	rm -rf obj/$flavor
	cp -r src/driver obj/$flavor
	export SYSMAP=/boot/System.map-`doit_b -s kernelrelease`
	doit_a hooks.h
	doit_b modules
done

%install
make DESTDIR=$RPM_BUILD_ROOT install
# contains -L $builddir from LDFLAGS
mkdir -p $RPM_BUILD_ROOT/usr/include
cp -aL include/perfutil.h $RPM_BUILD_ROOT/usr/include
#
for i in 1 3 8 ; do
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man$i/
cp -aL doc/*.$i $RPM_BUILD_ROOT%{_mandir}/man$i/
done
#
rm -fv $RPM_BUILD_ROOT%{_libdir}/*.la
for i in \
genmsi \
greater \
hdump \
itracec \
itracegtoff \
itracegton \
pi_watch \
ptt \
rmja2n \
rtdriver \
sysinfo \
; do 
rm -fv $RPM_BUILD_ROOT/usr/bin/$i
done
rm -fv $RPM_BUILD_ROOT%{_libdir}/libwbirlog*
# install kernel modules
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
	make V=1 TOUT=`pwd`/TOUT -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
	M=$PWD/obj/$flavor
done

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files 
%defattr(-,root,root)
%doc TODO README
%{_prefix}/bin/it_setup
%{_prefix}/bin/it_teardown
%{_prefix}/bin/pi_load.sh
%{_prefix}/bin/pi_unload.sh
%ifarch ppc64
%{_prefix}/bin/swtrace
%{_prefix}/bin/itracepids
%endif
%{_prefix}/bin/post
%{_prefix}/%{_lib}/liba2n.a
#%{_prefix}/%{_lib}/libperfutil.a
%{_prefix}/%{_lib}/liba2n.so*
%{_prefix}/%{_lib}/libperfutil.so*
%{_prefix}/include/*
%{_mandir}/*/*

%changelog
* Wed Nov 12 2008 olh@suse.de
- remove swtrace and itracepids from filelist on ppc32
  build itrace-??bit packages
* Fri Nov 07 2008 olh@suse.de
- fix build with kernel 2.6.27 (bnc#417296 - LTC47247)
* Wed Apr 30 2008 olh@suse.de
- update for 2.6.25 API changes, d_path() gets a struct path now
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Thu Feb 28 2008 olh@suse.de
- fix plt bug (bnc#365404 - LTC41799)
* Wed Nov 28 2007 olh@suse.de
- update for 2.6.24 API changes
* Tue Oct 16 2007 olh@suse.de
- fix compile error, unregister_chrdev has no return value
* Mon Oct 15 2007 olh@suse.de
- add power6 support (333483, fate 302745)
* Sun Aug 05 2007 olh@suse.de
- remove inclusion of linux/threads.h
* Thu Jul 05 2007 olh@suse.de
- replace find_type_devices with of_find_node_by_type
  run ldconfig in post/postun
* Sun Apr 15 2007 olh@suse.de
- add module-init-tools to buildrequires
* Thu Jan 25 2007 olh@suse.de
- add binutils-devel to buildrequires
- linux/config.h is gone in 2.6.20
* Tue Oct 17 2006 olh@suse.de
- fix buffer overflow in post (212916)
* Tue Oct 17 2006 olh@suse.de
- fix swtrace typo in README
  make modprobe errors non-fatal in pi_load.sh
* Fri Sep 08 2006 olh@suse.de
- fix build warnings
* Wed Aug 16 2006 olh@suse.de
- enable is_stepping_safe_ss r13 exception hack for all kernels
* Fri Aug 11 2006 olh@suse.de
- disable last change, kprobes are fixed in the kernel
* Wed Jun 14 2006 olh@suse.de
- allow itrace only on POWER5 for the time being (171699 - LTC23555)
  correct setting of pvr in driver_info.cpu_model in pitrace_cpu_init
* Fri Jun 09 2006 olh@suse.de
- remove the buildrequires for glibc-devel-32bit on ppc64 (177064 - LTC23995)
  It was a temporary workaround for abuild breakage.
* Thu May 04 2006 olh@suse.de
- fix wrong use of %%p (172541 - LTC23597)
* Thu Apr 20 2006 olh@suse.de
- handle symbol changes in ELF64 (166171 - LTC23205)
* Tue Apr 11 2006 olh@suse.de
- remove hardcoded -m32 from CFLAGS
* Tue Mar 28 2006 olh@suse.de
- add Requires: itrace-kmp-ppc64, pseries is the only supported kernel
* Wed Mar 22 2006 olh@suse.de
- use modprobe to load the kernel module (153529 - LTC21991)
* Mon Mar 20 2006 olh@suse.de
- update to version 0.9
* Tue Feb 28 2006 olh@suse.de
- turn km_itrace into a KMP
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Sat Oct 22 2005 od@suse.de
- fixed building with debuginfo switched on: changed %%files
  section
* Wed Oct 05 2005 od@suse.de
- removed superfluous "%%x" in printf in src/mpost/main.c:1564 for
  autobuild
* Fri Jun 24 2005 od@suse.de
- for ppc, set HOSTTYPE variable to ppc64 (LTC16341 - SUSE87292)
* Mon Jun 13 2005 od@suse.de
- update to version 0.8:
  - add perfutil.h                (LTC16343 - SUSE87261)
- set HOSTTYPE variable to %%_arch (LTC16341 - SUSE87292)
* Mon May 23 2005 od@suse.de
- update to version 0.7 (LTC14260 - SUSE67200)
* Wed May 11 2005 od@suse.de
- fixed return values in swtrace.c and perfutil.c to pass compile
  checks
* Tue May 10 2005 od@suse.de
- new package