File elgg.spec of Package elgg

# spec file for package elgg

# norootforbuild

Name:           elgg
Summary:        Social networking platform 
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
Requires:       mod_php_any      php-gd  php-mysql  php-gettext
BuildRequires:  apache2-devel
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes 
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

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.

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

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

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
  // Please edit the following file:
  include %configdir/config.php

# 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}

rm -rf %{buildroot}

%doc %{_defaultdocdir}/%{name}
%dir %{installdir}
%dir %configdir
# %attr(-,wwwrun,www) %dir %datadir
%config(noreplace) %{apache_sysconfdir}/conf.d/elgg_include.conf
%config(noreplace) %configdir/config.php
%dir %datadir