
#global apidocs 1

Name:    grantlee
Summary: Qt string template engine based on the Django template system
Version: 0.5.1
Release: 14

License: LGPLv2+
URL:     http://www.gitorious.org/grantlee/pages/Home
Source0: http://downloads.grantlee.org/grantlee-%{version}%{?pre:-%{pre}}.tar.gz

## upstream patches

BuildRequires: cmake >= 2.8.11
BuildRequires: gcc-c++
BuildRequires: kde-filesystem
BuildRequires: pkgconfig(QtGui) pkgconfig(QtScript) 
%if 0%{?apidocs}
BuildRequires: doxygen
BuildRequires: graphviz
%endif
## for %%check
BuildRequires: xorg-x11-server-Xvfb
BuildRequires: kde4-filesystem

Requires: kde-filesystem kde4-filesystem

%description
Grantlee is a plug-in based String Template system written 
using the Qt framework. The goals of the project are to make it easier for
application developers to separate the structure of documents from the 
data they contain, opening the door for theming.

The syntax is intended to follow the syntax of the Django template system, 
and the design of Django is reused in Grantlee. 
Django is covered by a BSD style license.

Part of the design of both is that application developers can extend 
the syntax by implementing their own tags and filters. For details of 
how to do that, see the API documentation.

For template authors, different applications using Grantlee will present 
the same interface and core syntax for creating new themes. For details of 
how to write templates, see the documentation.

%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package apidocs
Summary: Grantlee API documentation
Requires: kde-filesystem
BuildArch: noarch
%description apidocs
This package includes the Grantlee API documentation in HTML
format for easy browsing.


%prep
%autosetup -p1


%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{cmake} \
  -DCMAKE_BUILD_TYPE=release \
  ..
popd

make %{?_smp_mflags} -C %{_target_platform}

%if 0%{?apidocs}
make docs -C %{_target_platform}
%endif


%install
make install/fast -C %{_target_platform} DESTDIR=%{buildroot}

# create/own kde4-related dirs
mkdir -p %{buildroot}%{_kde4_libdir}/kde4/plugins/grantlee/0.5/

%if 0%{?apidocs}
mkdir -p %{buildroot}%{_docdir}/HTML/en/grantlee-apidocs
cp -prf %{_target_platform}/apidox/* %{buildroot}%{_docdir}/HTML/en/grantlee-apidocs
%endif


%check
export CTEST_OUTPUT_ON_FAILURE=1
xvfb-run -a make test -C %{_target_platform} ||:


%{ldconfig_scriptlets}

%files
%doc AUTHORS CHANGELOG README
%license COPYING.LIB
%{_libdir}/libgrantlee_core.so.0*
%{_libdir}/libgrantlee_gui.so.0*
%dir %{_libdir}/grantlee/
%{_libdir}/grantlee/0.5/
%{_kde4_libdir}/kde4/plugins/grantlee/0.5/

%files devel
%{_includedir}/grantlee/
%{_includedir}/grantlee_core.h
%{_includedir}/grantlee_templates.h
%{_includedir}/grantlee_textdocument.h
%{_libdir}/libgrantlee_core.so
%{_libdir}/libgrantlee_gui.so
%{_libdir}/cmake/grantlee/

%if 0%{?apidocs}
%files apidocs
%{_docdir}/HTML/en/grantlee-apidocs/
%endif


%changelog
* Tue Jan 30 2024 peijiankang <peijiankang@kylinos.cn> - 0.5.1-14
- fix build error of _kde4_libdir

* Mon Dec 13 2021 douyan <douyan@kylinos.cn> - 0.5.1-13
- remove %{?dist}

* Thu Jul 23 2020 wangmian<wangmian@kylinos.cn> - 0.5.1-12
- Init grantlee project
