[Release] wrt-commons_0.2.68
[framework/web/wrt-commons.git] / packaging / wrt-commons.spec
1 #git:slp/pkgs/w/wrt-commons wrt-commons 0.2.68
2 Name:       wrt-commons
3 Summary:    Wrt common library
4 Version:    0.2.68
5 Release:    1
6 Group:      Development/Libraries
7 License:    Apache License, Version 2.0
8 URL:        N/A
9 Source0:    %{name}-%{version}.tar.gz
10 BuildRequires:  cmake
11 BuildRequires:  pkgconfig(ecore)
12 BuildRequires:  pkgconfig(appcore-efl)
13 BuildRequires:  pkgconfig(libssl)
14 BuildRequires:  pkgconfig(sqlite3)
15 BuildRequires:  pkgconfig(dlog)
16 BuildRequires:  pkgconfig(glib-2.0)
17 BuildRequires:  pkgconfig(gio-2.0)
18 BuildRequires:  pkgconfig(db-util)
19 BuildRequires:  pkgconfig(zlib)
20 BuildRequires:  pkgconfig(libpcrecpp)
21 BuildRequires:  pkgconfig(icu-i18n)
22 BuildRequires:  pkgconfig(libxml-2.0)
23 BuildRequires:  pkgconfig(openssl)
24 BuildRequires:  pkgconfig(libiri)
25 BuildRequires:  pkgconfig(libidn)
26
27 %description
28 Wrt common library
29
30 %package devel
31 Summary:    Wrt common library development headers
32 Group:      Development/Libraries
33 Requires:   %{name} = %{version}
34
35 %description devel
36 Wrt common library development headers
37
38 %prep
39 %setup -q
40
41 %build
42 export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
43
44 cmake . -DVERSION=%{version} \
45         -DDPL_LOG="OFF"      \
46         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
47         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}
48 make %{?jobs:-j%jobs}
49
50 %install
51 mkdir -p %{buildroot}/usr/share/license
52 cp %{name} %{buildroot}/usr/share/license/
53 %make_install
54
55 %clean
56 rm -rf %{buildroot}
57
58 %post
59 mkdir -p /opt/share/widget/system
60 mkdir -p /opt/share/widget/user
61 mkdir -p /opt/share/widget/exec
62 mkdir -p /opt/share/widget/data/Public
63 mkdir -p /usr/lib/wrt-plugins
64
65 if [ -z ${2} ]; then
66     echo "This is new install of wrt-commons"
67     echo "Calling /usr/bin/wrt_commons_reset_db.sh"
68     /usr/bin/wrt_commons_reset_db.sh
69 else
70     # Find out old and new version of databases
71     WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"`
72     WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
73     echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
74     echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
75
76     if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} ]
77     then
78         if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} ]
79         then
80             echo "Equal database detected so db installation ignored"
81         else
82             echo "Calling /usr/bin/wrt_commons_reset_db.sh"
83             /usr/bin/wrt_commons_reset_db.sh
84         fi
85     else
86         echo "Calling /usr/bin/wrt_commons_reset_db.sh"
87         /usr/bin/wrt_commons_reset_db.sh
88     fi
89 fi
90
91 mkdir -p /usr/etc/ace
92 mkdir -p /usr/apps/org.tizen.policy
93
94 # DBUS services fix
95 # WARNING: THIS IS TEMPORARY SOLUTION, AS THIS SHOULD NOT BE OUR
96 # RESPONSIBILITY!!! WE HAVE TO CONTACT TO DBUS MAINAINERS
97
98 if [ -f /var/lib/dbus/machine-id ]; then
99     echo "machine-id exists"
100 else
101     if [ -f /usr/var/lib/dbus/machine-id ]; then
102         echo "machine-id exists"
103     else
104         echo "Creating machine-id"
105         mkdir -p /usr/var/lib/dbus/
106         dbus-uuidgen > /usr/var/lib/dbus/machine-id
107         dbus-uuidgen --ensure=/usr/var/lib/dbus/machine-id
108     fi
109     mkdir -p /var/lib/dbus/
110     cp /usr/var/lib/dbus/machine-id /var/lib/dbus/
111 fi
112
113 # Set Smack label for db files
114 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
115 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
116 chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db
117 chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db-journal
118
119 echo "[WRT] wrt-commons postinst done ..."
120
121 %files
122 %manifest wrt-commons.manifest
123 %{_libdir}/*.so
124 %{_libdir}/*.so.*
125 /usr/share/wrt-engine/*
126 %attr(775,root,root) %{_bindir}/wrt_commons_reset_db.sh
127 %attr(775,root,root) %{_bindir}/wrt_commons_create_clean_db.sh
128 %{_datadir}/license/%{name}
129
130 %files devel
131 %{_includedir}/dpl-efl/*
132 %{_libdir}/pkgconfig/*.pc