LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File klatexformula.spec of Package klatexformula (Project Publishing)

#
# spec file for package klatexformula
#
# 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/
#


# * Library version
%define	libversion		3.2
%define libversionpkgsuffix	3_2
# * Set whether to compile with debug information or not, depending on ability to create debug packages
%if 0%{?suse_version} < 1120
# # OpenSuse <= 11.1 complains about unpackaged debug files (?), so disable debug information...
# define cmake_build_type "Release"
# define makeinstall_target install/strip
%define cmake_build_type "RelWithDebInfo"
%define makeinstall_target install
%define want_explicit_debug_package 0
%define want_explicit_buildarch 1
%else
%define cmake_build_type "RelWithDebInfo"
%define makeinstall_target install
%define want_explicit_debug_package 0
%define want_explicit_buildarch 0
%endif
# * Set CMake Common compilation options
#   Note: KLF_CMAKE_DEBUG only turns on KLF's CMake debugging messages, it has no effect upon the build itself.
%define cmake_common_options -DKLF_CMAKE_DEBUG=ON -DCMAKE_INSTALL_PREFIX="/usr" -DKLF_INSTALL_LIB_DIR=%{_libdir} -DKLF_INSTALL_BIN_DIR=%{_bindir}
%define build_ktexteditorplugin 0%{?suse_version} > 1110
%if %build_ktexteditorplugin
  %define cmake_buildktexteditorplugin -DKLF_BUILD_KTEXTEDITORPLUGIN=ON
%else
  %define cmake_buildktexteditorplugin -DKLF_BUILD_KTEXTEDITORPLUGIN=OFF
%endif
# -------------------------
#
#  Package Header
#  --------------

Name:           klatexformula
Version:        3.2.6
Release:        0
Summary:        An easy-to-use graphical application for generating images from LaTeX equations
License:        GPL-2.0+
Group:          Productivity/Publishing/TeX/Frontends
Url:            http://klatexformula.sourceforge.net/
Source0:        http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
# NOTE: kdelibs4 is required for the ktexteditor plugin only, not klatexformula itself
BuildRequires:  cmake >= 2.6.4
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  graphviz
BuildRequires:  graphviz-gd
BuildRequires:  gs
BuildRequires:  help2man
BuildRequires:  kdelibs4
BuildRequires:  libkde4-devel
BuildRequires:  libqt4 >= 4.4.0
BuildRequires:  libqt4-devel
BuildRequires:  libstdc++-devel
BuildRequires:  qt3 >= 3.3
BuildRequires:  qt3-devel >= 3.3
BuildRequires:  shared-mime-info
BuildRequires:  texlive-latex
BuildRequires:  update-desktop-files
Requires:       libklfbackend%libversionpkgsuffix = %{version}
Requires:       libklftools%libversionpkgsuffix = %{version}
Requires:       shared-mime-info
Obsoletes:      KLatexFormula < 3.2
Obsoletes:      klatexformula-plugins < 3.2.2
Provides:       KLatexFormula = %{version}
Provides:       klatexformula-plugins = %{version}
Patch0:         klatexformula-3.2.5-add-needed.patch

%description
KLatexFormula is an easy-to-use graphical user interface for generating images
from LaTeX equations. These images can be dragged and dropped or copied and
pasted into external applications (presentations, text documents, graphics...),
or can be saved to disk in a variety of formats (PNG, JPG, BMP, EPS, PDF, etc.).

If package cm-unicode is installed, KLatexFormula can use LaTeX' Computer Modern
Sans Serif font as default application font.

%package -n libklfbackend%libversionpkgsuffix

Summary:        KLatexFormula backend library (Qt4)
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       gs
Requires:       texlive-latex
Provides:       libklfbackend = %{version}

%description -n libklfbackend%libversionpkgsuffix
A C++/Qt library to generate images (PNG, EPS, PDF, plus all Qt-supported image
formats) from LaTeX equations.

This library implements the base functionality of KLatexFormula. This library
is compiled for Qt 4.

See also packages klatexformula and libklfbackend-qt3.

%package -n libklfbackend-qt3-%libversionpkgsuffix

Summary:        KLatexFormula backend library (Qt3)
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       gs
Requires:       qt3 >= 3.3
Requires:       texlive-latex
Provides:       libklfbackend-qt3 = %{version}

%description -n libklfbackend-qt3-%libversionpkgsuffix
A C++/Qt library to generate images (PNG, EPS, PDF, plus all Qt-supported image
formats) from LaTeX equations.

This library implements the base functionality of KLatexFormula. This library
is compiled for Qt 3.

See also packages klatexformula and libklfbackend.

%package -n libklfbackend-devel
Summary:        KLatexFormula backend library (development files)
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       libklfbackend = %{version}

%description -n libklfbackend-devel
A C++/Qt library to generate images (PNG, EPS, PDF, plus all Qt-supported image
formats) from LaTeX equations.

This library implements the base functionality of KLatexFormula.

This package contains the needed files for development. Contains: headers,
static library.

See also packages klatexformula-devel and libklfbackend-qt3-devel

%package -n libklfbackend-qt3-devel
Summary:        KLatexFormula backend library (development files) (Qt3)
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       libklfbackend-devel = %{version}
Requires:       libklfbackend-qt3 = %{version}

%description -n libklfbackend-qt3-devel
A C++/Qt library to generate images (PNG, EPS, PDF, plus all Qt-supported image
formats) from LaTeX equations.

This library implements the base functionality of KLatexFormula. This library
is compiled for Qt 3.

This package contains the needed files for development. Contains: static
library.

See also packages klatexformula-devel and libklfbackend-devel.

%package -n libklftools%libversionpkgsuffix

Summary:        KLatexFormula tools library
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Provides:       libklftools = %{version}

%description -n libklftools%libversionpkgsuffix
A C++/Qt4 library containing general-purpose GUI tools.

These tools were originially written for use by klatexformula, but they have
been promoted to a library for use in any application.

%package -n libklftools-devel
Summary:        KLatexFormula tools library (development files)
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       libklftools = %{version}

%description -n libklftools-devel
A C++/Qt4 library containing general-purpose GUI tools.

These tools were originially written for use by klatexformula, but they have
been promoted to a library for use in any application.

This package contains the needed files for development. Contains: headers,
static library.

%package devel
Summary:        Development files for KLatexFormula
Group:          Development/Libraries/C and C++
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       klatexformula = %{version}
Requires:       libklfbackend-devel = %{version}
Requires:       libklftools-devel = %{version}

%description devel
KLatexFormula is an easy-to-use graphical user interface for generating images
from LaTeX equations. These images can be dragged and dropped or copied and
pasted into external applications (presentations, text documents, graphics...),
or can be saved to disk in a variety of formats (PNG, JPG, BMP, EPS, PDF, etc.).

This package contains the needed files for development. Contains: headers of
the main application library itself, unversioned shared library.

%package apidoc
Summary:        API documentation for KLatexFormula
Group:          Documentation/HTML
Requires:       klatexformula = %{version}
BuildArch:      noarch

%description apidoc
KLatexFormula is an easy-to-use graphical user interface for generating images
from LaTeX equations. These images can be dragged and dropped or copied and
pasted into external applications (presentations, text documents, graphics...),
or can be saved to disk in a variety of formats (PNG, JPG, BMP, EPS, PDF, etc.).

This package contains the API documentation of the libraries libklfbackend,
libklftool and libklfapp which are the different components of klatexformula.

%if %build_ktexteditorplugin

%package ktexteditor-plugin
Summary:        KLatexFormula integration into KDE4's text editor
Group:          Productivity/Publishing/TeX/Frontends
%if %want_explicit_buildarch
BuildArch:      %{_arch}
%endif
Requires:       klatexformula = %{version}
%kde4_runtime_requires

%description ktexteditor-plugin
KLatexFormula is an easy-to-use graphical user interface for generating images
from LaTeX equations. These images can be dragged and dropped or copied and
pasted into external applications (presentations, text documents, graphics...),
or can be saved to disk in a variety of formats (PNG, JPG, BMP, EPS, PDF, etc.).

This package contains a KLatexFormula integration plugin for KDE4's KTextEditor
interface. This makes KLatexFormula integrate into Kate, Kile, and any other
KDE4 application using KTextEditor.

%endif

# Explicit debug package for opensuse <= 11.1
%if 0%{?want_explicit_debug_package}
%endif

%prep
%setup -q
%patch0 -p1

%build

# Create a shared version in build-shared/, install runtime
mkdir build-shared
cd build-shared && cmake .. -DCMAKE_BUILD_TYPE=%cmake_build_type \
	-DKLF_LIBKLFBACKEND_STATIC=OFF -DKLF_LIBKLFTOOLS_STATIC=OFF -DKLF_LIBKLFAPP_STATIC=OFF \
	%cmake_common_options %cmake_buildktexteditorplugin \
	-DKLF_INSTALL_RUNTIME=ON -DKLF_INSTALL_DEVEL=OFF \
	-DKLF_INCLUDE_FONTS="" -DKLF_INSTALL_DESKTOP_CATEGORIES="Qt;Office;Utility;Viewer;DesktopUtility;" \
	-DKLF_INSTALL_DESKTOP_ICON="klatexformula" -DKLF_INSTALL_SHARE_PIXMAPS_DIR="" \
	-DKLF_INSTALL_ICON_THEME="share/icons/hicolor" -DKLF_INSTALL_RUN_POST_INSTALL=OFF \
	-DKLF_INSTALL_APIDOC_DIR="share/doc/klatexformula-api" \
        -DKLF_INSTALL_SHARE_MAN1_DIR=%{_mandir}/man1
pwd #debug specfile
make %{?_smp_mflags} VERBOSE=1
cd ..
pwd #debug specfile

# Create a static version in build-static/, install devel
mkdir build-static
# Run CMake
# Note: we don't want the binaries, install them somewhere harmless (/tmp)
cd build-static && cmake .. -DCMAKE_BUILD_TYPE=%cmake_build_type \
	 -DKLF_LIBKLFBACKEND_STATIC=ON -DKLF_LIBKLFTOOLS_STATIC=ON -DKLF_LIBKLFAPP_STATIC=ON \
	%cmake_common_options -DKLF_BUILD_KTEXTEDITORPLUGIN=OFF \
 	-DKLF_INSTALL_RUNTIME=ON -DKLF_INSTALL_DEVEL=ON \
	-DKLF_INSTALL_KLFAPP_STATIC_LIBS=OFF \
	-DKLF_INSTALL_KLATEXFORMULA_BIN=OFF -DKLF_INSTALL_KLATEXFORMULA_CMDL=OFF \
	-DKLF_INSTALL_DESKTOP=OFF -DKLF_INSTALL_RUN_POST_INSTALL=OFF -DKLF_BUILD_PLUGINS=OFF \
	-DKLF_BUILD_KTEXTEDITORPLUGIN=OFF
pwd #debug specfile
make %{?_smp_mflags} VERBOSE=1
cd ..

# Create a Qt3 shared version in build-qt3-shared/
mkdir build-qt3-shared
# Run CMake
cd build-qt3-shared && cmake .. -DCMAKE_BUILD_TYPE=%cmake_build_type \
	-DKLF_QT_VERSION=3 -DKLF_LIBKLFBACKEND_STATIC=OFF %cmake_common_options
make %{?_smp_mflags} VERBOSE=1
cd ..

# Create a Qt3 static version in build-qt3-static/
mkdir build-qt3-static
# Run CMake
cd build-qt3-static && cmake .. -DCMAKE_BUILD_TYPE=%cmake_build_type \
	-DKLF_QT_VERSION=3 -DKLF_LIBKLFBACKEND_STATIC=ON %cmake_common_options
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
# NOTE: If not creating debuginfo packages, use 'make install/strip'
# Install shared + executables
cd build-shared && make %makeinstall_target DESTDIR=%{buildroot} ; cd ..
# Install static libs
cd build-static && make %makeinstall_target DESTDIR=%{buildroot} ; cd ..
# Install Qt3 klfbackend shared library
cd build-qt3-shared && make %makeinstall_target DESTDIR=%{buildroot} ; cd ..
# Install Qt3 klfbackend static library
cd build-qt3-static && make %makeinstall_target DESTDIR=%{buildroot} ; cd ..

# Doxygen doc generates some duplicate files in the big lot ...
%fdupes %{buildroot}%{_datadir}/doc/klatexformula-api
# Man pages are duplicates
%fdupes -s %{buildroot}%{_mandir}

%suse_update_desktop_file klatexformula
%if %build_ktexteditorplugin
  %suse_update_desktop_file %{buildroot}%{_datadir}/kde4/services/ktexteditor_klf.desktop
  %suse_update_desktop_file %{buildroot}%{_datadir}/kde4/services/ktexteditor_klf_config.desktop
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING CMUFONTS_COPYING README
%{_bindir}/klatexformula
%{_bindir}/klatexformula_cmdl
%{_libdir}/libklfapp.so.%libversion
%{_datadir}/applications/klatexformula.desktop
%{_datadir}/icons/*/*/*/*
%{_datadir}/mime/packages/klatexformula-mime.xml
%{_mandir}/man1/klatexformula.1.gz
%{_mandir}/man1/klatexformula_cmdl.1.gz
%{_datadir}/klatexformula/
#/usr/share/klatexformula/rccresources/
#/usr/share/klatexformula/rccresources/klfbaseplugins.rcc

%post
update-mime-database /usr/share/mime
ldconfig

%postun
update-mime-database /usr/share/mime
ldconfig

%files -n libklfbackend%libversionpkgsuffix
%defattr(-,root,root,-)
%{_libdir}/libklfbackend.so.%libversion

%post -n libklfbackend%libversionpkgsuffix
ldconfig

%postun -n libklfbackend%libversionpkgsuffix
ldconfig

%files -n libklfbackend-qt3-%libversionpkgsuffix
%defattr(-,root,root,-)
%{_libdir}/libklfbackend-qt3.so.%libversion

%post -n libklfbackend-qt3-%libversionpkgsuffix
ldconfig

%postun -n libklfbackend-qt3-%libversionpkgsuffix
ldconfig

%files -n libklfbackend-qt3-devel
%defattr(-,root,root,-)
%{_libdir}/libklfbackend-qt3.so
%{_libdir}/libklfbackend-qt3.a

%files -n libklfbackend-devel
%defattr(-,root,root,-)
%{_libdir}/libklfbackend.so
%{_libdir}/libklfbackend.a
%{_includedir}/klfbackend/
#/usr/include/klfbackend/*.h

%post -n libklfbackend-devel
ldconfig

%postun -n libklfbackend-devel
ldconfig

%files -n libklftools%libversionpkgsuffix
%defattr(-,root,root,-)
%{_libdir}/libklftools.so.*

%post -n libklftools%libversionpkgsuffix
ldconfig

%postun -n libklftools%libversionpkgsuffix
ldconfig

%files -n libklftools-devel
%defattr(-,root,root,-)
%{_libdir}/libklftools.so
%{_libdir}/libklftools.a
%{_includedir}/klftools/
#/usr/include/klftools/*.h

%post -n libklftools-devel
ldconfig

%postun -n libklftools-devel
ldconfig

%files devel
%defattr(-,root,root,-)
%{_libdir}/libklfapp.so
%{_includedir}/klfapp/
#/usr/include/klfapp/*.h

%post devel
ldconfig

%postun devel
ldconfig

%files apidoc
%defattr(-,root,root,-)
%{_datadir}/doc/klatexformula-api
#/usr/share/doc/klatexformula-api/*
#/usr/share/doc/klatexformula-api/*/html
#/usr/share/doc/klatexformula-api/*/html/*
#/usr/share/doc/klatexformula-api/*/html/*/*

%if %build_ktexteditorplugin

%files ktexteditor-plugin
%defattr(-,root,root,-)
%{_libdir}/kde4/ktexteditor_klf.so
%{_datadir}/kde4/apps/ktexteditor_klf/
#/usr/share/kde4/apps/ktexteditor_klf/klfkatepluginui.rc
%{_datadir}/kde4/services/ktexteditor_klf.desktop
%{_datadir}/kde4/services/ktexteditor_klf_config.desktop
%endif

%changelog