19ebe138368ceebed7c1491a1bd9562c4e7ce1c2
[platform/core/csapi/tizen.git] / packaging / csapi-tizen.spec
1 %define dllpath %{_libdir}/mono/tizen
2 %define dllname Tizen.dll
3
4 Name:       csapi-tizen
5 Summary:    Tizen 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(dlog)
25
26 # P/Invoke Runtime Dependencies
27 # TODO: It should be removed after fix tizen-rpm-config
28 Requires: dlog
29 # DLL Dependencies
30 #BuildRequires: ...
31
32 %description
33 Tizen 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/Tizen.snk \
51   Tizen/Properties/AssemblyInfo.cs \
52   Tizen/Tizen/*.cs \
53   Tizen/Interop/*.cs
54
55 # check p/invoke
56 if [ -x %{dllname} ]; then
57   RET=`mono-shlib-cop %{dllname}`; \
58   CNT=`echo $RET | grep -E "^error:" | wc -l`; \
59   if [ $CNT -gt 0 ]; then exit 1; fi
60 fi
61
62 %install
63 # copy dll
64 mkdir -p %{buildroot}%{dllpath}
65 install -p -m 644 %{dllname} %{buildroot}%{dllpath}
66
67 # generate pkgconfig
68 mkdir -p %{buildroot}%{_libdir}/pkgconfig
69 sed -e "s#@version@#%{version}#g" \
70     -e "s#@dllpath@#%{dllpath}#g" \
71     -e "s#@dllname@#%{dllname}#g" \
72     %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
73
74 %post
75 gacutil -i %{dllpath}/%{dllname}
76
77 %files
78 %{dllpath}/%{dllname}
79
80 %files devel
81 %{_libdir}/pkgconfig/%{name}.pc