Fixed build on x86_64.
[platform/core/appfw/badge.git] / packaging / badge.spec
1 %define DBDIR "/opt/dbspace"
2 Name:       badge
3 Summary:    badge library
4 Version:    0.0.2
5 Release:    2
6 Group:      TBD
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: cmake
14 Requires(post): /sbin/ldconfig
15 requires(postun): /sbin/ldconfig
16 %description
17 Badge library.
18
19 %prep
20 %setup -q
21
22 %package devel
23 Summary:    Badge library (devel)
24 Group:      Development/Libraries
25 Requires:   %{name} = %{version}-%{release}
26
27 %description devel
28 Badge library (devel).
29
30 %build
31 export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--as-needed"
32 LDFLAGS="$LDFLAGS" %cmake . 
33 make %{?jobs:-j%jobs}
34
35 %install
36 %make_install
37
38 mkdir -p %{buildroot}/usr/share/license
39 cp -f LICENSE.APLv2.0 %{buildroot}/usr/share/license/%{name}
40
41
42 %post
43 /sbin/ldconfig
44
45 if [ ! -d %{DBDIR} ]
46 then
47         mkdir -p %{DBDIR}
48 fi
49
50 if [ ! -f %{DBDIR}/.%{name}.db ]
51 then
52         sqlite3 %{DBDIR}/.%{name}.db 'PRAGMA journal_mode = PERSIST;
53                 create table if not exists badge_data (
54                         pkgname TEXT NOT NULL,
55                         writable_pkgs TEXT,
56                         badge INTEGER default 0,
57                         rowid INTEGER PRIMARY KEY AUTOINCREMENT,
58                         UNIQUE (pkgname)
59                 );
60                 create table if not exists badge_option (
61                         pkgname TEXT NOT NULL,
62                         display INTEGER default 1,
63                         UNIQUE (pkgname)
64                 );
65         '
66 fi
67
68 chown :5000 %{DBDIR}/.%{name}.db
69 chown :5000 %{DBDIR}/.%{name}.db-journal
70 chmod 660 %{DBDIR}/.%{name}.db
71 chmod 660 %{DBDIR}/.%{name}.db-journal
72
73 %postun -p /sbin/ldconfig
74
75 %files
76 %manifest badge.manifest
77 %defattr(-,root,root,-)
78 %{_libdir}/lib%{name}.so*
79 /usr/share/license/%{name}
80
81 %files devel
82 %defattr(-,root,root,-)
83 %{_includedir}/%{name}/*.h
84 %{_libdir}/pkgconfig/%{name}.pc
85