File libqt4-devel-doc.spec.in of Package libqt4

#
# spec file for package libqt4-devel-doc
#
# 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/
#
# nodebuginfo

Name:           libqt4-devel-doc
BuildRequires:  pkgconfig(gl)
BuildRequires:  alsa-devel
BuildRequires:  cups-devel
BuildRequires:  fdupes
BuildRequires:  freeglut-devel
BuildRequires:  gtk2-devel
BuildRequires:  libjpeg-devel
%if 0%{?suse_version} >= 1330
BuildRequires:  libnsl-devel
%endif
BuildRequires:  libpng-devel
BuildRequires:  sqlite3-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
License:        SUSE-LGPL-2.1-with-digia-exception-1.1 or GPL-3.0
Summary:        Qt documentation
Url:            http://qt.digia.com/
Group:          Documentation/HTML
# COMMON-VERSION-BEGIN
# COMMON-VERSION-END
BuildRequires:  libQtWebKit-devel >= %{version}
BuildRequires:  libqt4-devel >= %{version}
Requires:       libqt4 = %{version}
Requires:       libqt4-devel-doc-data = %{version}
Requires:       libqt4-sql-sqlite >= %{version}
Provides:       libqt4-examples = 4.4.0
Obsoletes:      libqt4-examples < 4.4.0
Provides:       qt-devel-doc = 4.4.0
Obsoletes:      qt-devel-doc < 4.4.0
# COMMON-BEGIN
# COMMON-END

# COMMON-DESC-BEGIN
%package -n qt4-x11-tools
Summary:        C++ Program Library, Core Components
Group:          System/Libraries
Requires:       libqt4-x11 >= %{version}

%description -n qt4-x11-tools
Qt is a set of libraries for developing applications.

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

%package data
Summary:        C++ Program Library, Core Components
Group:          System/Libraries
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
The architecture independent data files for the documentation.
# COMMON-DESC-END

# COMMON-PREP-BEGIN
# COMMON-PREP-END

%build

%ifarch ppc64
export RPM_OPT_FLAGS="%{optflags} -mminimal-toc"
%endif
export QTDIR=$PWD
export PATH=$PWD/bin:$PATH
export LD_LIBRARY_PATH=$PWD/lib/
export CXXFLAGS="%{optflags}"
export CFLAGS="%{optflags}"
export MAKEFLAGS="%{?_smp_mflags}"
%ifarch sparc64
platform="-platform linux-g++-64"
%else
platform=""
%endif
echo yes | ./configure %common_options $platform \
	-webkit -xmlpatterns -no-sql-sqlite -no-sql-sqlite2 -no-sql-mysql
%check_config

# Simply use the binaries from the -devel package instead of building it again
rpm -ql libqt4-devel | grep %{_bindir}/ | sed 's#%{_bindir}/##' | \
    ( while read file; do test -e bin/$file || ln -s %{_bindir}/$file bin/ ; done )
rpm -ql libqt4-devel | grep %{_libdir}/lib | sed 's#%{_libdir}/##' | \
    ( while read file; do test -e lib/$file || ln -s %{_libdir}/$file lib/ ; done )
rpm -ql libQtWebKit-devel | grep %{_bindir}/ | sed 's#%{_bindir}/##' | \
    ( while read file; do test -e bin/$file || ln -s %{_bindir}/$file bin/ ; done )
rpm -ql libQtWebKit-devel | grep %{_libdir}/lib | sed 's#%{_libdir}/##' | \
    ( while read file; do test -e lib/$file || ln -s %{_libdir}/$file lib/ ; done )

make %{?_smp_mflags} -C tools/assistant
make %{?_smp_mflags} -C demos
make %{?_smp_mflags} -C examples
make %{?_smp_mflags} docs

%install
export QTDIR=$PWD
make INSTALL_ROOT=%{buildroot} -C tools/assistant install
make INSTALL_ROOT=%{buildroot} -C demos install
make INSTALL_ROOT=%{buildroot} -C examples install
mv %{buildroot}/%{_libdir}/qt4/examples/painting/svgviewer/svgviewer %{buildroot}/%{_bindir}
mv %{buildroot}/%{_libdir}/qt4/demos/browser/browser %{buildroot}/%{_bindir}/qt4-browser
ln -s %{_bindir}/svgviewer %{buildroot}/%{_libdir}/qt4/examples/painting/svgviewer/svgviewer
ln -s %{_bindir}/qt4-browser %{buildroot}/%{_libdir}/qt4/demos/browser/browser

# htmldocs are not generated - why?
for d in docimages qchdocs htmldocs ; do
  make INSTALL_ROOT=%{buildroot} install_${d}
done

# remove some executable flags from image files:
find %{buildroot}%{_datadir} -name "*.png" -print0 | xargs -0 chmod a-x
find %{buildroot}%{_datadir} -name "*.css" -print0 | xargs -0 chmod a-x
find %{buildroot}%{_datadir} -name "*.js" -print0 | xargs -0 chmod a-x

# remove executable flags from source files:
find %{buildroot}%{_libdir}/qt4/examples -name "*.h" -print0 | xargs -0 chmod a-x
find %{buildroot}%{_libdir}/qt4/examples -name "*.cpp" -print0 | xargs -0 chmod a-x

# reduce fileconflicts
for f in $(rpm -ql libqt4-devel) $(rpm -ql libqt4-x11) $(rpm -ql libqt4); do
  test -f %{buildroot}/$f && rm %{buildroot}/$f
done

find %{buildroot} -type d -print0 | xargs -0 --no-run-if-empty rmdir --ignore-fail-on-non-empty

# argggh, qmake is such a piece of <censored>
mkdir -p %{buildroot}/%{_libdir}/pkgconfig
find  %{buildroot}/%{_libdir} -type f -name '*.pc' -exec mv {} %{buildroot}/%{_libdir}/pkgconfig \;

# fix more qmake errors
mkdir -p %{buildroot}/%{_libdir}/qt
find %{buildroot}/%{_libdir} -type f -name '*la' -print -exec perl -pi -e 's, -L%{_builddir}/\S+,,g' {} \;
find %{buildroot}/%{_libdir}/pkgconfig -type f -name '*pc' -print -exec perl -pi -e 's, -L%{_builddir}/\S+,,g' {} \;
mkdir -p %{buildroot}/%_docdir/%base_name/
ln -s %{_libdir}/qt4/demos %{buildroot}/%_docdir/%base_name/demos
ln -s %{_libdir}/qt4/examples %{buildroot}/%_docdir/%base_name/examples

rm -f %{buildroot}/%{_libdir}/libQt{3,A,C,G,H,N,S,T}*
rm -f %{buildroot}/%{_libdir}/libQtXml.*
rm -rf %{buildroot}/%{_libdir}/qt4/plugins

%fdupes %{buildroot}%{_prefix}/include
%fdupes %{buildroot}%{_libdir}/qt4/
%fdupes %{buildroot}%_docdir/%base_name

# remove some executable flags from source files:
chmod ugo-x %{buildroot}%{_libdir}/qt4/examples/tutorials/modelview/*/*.h
chmod ugo-x %{buildroot}%{_libdir}/qt4/examples/tutorials/modelview/*/*.cpp

%suse_update_desktop_file -i assistant4 Qt Development Documentation

%pre
# used to be a directory, is now a binary
if [ $1 -gt 1 -a -d %{_libdir}/qt4/examples/declarative/i18n/i18n ]; then
  rm -rf %{_libdir}/qt4/examples/declarative/i18n/i18n || true
fi

%files
%defattr(-,root,root,755)
%dir %{_docdir}/%base_name
%{_bindir}/assistant
%{_bindir}/qcollectiongenerator
%{_bindir}/qtdemo
%{_datadir}/applications/assistant4.desktop
%{_datadir}/pixmaps/assistant.png
%{_docdir}/%base_name/demos
%{_docdir}/%base_name/examples
%{_libdir}/qt4/demos
%{_libdir}/qt4/examples

%files -n qt4-x11-tools
%defattr(-,root,root,755)
%{_bindir}/qt4-browser
%{_bindir}/svgviewer

%files data
%defattr(-,root,root,755)
%dir %{_datadir}/doc/packages/%base_name
%{_datadir}/doc/packages/%base_name/qch
%{_datadir}/doc/packages/%base_name/html*
%{_datadir}/doc/packages/%base_name/src

%changelog
openSUSE Build Service is sponsored by