Apply tizen coding rule
[platform/framework/web/download-provider.git] / packaging / download-provider.spec
1 %define _ux_define tizen2.3
2 Name:       download-provider
3 Summary:    Download the contents in background
4 Version:    2.1.89
5 Release:    0
6 Group:      Development/Libraries
7 License:    Apache-2.0
8 Source0:    %{name}-%{version}.tar.gz
9 Requires(post): libdevice-node
10 Requires(post): sqlite
11 Requires(post): connman
12 Requires: security-config
13 BuildRequires:  cmake
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(gobject-2.0)
16 BuildRequires:  pkgconfig(xdgmime)
17 BuildRequires:  pkgconfig(vconf)
18 BuildRequires:  pkgconfig(sqlite3)
19 BuildRequires:  pkgconfig(bundle)
20 BuildRequires:  pkgconfig(capi-base-common)
21 BuildRequires:  pkgconfig(capi-appfw-app-manager)
22 BuildRequires:  pkgconfig(capi-appfw-application)
23 BuildRequires:  pkgconfig(capi-network-connection)
24 BuildRequires:  pkgconfig(appsvc)
25 BuildRequires:  pkgconfig(libcurl)
26 BuildRequires:  pkgconfig(capi-content-mime-type)
27 BuildRequires:  pkgconfig(libsmack)
28 BuildRequires:  gettext-devel
29 BuildRequires:  pkgconfig(libsystemd-daemon)
30 BuildRequires:  pkgconfig(capi-network-wifi-direct)
31 #BuildRequires:  model-build-features T30
32 BuildRequires:  pkgconfig(storage)
33 %if "%{?tizen_profile_name}" == "wearable"
34 BuildRequires:  pkgconfig(security-server)
35 %else if "%{?tizen_profile_name}" == "mobile"
36 BuildRequires:  pkgconfig(notification)
37 %endif
38
39 BuildRequires: pkgconfig(cynara-client)
40 BuildRequires: pkgconfig(cynara-client-async)
41 BuildRequires: pkgconfig(cynara-creds-socket)
42 BuildRequires: pkgconfig(cynara-creds-dbus)
43 BuildRequires: pkgconfig(tpkp-curl)
44 BuildRequires: pkgconfig(libtzplatform-config)
45
46 %description
47 Description: Download the contents in background
48
49 %package devel
50 Summary:    download-provider
51 Group:      Development/Libraries
52 Requires:   %{name} = %{version}-%{release}
53
54 %description devel
55 Description: Download the contents in background (development files)
56
57 %prep
58 %setup -q
59
60 %define _data_install_path %{TZ_SYS_GLOBALUSER_DATA}/%{name}
61 %define _resource_install_path /usr/share/%{name}
62 %define _imagedir %{_resource_install_path}/images
63 %define _localedir %{_resource_install_path}/locales
64 %define _databasedir %{_data_install_path}/database
65 %define _database_client_dir %{_databasedir}/clients
66 %define _notifydir %{_data_install_path}/notify
67 %define _ipc_socket /tmp/.download-provider.sock
68 %define _logdump_script_dir %{TZ_SYS_ETC}/dump.d/module.d
69 %define _http_lib libcurl
70
71 %define download_booster OFF
72 %define support_oma_drm OFF
73 %ifarch armv7l
74 %define wifi_direct ON
75 %else
76 %define wifi_direct OFF
77 %endif
78 %define support_security_privilege OFF
79 %define support_companion_mode OFF
80 %define support_notification ON
81 %define support_knox ON
82 %define _manifest_name %{name}.manifest
83
84 %if 0%{?model_build_feature_wlan_p2p_disable}
85 %define wifi_direct OFF
86 %endif
87 %if "%{?tizen_profile_name}" == "wearable"
88 %define download_booster OFF
89 %define support_notification OFF
90 %define _manifest_name %{name}-w.manifest
91 %endif
92 %if 0%{?sec_product_feature_container_enable}
93 %define support_knox ON
94 %endif
95
96 %build
97 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
98 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
99 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
100
101 %cmake -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
102         -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
103         -DBIN_INSTALL_DIR:PATH=%{_bindir} \
104         -DLIB_INSTALL_DIR:PATH=%{_libdir} \
105 %ifarch aarch64 x86_64
106         -DLIB_AGENT_PATH="/usr/lib64/libdownloadagent2.so.0.1.0" \
107 %else
108         -DLIB_AGENT_PATH="/usr/lib/libdownloadagent2.so.0.1.0" \
109 %endif
110         -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
111         -DPKG_NAME=%{name} \
112         -DPKG_VERSION=%{version} \
113         -DPKG_RELEASE=%{release} \
114         -DIPC_SOCKET:PATH=%{_ipc_socket} \
115         -DPROVIDER_DIR:PATH=%{_data_install_path} \
116         -DNOTIFY_DIR:PATH=%{_notifydir} \
117         -DDATABASE_DIR:PATH=%{_databasedir} \
118         -DDATABASE_CLIENT_DIR:PATH=%{_database_client_dir} \
119         -DIMAGE_DIR:PATH=%{_imagedir} \
120         -DLOCALE_DIR:PATH=%{_localedir} \
121         -DSUPPORT_WIFI_DIRECT:BOOL=OFF \
122 %if "%{?download_booster}" == "ON"
123         -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=ON \
124 %else \
125         -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \
126 %endif
127 %if "%{?support_notification}" == "ON"
128         -DSUPPORT_NOTIFICATION:BOOL=ON \
129 %else
130         -DSUPPORT_NOTIFICATION:BOOL=OFF \
131 %endif
132         -DSUPPORT_LOG_MESSAGE:BOOL=ON \
133 %if "%{?support_oma_drm}" == "ON"
134         -DSUPPORT_OMA_DRM:BOOL=ON \
135 %else
136         -DSUPPORT_OMA_DRM:BOOL=OFF \
137 %endif
138 %if "%{?support_security_privilege}" == "ON"
139         -DSUPPORT_SECURITY_PRIVILEGE:BOOL=ON \
140 %else \
141         -DSUPPORT_SECURITY_PRIVILEGE:BOOL=OFF \
142 %endif
143 %if "%{?support_companion_mode}" == "ON"
144         -DSUPPORT_COMPANION_MODE:BOOL=ON \
145 %else
146         -DSUPPORT_COMPANION_MODE:BOOL=OFF \
147 %endif
148 %if "%{?support_knox}" == "ON"
149         -DSUPPORT_KNOX:BOOL=ON \
150 %else
151         -DSUPPORT_KNOX:BOOL=OFF \
152 %endif
153 %if "%{?_ux_define}" == "tizen2.3"
154         -DTIZEN_2_3_UX:BOOL=ON \
155 %endif
156         -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \
157         -DHTTP_LIB=%{_http_lib} \
158 %if "%{?_lib}" == "lib64"
159         %{?_cmake_lib_suffix64} \
160 %endif
161         %{?_cmake_skip_rpath} \
162         -DBUILD_SHARED_LIBS:BOOL=ON \
163         .
164
165 make %{?jobs:-j%jobs}
166
167 %install
168 rm -rf %{buildroot}
169 %make_install
170 %if "{tizen_profile_name}" == "tv"
171 mkdir -p %{buildroot}/etc/notstrip/
172 install -m 644 packaging/download-provider.notstrip %{buildroot}/etc/notstrip/download-provider.notstrip
173 %endif
174
175 ## container_enable
176 mkdir -p %{buildroot}/etc/vasum/vsmzone.resource/
177 mv %{buildroot}/usr/share/download-provider/download-provider.res %{buildroot}/etc/vasum/vsmzone.resource/
178
179 mkdir -p %{buildroot}/lib/systemd/system/graphical.target.wants
180 mkdir -p %{buildroot}/lib/systemd/system/sockets.target.wants
181 ln -s ../download-provider.service %{buildroot}/lib/systemd/system/graphical.target.wants/
182 ln -s ../download-provider.socket %{buildroot}/lib/systemd/system/sockets.target.wants/
183
184 %post
185 #make notify dir in post section for smack
186 mkdir %{TZ_SYS_GLOBALUSER_DATA}/download-provider
187 mkdir -p %{_notifydir}
188 chown -R web_fw:web_fw %{_notifydir}
189 chsmack -a 'System::Shared' %{_notifydir}
190 chsmack -t %{_notifydir}
191 mkdir -p --mode=0700 %{_databasedir}
192 chown -R web_fw:web_fw %{_databasedir}
193 chsmack -a 'System' %{_databasedir}
194 mkdir -p --mode=0700 %{_database_client_dir}
195 chsmack -a 'System' %{_database_client_dir}
196 chown -R web_fw:web_fw %{_database_client_dir}
197 chown -R web_fw:web_fw %{_data_install_path}
198
199 %files
200 %defattr(-,root,root,-)
201 %manifest %{_manifest_name}
202 %{_imagedir}/*.png
203 %{_localedir}/*/*/download-provider.mo
204 %{_libdir}/*.so.*
205 /lib/systemd/system/download-provider.service
206 /lib/systemd/system/graphical.target.wants/download-provider.service
207 /lib/systemd/system/download-provider.socket
208 /lib/systemd/system/sockets.target.wants/download-provider.socket
209 %{_bindir}/%{name}
210 %attr(0544,root,root) %{_logdump_script_dir}/dump-%{name}.sh
211 ## container_enable
212 %attr(0644,root,root) /etc/vasum/vsmzone.resource/download-provider.res
213 %if "{tizen_profile_name}" == "tv"
214 /etc/notstrip/download-provider.notstrip
215 %endif
216 %license LICENSE.APLv2
217
218 %files devel
219 %defattr(-,root,root,-)
220 %{_bindir}/%{name}
221 %{_libdir}/*.so
222 %{_libdir}/pkgconfig/download-provider.pc
223 %{_libdir}/pkgconfig/download-provider-interface.pc
224 %{_includedir}/download-provider/download-provider.h
225 %{_includedir}/download-provider/download-provider-interface.h