File apache2-mod_tidy.spec of Package apache2-mod_tidy

#
# spec file for package apache2-mod_tidy
#
# Copyright (c) 2015 SUSE LINUX 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/
#


########################################
# apache macros
########################################
%define modname mod_tidy
Name:           apache2-mod_tidy
Version:        0.5.5
Release:        0
###
###
Summary:        Apache Module using the Tidy Library to Clean Up HTML, XHTML, and XML
License:        Apache-2.0
Group:          Productivity/Networking/Web/Utilities
Url:            http://mod-tidy.sourceforge.net/
Source0:        http://mod-tidy.sourceforge.net/src/mod_tidy-%{version}.tar.gz
Source1:        %{modname}-suse-addons.tar.bz2
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2-devel
BuildRequires:  libtidy-devel
Requires:       %{apache_mmn}
Requires:       %{apache_suse_maintenance_mmn}
Requires:       apache2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
mod_tidy is a module for Apache that works as a filter that hooks
itself to HTML output.	mod_tidy feeds the HTML output to TidyLib
(http://tidy.sourceforge.net/), which validates the HTML output.  If
TidyLib finds an error, the client receives a HTML page with a list of
all found errors. If TidyLib does not complain, you get your HTML data
as without mod_tidy.

To load the module into Apache, run the command "a2enmod tidy" as root.

To learn about the configuration, refer to
%{_docdir}/apache2-mod_tidy/README.

%prep
%setup -q -n %{modname}-%{version} -a 1

%build
# APR uses pre-installed TidyLib instead of the packaged one
export CFLAGS="$CFLAGS -I%{_includedir}/tidy"
export CPPFLAGS="$CPPFLAGS -I%{_includedir}/tidy"
%{apache_apxs} -I%{_includedir}/tidy \
         -c src/%{modname}.c \
	 -ltidy
%configure --with-apxs=%{apache_apxs} \
           --with-tidy=%{_libdir}
# RPM_OPT_FLAGS come from apxs
make OPT="%{apache_cflags}" %{?_smp_mflags}

%install
install -Dpm 755 src/.libs/mod_tidy.so %{buildroot}%{apache_libexecdir}/%{modname}.so
install -Dpm 644 mod_tidy.conf %{buildroot}%{apache_sysconfdir}/%{modname}.conf
mv %{modname}-suse-addons/README.SUSE .

%post
echo "
To load %{modname} into Apache, add tidy to APACHE_MODULES in %{_sysconfdir}/sysconfig/apache2.
Please read %{_defaultdocdir}/%{name}/README.SUSE for further configuration hints.
Finally, restart the webserver with 'rcapache2 graceful'.
"

%check
set +x
%apache_test_module_load -m tidy:filter -i mod_tidy.conf
set -x

%files
%defattr(-, root, root)
%doc Changes INSTALL LICENSE README*
%config(noreplace) %{apache_sysconfdir}/%{modname}.conf
%attr(755, root, root) %{apache_libexecdir}/%{modname}.so

%changelog