Add RPM Macros
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 12 Dec 2016 05:58:58 +0000 (14:58 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Mon, 12 Dec 2016 08:52:07 +0000 (17:52 +0900)
Change-Id: Icfc3d25ad9bf0c30641eefa728e899248f8134cb

packaging/dotnet-build-tools.spec
packaging/macros.dotnet-build-tools [new file with mode: 0644]

index 4027e40..8070323 100644 (file)
@@ -1,11 +1,12 @@
 Name:       dotnet-build-tools
 Summary:    Tools for building C# API projects
-Version:    1.0.9
+Version:    1.0.10
 Release:    1
 Group:      Development/Libraries
 License:    MIT and Apache-2.0
 URL:        https://www.tizen.org
 Source0:    %{name}-%{version}.tar.gz
+Source1:    macros.dotnet-build-tools
 
 AutoReqProv: no
 
@@ -14,7 +15,10 @@ Requires: corefx-managed-ref-noarch
 %else
 Requires: corefx-managed-ref
 %endif
+
 Requires: mono-compat
+Requires: mono-devel
+Requires: mono-compiler
 
 %description
 Build target files (.Targets) and Tools (including NuGet.exe) for building
@@ -55,8 +59,12 @@ install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter
 mkdir -p %{buildroot}/nuget
 install -p -m 644 LocalPackages/*.nupkg %{buildroot}/nuget
 
+# RPM Macros
+install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.dotnet-build-tools
+
 %files
 %license LICENSE.Mono.Cecil LICENSE.NuGet
+%config(noreplace) %{_sysconfdir}/rpm/macros.dotnet-build-tools
 %{_bindir}/*
 %{NuGetDir}/*
 %{XBuildDir}/*
diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools
new file mode 100644 (file)
index 0000000..f279f31
--- /dev/null
@@ -0,0 +1,58 @@
+# Macro definitions for CSAPI Build
+
+%_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end}
+
+%dotnet_assembly_path   %{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework}
+%_mono_assembly_path    /opt/usr/lib/assembly
+
+%dotnet_assembly_files  %{dotnet_assembly_path}/*.dll
+
+%_nuget_package \
+%package nuget\
+Summary:   NuGet package for %{name}\
+Group:     Development/Libraries\
+%description nuget\
+NuGet package for %{name}\
+%files nuget\
+/nuget/*.nupkg\
+%{nil}
+
+%_mono_package \
+%package mono\
+Summary:   %{name} for Mono Runtime\
+Group:     Development/Libraries\
+%description mono\
+%{name} for Mono Runtime\
+%files mono\
+%manifest %{name}.manifest\
+%%license LICENSE\
+%attr(644,root,root) %{_mono_assembly_path}/*.dll\
+%{nil}
+
+%dotnet_subpackages \
+%_nuget_package \
+%_mono_package \
+%{nil}
+
+%dotnet_build() \
+find %{1}/*.project.json -print0 | xargs -n1 -0 nuget restore \
+find %{1}/*.csproj -print0 | xargs -n1 -0 xbuild /p:Configuration=%{_dotnet_build_conf} \
+%{nil}
+
+%dotnet_pack() \
+nuget pack %{1}/%{1}.nuspec -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \
+%{nil}
+
+%dotnet_install() \
+%if 0%{?_with_corefx} \
+mkdir -p %{buildroot}%{dotnet_assembly_path} \
+mkdir -p %{buildroot}%{_mono_assembly_path} \
+mkdir -p %{buildroot}/nuget \
+install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{dotnet_assembly_path} \
+%else \
+  install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{dotnet_assembly_path} \
+%endif \
+install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_mono_assembly_path} \
+install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \
+%{nil}
+