File elgg.spec of Package elgg

#
# spec file for package elgg
#

# norootforbuild

Name:           elgg
Summary:        Social networking platform 
Url:            http://elgg.org/
License:        GPL 
Group:          Productivity/Networking/Web/Utilities
BuildArch:      noarch
AutoReqProv:    on
Version:        0.9.2
Release:        1
Vendor:         openSUSE-Education
Source:         %{name}-%{version}.tar.bz2
Source2:        elgg_include.conf
Prereq:         apache2 mysql 
%if %sles_version == 9
Requires:       apache2-mod_php4 php4-gd php4-mysql php4-gettext
%else
Requires:       mod_php_any      php-gd  php-mysql  php-gettext
%endif
BuildRequires:  apache2-devel
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes 
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         installdir /srv/www/%name
%define         apache_sysconfdir %(/usr/sbin/apxs2 -q SYSCONFDIR)
%define         datadir /srv/www/%name/data
%define         configdir %_sysconfdir/%name

%description
Elgg is an open source social networking platform developed for LAMP 
(Linux, Apache, MySQL, PHP) which encompasses weblogging, file storage, 
RSS aggregation, personal profiles, FOAF functionality and more.
  

%prep
%setup -q 
find . -name "*~" -exec rm {} \;

%build
# if the following command fails, then apache dependencies are not met
/usr/sbin/apxs2 -q datadir >/dev/null

%install
mkdir -p %buildroot%installdir
mkdir -p %buildroot%_defaultdocdir/%name/
mkdir -p %buildroot%configdir
mkdir -p %buildroot%datadir
mkdir -p %buildroot%apache_sysconfdir/conf.d/
mv doc/* %buildroot%_defaultdocdir/%name/
rm %buildroot%_defaultdocdir/%name/IIS-INSTALL
cp -a * %{buildroot}%{installdir}/
sed -e "s#ROOTDIR#%{installdir}#g" \
    -e "s#CONFIGDIR#%{configdir}#g" \
    -e "s#DATADIR#%{datadir}#g" %{SOURCE2} \
    > %buildroot/%apache_sysconfdir/conf.d/elgg_include.conf
mv %{buildroot}%{installdir}/config-dist.php %{buildroot}%configdir/config.php
cat << EOF > %{buildroot}%{installdir}/config.php
<?php
  // Please edit the following file:
  include %configdir/config.php
?>
EOF

# remove .htaccess files as we have all included in the config for apache
# improves performance
find %buildroot%installdir -name .htaccess -exec rm {} \;

%if 0%{?suse_version} > 1020
%fdupes -s %{buildroot}
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc %{_defaultdocdir}/%{name}
%dir %{installdir}
%dir %configdir
# %attr(-,wwwrun,www) %dir %datadir
%{installdir}
%config(noreplace) %{apache_sysconfdir}/conf.d/elgg_include.conf
%config(noreplace) %configdir/config.php
%defattr(755,root,root,755)
%dir %datadir
%{installdir}/utils/unit2lib.pl
%{installdir}/lib/php-getttext/examples/update
%{installdir}/mod/rpc/debug/xmlrpc-debug-proxy.py

%changelog