File libqt4.spec of Package libqt4

# spec file for package libqt4 (Version 4.5.3)
# 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

# norootforbuild

Name:           libqt4
BuildRequires:  Mesa-devel cups-devel freetype2-devel gcc-c++ libjpeg-devel libmng-devel
BuildRequires:  libpng-devel libtiff-devel pkgconfig sqlite-devel
BuildRequires:  glib2-devel update-desktop-files
%if %suse_version > 910
BuildRequires:  dbus-1-devel openssl-devel xorg-x11-devel
BuildRequires:  XFree86-devel XFree86-libs
%if %suse_version > 1020
BuildRequires:  clucene-core-devel
%define with_qt3support 1
License:        GPL v3 only ; LGPL v2.1 or later
Group:          System/Libraries
AutoReqProv:    on
Summary:        C++ Program Library, Core Components
# bug437293
%ifarch ppc64
Obsoletes:      qt-64bit
# plugindir/codecs/* was moved from libqt4-x11, Ensure seamless update from openSUSE <= 11.1 and SLE <= 11:
# See also baselibs.conf.
Conflicts:      %{name}-x11 <= 4.5.1-2.5
Obsoletes:      qt
Provides:       qt
Provides:       libqt4-dbus-1 = 4.4.0
Obsoletes:      libqt4-dbus-1 < 4.4.0
Version:        4.5.3
Release:        2.<RELEASE5>
%define base_name libqt4
%define x11_free  -x11-opensource-src-
%define rversion 4.5.3
Source:         qt%x11_free%rversion.tar.bz2
Source10:       qt4config.desktop
Source11:       designer4.desktop
Source12:       linguist4.desktop
Source13:       assistant4.desktop
Source14:       assistant.png
Source15:       designer.png
Source16:       linguist.png
Patch2:         qt-never-strip.diff
Patch3:         plastik-default.diff
Patch6:         use-freetype-default.diff
Patch1006:      use-freetype-default-legacy.diff
Patch8:         link-tools-shared.diff
Patch39:        0191-listview-alternate-row-colors.diff
Patch40:        0188-fix-moc-parser-same-name-header.diff
Patch43:        0195-compositing-properties.diff
Patch55:        ignore-global-advance-width-in-fots.diff
Patch60:        0180-window-role.diff
Patch61:        qt4-fake-bold.patch
Patch70:        0225-invalidate-tabbar-geometry-on-refresh.patch
Patch75:        qt-debug-timer.diff
Patch87:        qfatal-noreturn.diff
Patch90:        display-key-support.diff
Patch101:       no-moc-date.diff
Patch102:       0253-qmake_correct_path_separators.diff
Patch105:       disable-callgrind.diff
Patch106:       build-install-qdoc3.diff
Patch108:       0280-deserialization-custom-dbus-properties.diff
Patch111:       0283-do-not-deduce-scrollbar-extent-twice.diff
Patch113:       0019-Make-QMenu-respect-the-minimum-width-set.patch
Patch114:       avoid-dbus-deadlock.diff
Patch116:       fix-xsync-flag.diff
Patch117:       glib-eventloop-regression.diff
Patch118:       filter-leak-fix.patch
Patch119:       fix-psql.diff
Patch120:       qtbug-15295-qfiledialog-system-filter-regression.diff
Patch121:       harfbuzz-crash.diff
Patch122:       CVE-2011-3922.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %suse_version > 910
  %define common_options --opensource -fast -no-separate-debug-info -shared -xkb -xrender -xcursor -dbus-linked -xfixes -xrandr -xinerama -sm -no-nas-sound -no-rpath -system-libjpeg -system-libpng -accessibility -cups -stl -nis -system-zlib -qt-gif -prefix /usr -L %_libdir -libdir %_libdir -docdir %_docdir/%{base_name} -examplesdir %_libdir/qt4/examples -demosdir %_libdir/qt4/demos -plugindir %plugindir -translationdir /usr/share/qt4/translations -iconv -sysconfdir /etc/settings -datadir /usr/share/qt4/ -no-pch -reduce-relocations -exceptions -system-libtiff -glib -optimized-qmake -no-webkit -no-xmlpatterns -system-sqlite -qt3support -xsync
  %define common_options --opensource -fast -no-separate-debug-info -shared -xkb -no-xrender -no-xrandr -no-xinerama -no-xshape -no-nas-sound -no-rpath -system-libjpeg -system-libpng -accessibility -cups -stl -nis -system-zlib -qt-gif -prefix /usr -L %_libdir -libdir %_libdir -docdir %_docdir/%{base_name} -examplesdir %_libdir/qt4/examples -demosdir %_libdir/qt4/demos -plugindir %plugindir -translationdir /usr/share/qt4/translations -iconv -sysconfdir /etc/settings -datadir /usr/share/qt4/ -no-pch -no-exceptions -system-libtiff -no-sm -no-opengl -no-xcursor -no-webkit -no-xmlpatterns
%define check_config \
  grep '# define' src/corelib/global/qconfig.h | egrep -v 'QT_(ARCH|USE)';             \
  if test -f /usr/share/qt4/mkspecs/qconfig.pri ; then                                 \
    cmp /usr/share/qt4/mkspecs/qconfig.pri mkspecs/qconfig.pri || exit 1;           \
  fi                                                                                   \

Qt is a set of libraries for developing applications.

This package contains base tools, like string, xml, and network

    Qt Software

%define plugindir %_libdir/qt4/plugins
%setup -q -n qt%x11_free%rversion
%if %suse_version > 1010
# needs rediffing
%if %suse_version > 910
# bnc#374073 comment #8
# %patch61
%patch113 -p1
%patch114 -p1
%patch117 -p1
# be sure not to use them
rm -rf src/3rdparty/{libjpeg,freetype,libpng,zlib,libtiff}

%package devel
License:        GPL v2 only ; GPL v3 only
Group:          Development/Libraries/X11
Summary:        Qt Development Kit
Requires:       zlib-devel c++_compiler pkgconfig
Requires:       freetype2-devel libmng-devel libpng-devel libtiff-devel
%if %suse_version > 910
Requires:       xorg-x11-devel Mesa-devel dbus-1-devel openssl-devel
Requires:       XFree86-devel
Requires:       glib2-devel
Requires:       %name = %version
# bug437293
%ifarch ppc64
Obsoletes:      qt-devel-64bit
Provides:       dbus-1-qt-devel < 0.63
Obsoletes:      dbus-1-qt-devel < 0.63
Obsoletes:      qt-devel < 4.4.0
Provides:       qt-devel < 4.4.0
Provides:       dbus-1-qt < 0.63
Provides:       qt-dbus-1 < 4.2.0
Obsoletes:      dbus-1-qt < 0.63
Obsoletes:      qt-dbus-1 < 4.2.0

%description devel
You need this package, if you want to compile programs with Qt. It
contains the "Qt Crossplatform Development Kit". It does contain
include files and development applications like GUI designers,
translator tools and code generators.

    Qt Software

%package -n libqt4-sql-sqlite
License:        GPL v2 only ; GPL v3 only
Group:          Development/Libraries/C and C++
Summary:        Qt 4 sqlite plugin
Requires:       libqt4-sql = %version
Provides:       libqt4_sql_backend = %version
Obsoletes:      qt-sql-sqlite
Provides:       qt-sql-sqlite

%description -n libqt4-sql-sqlite
Qt 4 sqlite plugin to be able to use database functionality with Qt
applications without the need to setup a SQL server.

    Qt Software

%package x11
License:        GPL v2 only ; GPL v3 only
Group:          Development/Libraries/C and C++
Summary:        Qt 4 GUI related libraries
# bug437293
%ifarch ppc64
Obsoletes:      qt-x11-64bit
Obsoletes:      qt-x11
Provides:       qt-x11
Requires:       %name = %version

%description x11
Qt 4 libraries which are used for drawing widgets and OpenGL items.

    Qt Software

%if %with_qt3support

%package qt3support
License:        GPL v2 only ; GPL v3 only
Group:          System/Libraries
Summary:        C++ Program Library, Core Components
# bug437293
%ifarch ppc64
Obsoletes:      qt-qt3support-64bit
Obsoletes:      qt-qt3support
Provides:       qt-qt3support
Requires:       %name = %version

%description qt3support
Qt is a set of libraries for developing applications.

This package contains base tools, like string, xml, and network

    Qt Software


%package sql
License:        GPL v2 only ; GPL v3 only
Group:          Development/Libraries/C and C++
Summary:        Qt 4 SQL related libraries
# bug437293
%ifarch ppc64
Obsoletes:      qt-sql-64bit
Obsoletes:      qt-sql
Provides:       qt-sql
Requires:       %name = %version
%if %suse_version > 910
Recommends:     libqt4_sql_backend = %version
Suggests:       libqt4-sql-sqlite

%description sql
Qt 4 libraries which are used for connection with an SQL server. You
will need also a plugin package for a supported SQL server.

    Qt Software

export QTDIR=$PWD
export PATH=$PWD/bin:$PATH
export LD_LIBRARY_PATH=$PWD/lib/
%ifarch ppc64
  RPM_OPT_FLAGS="$RPM_OPT_FLAGS -mminimal-toc"
sed -i -e "/^QMAKE_CFLAGS_RELEASE[ \t]*+=/s,\$, $RPM_OPT_FLAGS," mkspecs/common/g++.conf
export MAKEFLAGS="%{?jobs:-j %jobs}"
touch translations/qt_de.qm
echo yes | ./configure %common_options -plugin-sql-sqlite -nomake examples -nomake demos -webkit -xmlpatterns
mkdir fullconfig
cp -p src/corelib/global/qconfig.h fullconfig
cp -p mkspecs/qconfig.pri fullconfig
echo yes | ./configure %common_options -plugin-sql-sqlite -nomake examples -nomake docs -nomake demos -no-webkit -no-xmlpatterns
test -s translations/qt_de.qm || rm translations/qt_de.qm
make %{?jobs:-j %jobs}
for i in translations/*.ts; do
  LD_LIBRARY_PATH=$PWD/lib bin/lrelease $i -qm ${i/.ts/.qm}

# argggh, qmake is such a piece of <censored>
find $RPM_BUILD_ROOT/%_libdir -type f -name '*prl' -exec perl -pi -e "s, -L$RPM_BUILD_DIR/\S+,,g" {} \;
find $RPM_BUILD_ROOT/%_libdir -type f -name '*prl' -exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" {} \;
#find $RPM_BUILD_ROOT/%_docdir/%name -type f -name 'lib*.a' -exec rm {} \;
find $RPM_BUILD_ROOT/%_libdir -type f -name '*la' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \;
# insanity ...
find $RPM_BUILD_ROOT/%_libdir -type f -name '*pc' -print -exec perl -pi -e "s, -L$RPM_BUILD_DIR/?\S+,,g" {} \; -exec sed -i -e "s,^moc_location=.*,moc_location=/usr/bin/moc," -e "s,uic_location=.*,uic_location=/usr/bin/uic," {} \;
find $RPM_BUILD_ROOT/%_libdir/ -name 'lib*.a' -exec chmod -x -- {} \;
mkdir -p $RPM_BUILD_ROOT/%plugindir/sqldrivers
# overwrite config
install -m 644 fullconfig/qconfig.pri $RPM_BUILD_ROOT/usr/share/qt4/mkspecs/qconfig.pri
install -m 644 fullconfig/qconfig.h $RPM_BUILD_ROOT/usr/include/QtCore/
# packaged in devel-doc
rm $RPM_BUILD_ROOT/usr/bin/{qcollectiongenerator,assistant,assistant_adp}
rm $RPM_BUILD_ROOT/usr/bin/{qhelpconverter,qhelpgenerator}
# some packages expect these symlinks
ln -s /usr/include $RPM_BUILD_ROOT/%_libdir/qt4/include
ln -s %_libdir $RPM_BUILD_ROOT/%_libdir/qt4/lib
ln -s %_bindir $RPM_BUILD_ROOT/%_libdir/qt4/bin
# install menu entries
%suse_update_desktop_file -i qt4config  Qt Utility     DesktopSettings
%suse_update_desktop_file -i designer4  Qt Development GUIDesigner
%suse_update_desktop_file -i linguist4  Qt Development Translation

# no baselibs supplements for older distros
%if %suse_version < 1110
  sed -i -e 's, supplements .*,,' $RPM_SOURCE_DIR/baselibs.conf

%post -p /sbin/ldconfig

%post x11 -p /sbin/ldconfig
%if %with_qt3support

%post qt3support -p /sbin/ldconfig

%postun qt3support -p /sbin/ldconfig

%post sql -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%postun x11 -p /sbin/ldconfig

%postun sql -p /sbin/ldconfig

%doc changes-* *.txt LICENSE.GPL3
%dir %_libdir/qt4
%dir %plugindir
%if %suse_version > 910
%dir %plugindir/script
%dir %plugindir/codecs
%dir /usr/share/qt4
%if %suse_version > 910

%files x11
%if %with_qt3support
%exclude %plugindir/accessible/
%if %suse_version > 910
# designer.png is referenced by qt4config.desktop
%if %suse_version > 910
%if %suse_version > 910
%dir %plugindir/iconengines
%dir %plugindir/imageformats
%dir %plugindir/inputmethods
%dir %plugindir/accessible
%dir %plugindir/graphicssystems
%dir /usr/share/qt4/translations
%if %suse_version > 910
%if %with_qt3support

%files qt3support

%files devel
%if %with_qt3support
%if %suse_version > 910
%if %with_qt3support
%if %suse_version > 910
%if %suse_version > 910
%if %suse_version > 910
%dir /usr/share/qt4

%files sql
%dir %plugindir/sqldrivers

%files -n libqt4-sql-sqlite

openSUSE Build Service is sponsored by