File itrace.spec of Package itrace

#
# spec file for package itrace (Version 0.9)
#
# Copyright (c) 2010 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:        173
%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
# bug437293
%ifarch ppc64
Obsoletes:      itrace-64bit
%endif
#
Url:            http://perfinsp.sourceforge.net/itrace_ppc.html
Summary:        Instruction Tracing Tool
License:        GPL-2.0+
Group:          Development/Tools/Debuggers
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  ppc ppc64
Requires:       itrace-kmp-ppc64
Source0:        Dpiperf.dynamic.4.2.tar.bz2
Source1:        itrace.Module.supported
Source2:        baselibs.conf
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
Patch14:        itrace.branch-trace-safe.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-2.0+
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
%patch14 -p1

%build
cp %{S:1} src/driver/Module.supported
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
openSUSE Build Service is sponsored by