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