File joomla.spec of Package joomla

#
# spec file for package joomla
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2014-2016 Lars Vogdt <lars@linux-schulserver.de>
#
# 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 https://bugs.opensuse.org/
#


%define         joomla_webroot    /%{name}
%define         joomla_root       %{apache_serverroot}/%{name}
%define         joomla_tmpdir     %{apache_serverroot}/%{name}_tmpdir
%define         joomla_sessiondir %{apache_serverroot}/%{name}_sessiondir
%define         crondir %{_sysconfdir}/cron.d
Name:           joomla
Version:        3.10.11
Release:        0
Summary:        Open Source CMS
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Web/Frontends
URL:            http://www.joomla.org/
Source0:        https://github.com/joomla/joomla-cms/releases/download/%{version}/Joomla_%{version}-Stable-Full_Package.tar.bz2
Source1:        joomla-rpmlintrc
Source2:        joomla_apache.conf
Source3:        joomla-apparmor.profile
# Drop reference to US hosted google server, allowing them to track the IP of site visitro
# To be in sync with DSGVO regulation
Patch1:         dsgvo.patch
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2
BuildRequires:  fdupes
Requires:       apache2
Requires:       mod_php_any >= 5.3.10
Requires:       php-curl
Requires:       php-dom
Requires:       php-gd
Requires:       php-mbstring
Requires:       php-mysql
Requires:       php-pdo
Requires:       php-xsl
Requires:       php-zlib
Recommends:     php-zip
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Joomla is an award-winning content management system (CMS), which enables you
to build Web sites and powerful online applications.

%package install
Summary:        Open Source CMS install files
Group:          Productivity/Networking/Web/Frontends
URL:            http://www.joomla.org
Requires:       %{name} = %{version}

%description install
This package contains installation files that should be removed after installation.

Joomla is an award-winning content management system (CMS), which enables you
to build Web sites and powerful online applications.

%prep
%setup -q -c -n joomla-%{version}
%patch1 -p0
# clean up CVS stuff
for i in 	`find . -type d -name CVS` \
			`find . -type f -name .cvs\*` \
			`find . -type f -name .#\*` \
			`find . -type f -name "*php.orig"`; \
do
    if [ -e "$i" ]; then
		rm -r $i;
	fi
done

# strip away annoying ^M
find . -type f|xargs file|grep 'CRLF'|cut -d: -f1|xargs perl -p -i -e 's/\r//'
find . -type f|xargs file|grep 'text'|cut -d: -f1|xargs perl -p -i -e 's/\r//'

# fix file perms
find . -type f | xargs chmod 644

%build
#

%install
mkdir -p %{buildroot}%{joomla_root} %{buildroot}%{joomla_tmpdir} %{buildroot}%{joomla_sessiondir}
cp -aRf *  %{buildroot}%{joomla_root}

# favicon
test -f %{buildroot}%{joomla_root}/favicon.ico || touch %{buildroot}%{joomla_root}/favicon.ico
test -f %{buildroot}%{joomla_root}/robots.txt  || \
	sed -e "s|Disallow: /|Disallow: %{joomla_webroot}/|g" \
		%{buildroot}%{joomla_root}/robots.txt.dist \
		> %{buildroot}%{joomla_root}/robots.txt

# apache config
mkdir -p %{buildroot}%{apache_sysconfdir}/conf.d/
sed -e "s|__JOOMLA_ROOT__|%{joomla_root}|g; \
		s|__JOOMLA_WEBROOT__|%{joomla_webroot}|g; \
		s|__JOOMLA_TMPDIR__|%{joomla_tmpdir}|g; \
		s|__JOOMLA_SESSIONDIR__|%{joomla_sessiondir}|g;" \
		%{SOURCE2} > %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf
# apparmor config
mkdir -p %{buildroot}%{_sysconfdir}/apparmor.d/{apache2.d,local}
sed -e "s|__JOOMLA_ROOT__|%{joomla_root}|g; \
        s|__JOOMLA_WEBROOT__|%{joomla_webroot}|g; \
        s|__JOOMLA_TMPDIR__|%{joomla_tmpdir}|g; \
        s|__JOOMLA_SESSIONDIR__|%{joomla_sessiondir}|g;" \
        %{SOURCE3} > %{buildroot}%{_sysconfdir}/apparmor.d/apache2.d/%{name}
echo "# Site-specific additions and overrides for '%{name}'" > %{buildroot}%{_sysconfdir}/apparmor.d/local/%{name}

# documentation
mkdir -p  %{buildroot}%{_defaultdocdir}/%{name}
mv *.txt %{buildroot}%{_defaultdocdir}/%{name}/

# directories
pushd %{buildroot}%{joomla_root}
mkdir -p uploadfiles logs
popd

%fdupes %{buildroot}%{joomla_root}

%post install
# enable php5/JOOMLA in apache config on installation
if [ -x %{_sbindir}/a2enmod ]; then
  if grep -q php5 %{_sysconfdir}/sysconfig/apache2 1>&2 2>/dev/null; then
    %{_sbindir}/a2enmod php5 >/dev/null
  else
    %{_sbindir}/a2enmod php >/dev/null
  fi
  if grep -q JOOMLA %{_sysconfdir}/sysconfig/apache2 1>&2 2>/dev/null; then
    %{_sbindir}/a2enflag JOOMLA >/dev/null
  fi
fi

%files
%defattr(0644,root,root,0755)
%doc %{_defaultdocdir}/%{name}
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%{joomla_root}/
%config(noreplace) %{joomla_root}/robots.txt
%config(noreplace) %{joomla_root}/favicon.ico
%dir %{_sysconfdir}/apparmor.d
%dir %{_sysconfdir}/apparmor.d/apache2.d
%dir %{_sysconfdir}/apparmor.d/local
%config %{_sysconfdir}/apparmor.d/apache2.d/%{name}
%config(noreplace) %{_sysconfdir}/apparmor.d/local/%{name}
%exclude %{joomla_root}/installation
%exclude %{joomla_tmpdir}
%defattr(0644,%{apache_user},%{apache_group},0775)
%dir %{joomla_tmpdir}
%dir %{joomla_sessiondir}
%{joomla_root}/uploadfiles
%{joomla_root}/tmp
%{joomla_root}/logs
%{joomla_root}/cache
%{joomla_root}/media
%{joomla_root}/images
%{joomla_root}/language
%{joomla_root}/administrator/cache
%{joomla_root}/administrator/components
%{joomla_root}/administrator/language
%{joomla_root}/administrator/manifests/files
%{joomla_root}/administrator/manifests/libraries
%{joomla_root}/administrator/manifests/packages
%{joomla_root}/administrator/modules
%{joomla_root}/administrator/templates
%{joomla_root}/components
%{joomla_root}/templates
%{joomla_root}/plugins
%{joomla_root}/modules
%{joomla_root}/libraries

%files install
%defattr(0644,root,root,0755)
%dir %{joomla_root}/installation/
%{joomla_root}/installation/*

%changelog
openSUSE Build Service is sponsored by