Use nuget restore to solve dependencies
[platform/core/csapi/badge.git] / packaging / csapi-badge.spec
1 %{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework}
2
3 %if 0%{?tizen_build_devel_mode}
4 %define BUILDCONF Debug
5 %else
6 %define BUILDCONF Release
7 %endif
8
9 Name:       csapi-badge
10 Summary:    Tizen Badge API for C#
11 Version:    1.0.1
12 Release:    1
13 Group:      Development/Libraries
14 License:    Apache-2.0
15 URL:        https://www.tizen.org
16 Source0:    %{name}-%{version}.tar.gz
17 Source1:    %{name}.manifest
18
19 BuildRequires: mono-compiler
20 BuildRequires: mono-devel
21
22 BuildRequires: dotnet-build-tools
23
24 # C# API Requries
25 BuildRequires: csapi-tizen-nuget
26
27 %description
28 Tizen Badge API for C#
29
30 %prep
31 %setup -q
32 cp %{SOURCE1} .
33
34 %define Assemblies Tizen.Applications.Badge
35
36 %build
37 for ASM in %{Assemblies}; do
38 # NuGet Restore
39 find $ASM/*.project.json -exec nuget restore {} \;
40 # Build
41 find $ASM/*.csproj -exec xbuild {} /p:Configuration=%{BUILDCONF} \;
42 # NuGet Pack
43 nuget pack $ASM/$ASM.nuspec -Version %{version} -Properties Configuration=%{BUILDCONF}
44 done
45
46 %install
47 # Runtime Binary
48 mkdir -p %{buildroot}%{dotnet_assembly_path}
49 for ASM in %{Assemblies}; do
50 %if 0%{?_with_corefx}
51   install -p -m 644 $ASM/bin/%{BUILDCONF}/$ASM.dll %{buildroot}%{dotnet_assembly_path}
52 %else
53   install -p -m 644 $ASM/bin/%{BUILDCONF}/Net45/$ASM.dll %{buildroot}%{dotnet_assembly_path}
54 %endif
55 done
56 # NuGet
57 mkdir -p %{buildroot}/nuget
58 install -p -m 644 *.nupkg %{buildroot}/nuget
59
60 %files
61 %manifest %{name}.manifest
62 %license LICENSE
63 %attr(644,root,root) %{dotnet_assembly_path}/*.dll
64
65 %package nuget
66 Summary:   NuGet package for %{name}
67 Group:     Development/Libraries
68
69 %description nuget
70 NuGet package for %{name}
71
72 %files nuget
73 /nuget/*.nupkg