File netlabel.spec of Package netlabel

#
# spec file for package netlabel
#
# 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/
#


Name:           netlabel
%define         upstream_version 0.20
%define         netlabel_docdir %{_docdir}/%{name}
%if 0%{?suse_version} >= 1210
%bcond_without  systemd
%else
%bcond_with     systemd
%endif
Version:        0.20
Release:        0
Summary:        Explicit labeled networking for Linux
License:        GPL-2.0
Group:          Productivity/Networking/Security
Url:            http://netlabel.sourceforge.net/
PreReq:         %insserv_prereq %fillup_prereq
Source0:        http://downloads.sourceforge.net/project/netlabel/netlabel_tools/%{upstream_version}/netlabel_tools-%{upstream_version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  doxygen
%if 0%{?suse_version} >= 1210
BuildRequires:  libnl-1_1-devel
%else
BuildRequires:  libnl-devel
%endif
# PATCH-FIX-UPSTREAM netlabel_tools-0.20.diff mt@suse.de
Patch0:         netlabel_tools-0.20.diff
# PATCH-FIX-OPENSUSE netlabel_tools-0.20-service.diff mt@suse.de
Patch1:         netlabel_tools-0.20-service.diff

%description
Explicit labeled networking for Linux

The NetLabel control utility, netlabelctl, is a command line program designed
to allow system administrators to configure the NetLabel system in the kernel.
The utility is based around different "modules" which correspond to the
different types of NetLabel commands supported by the kernel.

Authors:
--------
    Paul Moore


%package tools
Summary:        Control utility for explicit labeled networking for Linux
Group:          Productivity/Networking/Security

%description tools
Explicit labeled networking for Linux

The NetLabel control utility, netlabelctl, is a command line program designed
to allow system administrators to configure the NetLabel system in the kernel.
The utility is based around different "modules" which correspond to the
different types of NetLabel commands supported by the kernel.

Authors:
--------
    Paul Moore

#
# Note: there's no NetLabel Daemon implemented yet,
#       the libraries are not installed by default.
#
%prep
%setup -q -n netlabel_tools-%{upstream_version}
%patch0 -p0
%patch1 -p0

%build
CFLAGS="$RPM_OPT_FLAGS -W -Wall"
export RPM_OPT_FLAGS CFLAGS
./configure \
%if %{with systemd}
	--enable-systemd \
%endif
	--prefix=%{_prefix} --libdir=%{_libdir} 
%__make V=1 clean
%__make V=1

%install
export RPM_BUILD_ROOT
make install V=1 DESTDIR="$RPM_BUILD_ROOT"
%if %{with systemd}
install -d -m 0755  "$RPM_BUILD_ROOT%{_sbindir}"
ln -s %{_sbindir}/service "$RPM_BUILD_ROOT%{_sbindir}/rcnetlabel"
%endif

%pre
%{service_add_pre netlabel.service}

%post
%if %{with systemd}
%{service_del_preun netlabel.service}
%endif

%preun
%if %{with systemd}
%{service_del_preun netlabel.service}
%endif

%postun
%if %{with systemd}
%{service_del_postun netlabel.service}
%endif

%files tools
%defattr(-,root,root)
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/netlabel.rules
%{_sbindir}/netlabelctl
%{_sbindir}/netlabel-config
%if %{with systemd}
%{_sbindir}/rcnetlabel
%{_unitdir}/netlabel.service
%endif
%doc LICENSE README CHANGELOG
%{_mandir}/man8/netlabelctl.8.gz
%{_mandir}/man8/netlabel-config.8.gz

%changelog