207a9052247e450d5b5e97762ac3d5e2a37ce86c
[platform/framework/web/download-provider.git] / packaging / download-provider.spec
1
2 Name:       download-provider
3 Summary:    Download the contents in background
4 Version:    1.0.5
5 Release:    9
6 Group:      Development/Libraries
7 License:    Apache License, Version 2.0
8 Source0:    %{name}-%{version}.tar.gz
9 Source1:    download-provider.service
10 Requires(post): /usr/bin/sqlite3
11 BuildRequires:  cmake
12 BuildRequires:  pkgconfig(glib-2.0)
13 BuildRequires:  pkgconfig(gobject-2.0)
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(libsoup-2.4)
16 BuildRequires:  pkgconfig(xdgmime)
17 BuildRequires:  pkgconfig(vconf)
18 BuildRequires:  pkgconfig(db-util)
19 BuildRequires:  pkgconfig(sqlite3)
20 BuildRequires:  pkgconfig(bundle)
21 BuildRequires:  pkgconfig(capi-base-common)
22 BuildRequires:  pkgconfig(capi-appfw-app-manager)
23 BuildRequires:  pkgconfig(capi-network-connection)
24 BuildRequires:  pkgconfig(notification)
25 BuildRequires:  pkgconfig(appsvc)
26 BuildRequires:  pkgconfig(dbus-1)
27 BuildRequires:  pkgconfig(wifi-direct)
28 Requires(post): /sbin/ldconfig
29 Requires(postun): /sbin/ldconfig
30 %description
31 Description: download the contents in background
32
33 %package devel
34 Summary:    Download-provider
35 Group:      Development/Libraries
36 Requires:   %{name} = %{version}-%{release}
37
38 %description devel
39 Description: download the contents in background (developement files)
40
41 %prep
42 %setup -q
43
44 %define _imagedir /usr/share/download-provider
45 %define _databasedir /opt/usr/dbspace
46 %define _databasefile %{_databasedir}/.download-provider.db
47 %define _dbusservicedir /usr/share/dbus-1/services
48 %define _licensedir /usr/share/license
49
50 %define cmake \
51         CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -fvisibility=hidden"; export CFLAGS \
52         FFLAGS="${FFLAGS:-%optflags} -fPIC -fvisibility=hidden"; export FFLAGS \
53         LDFLAGS+=" -Wl,--as-needed -Wl,--hash-style=both"; export LDFLAGS \
54         %__cmake \\\
55                 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
56                 -DBIN_INSTALL_DIR:PATH=%{_bindir} \\\
57                 -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
58                 -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
59                 -DPKG_NAME=%{name} \\\
60                 -DPKG_VERSION=%{version} \\\
61                 -DPKG_RELEASE=%{release} \\\
62                 -DIMAGE_DIR:PATH=%{_imagedir} \\\
63                 -DDATABASE_FILE:PATH=%{_databasefile} \\\
64                 -DDBUS_SERVICE_DIR:PATH=%{_dbusservicedir} \\\
65                 -DLICENSE_DIR:PATH=%{_licensedir} \\\
66                 -DSUPPORT_DBUS_SYSTEM:BOOL=ON \\\
67                 -DSUPPORT_WIFI_DIRECT:BOOL=OFF \\\
68                 -DSUPPORT_LOG_MESSAGE:BOOL=ON \\\
69                 -DSUPPORT_CHECK_IPC:BOOL=ON \\\
70                 %if "%{?_lib}" == "lib64" \
71                 %{?_cmake_lib_suffix64} \\\
72                 %endif \
73                 %{?_cmake_skip_rpath} \\\
74                 -DBUILD_SHARED_LIBS:BOOL=ON
75
76 %build
77 %cmake .
78 make %{?jobs:-j%jobs}
79
80 %install
81 rm -rf %{buildroot}
82 %make_install
83 mkdir -p %{buildroot}%{_licensedir}
84 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc3.d
85 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service  %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
86 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc5.d
87 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service  %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
88
89 mkdir -p %{buildroot}/%{_unitdir_user}/tizen-middleware.target.wants
90 install %{SOURCE1} %{buildroot}/%{_unitdir_user}/
91 ln -s ../download-provider.service %{buildroot}/%{_unitdir_user}/tizen-middleware.target.wants/
92
93 mkdir -p %{buildroot}/opt/data/%{name}
94 mkdir -p %{buildroot}%{_databasedir}
95 if [ ! -f %{buildroot}%{_databasefile} ];
96 then
97 sqlite3 %{buildroot}%{_databasefile} 'PRAGMA journal_mode=PERSIST;
98 PRAGMA foreign_keys=ON;
99 CREATE TABLE logging
100 (
101 id INTEGER UNIQUE PRIMARY KEY,
102 state INTEGER DEFAULT 0,
103 errorcode INTEGER DEFAULT 0,
104 startcount INTEGER DEFAULT 0,
105 packagename TEXT DEFAULT NULL,
106 createtime DATE,
107 accesstime DATE
108 );
109
110 CREATE TABLE requestinfo
111 (
112 id INTEGER UNIQUE PRIMARY KEY,
113 auto_download BOOLEAN DEFAULT 0,
114 state_event BOOLEAN DEFAULT 0,
115 progress_event BOOLEAN DEFAULT 0,
116 noti_enable BOOLEAN DEFAULT 0,
117 network_type TINYINT DEFAULT 0,
118 filename TEXT DEFAULT NULL,
119 destination TEXT DEFAULT NULL,
120 url TEXT DEFAULT NULL,
121 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
122 );
123
124 CREATE TABLE downloadinfo
125 (
126 id INTEGER UNIQUE PRIMARY KEY,
127 http_status INTEGER DEFAULT 0,
128 content_size UNSIGNED BIG INT DEFAULT 0,
129 mimetype VARCHAR(64) DEFAULT NULL,
130 content_name TEXT DEFAULT NULL,
131 saved_path TEXT DEFAULT NULL,
132 tmp_saved_path TEXT DEFAULT NULL,
133 etag TEXT DEFAULT NULL,
134 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
135 );
136
137 CREATE TABLE httpheaders
138 (
139 id INTEGER NOT NULL,
140 header_field TEXT DEFAULT NULL,
141 header_data TEXT DEFAULT NULL,
142 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
143 );
144
145 CREATE TABLE notification
146 (
147 id INTEGER NOT NULL,
148 extra_key TEXT DEFAULT NULL,
149 extra_data TEXT DEFAULT NULL,
150 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
151 );
152
153 CREATE UNIQUE INDEX requests_index ON logging (id, state, errorcode, packagename, createtime, accesstime);
154 '
155 fi
156
157
158 %post
159 /sbin/ldconfig
160
161 %postun
162 /sbin/ldconfig
163
164
165 %files
166 %defattr(-,root,root,-)
167 %dir %attr(0775,root,app) /opt/data/%{name}
168 %manifest download-provider.manifest
169 %{_imagedir}/*.png
170 %{_libdir}/libdownloadagent2.so.0.0.1
171 %{_libdir}/libdownloadagent2.so
172 %{_unitdir_user}/download-provider.service
173 %{_unitdir_user}/tizen-middleware.target.wants/download-provider.service
174 %{_libdir}/libdownload-provider-interface.so.%{version}
175 %{_libdir}/libdownload-provider-interface.so.0
176 %{_bindir}/%{name}
177 %{_sysconfdir}/rc.d/init.d/download-provider-service
178 %{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
179 %{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
180 %{_licensedir}/%{name}
181 %{_dbusservicedir}/org.download-provider.service
182 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db
183 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db-journal
184
185 %files devel
186 %defattr(-,root,root,-)
187 %{_libdir}/libdownloadagent2.so
188 %{_libdir}/libdownload-provider-interface.so
189 %{_includedir}/download-provider/download-provider-defs.h
190 %{_includedir}/download-provider/download-provider-interface.h
191 %{_bindir}/%{name}
192 %{_libdir}/pkgconfig/download-provider.pc
193 %{_libdir}/pkgconfig/download-provider-interface.pc
194