Accepting request 69293 from home:jones_tony:branches:devel:tools

OBS-URL: https://build.opensuse.org/request/show/69293
OBS-URL: https://build.opensuse.org/package/show/devel:tools/oprofile?expand=0&rev=16
This commit is contained in:
Tony Jones 2011-05-02 18:31:50 +00:00 committed by Git OBS Bridge
parent d50b65b611
commit 850e2fefb8
5 changed files with 438 additions and 30 deletions

View File

@ -0,0 +1,13 @@
All patches need to have a patch description header similar to what is used in
SuSE kernel git tree. Patches added without this will be reverted. Thanks.
From: Name <email>
Subject: Summary of fix
Date: date
References: bnc#xxxxxx (bugzilla reference if applicable)
Upstream: yes (provide repo/commit-id in description) or no (provide reason)
Signed-Off-by: Name <email> (same as From: if committer is patch author)
Short paragraph describing problem/fix.
References to upstream repo-path/commit-id if applicable.

View File

@ -1 +1,2 @@
oprofile
libopagent1

402
oprofile-qt4.diff Normal file
View File

@ -0,0 +1,402 @@
From: maynardj <maynardj@us.ibm.com>
Date: Fri Feb 25 11:50:18 2011 -0600
Subject: Use qt3Support to allow building with either qt3 or qt4
Git-Repo: git://oprofile.git.sourceforge.net/gitroot/oprofile/oprofile
Git-Commit: 7e4a107edca55f01dc62d2351c85264a3bc97fd3
References: request by Ismail Dönme, rferencing redhat BZ#683923
Signed-Off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Acked-by: Maynard Johnson <maynardj@us.ibm.com>
Description:
This patch makes changes to oprofile gui files to use qt3Support to facilitate
building with either qt3 or qt4. The configure script now has a new option:
--enable-gui=[qt3|qt4|yes|no]. If not given or set to yes, the gui build
defaults to qt3, which is the same as what it has done in the past.
---
configure.in | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++--
doc/oprofile.xml | 4 +--
gui/Makefile.am | 5 +--
gui/oprof_start.cpp | 64 ++++++++++++++++++++++++++++++------------------
gui/oprof_start.h | 14 +++++++---
gui/ui/Makefile.am | 2 -
6 files changed, 121 insertions(+), 36 deletions(-)
--- a/configure.in
+++ b/configure.in
@@ -18,6 +18,7 @@ AM_CONFIG_HEADER(config.h)
AC_CHECK_DECLS([basename], [], [], [[#include <libgen.h>]])
AC_PROG_RANLIB
AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
dnl for the man page
DATE="`date '+%a %d %B %Y'`"
@@ -131,7 +132,61 @@ ORIG_X_SAVE_LIBS="$LIBS"
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
X_LIBS="$LIBS"
AC_SUBST(X_LIBS)
-QT_DO_IT_ALL
+
+AC_ARG_ENABLE(gui,[ --enable-gui compile with gui component (qt3|qt4|yes|no),
+ if not given or set to yes, gui defaults to qt3],, enable_gui=qt3)
+
+if test "x$enable_gui" = "xqt3" || test "x$enable_gui" = "xyes"; then
+ QT_VERSION=3
+ QT_DO_IT_ALL
+ QT_LIBS="$QT_LIB $QT_LDFLAGS"
+ QT_CFLAGS="$QT_INCLUDES"
+fi
+
+if test "x$enable_gui" = "xqt4"; then
+ QT_VERSION=4
+ PKG_CHECK_MODULES(QT, Qt3Support QtGui QtCore ,,[
+ echo "You requested QT4 but its build files are not available. Exiting now."
+ exit
+ ])
+ MOC=$(pkg-config --variable=moc_location QtCore)
+ UIC=$(pkg-config --variable=uic_location QtCore)3
+ QT_VERSION=$(pkg-config --modversion QtCore)
+
+dnl following are some sanity tests and workarounds for buggy QtCore.pc files
+ if test "x$MOC" = "x"; then
+ echo "WARNING: Your QtCore.pc file is buggy, it doesn't provide the variable 'moc_location'"
+ echo "WARNING: I will try to find it in your PATH ..."
+ AC_CHECK_PROG(MOC, moc, moc)
+ if test "x$MOC" = "x"; then
+ echo "WARNING: You can fix this by adding the location of moc to your path."
+ echo "WARNING: Exiting now."
+ exit
+ fi
+ fi
+
+ if test "x$UIC" = "x3"; then
+ echo "WARNING: Your QtCore.pc file is buggy, it doesn't provide the variable 'uic_location'"
+ echo "WARNING: I will try to find it in your PATH ..."
+ AC_CHECK_PROG(UIChelp, uic3, uic3)
+ if test "x$UIChelp" = "x"; then
+ echo "WARNING: You can fix this by adding the location of uic3 to your path."
+ echo "WARNING: Exiting now."
+ exit
+ else
+ UIC="$UIChelp"
+ fi
+ fi
+
+ flags_has_qt3support=$(echo $QT_CFLAGS | grep QT3_SUPPORT)
+ if test "x$flags_has_qt3support" = "x" ; then
+ echo "WARNING: Your Qt3Support package is buggy; it dosn't include the 'QT3_SUPPORT' flag"
+ echo "WARNING: adding it manually"
+ QT_CFLAGS="$QT_CFLAGS -DQT3_SUPPORT"
+ fi
+fi
+AM_CONDITIONAL(have_qt, test -n "$QT_LIBS")
+
LIBS="$ORIG_X_SAVE_LIBS"
dnl enable pch for c++
@@ -155,7 +210,6 @@ AC_SUBST(POPT_LIBS)
# do NOT put tests here, they will fail in the case X is not installed !
-AM_CONDITIONAL(have_qt, test -n "$QT_LIB")
AX_CFLAGS_OPTION(OP_CFLAGS,[-W])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-W])
@@ -268,6 +322,16 @@ AC_OUTPUT(Makefile \
AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
+if test "x$enable_gui" = "xno" ; then
+ echo "No GUI will be built as it was explicitly disabled."
+else
+ if test -z "$QT_LIBS"; then
+ echo "Warning: QT version $QT_VERSION was requested but not found. No GUI will be built."
+ else
+ echo "Building GUI with QT $QT_VERSION"
+ fi
+fi
+
if test -z "$QT_LIB"; then
echo "Warning: a working Qt not found; no GUI will be built"
fi
--- a/doc/oprofile.xml
+++ b/doc/oprofile.xml
@@ -190,8 +190,8 @@ For information on how to use OProfile's
<varlistentry>
<term>OProfile GUI</term>
<listitem><para>
- The use of the GUI to start the profiler requires the <filename>Qt 2</filename> library. <filename>Qt 3</filename> should
- also work.
+ The use of the GUI to start the profiler requires the <filename>Qt</filename> library.
+ Either <filename>Qt 3</filename> or <filename>Qt 4</filename> should work.
</para></listitem>
</varlistentry>
<varlistentry>
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -14,7 +14,7 @@ EXTRA_DIST = $(dist_sources)
if have_qt
AM_CPPFLAGS = \
- @QT_INCLUDES@ \
+ @QT_CFLAGS@ \
-I ${top_srcdir}/libop \
-I ${top_srcdir}/libutil++ \
-I ${top_srcdir}/libutil
@@ -30,8 +30,7 @@ oprof_start_LDADD = \
../libop/libop.a \
../libutil/libutil.a \
ui/liboprof_start.a \
- @QT_LDFLAGS@ \
- @QT_LIB@ \
+ @QT_LIBS@ \
@X_LIBS@
oprof_start.moc.cpp: ${top_srcdir}/gui/oprof_start.h
--- a/gui/oprof_start.cpp
+++ b/gui/oprof_start.cpp
@@ -20,21 +20,37 @@
#include <fstream>
#include <algorithm>
+#if QT3_SUPPORT
+#include <Qt/qlineedit.h>
+#include <Qt/qcheckbox.h>
+#include <Qt/qtabwidget.h>
+#include <Qt/qmessagebox.h>
+#include <Qt/qvalidator.h>
+#include <Qt/qlabel.h>
+#include <Qt/qpushbutton.h>
+#include <Qt/q3listview.h>
+#include <Qt/q3combobox.h>
+#include <Qt/q3listbox.h>
+#include <Qt/q3filedialog.h>
+#include <Qt/q3buttongroup.h>
+#include <Qt/q3header.h>
+#else
#include <qlineedit.h>
-#include <qlistview.h>
-#include <qcombobox.h>
-#include <qlistbox.h>
-#include <qfiledialog.h>
-#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qmessagebox.h>
#include <qvalidator.h>
#include <qlabel.h>
#include <qpushbutton.h>
+#include <qlistview.h>
+#include <qcombobox.h>
+#include <qlistbox.h>
+#include <qfiledialog.h>
+#include <qbuttongroup.h>
#include <qheader.h>
+#define Q3ListView QListView
+#endif
-#include "config.h"
#include "oprof_start.h"
#include "op_config.h"
#include "op_config_24.h"
@@ -268,10 +284,10 @@ void oprof_start::fill_events()
namespace {
/// find the first item with the given text in column 0 or return NULL
-QListViewItem * findItem(QListView * view, char const * name)
+Q3ListViewItem * findItem(Q3ListView * view, char const * name)
{
// Qt 2.3.1 does not have QListView::findItem()
- QListViewItem * item = view->firstChild();
+ Q3ListViewItem * item = view->firstChild();
while (item && strcmp(item->text(0).latin1(), name))
item = item->nextSibling();
@@ -292,7 +308,7 @@ void oprof_start::setup_default_event()
event_cfgs[descr.name].user_ring_count = 1;
event_cfgs[descr.name].os_ring_count = 1;
- QListViewItem * item = findItem(events_list, descr.name);
+ Q3ListViewItem * item = findItem(events_list, descr.name);
if (item)
item->setSelected(true);
}
@@ -349,7 +365,7 @@ void oprof_start::read_set_events()
event_cfgs[ev_name].os_ring_count = 1;
}
- QListViewItem * item = findItem(events_list, ev_name.c_str());
+ Q3ListViewItem * item = findItem(events_list, ev_name.c_str());
if (item)
item->setSelected(true);
}
@@ -436,7 +452,7 @@ void oprof_start::fill_events_listbox()
for (vector<op_event_descr>::reverse_iterator cit = v_events.rbegin();
cit != v_events.rend(); ++cit) {
- new QListViewItem(events_list, cit->name.c_str());
+ new Q3ListViewItem(events_list, cit->name.c_str());
}
setUpdatesEnabled(true);
@@ -467,7 +483,7 @@ void oprof_start::display_event(op_event
}
-bool oprof_start::is_selectable_event(QListViewItem * item)
+bool oprof_start::is_selectable_event(Q3ListViewItem * item)
{
if (item->isSelected())
return true;
@@ -486,7 +502,7 @@ bool oprof_start::is_selectable_event(QL
void oprof_start::draw_event_list()
{
- QListViewItem * cur;
+ Q3ListViewItem * cur;
for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
if (is_selectable_event(cur))
cur->setPixmap(0, *green_pixmap);
@@ -500,7 +516,7 @@ bool oprof_start::alloc_selected_events(
{
vector<op_event const *> events;
- set<QListViewItem *>::const_iterator it;
+ set<Q3ListViewItem *>::const_iterator it;
for (it = selected_events.begin(); it != selected_events.end(); ++it)
events.push_back(find_event_by_name((*it)->text(0).latin1(),0,0));
@@ -520,24 +536,24 @@ void oprof_start::event_selected()
// (de)selected item so we record a set of selected items and diff
// it in the appropriate way with the previous list of selected items.
- set<QListViewItem *> current_selection;
- QListViewItem * cur;
+ set<Q3ListViewItem *> current_selection;
+ Q3ListViewItem * cur;
for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
if (cur->isSelected())
current_selection.insert(cur);
}
// First remove the deselected item.
- vector<QListViewItem *> new_deselected;
+ vector<Q3ListViewItem *> new_deselected;
set_difference(selected_events.begin(), selected_events.end(),
current_selection.begin(), current_selection.end(),
back_inserter(new_deselected));
- vector<QListViewItem *>::const_iterator it;
+ vector<Q3ListViewItem *>::const_iterator it;
for (it = new_deselected.begin(); it != new_deselected.end(); ++it)
selected_events.erase(*it);
// Now try to add the newly selected item if enough HW resource exists
- vector<QListViewItem *> new_selected;
+ vector<Q3ListViewItem *> new_selected;
set_difference(current_selection.begin(), current_selection.end(),
selected_events.begin(), selected_events.end(),
back_inserter(new_selected));
@@ -558,7 +574,7 @@ void oprof_start::event_selected()
}
-void oprof_start::event_over(QListViewItem * item)
+void oprof_start::event_over(Q3ListViewItem * item)
{
op_event_descr const & descr = locate_event(item->text(0).latin1());
@@ -566,10 +582,10 @@ void oprof_start::event_over(QListViewIt
if (!is_selectable_event(item)) {
help_str += " conflicts with:";
- set<QListViewItem *>::const_iterator it;
+ set<Q3ListViewItem *>::const_iterator it;
for (it = selected_events.begin();
it != selected_events.end(); ) {
- QListViewItem * temp = *it;
+ Q3ListViewItem * temp = *it;
selected_events.erase(it++);
if (is_selectable_event(item)) {
help_str += " ";
@@ -844,7 +860,7 @@ void oprof_start::on_start_profiler()
bool one_enable = false;
- QListViewItem * cur;
+ Q3ListViewItem * cur;
for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
if (!cur->isSelected())
continue;
@@ -946,7 +962,7 @@ bool oprof_start::save_config()
vector<string> tmpargs;
tmpargs.push_back("--setup");
- QListViewItem * cur;
+ Q3ListViewItem * cur;
for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
if (!cur->isSelected())
continue;
--- a/gui/oprof_start.h
+++ b/gui/oprof_start.h
@@ -16,11 +16,17 @@
#include <map>
#include <set>
+#include "config.h"
+
#include "ui/oprof_start.base.h"
#include "oprof_start_config.h"
#include "op_events.h"
+#ifndef QT3_SUPPORT
+#define Q3ListViewItem QListViewItem
+#endif
+
class QIntValidator;
class QListViewItem;
class QTimerEvent;
@@ -62,7 +68,7 @@ protected slots:
/// events selection change
void event_selected();
/// the mouse is over an event
- void event_over(QListViewItem *);
+ void event_over(Q3ListViewItem *);
/// state of separate_kernel_cb changed
void on_separate_kernel_cb_changed(int);
/// reset sample files
@@ -121,7 +127,7 @@ private:
void draw_event_list();
/// return true if item is selectable or already selected
- bool is_selectable_event(QListViewItem * item);
+ bool is_selectable_event(Q3ListViewItem * item);
/// try to alloc counters for the selected_events
bool alloc_selected_events() const;
@@ -139,8 +145,8 @@ private:
/// The currently selected events. We must track this because
/// with multiple selection listbox QT doesn't allow to know
/// what is the last selected item. events_selected() update it
- std::set<QListViewItem *> selected_events;
- QListViewItem * current_event;
+ std::set<Q3ListViewItem *> selected_events;
+ Q3ListViewItem * current_event;
/// current config
config_setting config;
--- a/gui/ui/Makefile.am
+++ b/gui/ui/Makefile.am
@@ -2,7 +2,7 @@ EXTRA_DIST = oprof_start.base.ui
if have_qt
-AM_CPPFLAGS = @QT_INCLUDES@
+AM_CPPFLAGS = @QT_CFLAGS@
AM_CXXFLAGS = @OP_CXXFLAGS@

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Thu Apr 28 18:33:19 UTC 2011 - tonyj@novell.com
- Add support for building using qt4 (no bnc)
-------------------------------------------------------------------
Thu Apr 28 18:14:54 UTC 2011 - tonyj@novell.com
- Add README-BEFORE-ADDING-PATCHES local file documenting required patch
header
-------------------------------------------------------------------
Tue Jun 29 15:10:22 UTC 2010 - coolo@novell.com
- fix baselibs.conf
-------------------------------------------------------------------
Thu Jun 24 21:17:12 UTC 2010 - tonyj@novell.com

View File

@ -18,14 +18,14 @@
Name: oprofile
BuildRequires: binutils-devel fdupes java2-devel-packages libxslt popt-devel qt3-devel update-desktop-files
BuildRequires: binutils-devel fdupes java2-devel-packages libxslt popt-devel qt-devel update-desktop-files
Url: http://oprofile.sourceforge.net/
License: GPLv2+ ; LGPLv2.1+
Group: Development/Tools/Other
AutoReqProv: on
PreReq: /usr/sbin/groupadd /usr/sbin/useradd
Version: 0.9.6
Release: 2
Release: 3
Summary: System-Wide Profiler for Linux Systems
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tar.bz2
@ -33,8 +33,10 @@ Source1: %{name}.desktop
Source2: %{name}.rpmlintrc
Source3: baselibs.conf
Source4: jvmpi.h
Source5: README-BEFORE-ADDING-PATCHES
Patch1: oprofile-0.9.5-buildfixes.diff
Patch2: oprofile-0.9.4-fixes.diff
Patch3: oprofile-qt4.diff
%description
OProfile is a system-wide profiler for Linux systems, capable of
@ -57,15 +59,6 @@ warranty.
This is the package containing the userspace tools.
Authors:
--------
John Levon <moz@compsoc.man.ac.uk>
Philippe Elie <phil_e@clubinternet.fr>
Dave Jones <davej@suse.de>
Bob Montgomery <bobm@fc.hp.com>
%package devel
Summary: System-Wide Profiler for Linux Systems
Group: Development/Libraries/C and C++
@ -81,15 +74,6 @@ the GNU GPL.
This package contains the files needed to develop JIT agents for other
virtual machines.
Authors:
--------
John Levon <moz@compsoc.man.ac.uk>
Philippe Elie <phil_e@clubinternet.fr>
Dave Jones <davej@suse.de>
Bob Montgomery <bobm@fc.hp.com>
%package -n libopagent1
Summary: System-Wide Profiler for Linux Systems
Group: Development/Libraries/C and C++
@ -104,19 +88,11 @@ the GNU GPL.
This package contains the library needed at runtime when profiling JITed code
from supported virtual machines.
Authors:
--------
John Levon <moz@compsoc.man.ac.uk>
Philippe Elie <phil_e@clubinternet.fr>
Dave Jones <davej@suse.de>
Bob Montgomery <bobm@fc.hp.com>
%prep
%setup -q
%patch1
%patch2 -p1
%patch3 -p1
mkdir -p java/include
# copy files necessary to build Java agent libraries
# libjvmpi_oprofile.so and libjvmti_oprofile.so
@ -129,7 +105,7 @@ autoreconf -fi
./configure CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
--prefix=/usr --mandir=%{_mandir} --libdir=%{_libdir} \
--with-kernel-support --with-java=$PWD/java \
--with-qt-libraries=%_libdir/qt3/%_lib
--enable-gui=qt4
make %{?jobs:-j%jobs}
%install