39ae4a34bc8e05da3e6ff8d3ff5a77db7bb5aee8
[platform/core/csapi/tizenfx.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.snk \
51   Properties/AssemblyInfo.cs \
52   Tizen/Log.cs \
53   Tizen/LogTraceListener.cs \
54   Tizen/NativeMethods.cs
55
56 # check p/invoke
57 if [ -x %{dllname} ]; then
58   RET=`mono-shlib-cop %{dllname}`; \
59   CNT=`echo $RET | grep -E "^error:" | wc -l`; \
60   if [ $CNT -gt 0 ]; then exit 1; fi
61 fi
62
63 %install
64 # copy dll
65 mkdir -p %{buildroot}%{dllpath}
66 install -p -m 644 %{dllname} %{buildroot}%{dllpath}
67
68 # generate pkgconfig
69 mkdir -p %{buildroot}%{_libdir}/pkgconfig
70 sed -e "s#@version@#%{version}#g" \
71     -e "s#@dllpath@#%{dllpath}#g" \
72     -e "s#@dllname@#%{dllname}#g" \
73     %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
74
75 %post
76 gacutil -i %{dllpath}/%{dllname}
77
78 %files
79 %{dllpath}/%{dllname}
80
81 %files devel
82 %{_libdir}/pkgconfig/%{name}.pc