File asn1scc.spec of Package asn1scc

#
# spec file for package asn1scc
#
# Copyright (c) 2019, 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/
#

# Tests are disabled by default
%bcond_with  test

Name:           asn1scc
Version:        4.1.0.1f
Release:        0
Summary:        An ASN.1 compiler that targets C and Ada
License:        SUSE-GPL-2.0-with-FLOSS-exception
Group:          Development/Languages/C and C++
URL:            https://www.thanassis.space/asn1.html
#Git-Clone:     https://github.com/ttsiodras/asn1scc.git
# Source tgz manually created with all nuget requirements (folder packages/) included
# Argu.3.7.0, CommandLineParser.FSharp.2.2.1, FSharp.Core.4.2.3
# alias nuget="mono /usr/lib/mono/nuget/NuGet.exe"
# nuget restore
Source:         asn1scc-4.1.0.1f.tar.gz
#Source:         https://github.com/ttsiodras/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  fsharp
BuildRequires:  fsharp
BuildRequires:  java-1_8_0-openjdk
BuildRequires:  mono-devel
BuildRequires:  python3
%if %{with test}
# Ada GNAT for tests
BuildRequires:  gcc-ada
%endif
BuildArch:      noarch

%description
ASN1SCC: an ASN.1 compiler that targets C and Ada, while placing specific
emphasis on embedded systems.

%prep
%setup -q

%build
xbuild /p:TargetFrameworkVersion="v4.5"

%install
install -d %{buildroot}/%{_libexecdir}/%{name}/
install -m 0664 Asn1f4/bin/Debug/* %{buildroot}/%{_libexecdir}/%{name}/
# Install wrapper
install -d %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/asn1scc << EOF
#!/bin/sh
mono %{_libexecdir}/%{name}/Asn1f4.exe "$@"
EOF
chmod 0755 %{buildroot}%{_bindir}/asn1scc

%if %{with test}
%check
export CFLAGS='-Wno-implicit-fallthrough'
cd v4Tests
make %{?_smp_mflags}
%endif

%files
%license LICENSE.txt
%doc CHANGELOG README.md
%{_bindir}/asn1scc
%{_libexecdir}/%{name}

%changelog
openSUSE Build Service is sponsored by