File coppermine.spec of Package coppermine

#
# spec file for package coppermine
#
# Copyright (c) 2021 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 coppermine_dir /srv/www/%{name}
%define coppermine_src_dir cpg15x
#
%if !0%{?suse_version}
%define	apxs	%{_sbindir}/apxs2
%define	apache_libexecdir	%(%{apxs} -q LIBEXECDIR)
%define	apache_sysconfdir	%(%{apxs} -q SYSCONFDIR)
%endif
Name:           coppermine
Version:        1.5.48
Release:        0
Summary:        Multi-purpose fully-featured and integrated web picture gallery
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Web/Frontends
URL:            https://coppermine-gallery.net/
Source0:        https://sourceforge.net/projects/coppermine/files/Coppermine/1.5.x/cpg%{version}.zip
Source1:        %{name}.conf.default
Source2:        %{name}.conf.vhost
Source3:        %{name}.conf.nonsuse
BuildRequires:  unzip
#
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2
BuildRequires:  fdupes
Requires:       ImageMagick
Requires:       apache2
Requires:       mod_php_any >= 5.1
Requires:       mysql
Requires:       php-mysql
%endif
%if 0%{?fedora_version} ||  0%{?rhel_version} || 0%{?centos_version}
BuildRequires:  httpd-devel
Requires:       ImageMagick
Requires:       httpd
Requires:       httpd-mod_php5
Requires:       mysql
Requires:       php5-mysql
%endif
%if 0%{?mandriva_version}
BuildRequires:  apache-devel
Requires:       apache-base
Requires:       apache-conf
Requires:       apache-mod_php
Requires:       imagemagick
Requires:       mysql
Requires:       php5-mysql
%endif

%description
Coppermine Photo Gallery is an advanced, user-friendly, picture gallery script with built-in support for other multi-media/data files. The gallery can be private, accessible to registered users only, and/or open to all visitors to your site. Users, if permitted, can upload pictures with their web browser (thumbnail and intermediate sized images are created on the fly), rate pictures, add comments and even send e-cards. The site administrator determines which of the features listed above are accessible by registered and non-registered users. The site administrator can also manage galleries and batch process large numbers of pictures that have been uploaded onto the server by FTP. Image files are stored in albums and albums can be grouped into categories, which in turn, can be further grouped under parent categories. The script supports multiple users and provides the administrator of the website with tools to manage which user groups can or cannot have personal albums, send ecards, or add comments. Users may also upload to public albums if the website administrator permits it. Permissions to create albums, upload and delete files are all determined by the website administrator. Coppermine has an optional user selectable theme system with a number of themes pre-installed. It also supports the use of multiple languages and contains it's own language library. These language files provide, users of your gallery, access in their preferred languages. Coppermine uses PHP, a MySQL database, and either the GD library (version 1.x or 2.x) or ImageMagick to generate and keep records and file information of all thumbnails, intermediate, and full-sized images. Coppermine generates the html code necessary to display its various categories, sub-categories, albums, intermediate, and full-sized image displays dynamically. This drastically cuts down on the number of files and space your gallery would require using standard HTML. The install script (install.php) makes it quick and easy to get started.

%prep
%setup -q -n %{coppermine_src_dir}

%build

%install
%if 0%{?suse_version}
mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d
cp -avL %{SOURCE1} %{buildroot}/%{apache_sysconfdir}/conf.d/coppermine.conf
mkdir -p %{buildroot}/%{apache_sysconfdir}/vhosts.d/conf.d
cp -avL %{SOURCE2} %{buildroot}/%{apache_sysconfdir}/vhosts.d/conf.d/coppermine.conf
%else
mkdir -p %{buildroot}/%{apache_sysconfdir}/../conf.d
cp -avL %{SOURCE3} %{buildroot}/%{apache_sysconfdir}/../conf.d/coppermine.conf
%endif
mkdir -p %{buildroot}/%{coppermine_dir}
cp -avL * %{buildroot}/%{coppermine_dir}/
chmod 755 %{buildroot}/%{coppermine_dir}/include
chmod 755 %{buildroot}/%{coppermine_dir}/albums
chmod 755 %{buildroot}/%{coppermine_dir}/albums/userpics
chmod 755 %{buildroot}/%{coppermine_dir}/albums/edit
#
find %{buildroot}%{coppermine_dir} -type d | \
sed "s@%{buildroot}@%dir @" > files.coppermine
find %{buildroot}%{coppermine_dir} -type f | \
sed "s@%{buildroot}@@;/\/templates\/\|\.conf$/s@^@%config (noreplace) @" >> files.coppermine
cat files.coppermine
#
%if 0%{?suse_version}
%fdupes %{buildroot}/%{coppermine_dir}
%endif

%files -f files.coppermine
%if 0%{?suse_version}
%dir %{apache_sysconfdir}/conf.d
%config (noreplace) %{apache_sysconfdir}/conf.d/coppermine.conf
%dir %{apache_sysconfdir}/vhosts.d/conf.d
%config (noreplace) %{apache_sysconfdir}/vhosts.d/conf.d/coppermine.conf
%else
%dir %{apache_sysconfdir}/../conf.d
%config (noreplace) %{apache_sysconfdir}/../conf.d/coppermine.conf
%endif

%post
%if 0%{?suse_version}
chown wwwrun.www /srv/www/coppermine/include
chown wwwrun.www /srv/www/coppermine/albums
chown wwwrun.www /srv/www/coppermine/albums/userpics
chown wwwrun.www /srv/www/coppermine/albums/edit
%else
chown apache.apache /srv/www/coppermine/include
chown apache.apache /srv/www/coppermine/albums
chown apache.apache /srv/www/coppermine/albums/userpics
chown apache.apache /srv/www/coppermine/albums/edit
%endif

%changelog
openSUSE Build Service is sponsored by