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