[CID-835380] Access shared data with holding a mutex lock
[platform/framework/web/download-provider.git] / packaging / download-provider.spec
1 Name:       download-provider
2 Summary:    Download the contents in background
3 Version:    2.1.112
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-daemon)
27 BuildRequires:  pkgconfig(capi-network-wifi-direct)
28 BuildRequires:  pkgconfig(storage)
29 BuildRequires:  pkgconfig(notification)
30 BuildRequires:  pkgconfig(cynara-client)
31 BuildRequires:  pkgconfig(cynara-client-async)
32 BuildRequires:  pkgconfig(cynara-creds-socket)
33 BuildRequires:  pkgconfig(cynara-creds-dbus)
34 BuildRequires:  pkgconfig(tpkp-curl)
35 BuildRequires:  pkgconfig(libtzplatform-config)
36
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
68 %build
69 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
70 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
71 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
72
73 %if 0%{?gcov:1}
74 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
75 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
76 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
77 export LDFLAGS+=" -lgcov"
78 %endif
79
80 %cmake -DTZ_SYS_GLOBALUSER_DATA=%TZ_SYS_GLOBALUSER_DATA \
81         -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
82         -DBIN_INSTALL_DIR:PATH=%{_bindir} \
83         -DLIB_INSTALL_DIR:PATH=%{_libdir} \
84         -DLIB_AGENT_PATH="/usr/%{?_lib}/libdownloadagent2.so.0.1.0" \
85         -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
86         -DPKG_NAME=%{name} \
87         -DPKG_VERSION=%{version} \
88         -DPKG_RELEASE=%{release} \
89         -DIPC_SOCKET:PATH=%{_ipc_socket} \
90         -DPROVIDER_DIR:PATH=%{_data_install_path} \
91         -DNOTIFY_DIR:PATH=%{_notifydir} \
92         -DDATABASE_DIR:PATH=%{_databasedir} \
93         -DDATABASE_CLIENT_DIR:PATH=%{_database_client_dir} \
94         -DIMAGE_DIR:PATH=%{_imagedir} \
95         -DLOCALE_DIR:PATH=%{_localedir} \
96         -DSUPPORT_WIFI_DIRECT:BOOL=OFF \
97         -DSUPPORT_DOWNLOAD_BOOSTER:BOOL=OFF \
98         -DSUPPORT_NOTIFICATION:BOOL=ON \
99         -DSUPPORT_LOG_MESSAGE:BOOL=ON \
100         -DSUPPORT_OMA_DRM:BOOL=OFF \
101         -DSUPPORT_COMPANION_MODE:BOOL=OFF \
102         -DTIZEN_2_3_UX:BOOL=ON \
103         -DCMAKE_LOG_DUMP_SCRIPT_DIR=%{_logdump_script_dir} \
104         -DHTTP_LIB=%{_http_lib} \
105 %if "%{?_lib}" == "lib64"
106         %{?_cmake_lib_suffix64} \
107 %endif
108         %{?_cmake_skip_rpath} \
109         -DBUILD_SHARED_LIBS:BOOL=ON \
110         -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
111         -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
112         .
113
114 make %{?jobs:-j%jobs}
115
116 %install
117 rm -rf %{buildroot}
118 %make_install
119 %if "%{?tizen_profile_name}" == "tv"
120 mkdir -p %{buildroot}/etc/notstrip/
121 install -m 644 packaging/download-provider.notstrip %{buildroot}/etc/notstrip/download-provider.notstrip
122 %endif
123
124 ## container_enable
125 mkdir -p %{buildroot}/etc/vasum/vsmzone.resource/
126 mv %{buildroot}/usr/share/download-provider/download-provider.res %{buildroot}/etc/vasum/vsmzone.resource/
127
128 mkdir -p %{buildroot}/lib/systemd/system/graphical.target.wants
129 mkdir -p %{buildroot}/lib/systemd/system/sockets.target.wants
130 ln -s ../download-provider.service %{buildroot}/lib/systemd/system/graphical.target.wants/
131 ln -s ../download-provider.socket %{buildroot}/lib/systemd/system/sockets.target.wants/
132
133 %post
134 #make notify dir in post section for smack
135 mkdir %{TZ_SYS_GLOBALUSER_DATA}/download-provider
136 mkdir -p %{_notifydir}
137 chown -R web_fw:web_fw %{_notifydir}
138 chsmack -a 'System::Shared' %{_notifydir}
139 chsmack -t %{_notifydir}
140 mkdir -p --mode=0700 %{_databasedir}
141 chown -R web_fw:web_fw %{_databasedir}
142 chsmack -a 'System' %{_databasedir}
143 mkdir -p --mode=0700 %{_database_client_dir}
144 chsmack -a 'System' %{_database_client_dir}
145 chown -R web_fw:web_fw %{_database_client_dir}
146 chown -R web_fw:web_fw %{_data_install_path}
147
148 %files
149 %defattr(-,root,root,-)
150 %manifest %{_manifest_name}
151 %{_imagedir}/*.png
152 %{_localedir}/*/*/download-provider.mo
153 %{_libdir}/*.so.*
154 /lib/systemd/system/download-provider.service
155 /lib/systemd/system/graphical.target.wants/download-provider.service
156 /lib/systemd/system/download-provider.socket
157 /lib/systemd/system/sockets.target.wants/download-provider.socket
158 %{_bindir}/%{name}
159 %attr(0544,root,root) %{_logdump_script_dir}/dump-%{name}.sh
160 ## container_enable
161 %attr(0644,root,root) /etc/vasum/vsmzone.resource/download-provider.res
162 %if "%{?tizen_profile_name}" == "tv"
163 /etc/notstrip/download-provider.notstrip
164 %endif
165 %license LICENSE.APLv2
166
167 %files devel
168 %defattr(-,root,root,-)
169 %{_bindir}/%{name}
170 %{_libdir}/*.so
171 %{_libdir}/pkgconfig/download-provider.pc
172 %{_libdir}/pkgconfig/download-provider-interface.pc
173 %{_libdir}/pkgconfig/download-agent.pc
174 %{_includedir}/download-provider/download-provider.h
175 %{_includedir}/download-provider/download-provider-interface.h
176 %{_includedir}/download-provider/download-agent-interface.h
177
178 %if 0%{?gtests:1}
179 %{_bindir}/gtest*
180 %endif