File nunit.spec of Package nunit

#
# spec file for package nunit
#
# Copyright (c) 2014 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:           nunit
Version:        2.6.4
Release:        0
License:        Zlib
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Url:            http://www.nunit.org/
Source:         https://github.com/nunit/nunitv2/archive/%{version}.tar.gz
BuildRequires:  mono-devel dos2unix strace libgdiplus0 fdupes
%if 0%{?fedora_version}
BuildRequires:  xorg-x11-fonts-truetype
%endif
%if 0%{?suse_version}
BuildRequires:  xorg-x11-fonts-core
%endif
Group:          Development/Libraries/Mono
Summary:        Unit-testing framework for all .NET languages

%description
NUnit is a unit testing framework for all .NET languages. It serves the
same purpose as JUnit does in the Java world. It supports test
categories, testing for exceptions and writing test results in plain
text or XML.

%package devel
Summary:        Development files for NUnit
Group:          Development/Languages/Mono
Requires:       nunit = %{version}

%description devel
This package contains development files for NUnit integration.

%prep
%setup -q -n nunitv2-%{version}

%build
xbuild nunit.sln /t:Rebuild /p:Configuration=Debug

%install
mkdir -p "%{buildroot}%{_prefix}/lib/nunit"
cp -a bin/Debug/* "%{buildroot}%{_prefix}/lib/nunit"
mkdir -p "%{buildroot}%{_docdir}/%{name}"
cp -a license.txt "%{buildroot}%{_docdir}/%{name}/"
cp -a doc "%{buildroot}%{_docdir}/%{name}/"
cp -a samples "%{buildroot}%{_docdir}/%{name}/"

mkdir -p "%{buildroot}%{_bindir}"
echo '#!/bin/sh
exec /usr/bin/mono %{_prefix}/lib/nunit/nunit.exe "$@"' > "%{buildroot}%{_bindir}/nunit"
chmod +x "%{buildroot}%{_bindir}/nunit"

cd %{buildroot}%{_docdir}/%{name}/
find . -type f -exec dos2unix {} \;

for i in nunit.core.dll nunit.core.interfaces.dll nunit.framework.dll nunit.util.dll lib/nunit-console-runner.dll lib/nunit-gui-runner.dll lib/nunit.uiexception.dll lib/nunit.uikit.dll framework/nunit.mocks.dll ; do
	gacutil -i %{buildroot}%{_prefix}/lib/nunit/$i -package nunit -root %{buildroot}%{_prefix}/lib
	rm -f %{buildroot}%{_prefix}/lib/nunit/$i
done

mkdir -p %{buildroot}%{_datadir}/pkgconfig
cat <<EOF > %{buildroot}%{_datadir}/pkgconfig/nunit.pc
prefix=%{_prefix}
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
pkglibdir=\${prefix}/lib/mono/nunit

Name: NUnit
Description: Testing framework for .NET
Version: %{version}
Libs: -r:\${pkglibdir}/nunit.core.dll -r:\${pkglibdir}/nunit.core.interfaces.dll -r:\${pkglibdir}/nunit.framework.dll -r:\${pkglibdir}/nunit.util.dll r:\${pkglibdir}/nunit-console-runner.dll r:\${pkglibdir}/nunit-gui-runner.dll r:\${pkglibdir}/nunit.uiexception.dll r:\${pkglibdir}/nunit.uikit.dll r:\${pkglibdir}/nunit.mocks.dll
EOF

%fdupes %{buildroot}%{_prefix}

%files
%defattr(-,root,root)
%{_prefix}/lib/nunit
%{_prefix}/lib/mono/nunit
%{_prefix}/lib/mono/gac/nunit*
%{_bindir}/nunit
%{_docdir}/nunit

%files devel
%defattr(-, root, root)
%{_datadir}/pkgconfig/nunit.pc
openSUSE Build Service is sponsored by