File processwire3.spec of Package processwire3
#
# spec file for package processwire3
#
# Copyright (c) 2023 SUSE LLC
#
# 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 package_shared %{_datadir}/%{name}
%if 0%{?suse_version}
%define apache_conf %{_sysconfdir}/apache2
%define package_var /srv/www/%{name}
%define apache_user wwwrun
%define apache_group www
%else
%define apache_conf %{_sysconfdir}/httpd
%define package_var %{_localstatedir}/lib/%{name}
%define apache_user apache
%define apache_group apache
%endif
Name: processwire3
Version: 3.0.210
Release: 0
Summary: Open source CMS
License: MIT OR MPL-2.0
Group: Productivity/Networking/Web/Servers
URL: https://processwire.com/
#Source: https://github.com/processwire/processwire/archive/dev.tar.gz#/processwire-%%{version}.tar.gz
Source: https://github.com/processwire/processwire/archive/%{version}.tar.gz#/processwire-%{version}.tar.gz
Source1: %{name}-admin
BuildRequires: fdupes
BuildRequires: php-devel > 5.3.8
Requires: mod_php_any >= 5.3.8
Requires: php-ctype
Requires: php-gd
Requires: php-iconv
Requires: php-json
Requires: php-mysql
Requires: php-pdo
BuildArch: noarch
%if 0%{?suse_version} >= 1330
Requires(pre): user(wwwrun)
%endif
%description
ProcessWire is a free PHP5 content management system and framework (open source
CMS/CMF) built to save you time and work the way you do. Stop trying to bend
other open source CMS platforms to your will – ProcessWire gives simpler and
stronger control over your pages, fields, templates and markup at any scale.
And it provides a powerful template system that works the way you already do.
ProcessWire’s jQuery-inspired API makes working with your content easy and
enjoyable. Managing and developing a site in ProcessWire is shockingly
simple–and fun–compared to what you may be used to.
%prep
%setup -q -T -c processwire-%{version}
tar --strip-components=1 -xzf %{SOURCE0}
# allow symlinked index.php file
sed -i -e 's/\$rootPath = __DIR__\;/\$rootPath = getcwd();/' index.php
# remove unused file
rm -f wire/core/.phpstorm.meta.php wire/.editorconfig
%build
%install
mkdir -p %{buildroot}%{package_shared}
cp -r * %{buildroot}%{package_shared}/
%fdupes %{buildroot}%{package_shared}/wire/
%fdupes %{buildroot}%{package_shared}/site*
mkdir -p %{buildroot}%{_bindir}
install -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/
sed -i -e 's|apache_conf|%{apache_conf}| ; s|package_var|%{package_var}| ;
s|apache_user|%{apache_user}| ; s|apache_group|%{apache_group}|' \
%{buildroot}%{_bindir}/%{name}-admin
mkdir -p %{buildroot}%{apache_conf}/conf.d
# remove and rebuild site
rm -rf %{buildroot}%{package_var}
mkdir -p `dirname %{buildroot}%{package_var}`
%{buildroot}%{_bindir}/%{name}-admin install %{package_var} --prefix %{buildroot} |
sed -e 's/^\t// ;
s/\(RewriteRule .* index.php?it=\$1 \[L,QSA\]\)/\# \1/ ;
s/# \(RewriteRule .* \)\(\/index.php?it=\$1 \[L,QSA\]\)/\1 \/processwire\2/ ' \
> %{buildroot}%{apache_conf}/conf.d/%{name}.conf
# remove site and install scripts; this will be copied in empty installations
rm -rf %{buildroot}%{package_var}/webroot/site %{buildroot}%{package_var}/webroot/install.php
%post
# install installation packages when no site has been configured
if [ ! -d %{package_var}/webroot/site ] ; then
cp -a %{package_shared}/site-blank %{package_var}/webroot/site
cp -a %{package_shared}/install.php %{package_var}/webroot/
chown -R %{apache_user}. %{package_var}/webroot/
fi
%files
%defattr(0644, root, root, 0755)
%license LICENSE.TXT
%doc CONTRIBUTING.md README.md
%dir %{apache_conf}
%dir %{apache_conf}/conf.d
%config(noreplace) %{apache_conf}/conf.d/%{name}.conf
%{package_shared}
%exclude %{package_shared}/CONTRIBUTING.md
%exclude %{package_shared}/LICENSE.TXT
%exclude %{package_shared}/README.md
%attr(0750,root,root) %{_bindir}/%{name}-admin
%defattr(0644, %{apache_user}, %{apache_group}, 0755)
%{package_var}
%changelog