refactoring download-provider alloc/free
[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.75
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 _licensedir /usr/share/license
69 %define _logdump_script_dir %{TZ_SYS_ETC}/dump.d/module.d
70 %define _http_lib libcurl
71 %define upgrade_script_path /usr/share/upgrade/scripts
72
73 %define download_booster OFF
74 %define support_oma_drm OFF
75 %ifarch armv7l
76 %define wifi_direct ON
77 %else
78 %define wifi_direct OFF
79 %endif
80 %define support_security_privilege OFF
81 %define support_companion_mode OFF
82 %define support_notification ON
83 %define support_knox ON
84 %define _manifest_name %{name}.manifest
85
86 %if 0%{?model_build_feature_wlan_p2p_disable }
87 %define wifi_direct OFF
88 %endif
89 %if "%{?tizen_profile_name}" == "wearable"
90 %define download_booster OFF
91 %define support_notification OFF
92 %define _manifest_name %{name}-w.manifest
93 %endif
94 %if 0%{?sec_product_feature_container_enable}
95 %define support_knox ON
96 %endif
97
98 %define cmake \
99         CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fvisibility=hidden"; export CFLAGS \
100         FFLAGS="${FFLAGS:-%optflags} -fPIC -fvisibility=hidden"; export FFLAGS \
101         LDFLAGS+=" -Wl,--as-needed -Wl,--hash-style=both"; export LDFLAGS \
102         %__cmake \\\
103                 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
104                 -DBIN_INSTALL_DIR:PATH=%{_bindir} \\\
105                 -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
106                 %ifarch aarch64 x86_64 \
107                 -DLIB_AGENT_PATH="/usr/lib64/libdownloadagent2.so" \\\
108                 %else \
109                 -DLIB_AGENT_PATH="/usr/lib/libdownloadagent2.so" \\\
110                 %endif \
111                 -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
112                 -DPKG_NAME=%{name} \\\
113                 -DPKG_VERSION=%{version} \\\
114                 -DPKG_RELEASE=%{release} \\\
115                 -DIPC_SOCKET:PATH=%{_ipc_socket} \\\
116                 -DPROVIDER_DIR:PATH=%{_data_install_path} \\\
117                 -DNOTIFY_DIR:PATH=%{_notifydir} \\\
118                 -DDATABASE_DIR:PATH=%{_databasedir} \\\
119                 -DDATABASE_CLIENT_DIR:PATH=%{_database_client_dir} \\\
120                 -DIMAGE_DIR:PATH=%{_imagedir} \\\
121                 -DLOCALE_DIR:PATH=%{_localedir} \\\
122                 -DLICENSE_DIR:PATH=%{_licensedir} \\\
123                 -DSUPPORT_WIFI_DIRECT:BOOL=OFF \\\
124                 %if "%{?download_booster}" == "ON" \
125                 -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=ON \\\
126                 %else \
127                 -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \\\
128                 %endif \
129                 %if "%{?support_notification}" == "ON" \
130                 -DSUPPORT_NOTIFICATION:BOOL=ON \\\
131                 %else \
132                 -DSUPPORT_NOTIFICATION:BOOL=OFF \\\
133                 %endif \
134                 -DSUPPORT_LOG_MESSAGE:BOOL=ON \\\
135                 %if "%{?support_oma_drm}" == "ON" \
136                 -DSUPPORT_OMA_DRM:BOOL=ON \\\
137                 %else \
138                 -DSUPPORT_OMA_DRM:BOOL=OFF \\\
139                 %endif \
140                 %if "%{?support_security_privilege}" == "ON" \
141                 -DSUPPORT_SECURITY_PRIVILEGE:BOOL=ON \\\
142                 %else \
143                 -DSUPPORT_SECURITY_PRIVILEGE:BOOL=OFF \\\
144                 %endif \
145                 %if "%{?support_companion_mode}" == "ON" \
146                 -DSUPPORT_COMPANION_MODE:BOOL=ON \\\
147                 %else \
148                 -DSUPPORT_COMPANION_MODE:BOOL=OFF \\\
149                 %endif \
150                 %if "%{?support_knox}" == "ON" \
151                 -DSUPPORT_KNOX:BOOL=ON \\\
152                 %else \
153                 -DSUPPORT_KNOX:BOOL=OFF \\\
154                 %endif \
155                 %if "%{?_ux_define}" == "tizen2.3" \
156                 -DTIZEN_2_3_UX:BOOL=ON \\\
157                 %endif \
158                 -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \\\
159                 -DHTTP_LIB=%{_http_lib} \\\
160                 %if "%{?_lib}" == "lib64" \
161                 %{?_cmake_lib_suffix64} \\\
162                 %endif \
163                 %{?_cmake_skip_rpath} \\\
164                 -DBUILD_SHARED_LIBS:BOOL=ON
165
166 %build
167 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
168 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
169 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
170 %cmake . -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA
171
172 make %{?jobs:-j%jobs}
173
174 %install
175 rm -rf %{buildroot}
176 %make_install
177 %if ("%{VD_PRODUCT_TYPE}" == "AUDIO") || ("%{VD_PRODUCT_TYPE}" == "TV") || ("%{VD_PRODUCT_TYPE}" == "LFD") || ("%{VD_PRODUCT_TYPE}" == "HTV") || ("%{VD_PRODUCT_TYPE}" == "AV")
178 mkdir -p %{buildroot}/etc/notstrip/
179 install -m 644 packaging/download-provider.notstrip %{buildroot}/etc/notstrip/download-provider.notstrip
180 %endif
181
182 #%if 0%{?sec_product_feature_container_enable}
183 mkdir -p %{buildroot}/etc/vasum/vsmzone.resource/
184 mv %{buildroot}/usr/share/download-provider/download-provider.res %{buildroot}/etc/vasum/vsmzone.resource/
185 #%endif
186
187 mkdir -p %{buildroot}%{_licensedir}
188 mkdir -p %{buildroot}/lib/systemd/system/graphical.target.wants
189 mkdir -p %{buildroot}/lib/systemd/system/sockets.target.wants
190 ln -s ../download-provider.service %{buildroot}/lib/systemd/system/graphical.target.wants/
191 ln -s ../download-provider.socket %{buildroot}/lib/systemd/system/sockets.target.wants/
192
193 #OS Upgrade
194 mkdir -p %{buildroot}%{upgrade_script_path}
195 cp -f 500.download-provider_upgrade.sh %{buildroot}%{upgrade_script_path}
196
197 %post
198 #make notify dir in post section for smack
199 mkdir %{TZ_SYS_GLOBALUSER_DATA}/download-provider
200 mkdir -p %{_notifydir}
201 chown -R web_fw:web_fw %{_notifydir}
202 chsmack -a 'System::Shared' %{_notifydir}
203 chsmack -t %{_notifydir}
204 mkdir -p --mode=0700 %{_databasedir}
205 chown -R web_fw:web_fw %{_databasedir}
206 chsmack -a 'System' %{_databasedir}
207 mkdir -p --mode=0700 %{_database_client_dir}
208 chsmack -a 'System' %{_database_client_dir}
209 chown -R web_fw:web_fw %{_database_client_dir}
210 chown -R web_fw:web_fw %{_data_install_path}
211
212 %files
213 %defattr(-,root,root,-)
214 %manifest %{_manifest_name}
215 %{_imagedir}/*.png
216 %{_localedir}/*/*/download-provider.mo
217 %{_libdir}/libdownloadagent2.so.0.1.0
218 %{_libdir}/libdownloadagent2.so
219 /lib/systemd/system/download-provider.service
220 /lib/systemd/system/graphical.target.wants/download-provider.service
221 /lib/systemd/system/download-provider.socket
222 /lib/systemd/system/sockets.target.wants/download-provider.socket
223 %{_libdir}/libdownload-provider-interface.so.%{version}
224 %{_libdir}/libdownload-provider-interface.so.0
225 %{_bindir}/%{name}
226 %{_licensedir}/%{name}
227 %attr(0544,root,root) %{_logdump_script_dir}/dump-%{name}.sh
228 #%if 0%{?sec_product_feature_container_enable}
229 %attr(0644,root,root) /etc/vasum/vsmzone.resource/download-provider.res
230 #%endif
231 %{upgrade_script_path}/500.download-provider_upgrade.sh
232 %if ("%{VD_PRODUCT_TYPE}" == "AUDIO") || ("%{VD_PRODUCT_TYPE}" == "TV") || ("%{VD_PRODUCT_TYPE}" == "LFD") || ("%{VD_PRODUCT_TYPE}" == "HTV") || ("%{VD_PRODUCT_TYPE}" == "AV")
233 /etc/notstrip/download-provider.notstrip
234 %endif
235
236 %files devel
237 %defattr(-,root,root,-)
238 %{_libdir}/libdownload-provider-interface.so
239 %{_includedir}/download-provider/download-provider.h
240 %{_includedir}/download-provider/download-provider-interface.h
241 %{_bindir}/%{name}
242 %{_libdir}/pkgconfig/download-provider.pc
243 %{_libdir}/pkgconfig/download-provider-interface.pc