Fix project files to support netstandard 1.6
[platform/core/csapi/tizenfx.git] / packaging / csapi-mime-type.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-mime-type
11 Summary:    Tizen MimeType 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 Requries
33 BuildRequires: csapi-tizen-devel
34
35 %description
36 Tizen MimeType API for C#
37
38 %prep
39 %setup -q
40 cp %{SOURCE1} .
41
42 %define Assemblies Tizen.Content.MimeType
43
44 %build
45 # Build for Net45
46 for ASM in %{Assemblies}; do
47 if [ -e $ASM/$ASM.Net45.csproj ]; then
48   xbuild $ASM/$ASM.Net45.csproj \
49          /p:Configuration=%{BUILDCONF} \
50          /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/net45 \
51          /p:OutputPath=bin/net45
52 fi
53
54 # Build for Dotnet
55 %if 0%{?_with_corefx}
56 if [ -e $ASM/$ASM.csproj ]; then
57   xbuild $ASM/$ASM.csproj \
58          /p:Configuration=%{BUILDCONF} \
59          /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/netstandard1.6 \
60          /p:CoreFxPath=%{dotnet_core_path} \
61          /p:OutputPath=bin/netstandard1.6
62 fi
63 %endif
64
65 # Make NuGet package
66 dotnet-gbs pack $ASM/$ASM.nuspec --PackageVersion=%{version} --PackageFiles=$ASM/bin
67
68 done
69
70 %install
71 mkdir -p %{buildroot}%{dotnet_assembly_path}/devel
72 for ASM in %{Assemblies}; do
73   cp -fr $ASM/bin/* %{buildroot}%{dotnet_assembly_path}/devel
74 %if 0%{?_with_corefx}
75   install -p -m 644 $ASM/bin/netstandard1.6/$ASM.dll %{buildroot}%{dotnet_assembly_path}
76 %else
77   install -p -m 644 $ASM/bin/net45/$ASM.dll %{buildroot}%{dotnet_assembly_path}
78 %endif
79 done
80
81 mkdir -p %{buildroot}/nuget
82 install -p -m 644 *.nupkg %{buildroot}/nuget
83
84 %files
85 %manifest %{name}.manifest
86 %license LICENSE
87 %attr(644,root,root) %{dotnet_assembly_path}/*.dll
88
89 %package devel
90 Summary:   Development package for %{name}
91 Group:     Development/Libraries
92 Requires:  %{name} = %{version}-%{release}
93 AutoReqProv: no
94
95 %description devel
96 Development package for %{name}
97
98 %files devel
99 %{dotnet_assembly_path}/devel/*
100
101 %package nuget
102 Summary:   NuGet package for %{name}
103 Group:     Development/Libraries
104 Requires:  %{name} = %{version}-%{release}
105
106 %description nuget
107 NuGet package for %{name}
108
109 %files nuget
110 /nuget/*.nupkg