[oprofile] Use QT4 (rhbz683923)
William Eden Cohen
wcohen at fedoraproject.org
Thu Mar 10 22:55:30 UTC 2011
commit 34249a64860966ba9129dc472be40db676f6db9d
Author: William Cohen <wcohen at redhat.com>
Date: Thu Mar 10 17:48:54 2011 -0500
Use QT4 (rhbz683923)
oprofile-qt4.patch | 381 ++++++++++++++++++++++++++++++++++++++++++++++++++++
oprofile.spec | 12 +-
2 files changed, 389 insertions(+), 4 deletions(-)
---
diff --git a/oprofile-qt4.patch b/oprofile-qt4.patch
new file mode 100644
index 0000000..8d5adbd
--- /dev/null
+++ b/oprofile-qt4.patch
@@ -0,0 +1,381 @@
+diff -up oprofile-0.9.6/configure.in.orig oprofile-0.9.6/configure.in
+--- oprofile-0.9.6/configure.in.orig 2009-11-24 10:25:17.000000000 -0500
++++ oprofile-0.9.6/configure.in 2011-03-10 17:26:41.191319680 -0500
+@@ -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,8 +322,14 @@ AC_OUTPUT(Makefile \
+
+ AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
+
+-if test -z "$QT_LIB"; then
+- echo "Warning: a working Qt not found; no GUI will be built"
++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 "`getent passwd oprofile 2>/dev/null`" == "" || \
+diff -up oprofile-0.9.6/doc/oprofile.xml.orig oprofile-0.9.6/doc/oprofile.xml
+--- oprofile-0.9.6/doc/oprofile.xml.orig 2009-11-24 10:25:17.000000000 -0500
++++ oprofile-0.9.6/doc/oprofile.xml 2011-03-10 17:26:41.193319724 -0500
+@@ -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>
+diff -up oprofile-0.9.6/gui/Makefile.am.orig oprofile-0.9.6/gui/Makefile.am
+--- oprofile-0.9.6/gui/Makefile.am.orig 2011-03-10 17:26:13.639320003 -0500
++++ oprofile-0.9.6/gui/Makefile.am 2011-03-10 17:26:41.194319735 -0500
+@@ -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/liboputil.a \
+ ui/liboprof_start.a \
+- @QT_LDFLAGS@ \
+- @QT_LIB@ \
++ @QT_LIBS@ \
+ @X_LIBS@
+
+ oprof_start.moc.cpp: ${top_srcdir}/gui/oprof_start.h
+diff -up oprofile-0.9.6/gui/oprof_start.cpp.orig oprofile-0.9.6/gui/oprof_start.cpp
+--- oprofile-0.9.6/gui/oprof_start.cpp.orig 2009-11-24 10:25:17.000000000 -0500
++++ oprofile-0.9.6/gui/oprof_start.cpp 2011-03-10 17:26:41.195319757 -0500
+@@ -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;
+diff -up oprofile-0.9.6/gui/oprof_start.h.orig oprofile-0.9.6/gui/oprof_start.h
+--- oprofile-0.9.6/gui/oprof_start.h.orig 2009-11-24 10:25:17.000000000 -0500
++++ oprofile-0.9.6/gui/oprof_start.h 2011-03-10 17:26:41.196319788 -0500
+@@ -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;
+diff -up oprofile-0.9.6/gui/ui/Makefile.am.orig oprofile-0.9.6/gui/ui/Makefile.am
+--- oprofile-0.9.6/gui/ui/Makefile.am.orig 2009-11-24 10:25:17.000000000 -0500
++++ oprofile-0.9.6/gui/ui/Makefile.am 2011-03-10 17:26:41.196319788 -0500
+@@ -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@
+
diff --git a/oprofile.spec b/oprofile.spec
index ec06c8f..581892f 100644
--- a/oprofile.spec
+++ b/oprofile.spec
@@ -1,7 +1,7 @@
Summary: System wide profiler
Name: oprofile
Version: 0.9.6
-Release: 14%{?dist}
+Release: 15%{?dist}
License: GPLv2
Group: Development/System
#
@@ -21,12 +21,13 @@ Patch122: oprofile-amd.patch
Patch123: oprofile-westmere.patch
Patch124: oprofile-check.patch
Patch130: oprofile-unmutable.patch
+Patch131: oprofile-qt4.patch
URL: http://oprofile.sf.net
#ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x alpha alphaev6 sparcv9 sparc64 %{arm}
#If oprofile doesn't build on an arch, report it and will add ExcludeArch tag.
-BuildRequires: qt3-devel
+BuildRequires: qt-devel
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
BuildRequires: docbook-utils
@@ -95,11 +96,11 @@ agent library.
%patch123 -p1
%patch124 -p1
%patch130 -p1
+%patch131 -p1
./autogen.sh
%build
-QTDIR=%{_libdir}/qt-3.3; export QTDIR
#The CXXFLAGS below is temporary to work around
# bugzilla #113909
@@ -124,7 +125,7 @@ CXXFLAGS=-g; export CXXFLAGS
--infodir=%{_infodir} \
--with-separate-debug-dir=/usr/lib/debug \
--enable-abi \
---with-qt-dir=$QTDIR \
+--enable-gui=qt4 \
--with-java=/usr/lib/jvm/java
make CFLAGS="$RPM_OPT_FLAGS"
@@ -242,6 +243,9 @@ exit 0
/etc/ld.so.conf.d/*
%changelog
+* Thu Mar 10 2011 Will Cohen <wcohen at redhat.com> - 0.9.6-15
+- Use QT4.
+
* Fri Feb 25 2011 Will Cohen <wcohen at redhat.com> - 0.9.6-14
- Add processors models for Intel westmere and core i7.
More information about the scm-commits
mailing list