File CodeAnalyst.spec of Package CodeAnalyst

#
# spec file for package CodeAnalyst
#
# Copyright (c) 2012 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/
#


%define file_ver 2_12_3_0126-Public

Name:           CodeAnalyst
Version:        2.12.3
Release:        0
Summary:        CodeAnalyst is a Performance Analysis Suite for AMD-based System
License:        GPL-2.0
Group:          Development/Tools/Other
Url:            http://developer.amd.com/cpu/CodeAnalyst/codeanalystlinux
Source0:        %{name}-%{file_ver}.tar.bz2
Source1:        CodeAnalyst.desktop
Source2:        DiffAnalyst.desktop
# Use oprofile default cpu/watershed/event-buffer size
# since using stock oprofile daemon/driver
Patch0:         ca-use-oprofile-default-buffersize.patch
# Fix basename issue when building
Patch3:         ca-fix-oprofile-ibs-check.patch
Patch4:         gcc46.patch
Patch5:         ca-support-newer-oprofile.patch
# PATCH-FIX-UPSTREAM CodeAnalyst-gcc47.patch dimstar@opensuse.org -- Fix build with gcc 4.7
Patch6:         CodeAnalyst-gcc47.patch
Patch7:         ca-fix-bfd-include.patch
Requires:       binutils
Requires:       oprofile >= 0.9.4
PreReq:         pwdutils
BuildRequires:  automake
BuildRequires:  binutils-devel
BuildRequires:  fdupes
BuildRequires:  libdwarf-devel
BuildRequires:  libelf-devel
BuildRequires:  libtool
BuildRequires:  oprofile >= 0.9.4
BuildRequires:  popt-devel
BuildRequires:  pwdutils
BuildRequires:  qt3-designer >= 3.3
BuildRequires:  qt3-devel >= 3.3
BuildRequires:  sysvinit-tools
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# CodeAnalyst only supports AMD based systems.
ExclusiveArch:  %ix86 x86_64

%description
CodeAnalyst is a performance analysis suite. It provids graphical
utilitys for running Oprofile, and analyzing result on AMD-based systems.
CodeAnalyst includes several features to aid profile analysis such as
inline-function analysis, code-block analysis, and a utility for
profile comparison, DiffAnalayst.


%prep
%setup -q -n %{name}-%{file_ver}
%patch0 -b .ca-use-oprofile-default-buffersize
%patch3 -p0 -b .ca-fix-oprofile-ibs-check
%patch4
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
./autogen.sh
#chmod -x $(find . -name configure)
%configure \
  --with-oprofile=%{_prefix} \
  --disable-oprofile-lib \
  --disable-static \
  --with-libdwarf-includes=%{_includedir}/libdwarf \
  --with-libdwarf-libraries=%{_libdir}
# Change DATE/TIME macros to use last change time of oprofile.changes
# See http://lists.opensuse.org/opensuse-factory/2011-05/msg00304.html
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . -type f -regex ".*\.c\|.*\.cpp\|.*\.h" -exec grep -E -e __DATE__ -e __TIME__ {} +
find . -type f -regex ".*\.c\|.*\.cpp\|.*\.h" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +
make %{?jobs:-j%jobs}

%install
make -C src/ca/libs    install DESTDIR=${RPM_BUILD_ROOT}
make -C src/ca/gui     install DESTDIR=${RPM_BUILD_ROOT}
make -C src/ca/diffgui install DESTDIR=${RPM_BUILD_ROOT}
make -C src/ca/utils   install DESTDIR=${RPM_BUILD_ROOT}
make -C src/ca/scripts install DESTDIR=${RPM_BUILD_ROOT}
# These are help documents and images which
# the GUIs is using for the "Help" on toolbar.
# GUI will not run correctly if these are not available
# make -C doc install DESTDIR=${RPM_BUILD_ROOT}
install -D -m 755 careport.sh ${RPM_BUILD_ROOT}%{_bindir}
# Remove these unnecessary files from the installation
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/lib*.{la,so}
# install icons
install -D -m 644 src/ca/gui/CodeAnalyst-gui.xpm ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/CodeAnalyst.xpm
install -D -m 644 src/ca/diffgui/DiffAnalyst-gui.xpm ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/DiffAnalyst.xpm
# create hardlinks for duplicate files
%fdupes ${RPM_BUILD_ROOT}%{_datadir}/
# Install CodeAnalyst.desktop file
%suse_update_desktop_file -i CodeAnalyst -u
# Install DiffAnalyst.desktop file
%suse_update_desktop_file -i DiffAnalyst -u

%clean
rm -rf ${RPM_BUILD_ROOT}

%pre
# Adding "amdca" user group
getent group amdca >/dev/null || /usr/sbin/groupadd -r amdca
exit 0

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc README COPYING INSTALLATION
%{_bindir}/CodeAnalyst
%{_bindir}/DiffAnalyst
%{_bindir}/careport.sh
%{_bindir}/capackage.sh
%{_sbindir}/ca_user_manager
%{_sbindir}/ca_oprofile_controller
%{_libdir}/lib*.so.*
%dir %{_datadir}/codeanalyst
%{_datadir}/codeanalyst/*
%{_datadir}/applications/CodeAnalyst.desktop
%{_datadir}/applications/DiffAnalyst.desktop
%{_datadir}/pixmaps/*

%changelog
openSUSE Build Service is sponsored by