Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1493850
 поиск   регистрация   авторизация 
 
Группа :: Система/Серверы
Пакет: cherokee

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

%def_disable static
%def_enable pcre

# gnutls reads /dev/random, it is slow

#%%define tls gnutls
%define tls openssl

%define cherokee_user _cherokee
%define cherokee_group _cherokee
%define cherokee_webmaster webmaster

#%%define revision r198


%def_with M24

%if_with M24
%define _release alt0.M24.1
%else
%define _release alt1
%endif

Name: cherokee
%ifdef revision
Version: 0.5.5.%revision
%else
Version: 0.5.5
%endif
Release: %_release
Packager: Grigory Batalov <bga at altlinux.ru>

Summary: Flexible and Fast web server
License: GPL
Group: System/Servers
Url: http://www.0x50.org

%ifdef revision
Source0: %name-%revision.tar.gz
%else
Source0: http://www.0x50.org/download/0.5/%version/%name-%version.tar.gz
%endif
Source1: cherokee-0.4.30-alt-init
Source2: cherokee-0.4.30-alt-logrotate
Source3: cherokee-0.4.30-alt-test-cgi

Patch0: cherokee-0.4.30-alt-conf.patch
Patch1: cherokee-0.4.30-alt-gnutls.patch
Patch2: cherokee-0.4.30-alt-libs.patch

# don't try to generate docs

Patch8: cherokee-0.4.30.r198-alt-nodoc.patch
# give no content headers for 301/302 errors
Patch9: cherokee-0.5.0-alt-nocontent.patch

Patch10: cherokee-0.5.0-alt-epoll-warn.patch

# Added on Tue Feb 21 2006

BuildRequires: flex libpam-devel libfcgi-devel

%if "%tls" == "openssl"
BuildRequires: libssl-devel
%endif

%if "%tls" == "gnutls"
BuildRequires: libgcrypt-devel libgnutls-devel libgpg-error-devel libtasn1-devel zlib-devel
%endif

%if_enabled pcre
BuildRequires: libpcre-devel
%endif

%if_enabled static
BuildRequires: glibc-devel-static
%endif

Requires: vhosts-filesystem

%description
Cherokee is a tiny, very fast, lightweight Web server. It is
implemented entirely in C, and has no dependencies beyond a standard C
library. It is embeddable and extensible with plug-ins. It supports
on-the-fly configuration by reading files or strings, TLS/SSL (via
GNUTLS or OpenSSL), virtual hosts, authentication, cache friendly
features, PHP4, custom error management, and much more.

%package ssl
Group: System/Servers
Summary: SSL support for Cherokee Web server
Requires: %name = %version-%release

%description ssl
Cherokee is a tiny, very fast, lightweight Web server.
This package enables TLS/SSL Cherokee module.

%package devel
Group: Development/C
Summary: Development files for Cherokee Web server
Requires: %name = %version-%release

%description devel
Cherokee is a tiny, very fast, lightweight Web server.
This package contains development files for Cherokee.

%package devel-static
Summary: Static libraries from Cherokee Web server
Group: Development/C
Requires: %name-devel = %version-%release

%description devel-static
Cherokee is a tiny, very fast, lightweight Web server.
This package contains Cherokee static libraries.

%prep
%ifdef revision

%setup -q -n %name-%revision
%patch8 -p0

%else

%setup -q

%endif

# add -l to ignore whitespaces

cat %PATCH0 | patch -l -s -p1
%patch1 -p1
%patch9 -p0
%patch10 -p0

gzip ChangeLog

# remove included libs

#%patch2 -p1
#for i in getopt pcre zlib; do
# mv cherokee/$i cherokee/$i.orig
#done

%build
%ifdef revision
./autogen.sh
%endif

%if_enabled pcre
export CFLAGS="%optflags `pcre-config --cflags`"
export CPPGLAGS="%optflags `pcre-config --cflags`"
%endif

# cherokee hangs on pthread_join() in background mode

# so don't enable pthreads until this is fixed
%configure  --disable-pthread \
   --enable-tls=%tls \
   --with-wwwroot=%_var/www/%name \
   --with-pic \
   --enable-trace \
   %{subst_enable static} \
   %{subst_enable pcre}
%make_build

%install
# standard install
%make_install install DESTDIR=%buildroot
rm -f %buildroot%_libdir/%name/*.la

# init and logrotate scripts

install -D -m755 %SOURCE1 %buildroot%_initdir/%name
install -D -m644 %SOURCE2 %buildroot%_sysconfdir/logrotate.d/%name

# fix docs

rm -fR doc/html
mkdir -p doc/html
%ifndef revision
cp -R doc/images doc/*.html doc/*.png doc/html
%endif

# create extra folders

mkdir -p %buildroot%_var/run/%name
mkdir -p %buildroot%_logdir/%name
mkdir -p %buildroot%_var/www/%name/{cgi-bin,html}
mv %buildroot%_var/www/%name/{index.html,images} %buildroot%_var/www/%name/html/
install -m755 %SOURCE3 %buildroot%_var/www/%name/cgi-bin/test-cgi

# files to remove on deinstall (ghosts)

touch %buildroot%_logdir/%name/{access,error}.log
touch %buildroot%_var/run/%name/%name.pid

# ghost ssl certificate and ssl module link

mkdir -p %buildroot%_localstatedir/ssl/certs
touch %buildroot%_localstatedir/ssl/certs/cherokee.pem
ln -s ../mods-available/ssl %buildroot%_sysconfdir/%name/mods-enabled/ssl

# replace user/group and logdir

subst "s, at cherokee_user at ,%cherokee_user," \
%buildroot%_sysconfdir/%name/%name.conf
subst "s, at cherokee_group at ,%cherokee_group," \
%buildroot%_sysconfdir/%name/%name.conf \
%buildroot%_sysconfdir/logrotate.d/%name
install -d %buildroot%_sysconfdir/%name/addon.d
# store certificate in %%_localstatedir
rm -fR %buildroot%_sysconfdir/%name/ssl
# remove unpackaged files
rm -fR %buildroot%_defaultdocdir/%name

%pre
%_sbindir/groupadd -r -f %cherokee_group ||:
%_sbindir/useradd -r -g %cherokee_group -d /dev/null -s /dev/null -n %cherokee_user \
2> /dev/null > /dev/null ||:

%post
%post_ldconfig
%post_service %name

%post ssl
if [ ! -f %_localstatedir/ssl/certs/%name.pem ] ; then
umask 077
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi

cat << EOF | %_bindir/openssl req -days 365 -new -x509 -nodes \
-rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime \
-out %_localstatedir/ssl/certs/%name.pem \
-keyout %_localstatedir/ssl/certs/%name.pem 2> /dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root at ${FQDN}
EOF
fi
/sbin/service %name condreload ||:

%preun
%preun_service %name

%postun -p %postun_ldconfig

%postun ssl
/sbin/service %name condreload ||:

%files
%doc AUTHORS ChangeLog.gz README TODO pam.d_cherokee *.conf.sample
%doc doc/html
#%exclude %_sysconfdir/%name/ssl/
%exclude %_sysconfdir/%name/mods-enabled/ssl
%exclude %_sysconfdir/%name/mods-available/ssl
%_bindir/%name-panic
%_bindir/cget
%_sbindir/%name
%_libdir/*.so.*
# plugins
%dir %_libdir/%name
%_libdir/%name/*.so
%_datadir/%name
# web root
%attr(775,root,%cherokee_webmaster) %dir %_var/www/%name
%attr(775,root,%cherokee_webmaster) %dir %_var/www/%name/html
%attr(775,root,%cherokee_webmaster) %dir %_var/www/%name/cgi-bin
%_var/www/%name/html/*
%_var/www/%name/cgi-bin/*
# logdir
%attr(750,root,%cherokee_group) %dir %_logdir/%name
%ghost %_logdir/%name/access.log
%ghost %_logdir/%name/error.log
# pidfile dir
%attr(750,%cherokee_user,%cherokee_group) %dir %_var/run/%name
%ghost %_var/run/%name/%name.pid
%_man1dir/%name.*
%_man1dir/cget.*
# config dir
%dir %_sysconfdir/%name
%config(noreplace) %_sysconfdir/%name/*
# initscript
%config %_initdir/%name
# logrotate script
%config %_sysconfdir/logrotate.d/%name

%files ssl
# ssl config dir
#%attr(0700,root,root) %dir %_sysconfdir/%name/ssl/
%attr(0700,root,root) %ghost %_localstatedir/ssl/certs/%name.pem
%_sysconfdir/%name/mods-enabled/ssl
%_sysconfdir/%name/mods-available/ssl

%files devel
%_bindir/%name-config
%_includedir/*
%_libdir/*.so
%_libdir/pkgconfig/*
%_datadir/aclocal
%_man1dir/%name-config.*

%if_enabled static
%files devel-static
%_libdir/*.a
%_libdir/%name/*.a
%endif

%changelog

Полный changelog можно просмотреть здесь

 
design & coding: Vladimir Lettiev aka crux © 2004-2005