File apache2-mod_tidy.spec of Package apache2-mod_tidy

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


Name:           apache2-mod_tidy
BuildRequires:  apache2-devel
BuildRequires:  libtidy-devel
Version:        0.5.5
Release:        0
########################################
# apache macros
########################################
%define modname mod_tidy
%define apxs %{_sbindir}/apxs2
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
###
###
Summary:        Apache Module using the Tidy Library to Clean Up HTML, XHTML, and XML
License:        Apache-2.0
Group:          Productivity/Networking/Web/Utilities
Requires:       apache2 %{apache_mmn}
Url:            http://mod-tidy.sourceforge.net/
Source0:        http://mod-tidy.sourceforge.net/src/mod_tidy-%{version}.tar.gz
Source1:        %{modname}-suse-addons.tar.bz2
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
/usr/share/doc/packages/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"
%{apxs} -I%{_includedir}/tidy \
         -c src/%{modname}.c \
	 -ltidy
%configure --with-apxs=%{apxs} \
           --with-tidy=%{_libdir}
# RPM_OPT_FLAGS come from apxs
make OPT="$(%{apxs} -q CFLAGS)" %{?_smp_mflags}

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

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

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

%changelog
openSUSE Build Service is sponsored by