[Device] Implementation of system.device module including error handling.
[platform/core/csapi/system.git] / packaging / csapi-tizen.system.spec
1 %define dllpath %{_libdir}/mono/tizen
2 %define dllname Tizen.System.dll
3
4 Name:       csapi-tizen.system
5 Summary:    Tizen System API for C#
6 Version:    1.0.0
7 Release:    1
8 Group:      Development/Libraries
9 License:    Apache-2.0
10 URL:        https://www.tizen.org
11 Source0:    %{name}-%{version}.tar.gz
12 Source1:    %{name}.manifest
13 Source2:    %{name}.pc.in
14
15 # TODO: replace mono-compiler, mono-devel to mcs, mono-shlib-cop
16 BuildRequires: mono-compiler
17 BuildRequires: mono-devel
18 # TODO: replace mono-core to gacutil.
19 #       mono-core should provide the symbol 'gacutil'
20 Requires(post): mono-core
21 Requires(postun): mono-core
22
23 # P/Invoke Dependencies
24 BuildRequires: pkgconfig(capi-system-device)
25
26 # P/Invoke Runtime Dependencies
27 # TODO: It should be removed after fix tizen-rpm-config
28 Requires: capi-system-device
29 # DLL Dependencies
30 #BuildRequires: ...
31
32 %description
33 Tizen System Device API for C#
34
35 %package devel
36 Summary:    Development package for %{name}
37 Group:      Development/Libraries
38 Requires:   %{name} = %{version}-%{release}
39
40 %description devel
41 Development package for %{name}
42
43 %prep
44 %setup -q
45
46 cp %{SOURCE1} .
47
48 %build
49 # build dll
50 mcs -target:library -out:%{dllname} -keyfile:Tizen.System/Tizen.System.snk \
51   Tizen.System/Properties/AssemblyInfo.cs \
52   Tizen.System/System.cs \
53   Tizen.System/Device/EventArgs.cs \
54   Tizen.System/Device/Battery.cs \
55   Tizen.System/Device/Display.cs \
56   Tizen.System/Device/Haptic.cs \
57   Tizen.System/Device/Led.cs \
58   Tizen.System/Device/Power.cs \
59   Tizen.System/Interop/Interop.Device.cs
60
61 # check p/invoke
62 if [ -x %{dllname} ]; then
63   RET=`mono-shlib-cop %{dllname}`; \
64   CNT=`echo $RET | grep -E "^error:" | wc -l`; \
65   if [ $CNT -gt 0 ]; then exit 1; fi
66 fi
67
68 %install
69 # copy dll
70 mkdir -p %{buildroot}%{dllpath}
71 install -p -m 644 %{dllname} %{buildroot}%{dllpath}
72
73 # generate pkgconfig
74 mkdir -p %{buildroot}%{_libdir}/pkgconfig
75 sed -e "s#@version@#%{version}#g" \
76     -e "s#@dllpath@#%{dllpath}#g" \
77     -e "s#@dllname@#%{dllname}#g" \
78     %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
79
80 %post
81 gacutil -i %{dllpath}/%{dllname}
82
83 %files
84 %{dllpath}/%{dllname}
85
86 %files devel
87 %{_libdir}/pkgconfig/%{name}.pc