File lighttpd.spec of Package lighttpd

#
# spec file for package lighttpd
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           lighttpd
Version:        1.4.30
Release:        0
#
%define pkg_name lighttpd
%define pkg_user lighttpd
%define pkg_home /var/lib/%{pkg_name}
#
Group:          Productivity/Networking/Web/Servers
License:        BSD-3-Clause
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  FastCGI-devel e2fsprogs-devel fam-devel gdbm-devel libattr-devel libmemcache-devel libxml2-devel mysql-devel openldap2-devel pcre-devel pkgconfig pwdutils zlib-devel automake
#
%define with_tests 1
%define with_enh_webdav 1
%define with_mod_magnet 1
%if 0%{?sles_version} == 9
%define with_tests 0
%define with_enh_webdav 0
%endif
%if 0%{?suse_version} > 1020
%define with_susefirewall_config 1
%endif
#
%if 0%{?with_enh_webdav}
BuildRequires:  sqlite-devel >= 3
%endif
#
%if "x%{?_repository}" != "x" && "x%{?_repository}" != "xstandard"
%if 0%{?suse_version} < 1030 || 0%{?suse_version} > 1210
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel
%endif
%define with_geoip 1
%else
BuildRequires:  lua-devel
%if 0%{?sles_version} == 9
%define with_mod_magnet 0
%endif
%endif
#
%if 0%{?with_geoip}
BuildRequires:  GeoIP-devel
%endif
#
%if 0%{?with_tests}
BuildRequires:  php5-fastcgi
%endif
#
%if 0%{?suse_version} < 1000
BuildRequires:  libstdc++-devel
%endif
%if 0%{?suse_version} > 1020
BuildRequires:  libbz2-devel
%endif
%if 0%{?suse_version} >= 1010
Recommends:     logrotate
%endif
PreReq:         %insserv_prereq %fillup_prereq pwdutils
Requires:       spawn-fcgi
#
Url:            http://www.lighttpd.net/
# Source:         http://www.lighttpd.net/download/%{pkg_name}-%{version}.tar.bz2
Source:         lighttpd_1.4.30.orig.tar.bz2
Source1:        %{pkg_name}.init
Source2:        %{pkg_name}.sysconfig
Source4:        lightytest.sh
Source5:        lighttpd.SuSEfirewall
Source6:        lighttpd-ssl.SuSEfirewall
Source7:        lighttpd.logrotate
# this is just dummy to pass the check for factory and still have one package for deb and rpm
Source99:       lighttpd_1.4.30-0.1.debian.tar.gz
Patch:          lighttpd-1.4.13_geoip.patch
#
Summary:        A Secure, Fast, Compliant, and Very Flexible Web Server
%description
Lighttpd is a secure, fast, compliant, and very flexible Web server
that has been optimized for high-performance environments. It has a
very low memory footprint compared to other Web servers and takes care
of CPU load. Its advanced feature set (FastCGI, CGI, Auth,
Output-Compression, URL-Rewriting, and more) makes lighttpd the perfect
Web server software for every server that is suffering load problems.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%package mod_cml
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        CML (Cache Meta Language) module for Lighttpd
%description mod_cml
CML is a Meta language to describe the dependencies of a page at one
side and building a page from its fragments on the oth er side using
LUA.

CML (Cache Meta Language) wants to solves several problems:

* dynamic content needs caching to perform

* checking if the content is dirty inside of the application is
   usually more expensive than sending out the cached data

* a dynamic page is usually fragmented and the fragments have
   different livetimes

* the different fragements can be cached independently



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%package mod_magnet
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        A module to control the request handling in lighttpd
%description mod_magnet
A module to control the request handling in lighttpd.

It is the successor of mod_cml.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%package mod_mysql_vhost
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        MySQL based virtual hosts (vhosts) module for Lighttpd
%description mod_mysql_vhost
With MySQL based vhosting you can put the information where to look for
a. document-root of a given host into a MySQL database.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%package mod_trigger_b4_dl
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        Another anti hot-linking module for Lighttpd
%description mod_trigger_b4_dl
Anti Hotlinking:

* if user requests download-url directly the request is denied and
   he is redirected to ''deny-url'

* if user visits trigger-url before requesting download-url access
   is granted

* if user visits download-url again after trigger-timeout has run
   down to the request is denied and he is redirected  to deny-url

The storage for the trigger information is either stored locally in a
gdbm file or remotly in memcached.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%package mod_rrdtool
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Requires:       rrdtool
Group:          Productivity/Networking/Web/Servers
Summary:        Lighttpd module to feed rrdtool databases
%description mod_rrdtool
RRD_tool is a system to store and display time-series data (i.e.
network bandwidth, machine-room temperature, server load average).

This module feeds an rrdtool database with the traffic stats from
lighttpd.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%if 0%{?with_geoip}

%package mod_geoip
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        A Secure, Fast, Compliant, and Very Flexible Web Server
%description mod_geoip
Lighttpd a secure, fast, compliant, and very flexible Web server that
has been optimized for high-performance environments. It has a very low
memory footprint compared to other Web servers and takes care of CPU
load.  Its advanced feature set (FastCGI, CGI, Auth,
Output-Compression, URL-Rewriting, and more) makes lighttpd the perfect
Web server software for every server that is suffering load problems.

This is just a dummy package which is not build in autobuild. see the
buildservice project server:http if you want it.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%endif

%package mod_webdav
License:        BSD-3-Clause
Requires:       %{name} = %{version}
Group:          Productivity/Networking/Web/Servers
Summary:        WebDAV module for Lighttpd
%description mod_webdav
The WebDAV module is a very minimalistic implementation of RFC 2518.
Minimalistic means that not all operations are implementated yet..

So far we have

* PROPFIND

* OPTIONS

* MKCOL

* DELETE

* PUT

and the usual GET, POST, HEAD from HTTP/1.1..

So far mounting a webdav resource into Windows XP works and the basic
litmus tests are passed.



Authors:
--------
    Jan Kneschke <jan@kneschke.de>

%prep
%setup
%if 0%{?with_geoip}
%patch
%endif
perl -p -i -e 's| tar-ustar||g' configure.ac

%build
%if 0%{?with_geoip}
autoreconf
%endif
export CFLAGS="%{optflags} -DLDAP_DEPRECATED -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -std=gnu99"
%if %suse_version > 1000
export CFLAGS="$CFLAGS -fstack-protector"
%endif
%configure                      \
    --bindir=%{_sbindir}        \
    --libdir=%{_libdir}/%{pkg_name} \
    --enable-lfs                \
    --enable-ipv6               \
    --with-ldap                 \
    --with-mysql                \
    --with-openssl              \
    --with-kerberos5            \
    --with-gdbm                 \
    --with-lua                  \
    --with-memcache             \
    --with-bzip2                \
%if 0%{?with_enh_webdav}
    --with-webdav-props         \
    --with-webdav-locks         \
%endif
    --with-fam                  \
    --with-attr
%{__make}
%if 0%{?with_tests}
%if 0%{suse_version} > 1200
export PHP="/srv/www/cgi-bin/php"
%else
export PHP="/srv/www/cgi-bin/php5"
%endif
sh -x %{S:4}
%endif

%install
%makeinstall
%{__install} -d -m 0755                            \
    %{buildroot}%{pkg_home}/sockets/               \
    %{buildroot}%{_var}/cache/%{pkg_name}/compress \
    %{buildroot}%{_var}/log/%{pkg_name}            \
    %{buildroot}%{_sysconfdir}/%{pkg_name}
#
# init script
#
%{__install} -D -m 0755 %{S:1} \
    %{buildroot}%{_sysconfdir}/init.d/%{pkg_name}
%{__ln_s} -f %{_sysconfdir}/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
#
# sample config
#
perl -p -i.orig -e 's|^(server\.tag = ).*$|$1 "%{pkg_name} (%{version}/SuSE)"|' doc/config/lighttpd.conf
diff -ur doc/config/lighttpd.conf{.orig,} ||:
%{__rm} -vf doc/config/lighttpd.conf.orig ||:
%{__cp} -rv doc/config/* %{buildroot}%{_sysconfdir}/%{pkg_name}/
# as much as i would like to use -delete here. sles9 doesnt understand it. 
find %{buildroot}%{_sysconfdir}/%{pkg_name}/ -name Makefile\* -print0 | xargs -r0 rm -fv
# only needed when build with mod_geoip support
%if ! 0%{?with_geoip}
%{__rm} -v %{buildroot}%{_sysconfdir}/%{pkg_name}/conf.d/geoip.conf
%endif
#
# sysconfig template
#
%{__install} -D -m 0644 %{S:2} \
    %{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
#
# susefirewall config file
#
%if 0%{?with_susefirewall_config}
%{__install} -D -m 0644 %{S:5} \
    %{buildroot}/etc/sysconfig/SuSEfirewall2.d/services/lighttpd
%{__install} -D -m 0644 %{S:6} \
    %{buildroot}/etc/sysconfig/SuSEfirewall2.d/services/lighttpd-ssl
%endif
#
# logrotate config
#
%{__install} -D -m 0644 %{S:7} \
    %{buildroot}/etc/logrotate.d/%{name}
#
# remove the .la files. we dont need them.
#
%{__rm} -vf %{buildroot}%{_libdir}/%{pkg_name}/*.la

%clean
%{__rm} -rf %{buildroot};

%pre
#
# e.g. adding user
#
/usr/sbin/groupadd -r %{pkg_user} &>/dev/null ||:
/usr/sbin/useradd  -g %{pkg_user} -s /bin/false -r -c "user for %{pkg_user}" -d %{pkg_home} %{pkg_user} &>/dev/null ||:

%post
%fillup_and_insserv %{pkg_name}

%preun
%stop_on_removal %{pkg_name}

%postun
%restart_on_update %{pkg_name}
%{insserv_cleanup}

%files
%defattr(-,root,root,-)
%if 0%{?with_susefirewall_config}
%config(noreplace) /etc/sysconfig/SuSEfirewall2.d/services/lighttpd*
%endif
%config(noreplace) /etc/logrotate.d/%{name}
%{_sbindir}/*
%dir               %attr(750,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}
%dir               %attr(750,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d
%dir               %attr(750,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/vhosts.d
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/lighttpd.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/modules.conf
# modules config
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/access_log.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/auth.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/cgi.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/compress.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/debug.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/dirlisting.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/evhost.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/expire.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/fastcgi.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/mime.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/mod.template
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/proxy.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/scgi.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/secdownload.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/simple_vhost.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/ssi.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/status.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/userdir.conf
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/vhosts.d/vhosts.template
# modules
%dir %{_libdir}/%{pkg_name}
%{_libdir}/%{pkg_name}/mod_access.so
%{_libdir}/%{pkg_name}/mod_accesslog.so
%{_libdir}/%{pkg_name}/mod_alias.so
%{_libdir}/%{pkg_name}/mod_auth.so
%{_libdir}/%{pkg_name}/mod_cgi.so
%{_libdir}/%{pkg_name}/mod_compress.so
%{_libdir}/%{pkg_name}/mod_dirlisting.so
%{_libdir}/%{pkg_name}/mod_evasive.so
%{_libdir}/%{pkg_name}/mod_evhost.so
%{_libdir}/%{pkg_name}/mod_expire.so
%{_libdir}/%{pkg_name}/mod_extforward.so
%{_libdir}/%{pkg_name}/mod_fastcgi.so
%{_libdir}/%{pkg_name}/mod_flv_streaming.so
%{_libdir}/%{pkg_name}/mod_indexfile.so
%{_libdir}/%{pkg_name}/mod_proxy.so
%{_libdir}/%{pkg_name}/mod_redirect.so
%{_libdir}/%{pkg_name}/mod_rewrite.so
%{_libdir}/%{pkg_name}/mod_scgi.so
%{_libdir}/%{pkg_name}/mod_secdownload.so
%{_libdir}/%{pkg_name}/mod_setenv.so
%{_libdir}/%{pkg_name}/mod_simple_vhost.so
%{_libdir}/%{pkg_name}/mod_ssi.so
%{_libdir}/%{pkg_name}/mod_staticfile.so
%{_libdir}/%{pkg_name}/mod_status.so
%{_libdir}/%{pkg_name}/mod_userdir.so
%{_libdir}/%{pkg_name}/mod_usertrack.so
%{_mandir}/man8/*.8*
%config(noreplace) %{_sysconfdir}/init.d/%{pkg_name}
%doc AUTHORS NEWS README
#doc doc/*.dot
%doc doc/scripts/spawn-php.sh
%doc doc/outdated/accesslog.txt
%doc doc/outdated/access.txt
%doc doc/outdated/alias.txt
%doc doc/outdated/authentication.txt
%doc doc/outdated/cgi.txt
%doc doc/outdated/compress.txt
%doc doc/outdated/configuration.txt
%doc doc/outdated/expire.txt
%doc doc/outdated/fastcgi-state.txt
%doc doc/outdated/fastcgi.txt
%doc doc/outdated/features.txt
%doc doc/outdated/performance.txt
%doc doc/outdated/plugins.txt
%doc doc/outdated/proxy.txt
%doc doc/outdated/redirect.txt
%doc doc/outdated/rewrite.txt
%doc doc/outdated/scgi.txt
%doc doc/outdated/secdownload.txt
%doc doc/outdated/security.txt
%doc doc/outdated/setenv.txt
%doc doc/outdated/simple-vhost.txt
%doc doc/outdated/skeleton.txt
%doc doc/outdated/ssi.txt
%doc doc/outdated/ssl.txt
%doc doc/outdated/state.txt
%doc doc/outdated/status.txt
%doc doc/outdated/traffic-shaping.txt
%doc doc/outdated/userdir.txt
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%dir %attr(751,%{pkg_user},%{pkg_user}) %{pkg_home}/
%dir %attr(751,%{pkg_user},%{pkg_user}) %{pkg_home}/sockets/
%attr(751,%{pkg_user},%{pkg_user}) %{_var}/cache/%{pkg_name}/
%dir %attr(750,%{pkg_user},%{pkg_user}) %{_var}/log/%{pkg_name}/

%files mod_rrdtool
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/rrdtool.conf
%doc doc/outdated/rrdtool.txt
%doc doc/scripts/rrdtool-graph.sh
%{_libdir}/%{pkg_name}/mod_rrdtool.so

%files mod_cml
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/cml.conf
%{_libdir}/%{pkg_name}/mod_cml.so
%doc doc/outdated/cml.txt

%files mod_magnet
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/magnet.conf
%{_libdir}/%{pkg_name}/mod_magnet.so
%doc doc/outdated/magnet.txt

%files mod_mysql_vhost
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/mysql_vhost.conf
%{_libdir}/%{pkg_name}/mod_mysql_vhost.so
%doc doc/outdated/mysqlvhost.txt

%files mod_trigger_b4_dl
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/trigger_b4_dl.conf
%{_libdir}/%{pkg_name}/mod_trigger_b4_dl.so
%doc doc/outdated/trigger_b4_dl.txt

%if 0%{?with_geoip}
%files mod_geoip
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/geoip.conf
%doc doc/geoip.txt
%{_libdir}/%{pkg_name}/mod_geoip.so
%endif

%files mod_webdav
%defattr(-,root,root,-)
%config(noreplace) %attr(640,root,%{pkg_user}) %{_sysconfdir}/%{pkg_name}/conf.d/webdav.conf
%{_libdir}/%{pkg_name}/mod_webdav.so
%doc doc/outdated/webdav.txt

%changelog
openSUSE Build Service is sponsored by