File ngircd.spec of Package ngircd

#
# spec file for package ngircd (Version 24)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2009-2010 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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/
#
# Example for handling systemd is at
# https://build.opensuse.org/package/view_file?expand=1&file=upower.spec&package=upower&project=Base:System
#
# Backport:
%{!?_initddir: %{expand: %global _initddir %{_initrddir}}}
%{!?_rundir:   %{expand: %global _rundir %{_localstatedir}/run}}

Name:           ngircd
Version:        24
Release:        0
License:        GPL-2.0+
Group:          Productivity/Networking/IRC
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  libident-devel tcpd-devel zlib-devel pam-devel
#BuildRequires:  gnutls-devel
BuildRequires:  libopenssl-devel
%if 0%{?suse_version} >= 1020
BuildRequires:  avahi-compat-howl-devel
%endif
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%{?systemd_requires}
%endif
#
%define         home_dir %{_var}/lib/%{name}
%define         pid_dir  %{_var}/run/%{name}
%define         systemd_tmpfiles /usr/lib/tmpfiles.d
#
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
Requires(pre):  pwdutils
#
Url:            http://ngircd.barton.de/
Source:         ngircd-%{version}.tar.bz2
%if 0%{?suse_version} <= 1310
Source1:        ngircd.init
%endif
Source2:        ngircd.pam
%if 0%{?suse_version} >= 1210
Source3:        ngircd.service
Source5:        ngircd-start-pre
%endif
%if 0%{?suse_version} >= 1220
Source4:        ngircd.tmpfiles
%endif
#
Patch1:         ngircd-default_config.patch
Patch2:         ngircd-remove_build_timestamp.patch
Source99:       %{name}-rpmlintrc
#
Summary:        Next Generation IRC Daemon

%description
ngIRCd is a free open source daemon for Internet Relay Chat (IRC), developed
under the GNU General Public License (GPL). It's written from scratch and is
not based upon the original IRCd like many others.

Advantages

Why should you use ngIRCd? Because ...
    * there are no problems with servers on changing or non-static IP
      addresses.
    * there is a small and lean configuration file.
    * there is a free, modern and open source C source code.
    * it is still under active development.

ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run mixed
networks.

Authors:
--------
    Alexander Barton (alex@barton.de)

%prep
%setup
%patch1
%patch2

%build
%configure \
    --disable-silent-rules \
    --enable-ipv6 \
    --with-openssl \
    --with-tcp-wrappers \
    --with-ident \
    --with-pam \
    --docdir=%{_docdir}/%{name}
%__make %{?_smp_flags}

%if 0%{?suse_version} >= 1210
sed -i 's@__piddir__@%_rundir@' %{SOURCE5}
%endif

%install
%makeinstall docdir=%{_docdir}/%{name}

%if 0%{?suse_version} <= 1310
%{__install} -d -m 0755 %{buildroot}%{pid_dir}
%endif
%{__install} -d -m 0755 %{buildroot}%{home_dir}%{pid_dir}

# for ghost
touch %{buildroot}%{_sysconfdir}/ngircd.motd

# init script
%if 0%{?suse_version} <= 1310
%{__install} -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}
%{__ln_s} -f %{_initddir}/%{name}  %{buildroot}%{_sbindir}/rc%{name}
%endif

%if 0%{?suse_version} > 1310
%{__ln_s} /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
%endif

%__install -D -m 0644 "%{SOURCE2}" "%{buildroot}/etc/pam.d/ngircd"
%__rm -f %{buildroot}%{_docdir}/%{name}/INSTALL

%if 0%{?suse_version} >= 1210
%{__install} -d -m 0755            %{buildroot}%{_unitdir}
%{__install}    -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
%{__install}    -m 0700 %{SOURCE5} %{buildroot}%{_sbindir}/%{name}-start-pre
%endif

%if 0%{?suse_version} >= 1220
%{__install} -d -m 0755            %{buildroot}%{systemd_tmpfiles}
%{__install}    -m 0644 %{SOURCE4} %{buildroot}%{systemd_tmpfiles}/%{name}.conf
%endif

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%pre
/usr/sbin/groupadd -r %{name} &>/dev/null ||:
/usr/sbin/useradd -g %{name} -s /bin/false -r -c "%{name} irc server" -d %{home_dir} %{name} &>/dev/null ||:
%if 0%{?suse_version} >= 1210
%service_add_pre %{name}.service
%endif

%post
%if 0%{?suse_version} <= 1310
%fillup_and_insserv %{name}
%endif
%if 0%{?suse_version} >= 1210
%service_add_post %{name}.service
%endif
# Make the pid_dir available on tmpfs
%if 0%{?suse_version} >= 1220
systemd-tmpfiles --create %{systemd_tmpfiles}/%{name}.conf
%endif

%preun
%stop_on_removal %{name}
%if 0%{?suse_version} >= 1210
%service_del_preun %{name}.service
%endif

%postun
%{insserv_cleanup}
%if 0%{?suse_version} >= 1210
%service_del_postun %{name}.service
%endif

%files
%defattr(-,root,root,-)
%config(noreplace)        %attr(0640,root,ngircd) %{_sysconfdir}/ngircd.conf
%ghost %config(noreplace) %attr(0640,root,ngircd) %{_sysconfdir}/ngircd.motd
%config(noreplace) /etc/pam.d/ngircd
%{_sbindir}/ngircd
%{_mandir}/man5/ngircd.conf.5%{ext_man}
%{_mandir}/man8/ngircd.8%{ext_man}
%doc %{_docdir}/%{name}/
%attr(755,root,root) %{home_dir}/
%attr(755,ngircd,ngircd) %{home_dir}%{pid_dir}
#
%if 0%{?suse_version} <= 1310
%ghost %attr(755,ngircd,ngircd) %{pid_dir}
%{_sysconfdir}/init.d/%{name}
%endif
%{_sbindir}/rc%{name}
#
%if 0%{?suse_version} >= 1210
%{_unitdir}/%{name}.service
%{_sbindir}/%{name}-start-pre
%endif
#
%if 0%{?suse_version} >= 1220
%{systemd_tmpfiles}/%{name}.conf
%endif
openSUSE Build Service is sponsored by