f279f316d065ffaaeb71464b860b466b1c04631d
[platform/core/dotnet/build-tools.git] / packaging / macros.dotnet-build-tools
1 # Macro definitions for CSAPI Build
2
3 %_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end}
4
5 %dotnet_assembly_path   %{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework}
6 %_mono_assembly_path    /opt/usr/lib/assembly
7
8 %dotnet_assembly_files  %{dotnet_assembly_path}/*.dll
9
10 %_nuget_package \
11 %package nuget\
12 Summary:   NuGet package for %{name}\
13 Group:     Development/Libraries\
14 %description nuget\
15 NuGet package for %{name}\
16 %files nuget\
17 /nuget/*.nupkg\
18 %{nil}
19
20 %_mono_package \
21 %package mono\
22 Summary:   %{name} for Mono Runtime\
23 Group:     Development/Libraries\
24 %description mono\
25 %{name} for Mono Runtime\
26 %files mono\
27 %manifest %{name}.manifest\
28 %%license LICENSE\
29 %attr(644,root,root) %{_mono_assembly_path}/*.dll\
30 %{nil}
31
32 %dotnet_subpackages \
33 %_nuget_package \
34 %_mono_package \
35 %{nil}
36
37 %dotnet_build() \
38 find %{1}/*.project.json -print0 | xargs -n1 -0 nuget restore \
39 find %{1}/*.csproj -print0 | xargs -n1 -0 xbuild /p:Configuration=%{_dotnet_build_conf} \
40 %{nil}
41
42 %dotnet_pack() \
43 nuget pack %{1}/%{1}.nuspec -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \
44 %{nil}
45
46 %dotnet_install() \
47 %if 0%{?_with_corefx} \
48 mkdir -p %{buildroot}%{dotnet_assembly_path} \
49 mkdir -p %{buildroot}%{_mono_assembly_path} \
50 mkdir -p %{buildroot}/nuget \
51 install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{dotnet_assembly_path} \
52 %else \
53   install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{dotnet_assembly_path} \
54 %endif \
55 install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_mono_assembly_path} \
56 install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \
57 %{nil}
58