File sympa.spec of Package sympa

#
# spec file for package sympa
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


# See also http://en.opensuse.org/openSUSE:Specfile_guidelines

%define	name    sympa
%define	version	6.2.32
%define	release 1

%define	cgidir		/srv/www/cgi-bin/sympa
%define	staticdir	/srv/www/sympa
%define	confdir		%{_sysconfdir}/sympa
%define	sympadir	/usr/lib/sympa
%define	datadir		/usr/share/sympa
%define	list_datadir	%{sympadir}/list_data
%define	spooldir	%{_localstatedir}/spool/sympa
%define	docdir		%{sympadir}/doc
%define	lockdir		/run/lock/sympa
%define piddir		/run/sympa
%define	postfix_aliases	%{confdir}/mail/postfix-virtual-aliases
%define	sympa_user	sympa
%define	sympa_group	sympa
%define	www_group	www

Name:     	%{name}
Version:  	%{version}
Release:  	%{release}
Summary:  	A powerful multilingual List Manager
License:  	GPL-2.0
Group:    	System/Daemons
URL:      	https://www.sympa.org/
Source0:	https://github.com/sympa-community/sympa/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1:	sympa.aliases
Source2:	README.SUSE
Source3:	sympa.service
Source4:	sympa.apache2
Source5:	sympa-archived.service
Source6:	sympa-bounced.service
Source7:	sympa-bulk.service
Source8:	sympa-task_manager.service
Source9:	sympa.tmpfiles

BuildRequires:  gettext-tools
BuildRequires:  autoconf automake
BuildRequires:	systemd
BuildRequires:	perl-Class-Singleton
BuildRequires:	perl-libintl-perl

Requires:	apache2
Requires:	apache2-mod_fcgid
Requires:	MHonArc
Requires:	perl
Requires:	perl-Archive-Zip
Requires:	perl-base >= 5.20.1
Requires:	perl-CGI
Requires:	perl-Convert-ASN1
Requires:	perl-Crypt-CipherSaber
Requires:	perl-DB_File
Requires:	perl-DBI
Requires:	perl-Digest-MD5
Requires:	perl-Encode
Requires:	perl-FCGI
Requires:	perl-File-Copy-Recursive
Requires:	perl-HTML-Format
Requires:	perl-HTML-Parser
Requires:	perl-HTML-Tagset
Requires:	perl-IO-Socket-SSL
Requires:	perl-IO-stringy
Requires:	perl-ldap
Requires:	perl-libintl-perl
Requires:	perl-libwww-perl
Requires:	perl-MailTools
Requires:	perl-MIME-Base64
Requires:	perl-MIME-Charset
Requires:	perl-MIME-EncWords
Requires:	perl-MIME-Lite
Requires:	perl-MIME-tools
Requires:	perl-Net-Netmask
Requires:	perl-Regexp-Common
Requires:	perl-Template-Toolkit
Requires:	perl-Term-ProgressBar
Requires:	perl-Unicode-LineBreak
Requires:	perl-URI
Requires:	perl-XML-LibXML
%{?systemd_requires}
Requires(pre):	pwdutils
Requires(post):	postfix
Recommends:	perl-DBD-mysql


%description
Sympa is scalable and highly customizable mailing list manager. It can cope
with big lists (200,000 subscribers) and comes with a complete (user and admin)
Web interface. It is internationalized, and supports the us, fr, de, es, it,
fi, and chinese locales. A scripting language allows you to extend the behavior
of commands. Sympa can be linked to an LDAP directory or an RDBMS to create
dynamic mailing lists. Sympa provides S/MIME-based authentication and
encryption.

%prep
%setup -q
%lang_package

%build
autoreconf -fi
%configure \
	--prefix=%{sympadir} \
	--bindir=%{sympadir}/bin \
	--sbindir=%{sympadir}/bin \
	--libexecdir=%{sympadir}/libexec \
	--sysconfdir=%{confdir} \
	--datadir=%{datadir} \
	--mandir=%{_mandir} \
	--with-confdir=%{confdir} \
	--with-cgidir=%{cgidir} \
	--with-localedir=/usr/share/locale \
	--with-docdir=%{docdir} \
	--with-expldir=%{list_datadir} \
	--with-spooldir=%{spooldir} \
	--with-lockdir=%{lockdir} \
	--with-piddir=%{piddir} \
	--with-modulesdir=%{perl_vendorlib}/Sympa \
	--with-defaultdir=%{confdir}/default \
	--with-scriptdir=%{sympadir}/scripts \
	--with-staticdir=%{staticdir} \
	--with-aliases_file=%{postfix_aliases}

	
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} %{?_smp_mflags}

rm -rf %{buildroot}/%{_sysconfdir}/rc.d

mkdir -p %{buildroot}%{spooldir}
mkdir -p %{buildroot}%{list_datadir}
mkdir -p %{buildroot}%{staticdir}

mkdir -p "%{buildroot}%{confdir}/mail"
install -m 644 "%{S:1}" "%{buildroot}%{postfix_aliases}"

mkdir -p %{buildroot}%{_unitdir}
install -m 644 "%{S:3}" "%{buildroot}%{_unitdir}/sympa.service"
install -m 644 "%{S:5}" "%{buildroot}%{_unitdir}/sympa-archive.service"
install -m 644 "%{S:6}" "%{buildroot}%{_unitdir}/sympa-bounce.service"
install -m 644 "%{S:7}" "%{buildroot}%{_unitdir}/sympa-outgoing.service"
install -m 644 "%{S:8}" "%{buildroot}%{_unitdir}/sympa-task.service"

mkdir -p %{buildroot}%{_sysconfdir}/apache2/vhosts.d
install -m 644 "%{S:4}" %{buildroot}%{_sysconfdir}/apache2/vhosts.d/sympa.conf.template

mkdir -p %{buildroot}%{docdir}
install -m 644 "%{S:2}" %{buildroot}%{docdir}/README.SUSE

mkdir -p %{buildroot}%{_tmpfilesdir}
%{__install} -m 0644 %{S:9} %{buildroot}%{_tmpfilesdir}/%{name}.conf
mkdir -p %{buildroot}%{lockdir}

%find_lang %{name}
%find_lang web_help


%pre
getent group %{sympa_group} >/dev/null || groupadd -r %{sympa_group}
getent passwd %{sympa_user} >/dev/null || useradd -r -g %{sympa_group} -d %{sympadir} -s /sbin/nologin -c "Sympa mailing list software" %{sympa_user}
%service_add_pre sympa.service
%service_add_pre sympa-archived.service
%service_add_pre sympa-bounced.service
%service_add_pre sympa-bulk.service
%service_add_pre sympa-task_manager.service

%post
%service_add_post sympa.service
%service_add_post sympa-archive.service
%service_add_post sympa-bounce.service
%service_add_post sympa-outgoing.service
%service_add_post sympa-task.service

%preun
%service_del_preun sympa.service
%service_del_preun sympa-archive.service
%service_del_preun sympa-bounce.service
%service_del_preun sympa-outgoing.service
%service_del_preun sympa-task.service

%postun
%service_del_postun sympa.service
%service_del_postun sympa-archive.service
%service_del_postun sympa-bounce.service
%service_del_postun sympa-outgoing.service
%service_del_postun sympa-task.service

%files
%defattr(-,root,root)

%dir %attr(0755,%{sympa_user},root) %{confdir}
%config(noreplace) %{confdir}/default
%config(noreplace) %{confdir}/scenari
%dir %attr(0755,%{sympa_user},%{sympa_group}) %{confdir}/mail
%config(noreplace) %attr(0644,%{sympa_user},%{sympa_group}) %{postfix_aliases}
%config(noreplace) %attr(0640,%{sympa_user},%{sympa_group}) %{confdir}/sympa.conf
%config(noreplace) %{confdir}/README
%config(noreplace) %{confdir}/data_structure.version
%dir %{_sysconfdir}/smrsh
%config(noreplace) %{_sysconfdir}/smrsh/bouncequeue
%config(noreplace) %{_sysconfdir}/smrsh/familyqueue
%config(noreplace) %{_sysconfdir}/smrsh/queue

%attr(0750,%{sympa_user},%{sympa_group}) %{spooldir}
%attr(0750,%{sympa_user},%{sympa_group}) %{list_datadir}

%dir %{sympadir}
%dir %{sympadir}/bin
%dir %{sympadir}/scripts
%dir %{sympadir}/libexec
%dir %{sympadir}/bounce
%attr(0644,-,-) %{sympadir}/scripts/create_db.*
%attr(0755,-,-) %{sympadir}/bin/*.pl
%attr(0755,-,-) %{sympadir}/scripts/*.pl
%attr(0755,-,-) %{sympadir}/libexec/queue
%attr(0755,-,-) %{sympadir}/libexec/bouncequeue
%attr(0755,-,-) %{sympadir}/libexec/familyqueue
%attr(0755,-,-) %{sympadir}/libexec/sympa_newaliases-wrapper

%attr(0750,%{sympa_user},%{sympa_group}) %{sympadir}/arc

%{_unitdir}/sympa.service
%{_unitdir}/sympa-archive.service
%{_unitdir}/sympa-bounce.service
%{_unitdir}/sympa-outgoing.service
%{_unitdir}/sympa-task.service

%{_tmpfilesdir}/%{name}.conf

%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/vhosts.d
%config %{_sysconfdir}/apache2/vhosts.d/sympa.conf.template

%dir %attr(0755,%{sympa_user},%{sympa_group}) %{cgidir}
%attr(0755,%{sympa_user},%{sympa_group}) %{cgidir}/sympa_soap_server-wrapper.fcgi
%attr(0755,%{sympa_user},%{sympa_group}) %{cgidir}/sympa_soap_server.fcgi
%attr(0755,%{sympa_user},%{sympa_group}) %{cgidir}/wwsympa-wrapper.fcgi
%attr(0755,%{sympa_user},%{sympa_group}) %{cgidir}/wwsympa.fcgi

%attr(0755,%{sympa_user},%{sympa_group}) %{staticdir}

%{perl_vendorlib}/Sympa

%doc %{docdir}
%doc %{_mandir}/man1/mod2html.1.gz
%doc %{_mandir}/man1/sympa*
%doc %{_mandir}/man1/upgrade_bulk_spool.1.gz
%doc %{_mandir}/man1/upgrade_send_spool.1.gz
%doc %{_mandir}/man1/upgrade_sympa_password.1.gz
%doc %{_mandir}/man1/upgrade_shared_repository.1.gz
%doc %{_mandir}/man3/Sympa*
%doc %{_mandir}/man5/charset.conf.5.gz
%doc %{_mandir}/man5/sympa*
%doc %{_mandir}/man5/auth.conf.5.gz
%doc %{_mandir}/man5/automatic_lists_description.conf.5.gz
%doc %{_mandir}/man5/crawlers_detection.conf.5.gz
%doc %{_mandir}/man5/edit_list.conf.5.gz
%doc %{_mandir}/man5/ldap_alias_manager.conf.5.gz
%doc %{_mandir}/man5/list_config.5.gz
%doc %{_mandir}/man5/nrcpt_by_domain.conf.5.gz
%doc %{_mandir}/man5/topics.conf.5.gz
%doc %{_mandir}/man5/trusted_applications.conf.5.gz
%doc %{_mandir}/man8/alias_manager.8.gz
%doc %{_mandir}/man8/archived.8.gz
%doc %{_mandir}/man8/bounced.8.gz
%doc %{_mandir}/man8/bulk.8.gz
%doc %{_mandir}/man8/sympa*
%doc %{_mandir}/man8/task_manager.8.gz
%doc %{_mandir}/man8/wwsympa.8.gz

%ghost %{lockdir}
%ghost %attr(0755,%{sympa_user},%{sympa_group}) %{piddir}

%files lang -f %{name}.lang -f web_help.lang
%defattr(-,root,root)

%changelog