File coreemu.spec of Package coreemu

#
# spec file for package coreemu
#
# Copyright (c) 2016-2018, Martin Hauke <mardnh@gmx.de>
#
# 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:           coreemu
Version:        5.2
Release:        0
Summary:        Common Open Research Emulator for use with network namespaces
License:        BSD-2-Clause
Group:          System/Emulators/PC
Url:            http://www.nrl.navy.mil/itd/ncs/products/core
#Source:         http://downloads.pf.itd.nrl.navy.mil/core/source/core-%{version}.tar.gz
Source:         https://github.com/coreemu/core/archive/release-%{version}.tar.gz
Patch1:		coreemu-systemddir.diff
#Patch2:		coreemu-fix-desktop-file.diff
#Patch3:		coreemu-remove-shebang.diff
BuildRequires:  ImageMagick
BuildRequires:  autoconf
BuildRequires:  automake
#
BuildRequires:  bridge-utils
BuildRequires:  ebtables
BuildRequires:  fdupes
BuildRequires:  help2man
BuildRequires:  iproute2
BuildRequires:  pkg-config
BuildRequires:  python2-Sphinx
BuildRequires:  python2-sphinxcontrib-apidoc
BuildRequires:  python2-idna
BuildRequires:  python2-devel
#
BuildRequires:  systemd
BuildRequires:  pkgconfig(libev)
#
Requires:       bridge-utils
Requires:       ebtables
Requires:       iproute2
Requires:       tcl
Requires:       tk
Requires:       tkimg
#
Recommends:	quagga
#Recommends:	mgen
#Recommends:	ipsec-tools
#Recommends:	docker
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Common Open Research Emulator provides Python modules and a GUI for
building virtual networks using Linux network namespace containers and bridging.

%prep
%setup -q -n core-release-%{version}
%patch1 -p1
#%patch2 -p1
#%patch3 -p1

%build
./bootstrap.sh
export CFLAGS="-fno-strict-aliasing -Wno-error=int-in-bool-context %{optflags}"
%configure --with-startup=systemd
make %{?_smp_mflags}

%install
%make_install
%fdupes -s %{buildroot}

# FIXME: set proper permissions
chmod 644 %{buildroot}/%{_unitdir}/core-daemon.service

# compat rc-symlink   
install -d %{buildroot}/%{_sbindir}
ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rccore-daemon

# Fix env-script-interpreter warnings
find "%{buildroot}/%{_datadir}/core/examples/" -iname "*.py" | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/python2|g'

%pre
%service_add_pre core-daemon.service

%post
%service_add_post core-daemon.service

%preun
%service_del_preun core-daemon.service

%postun
%service_del_postun core-daemon.service

%files
%doc Changelog LICENSE README.md
%{_mandir}/man1/*
%dir %{_sysconfdir}/core
%config %{_sysconfdir}/core/core.conf
%config %{_sysconfdir}/core//logging.conf
%config %{_sysconfdir}/core/perflogserver.conf
#
%{_unitdir}/core-daemon.service
%dir %{_libexecdir}/core/
%dir %{_libexecdir}/core/addons
%{_libexecdir}/core/addons/ipsecservice.tcl
%{_libexecdir}/core/*.tcl
#
%{_sbindir}/rccore-daemon
#
%{_bindir}/core-gui
%{_bindir}/core-cleanup
%{_bindir}/core-daemon
%{_bindir}/core-manage
%{_bindir}/coresendmsg
%{_bindir}/netns
%{_bindir}/vcmd
%{_bindir}/vnoded
#
%{_datadir}/core
%dir %{_datadir}/corens3
%{_datadir}/corens3/examples
%{_datadir}/pixmaps/core-gui.xpm
%{_datadir}/applications/core-gui.desktop
#
%{python2_sitelib}

%changelog
openSUSE Build Service is sponsored by