7bc947ba239233c36e4223d5d49a478360471202
[platform/core/csapi/tizenfx.git] / packaging / csapi-security.spec
1 %{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework}
2 %{!?dotnet_core_path: %define dotnet_core_path %{_datadir}/tizen.net/ref}
3
4 %if 0%{?tizen_build_devel_mode}
5 %define BUILDCONF Debug
6 %else
7 %define BUILDCONF Release
8 %endif
9
10 Name:       csapi-security
11 Summary:    Tizen Security API for C#
12 Version:    1.0.0
13 Release:    1
14 Group:      Development/Libraries
15 License:    Apache-2.0
16 URL:        https://www.tizen.org
17 Source0:    %{name}-%{version}.tar.gz
18 Source1:    %{name}.manifest
19
20 # Mono
21 BuildRequires: mono-compiler
22 BuildRequires: mono-devel
23
24 # .NETCore
25 %if 0%{?_with_corefx}
26 AutoReqProv: no
27 BuildRequires: corefx-managed-32b-ref
28 %endif
29
30 BuildRequires: dotnet-build-tools
31
32 # C# API Requires
33 BuildRequires: csapi-tizen-devel
34 BuildRequires: csapi-application-devel
35
36 %description
37 Tizen Security API for C#
38
39 %prep
40 %setup -q
41 cp %{SOURCE1} .
42
43 %define Assemblies Tizen.Security Tizen.Security.SecureRepository
44
45 %build
46 # Build for Net45
47 for ASM in %{Assemblies}; do
48 if [ -e $ASM/$ASM.Net45.csproj ]; then
49   xbuild $ASM/$ASM.Net45.csproj \
50          /p:Configuration=%{BUILDCONF} \
51          /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/net45 \
52          /p:OutputPath=bin/net45
53 fi
54
55 # Build for Dotnet
56 %if 0%{?_with_corefx}
57 if [ -e $ASM/$ASM.csproj ]; then
58   xbuild $ASM/$ASM.csproj \
59          /p:Configuration=%{BUILDCONF} \
60          /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/netstandard1.6 \
61          /p:CoreFxPath=%{dotnet_core_path} \
62          /p:OutputPath=bin/netstandard1.6
63 fi
64 %endif
65
66 # Make NuGet package
67 dotnet-gbs pack $ASM/$ASM.nuspec --PackageVersion=%{version} --PackageFiles=$ASM/bin
68
69 done
70
71 %install
72 mkdir -p %{buildroot}%{dotnet_assembly_path}/devel
73 for ASM in %{Assemblies}; do
74   cp -fr $ASM/bin/* %{buildroot}%{dotnet_assembly_path}/devel
75 %if 0%{?_with_corefx}
76   install -p -m 644 $ASM/bin/netstandard1.6/$ASM.dll %{buildroot}%{dotnet_assembly_path}
77 %else
78   install -p -m 644 $ASM/bin/net45/$ASM.dll %{buildroot}%{dotnet_assembly_path}
79 %endif
80 done
81
82 mkdir -p %{buildroot}/nuget
83 install -p -m 644 *.nupkg %{buildroot}/nuget
84
85 %files
86 %manifest %{name}.manifest
87 %license LICENSE
88 %attr(644,root,root) %{dotnet_assembly_path}/*.dll
89
90 %package devel
91 Summary:   Development package for %{name}
92 Group:     Development/Libraries
93 Requires:  %{name} = %{version}-%{release}
94 AutoReqProv: no
95
96 %description devel
97 Development package for %{name}
98
99 %files devel
100 %{dotnet_assembly_path}/devel/*
101
102 %package nuget
103 Summary:   NuGet package for %{name}
104 Group:     Development/Libraries
105 Requires:  %{name} = %{version}-%{release}
106
107 %description nuget
108 NuGet package for %{name}
109
110 %files nuget
111 /nuget/*.nupkg