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