Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > 1a478377b0e4c507b90ce5ee129f7d31 > files > 2

cgiwrap-3.8-1mdk.src.rpm

# OE: conditional switches
#(ie. use with rpm --rebuild):
#	--with diet	Compile cgiwrap against dietlibc

%define build_diet 0

# commandline overrides:
# rpm -ba|--rebuild --with 'xxx'
%{?_with_diet: %{expand: %%define build_diet 1}}

%define name 	cgiwrap
%define version 3.8
%define release 1mdk

Summary: 	User CGI access
Name: 		%{name}
Version: 	%{version}
Release: 	%{release}
License: 	GPL
Group: 		System/Servers
Source0: 	%{name}-%{version}.tar.bz2
Source1: 	conf.tar.bz2
Source2: 	php-cgiwrap-docs.tar.bz2
URL:		http://cgiwrap.unixtools.org
PreReq:		rpm-helper
Provides: 	ADVXpackage
Requires:	php-cgi apache2
BuildRoot: 	%{_tmppath}/%{name}-%{version}-buildroot

%if %{build_diet}
BuildRequires:	dietlibc-devel >= 0.20-1mdk
%endif

%description
This is CGIWrap - a gateway that allows more secure user access to
CGI programs on an HTTPd server than is provided by the http
server itself. The primary function of CGIwrap is to make certain
that any CGI script runs with the permissions of the user who
installed it, and not those of the server.

%prep

%setup -q -n %{name}-%{version} -a1 -a2

%build
#libtoolize --copy --force; aclocal; autoconf

%if %{build_diet}
# OE: use the power of dietlibc
export CFLAGS="-Os -pipe -D_BSD_SOURCE -D_GNU_SOURCE -static -nostdinc"
export CC="diet gcc $CFLAGS"
export GCC="diet gcc $CFLAGS"
%else
%serverbuild
%endif

%configure2_5x \
    --with-perl=%{_bindir}/perl \
    --with-local-doc-url=/cgiwrap \
    --with-install-dir=/var/www/cgi-bin \
    --with-cgi-dir="public_html/cgi-bin" \
    --with-httpd-user=apache \
    --with-minimum-uid=500 \
    --with-minimum-gid=100 \
    --without-redirect-stderr \
    --with-logging-file=/var/log/cgiwrap.log \
    --with-allow-file=%{_sysconfdir}/cgiwrap.allow \
    --with-deny-file=%{_sysconfdir}/cgiwrap.deny \
    --with-rewrite=%{_sysconfdir}/cgiwrap.userdir \
    --with-host-checking \
    --with-check-shell \
    --with-rlimit-core=0 \
    --with-rlimit-cpu=30 \
    --with-php=%{_bindir}/php-cgi \
    --with-php-cgiwrap \
    --with-php-interpreter

%make 

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
install -d %{buildroot}%{_sysconfdir}/logrotate.d
install -d %{buildroot}/var/www/cgi-bin
install -d %{buildroot}/var/www/html/cgiwrap
install -d %{buildroot}/var/log

install cgiwrap %{buildroot}/var/www/cgi-bin/
ln -s cgiwrap %{buildroot}/var/www/cgi-bin/cgiwrapd
ln -s cgiwrap %{buildroot}/var/www/cgi-bin/nph-cgiwrap
ln -s cgiwrap %{buildroot}/var/www/cgi-bin/nph-cgiwrapd
ln -s cgiwrap %{buildroot}/var/www/cgi-bin/php-cgiwrap
ln -s cgiwrap %{buildroot}/var/www/cgi-bin/php-cgiwrapd

install -m644 cgiwrap.allow %{buildroot}/%{_sysconfdir}/
install -m644 cgiwrap.deny %{buildroot}/%{_sysconfdir}/
install -m644 cgiwrap.userdir %{buildroot}/%{_sysconfdir}/
install -m644 htdocs/* %{buildroot}/var/www/html/cgiwrap/

# install the apache2 config
cat > %{buildroot}%{_sysconfdir}/httpd/conf.d/Z10_cgiwrap.conf << EOF

# The following was taken from the http://localhost/cgiwrap/php-cgiwrap.html file.

# for other use it as needed:
AddHandler cgi-wrapper .cgi
Action cgi-wrapper /cgi-bin/cgiwrap

# that is specially for php developers:
AddHandler php-cgiwrap .php
AddHandler php-cgiwrap .php3
AddHandler php-cgiwrap .phtml
Action php-cgiwrap /cgi-bin/php-cgiwrap
Action php-cgiwrapd /cgi-bin/php-cgiwrapd

EOF

# fix ghost log file
touch %{buildroot}/var/log/cgiwrap.log

# fix logrotate file
cat > %{buildroot}%{_sysconfdir}/logrotate.d/cgiwrap << EOF
/var/log/cgiwrap.log {
    monthly
    missingok
    nocompress
    prerotate
	ADVXctl closelogs
    endscript
    postrotate
	ADVXctl closelogs
    endscript
}
EOF

%post
%create_ghostfile /var/log/cgiwrap.log apache root 0644

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README doc/*
%attr(0640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/*_cgiwrap.conf 
%attr(0644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/logrotate.d/cgiwrap
%attr(0640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cgiwrap.*
%attr(4711,root,root) /var/www/cgi-bin/*
%attr(0644,root,root) /var/www/html/cgiwrap/*.html
%ghost %attr(0644,apache,root) /var/log/cgiwrap.log

%changelog
* Fri Jul 11 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.8-1mdk
- 3.8
- misc spec file fixes

* Sun Apr 06 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.8-0.20021230.3mdk
- re-add logging, require apache2, fix attribs, and more as requested by Geoffrey Lee
- use spec file magic to enable builds against dietlibc

* Mon Jan 27 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.8-0.20021230.2mdk
- build release
- point to %{_bindir}/php-cgi

* Mon Dec 30 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.8-0.20021230.1mdk
- Enabled experimental php support (as requested by Geoffrey Lee), also check:
  http://www.klaban.torun.pl/patches/cgiwrap/index-old.html. Note that manual
  fiddling with the php/apache config is required.

* Tue Aug 13 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 3.7.1-1mdk
- initial cooker contrib
- ripped the stuff in S1 from debian