Add cache support
[platform/framework/web/download-provider.git] / packaging / download-provider.spec
index 4274a16..1f93da3 100755 (executable)
@@ -1,11 +1,10 @@
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.1.99
+Version:    2.3.11
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Requires(post): libdevice-node
 Requires(post): sqlite
 Requires(post): connman
 Requires: security-config
@@ -24,18 +23,18 @@ BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(libcurl)
 BuildRequires:  pkgconfig(capi-content-mime-type)
 BuildRequires:  gettext-devel
-BuildRequires:  pkgconfig(libsystemd-daemon)
+BuildRequires:  pkgconfig(libsystemd)
 BuildRequires:  pkgconfig(capi-network-wifi-direct)
-BuildRequires:  pkgconfig(storage)
+%if "%{?profile}" != "wearable"
 BuildRequires:  pkgconfig(notification)
+%endif
+BuildRequires:  pkgconfig(storage)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-client-async)
 BuildRequires:  pkgconfig(cynara-creds-socket)
 BuildRequires:  pkgconfig(cynara-creds-dbus)
-BuildRequires:  pkgconfig(tpkp-curl)
 BuildRequires:  pkgconfig(libtzplatform-config)
 
-
 %if 0%{?gtests:1}
 BuildRequires:  pkgconfig(gmock)
 %endif
@@ -65,6 +64,13 @@ Description: Download the contents in background (development files)
 %define _logdump_script_dir %{TZ_SYS_ETC}/dump.d/module.d
 %define _http_lib libcurl
 %define _manifest_name %{name}.manifest
+%if "%{?tizen_profile_name}" == "tv"
+%define _ca_cert /opt/data/cert/vdca.pem
+%define _ca_path /opt/data/cert/user/
+%define max_concurrent_downloads 15
+%else
+%define max_concurrent_downloads 50
+%endif
 
 %build
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
@@ -72,6 +78,9 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 %if 0%{?gcov:1}
+export CFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export FFLAGS+=" -fprofile-arcs -ftest-coverage"
 export LDFLAGS+=" -lgcov"
 %endif
 
@@ -80,6 +89,7 @@ export LDFLAGS+=" -lgcov"
        -DBIN_INSTALL_DIR:PATH=%{_bindir} \
        -DLIB_INSTALL_DIR:PATH=%{_libdir} \
        -DLIB_AGENT_PATH="/usr/%{?_lib}/libdownloadagent2.so.0.1.0" \
+       -DLIB_CACHE_AGENT_PATH="/usr/%{?_lib}/libcacheagent.so.0.1.0" \
        -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
        -DPKG_NAME=%{name} \
        -DPKG_VERSION=%{version} \
@@ -93,11 +103,20 @@ export LDFLAGS+=" -lgcov"
        -DLOCALE_DIR:PATH=%{_localedir} \
        -DSUPPORT_WIFI_DIRECT:BOOL=OFF \
        -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \
+%if "%{?profile}" == "wearable"
+       -DSUPPORT_NOTIFICATION:BOOL=OFF \
+%else
        -DSUPPORT_NOTIFICATION:BOOL=ON \
+%endif
        -DSUPPORT_LOG_MESSAGE:BOOL=ON \
        -DSUPPORT_OMA_DRM:BOOL=OFF \
        -DSUPPORT_COMPANION_MODE:BOOL=OFF \
-       -DTIZEN_2_3_UX:BOOL=ON \
+%if "%{?profile}" == "wearable"
+       -DSUPPORT_MULTILINGUAL:BOOL=ON \
+%else
+       -DSUPPORT_MULTILINGUAL:BOOL=OFF \
+       -DMAX_CONCURRENT_DOWNLOADS=%{?max_concurrent_downloads}\
+%endif
        -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \
        -DHTTP_LIB=%{_http_lib} \
 %if "%{?_lib}" == "lib64"
@@ -106,7 +125,12 @@ export LDFLAGS+=" -lgcov"
        %{?_cmake_skip_rpath} \
        -DBUILD_SHARED_LIBS:BOOL=ON \
        -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
-        -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
+       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
+       -DSUPPORT_LARGE_FILE:BOOL=ON \
+%if "%{?tizen_profile_name}" == "tv"
+       -DCA_CERT=%{_ca_cert} \
+       -DCA_PATH=%{_ca_path} \
+%endif
        .
 
 make %{?jobs:-j%jobs}
@@ -114,18 +138,19 @@ make %{?jobs:-j%jobs}
 %install
 rm -rf %{buildroot}
 %make_install
-%if "{tizen_profile_name}" == "tv"
+%if "%{?tizen_profile_name}" == "tv"
 mkdir -p %{buildroot}/etc/notstrip/
 install -m 644 packaging/download-provider.notstrip %{buildroot}/etc/notstrip/download-provider.notstrip
 %endif
 
+mkdir -p %{buildroot}/var/lib/download-provider/
+install -m 600 res/var/lib/download-provider/settings %{buildroot}/var/lib/download-provider/settings
+
 ## container_enable
 mkdir -p %{buildroot}/etc/vasum/vsmzone.resource/
 mv %{buildroot}/usr/share/download-provider/download-provider.res %{buildroot}/etc/vasum/vsmzone.resource/
 
-mkdir -p %{buildroot}/lib/systemd/system/graphical.target.wants
 mkdir -p %{buildroot}/lib/systemd/system/sockets.target.wants
-ln -s ../download-provider.service %{buildroot}/lib/systemd/system/graphical.target.wants/
 ln -s ../download-provider.socket %{buildroot}/lib/systemd/system/sockets.target.wants/
 
 %post
@@ -142,6 +167,9 @@ mkdir -p --mode=0700 %{_database_client_dir}
 chsmack -a 'System' %{_database_client_dir}
 chown -R web_fw:web_fw %{_database_client_dir}
 chown -R web_fw:web_fw %{_data_install_path}
+chown -R web_fw:web_fw /var/lib/download-provider/
+mkdir -p /opt/usr/data/download_cache
+chown -R web_fw:web_fw /opt/usr/data/download_cache
 
 %files
 %defattr(-,root,root,-)
@@ -149,15 +177,15 @@ chown -R web_fw:web_fw %{_data_install_path}
 %{_imagedir}/*.png
 %{_localedir}/*/*/download-provider.mo
 %{_libdir}/*.so.*
+%attr(0600,web_fw,web_fw) /var/lib/download-provider/settings
 /lib/systemd/system/download-provider.service
-/lib/systemd/system/graphical.target.wants/download-provider.service
 /lib/systemd/system/download-provider.socket
 /lib/systemd/system/sockets.target.wants/download-provider.socket
 %{_bindir}/%{name}
 %attr(0544,root,root) %{_logdump_script_dir}/dump-%{name}.sh
 ## container_enable
 %attr(0644,root,root) /etc/vasum/vsmzone.resource/download-provider.res
-%if "{tizen_profile_name}" == "tv"
+%if "%{?tizen_profile_name}" == "tv"
 /etc/notstrip/download-provider.notstrip
 %endif
 %license LICENSE.APLv2
@@ -169,9 +197,11 @@ chown -R web_fw:web_fw %{_data_install_path}
 %{_libdir}/pkgconfig/download-provider.pc
 %{_libdir}/pkgconfig/download-provider-interface.pc
 %{_libdir}/pkgconfig/download-agent.pc
+%{_libdir}/pkgconfig/cache-agent.pc
 %{_includedir}/download-provider/download-provider.h
 %{_includedir}/download-provider/download-provider-interface.h
 %{_includedir}/download-provider/download-agent-interface.h
+%{_includedir}/download-provider/cache-agent-interface.h
 
 %if 0%{?gtests:1}
 %{_bindir}/gtest*