1. Move db file to /usr/dbspace
[platform/core/appfw/badge.git] / packaging / badge.spec
1 %define DBDIR "/usr/dbspace"
2 Name:       badge
3 Summary:    badge library
4 Version:    0.0.16
5 Release:    1
6 Group:      Applications/Core Applications
7 License:    Apache-2.0
8 Source0:    %{name}-%{version}.tar.gz
9 BuildRequires: pkgconfig(aul)
10 BuildRequires: pkgconfig(dbus-1)
11 BuildRequires: pkgconfig(dbus-glib-1)
12 BuildRequires: pkgconfig(dlog)
13 BuildRequires: pkgconfig(vconf)
14 BuildRequires: pkgconfig(com-core)
15 BuildRequires: pkgconfig(capi-appfw-package-manager)
16 BuildRequires: pkgconfig(db-util)
17 BuildRequires: cmake
18 Requires(post): /sbin/ldconfig
19 requires(postun): /sbin/ldconfig
20 %description
21 Client/Server library for updating badge information
22
23 %prep
24 %setup -q
25
26 %package devel
27 Summary:    Badge library (devel)
28 Group:      Development/Libraries
29 Requires:   %{name} = %{version}-%{release}
30
31 %description devel
32 Development files needed to build software that needs to system a system badge.
33
34 %package service-devel
35 Summary:    Badge library (service-devel)
36 Group:      Development/Libraries
37 Requires:   %{name} = %{version}-%{release}
38
39 %description service-devel
40 Development files needed to build badge service
41
42 %build
43 %if 0%{?tizen_build_binary_release_type_eng}
44 export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
45 export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
46 export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
47 %endif
48 %if 0%{?sec_build_binary_debug_enable}
49 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
50 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
51 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
52 %endif
53 export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
54 LDFLAGS="$LDFLAGS" %cmake .
55 make %{?jobs:-j%jobs}
56
57 %install
58 %make_install
59
60 mkdir -p %{buildroot}/usr/share/license
61 cp -f LICENSE %{buildroot}/usr/share/license/%{name}
62
63
64 %post
65 /sbin/ldconfig
66
67 if [ ! -d %{DBDIR} ]
68 then
69         mkdir -p %{DBDIR}
70 fi
71
72 if [ ! -f %{DBDIR}/.%{name}.db ]
73 then
74         sqlite3 %{DBDIR}/.%{name}.db 'PRAGMA journal_mode = PERSIST;
75                 create table if not exists badge_data (
76                         pkgname TEXT NOT NULL,
77                         writable_pkgs TEXT,
78                         badge INTEGER default 0,
79                         rowid INTEGER PRIMARY KEY AUTOINCREMENT,
80                         UNIQUE (pkgname)
81                 );
82                 create table if not exists badge_option (
83                         pkgname TEXT NOT NULL,
84                         display INTEGER default 1,
85                         UNIQUE (pkgname)
86                 );
87         '
88 fi
89
90 chown :5000 %{DBDIR}/.%{name}.db
91 chown :5000 %{DBDIR}/.%{name}.db-journal
92 chmod 644 %{DBDIR}/.%{name}.db
93 chmod 644 %{DBDIR}/.%{name}.db-journal
94
95 %postun -p /sbin/ldconfig
96
97 %files
98 %manifest badge.manifest
99 %defattr(-,root,root,-)
100 %{_libdir}/libbadge.so*
101 %{_datarootdir}/license/%{name}
102
103 %files devel
104 %defattr(-,root,root,-)
105 %{_includedir}/badge/badge.h
106 %{_includedir}/badge/badge_error.h
107 %{_includedir}/badge/badge_internal.h
108 %{_libdir}/pkgconfig/%{name}.pc
109
110 %files service-devel
111 %defattr(-,root,root,-)
112 %{_includedir}/badge/service/badge_db.h
113 %{_includedir}/badge/service/badge_setting_service.h
114 %{_libdir}/pkgconfig/badge-service.pc