File libqt4-sql-plugins.spec of Package libqt4

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

# norootforbuild
# nodebuginfo

Name:           libqt4-sql-plugins
BuildRequires:  cups-devel
BuildRequires:  libmysqlclient-devel pkgconfig postgresql-devel unixODBC-devel
BuildRequires:  libqt4-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
License:        GPL v2 only; GPL v3 only
Group:          Development/Libraries/C and C++
AutoReqProv:    on
Summary:        Qt 4 SQL-Related Libraries
Version:        4.4.3
Release:        12.<RELEASE1>
%define base_name libqt4
%define x11_free  -x11-opensource-src-
%define rversion 4.4.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
Source42:       libQtWebKit-4.5.3.tar.bz2
Patch2:         qt-never-strip.diff
Patch3:         plastik-default.diff
Patch5:         lib64.patch
Patch6:         use-freetype-default.diff
Patch1006:      use-freetype-default-legacy.diff
Patch8:         link-tools-shared.diff
#Patch20:        qt-font-choose.diff
Patch27:        0167-fix-group-reading.diff
Patch39:        0191-listview-alternate-row-colors.diff
Patch40:        0188-fix-moc-parser-same-name-header.diff
Patch43:        0195-compositing-properties.diff
Patch48:        0203-qtexthtmlparser-link-color.diff
Patch55:        ignore-global-advance-width-in-fots.diff
Patch60:        0180-window-role.diff
Patch61:        qt4-fake-bold.patch
Patch66:        statusbar-recursion.diff
Patch67:        postgresql83-support.diff
Patch70:        0225-invalidate-tabbar-geometry-on-refresh.patch
Patch74:        ppc-atomic.diff
Patch75:        qt-debug-timer.diff
Patch77:        qt4-input-method-lazy-load.patch
Patch79:        aliasing.diff
Patch82:        0234-fix-mysql-threaded.diff
Patch86:        0238-fix-qt-qttabbar-size.diff
Patch87:        qfatal-noreturn.diff
Patch88:        0245-fix-randr-changes-detecting.diff
Patch90:        display-key-support.diff
Patch91:        0249-webkit-stale-frame-pointer.diff
Patch92:        0254-fix-qgraphicsproxywidget-deletion-crash.diff
Patch93:        0260-fix-qgraphicswidget-deletionclearFocus.diff
Patch94:        qnativesocketengine-select.diff
Patch95:        0257-qurl-validate-speedup.diff
Patch97:        0256-fix-recursive-backingstore-sync-crash.diff
Patch98:        0262-fix-treeview-animation-crash.diff
Patch99:        0261-sync-before-reset-errorhandler.patch
Patch100:       0263-fix-fontconfig-handling.diff
Patch101:       no-moc-date.diff
Patch102:       0253-qmake_correct_path_separators.diff
Patch103:       0265-fix-formlayoutcrash.diff
Patch104:       0264-fix-zero-height-qpixmap-isnull.diff
Patch105:       CVE-2009-0945.Qt-4.4.x.patch
Patch106:       CVE-2009-2700.diff
Patch107:       avoid-dbus-deadlock.diff
#Patch108:       libQtWebKit.diff
Patch109:       qt4-466791-force-focus-out-input-context.patch
Patch110:       CVE-2011-3922.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %suse_version > 910
  %define common_options -fast -no-separate-debug-info -shared -xkb -tablet -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
  %define common_options -fast -no-separate-debug-info -shared -xkb -no-tablet -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 4 libraries that are used for connection with an SQL server. You
need a plug-in package for a supported SQL server as well.

    Troll Tech AS, Norway

%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
%patch67 -p1
%patch109 -p1
# be sure not to use them
rm -rf src/3rdparty/{libjpeg,freetype,libpng,zlib,libtiff}

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

%description -n libqt4-sql-unixODBC
Qt unixODBC plugin to support databases via unixODBC within Qt

    Troll Tech AS, Norway

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

%description -n libqt4-sql-postgresql
Qt SQL plugin to support PostgreSQL servers in Qt applications.

    Troll Tech AS, Norway

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

%description -n libqt4-sql-mysql
A plugin to support MySQL server in Qt applications.

    Troll Tech AS, Norway

export QTDIR=$PWD
export PATH=$PWD/bin:$PATH
export LD_LIBRARY_PATH=$PWD/lib/
sed -i -e "/^QMAKE_CFLAGS_RELEASE[ \t]*+=/s,\$, $RPM_OPT_FLAGS," mkspecs/common/g++.conf
export MAKEFLAGS="%{?jobs:-j %jobs}"
echo yes | ./configure %common_options -no-webkit -no-xmlpatterns -nomake examples \
   -plugin-sql-psql -I/usr/include -I/usr/include/pgsql/ -I/usr/include/pgsql/server \
   -plugin-sql-odbc \
   -plugin-sql-mysql -I/usr/include/mysql/ -no-sql-sqlite -no-sql-sqlite2
make %{?jobs:-j%jobs} sub-src

export QTDIR=$PWD
make INSTALL_ROOT=$RPM_BUILD_ROOT -C src install_subtargets
# argggh, qmake is such a piece of <censored>
mkdir -p $RPM_BUILD_ROOT/%_libdir/pkgconfig
find  $RPM_BUILD_ROOT/%_libdir -type f -name '*.pc' -exec mv {} $RPM_BUILD_ROOT/%_libdir/pkgconfig \;
# fix more qmake errors
mkdir -p $RPM_BUILD_ROOT/%_libdir/qt
find $RPM_BUILD_ROOT/%_libdir -type f -name '*la' -print -exec perl -pi -e 's, -L/usr/src/packages/BUILD/\S+,,g' {} \;
find $RPM_BUILD_ROOT/%_libdir/pkgconfig -type f -name '*pc' -print -exec perl -pi -e 's, -L/usr/src/packages/BUILD/\S+,,g' {} \;
rm -rf $RPM_BUILD_ROOT/usr/include
rm -rf $RPM_BUILD_ROOT/usr/%_lib/pkgconfig
mkdir $RPM_BUILD_ROOT/%_libdir/backup
mv $RPM_BUILD_ROOT/%_libdir/libQtSql*.so.* $RPM_BUILD_ROOT/%_libdir/backup
rm -f $RPM_BUILD_ROOT/%_libdir/lib*
mv $RPM_BUILD_ROOT/%_libdir/backup/libQtSql*.so.* $RPM_BUILD_ROOT/%_libdir
rmdir $RPM_BUILD_ROOT/%_libdir/backup
rm -rf $RPM_BUILD_ROOT/usr/bin
for i in $RPM_BUILD_ROOT/%plugindir/*; do
  case "$i" in
    *sqldriv*): ;;
    *) rm -rf $i
rm -f $RPM_BUILD_ROOT/%_libdir/libQtSql*


%files -n libqt4-sql-unixODBC
%dir %plugindir/sqldrivers

%files -n libqt4-sql-postgresql
%dir %plugindir/sqldrivers

%files -n libqt4-sql-mysql
%dir %plugindir/sqldrivers

openSUSE Build Service is sponsored by