File thttpd.spec of Package thttpd

#
# spec file for package thttpd
#
# Copyright (c) 2013 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:           thttpd
Provides:       http_daemon
PreReq:         %fillup_prereq %insserv_prereq permissions
Version:        2.25b
Release:        1.1
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}-SuSE.tar.bz2
Patch0:         %{name}-%{version}-configure.patch
Patch1:         %{name}-%{version}-dirs.patch
Patch2:         %{name}-%{version}-time_h.patch
Patch3:         %{name}-%{version}-newautoconf.patch  
Patch4:         %{name}-%{version}-sec.patch
Patch5:         %{name}-%{version}-static.patch
Patch6:         %{name}-%{version}-pie.patch
Patch7:         %{name}-%{version}-syslogtocern.diff
Patch8:         %{name}-%{version}-overflow.diff
Patch9:         %{name}-%{version}-chown.diff
Patch10:        %{name}-%{version}-zerolen.patch
Patch11:        %{name}-%{version}-strcpy.patch
Patch12:        thttpd-2.25b-getline.patch
# PATCH-FIX-SUSE CVE-2012-5640
Patch13:        thttpd-2.25b-CVE-2012-5640-check_crypt_return_value.patch
Url:            http://www.acme.com/software/thttpd/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        Small and very simple webserver
License:        BSD-3-Clause
Group:          Productivity/Networking/Web/Servers
BuildRequires:  automake
BuildRequires:  libtool

%description
Thttpd is a very compact no-frills httpd serving daemon that can handle
very high loads.  While lacking many of the advanced features of Roxen
or Apache, thttpd operates without forking and is extremely efficient
in memory use.	Basic support for cgi scripts, authentication, and ssi
is provided for.  Advanced features include the ability to throttle
traffic.



Authors:
--------
    jef@acme.com

%define serverroot /srv/www

%prep
%setup -q -a 1
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13 -p1

%build
cp /usr/share/automake-1.*/config.* . 
# update server root path
sed -i "s@__SRVROOT__@%{serverroot}/htdocs@g" README.SuSE SuSE/etc/thttpd.conf
sed -i "s@__PREFIX__@%{_prefix}@g;\
    s@__SYSCONFDIR__@%{_sysconfdir}@g;\
    s@__NAME__@%{name}@g;\
    s@__VERSION__@%{version}@g" SuSE/etc/init.d/thttpd
chmod 744 SuSE/etc/init.d/thttpd
chmod 644 SuSE/etc/thttpd.conf
mv aclocal.m4 acinclude.m4
libtoolize --force
aclocal --force
autoconf -f
V_CCOPT="$RPM_OPT_FLAGS -Wall" \
./configure \
    --mandir=%{_mandir} \
    --prefix=%{_prefix} \
    --infodir=%{_infodir} \
    --sysconfdir=%{_sysconfdir}
%ifarch s390 s390x
make F_PIE="-fPIE"
%else
make F_PIE="-fpie"
%endif

%install
install -d %{buildroot}/usr/bin \
    %{buildroot}/usr/sbin \
    %{buildroot}%{_mandir}/man1 \
    %{buildroot}%{_mandir}/man8 \
    %{buildroot}%{serverroot}/htdocs/users
make DESTDIR=%{buildroot} install
cp -a SuSE/* %{buildroot}
rm -f %{buildroot}%{serverroot}/htdocs/index.html

%post
%{fillup_and_insserv thttpd}
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions /usr/bin/makeweb
%endif

%verifyscript
%verify_permissions -e /usr/bin/makeweb

%preun
%stop_on_removal thttpd

%postun
%restart_on_update thttpd
%{insserv_cleanup}

%clean
rm -rf "%{buildroot}"

%files
%defattr(-, root, root)
%doc README README.SuSE config.h
%{serverroot}/htdocs/*
%attr(775, root, www) %{serverroot}/htdocs/users
%verify(not mode) %attr(2750, root, www) /usr/bin/makeweb
/usr/bin/htpasswd
/usr/sbin/*
/usr/share/man/*/*
%config /etc/init.d/thttpd
%config(noreplace) /etc/thttpd.conf

%changelog
* Thu Jun 27 2013 crrodriguez@opensuse.org
- DO not add sample index.html that will conflict with apache
* Mon Mar  4 2013 vcizek@suse.com
- added checks for crypt() return value (CVE-2012-5640) (bnc#783165)
  * thttpd-2.25b-CVE-2012-5640-check_crypt_return_value.patch
* Wed Oct 24 2012 suse@ammler.ch
- use different versions of automake (SLE)
* Fri Jun  8 2012 vcizek@suse.com
- use %%set_permissions instead of %%run_permissions (bnc#764110)
* Tue May 29 2012 puzel@suse.com
- fix build with automake 1.12
* Thu Mar 22 2012 dvaleev@suse.com
- drop thttpd-2.25b-x86_64_machine_not_recognized.patch but copy
  config.guess from automake to fix ppc64 as well
* Tue Jan 31 2012 vcizek@suse.com
- fixed build and added -fpie for makeweb
* Wed Nov 23 2011 coolo@suse.com
- add libtool as buildrequire to avoid implicit dependency
* Sun Jun  7 2009 ro@suse.de
- rename getline to my_getline to avoid collision with function
  from glibc
* Tue May 26 2009 anicka@suse.cz
- add new branding (bnc#492693)
* Mon Jun 11 2007 pcerny@suse.cz
- fixed another syntax error in config file
* Fri Jun  8 2007 dmueller@suse.de
- fix syntax error in config file
* Wed Jun  6 2007 pcerny@suse.cz
- use %%config(noreplace) for /etc/thttpd.conf
* Tue Jun  5 2007 pcerny@suse.cz
- added Short-Description tag into init script
* Fri Jun  1 2007 pcerny@suse.cz
- added config file (/etc/thttpd.conf)
* Fri Feb 16 2007 mvaner@suse.cz
- Adding check for zero length
  - from Marcus Meissner
  - zerolen.patch
- Replacing strcpy with memmove when they overlap
  - strcpy.patch
- Both from #230776
* Wed Feb 14 2007 schwab@suse.de
- Fix building as non-root.
* Fri Mar 10 2006 anicka@suse.cz
- fix buffer overflows in htpasswd (#156978)
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Nov 21 2005 anicka@suse.cz
- fix tmp race in syslogtocern (#131056)
* Wed Oct 12 2005 anicka@suse.cz
- use %%config(noreplace) for index.html
* Wed Jun 22 2005 anicka@suse.cz
- compile dynamic binaries instead of static
- compile htpasswd with -pie
* Wed Mar  9 2005 mcihar@suse.cz
- do not conflict with other webservers (bug #71742)
* Tue Feb 17 2004 tcrhak@suse.cz
- update to version 2.25b
* Tue Jan 13 2004 schwab@suse.de
- Fix use of aclocal.
* Wed Oct 29 2003 tcrhak@suse.cz
- update to 2.24, includes a fix for a buffer overflow [bug #32734]
- fixed virtual hosting security hole [bug #32757]
- fixed permissions according to permissions.secure,
  added macros %%run_permissions and %%verify_permissions
* Mon Sep  1 2003 tcrhak@suse.cz
- added macros %%stop_on_removal and %%restart_on_update [bug #29022]
* Thu Jun  5 2003 ro@suse.de
- remove unpackaged files from buildroot
* Tue Mar 11 2003 tcrhak@suse.cz
- fixed permissions of the init scipt [bug #25084]
* Tue Oct 15 2002 tcrhak@suse.cz
- substitute correct servroot during built
* Mon Oct 14 2002 tcrhak@suse.cz
- use /srv/www rather then /usr/local/httpd [bug #20802]
* Thu Aug  1 2002 ro@suse.de
- adapt server root
* Sat Jul 27 2002 kukuk@suse.de
- Change group from wwwadmin to www
* Sat Jul 27 2002 adrian@suse.de
- do not source rc.config anymore
* Tue Jul  2 2002 tcrhak@suse.cz
- update to version 2.23beta1
* Tue Jan 15 2002 tcrhak@suse.cz
- update to version 2.20c
- added thttpd-2.20c-sec.patch
- removed START_THTTPD from README.SuSE
* Mon Jan 14 2002 ro@suse.de
- removed START_THTTPD
* Fri Sep 21 2001 bjacke@suse.de
- fix version on template webpage
* Mon Sep  3 2001 adostal@suse.cz
- fix /etc/init.d in thttpd-SuSE.tar.bz2 files
- split patches on configure, dirs, time_h and newautoconf
* Thu Jun 14 2001 adostal@suse.cz
- fix for new autoconf
* Fri Apr 13 2001 nadvornik@suse.cz
- changed initscript according to skeleton
* Thu Mar  8 2001 nadvornik@suse.cz
- compiled with RPM_OPT_FLAGS
* Thu Feb 15 2001 nadvornik@suse.cz
- fixed to compile
* Wed Dec 13 2000 smid@suse.cz
- generatig of default page moved to %%install (it was in %%post and
- caused [#4566]
* Tue Dec 12 2000 smid@suse.cz
- default cgibin pattern changed [#4564]
- rcthttpd link added
* Sun Dec  3 2000 smid@suse.cz
- new version: 2.20b
* Fri Dec  1 2000 ro@suse.de
- moved init-script
* Thu Nov  2 2000 smid@suse.cz
- fix ugly bug in startup scripts
* Thu Sep 28 2000 smid@suse.cz
- new version: 2.20
* Wed Aug 30 2000 smid@suse.cz
- fix bug in startup script
* Wed Jul  5 2000 mha@suse.de
- new version: 2.19
* Tue May 23 2000 smid@suse.cz
- buildroot fixed
* Wed May  3 2000 smid@suse.cz
- buildroot added
* Tue Mar 21 2000 mha@suse.de
- update to 2.16
* Fri Mar  3 2000 uli@suse.de
- moved man pages to %%{_mandir}
* Mon Feb 28 2000 mha@suse.de
- new version: 2.15
* Thu Feb 17 2000 dipa@suse.de
- bug #1268 rc.config variable set to no
* Wed Jan 12 2000 mha@suse.de
- new version: 2.11
- new conflicts (roxen, apache, aolserv), provides (http_daemon)
- new homepage
* Tue Nov 16 1999 kukuk@suse.de
- Fix stack overflow
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Thu Sep  9 1999 bs@suse.de
- fixed call of Check at the end of %%install section
* Sun Jul 11 1999 mha@suse.de
- new package: thttpd (a _small_ webserver)
  absolutely no configuration needed - and yet save (chroot)!