cf92fb0c465e1df7b7726baedf251132fca7d093
[framework/web/wrt-commons.git] / packaging / wrt-commons.spec
1 #git:framework/web/wrt-commons wrt-commons 0.2.98
2 Name:       wrt-commons
3 Summary:    Wrt common library
4 Version:    0.2.98
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 BuildRequires:  libcryptsvc-devel
27 BuildRequires:  dukgenerator-devel
28 Requires: libcryptsvc
29
30 %description
31 Wrt common library
32
33 %package devel
34 Summary:    Wrt common library development headers
35 Group:      Development/Libraries
36 Requires:   %{name} = %{version}
37
38 %description devel
39 Wrt common library development headers
40
41 %prep
42 %setup -q
43
44 %define with_tests 0
45 %if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1"
46     %define with_tests 1
47 %endif
48
49 %build
50
51 export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
52
53 cmake . -DVERSION=%{version} \
54         -DDPL_LOG="OFF"      \
55         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
56         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
57         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
58 make %{?jobs:-j%jobs}
59
60 %install
61 mkdir -p %{buildroot}/usr/share/license
62 cp %{name} %{buildroot}/usr/share/license/
63 %make_install
64
65 %clean
66 rm -rf %{buildroot}
67
68 %post
69 mkdir -p /opt/share/widget/system
70 mkdir -p /opt/share/widget/user
71 mkdir -p /opt/share/widget/exec
72 mkdir -p /opt/share/widget/data/Public
73 mkdir -p /usr/lib/wrt-plugins
74
75 if [ -z ${2} ]; then
76     echo "This is new install of wrt-commons"
77     echo "Calling /usr/bin/wrt_commons_reset_db.sh"
78     /usr/bin/wrt_commons_reset_db.sh
79 else
80     # Find out old and new version of databases
81     WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"`
82     WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
83     echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
84     echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
85
86     if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} ]
87     then
88         if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} ]
89         then
90             echo "Equal database detected so db installation ignored"
91         else
92             echo "Calling /usr/bin/wrt_commons_reset_db.sh"
93             /usr/bin/wrt_commons_reset_db.sh
94         fi
95     else
96         echo "Calling /usr/bin/wrt_commons_reset_db.sh"
97         /usr/bin/wrt_commons_reset_db.sh
98     fi
99 fi
100
101 mkdir -p /usr/etc/ace
102 mkdir -p /usr/apps/org.tizen.policy
103
104 # DBUS services fix
105 # WARNING: THIS IS TEMPORARY SOLUTION, AS THIS SHOULD NOT BE OUR
106 # RESPONSIBILITY!!! WE HAVE TO CONTACT TO DBUS MAINAINERS
107
108 if [ -f /var/lib/dbus/machine-id ]; then
109     echo "machine-id exists"
110 else
111     if [ -f /usr/var/lib/dbus/machine-id ]; then
112         echo "machine-id exists"
113     else
114         echo "Creating machine-id"
115         mkdir -p /usr/var/lib/dbus/
116         dbus-uuidgen > /usr/var/lib/dbus/machine-id
117         dbus-uuidgen --ensure=/usr/var/lib/dbus/machine-id
118     fi
119     mkdir -p /var/lib/dbus/
120     cp /usr/var/lib/dbus/machine-id /var/lib/dbus/
121 fi
122
123 # Set Smack label for db files
124 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
125 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
126 chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db
127 chsmack -a 'wrt-commons::db_wrt_autosave' /opt/dbspace/.wrt_autosave.db-journal
128 chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/dbspace/.wrt_custom_handler.db
129 chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/dbspace/.wrt_custom_handler.db-journal
130
131 echo "[WRT] wrt-commons postinst done ..."
132
133 %files
134 %manifest wrt-commons.manifest
135 %{_libdir}/*.so
136 %{_libdir}/*.so.*
137 %{_datadir}/wrt-engine/*
138 %{_datadir}/license/%{name}
139 %attr(755,root,root) %{_bindir}/wrt_commons_create_clean_db.sh
140 %attr(755,root,root) %{_bindir}/wrt_commons_reset_db.sh
141 %if %{with_tests}
142     %attr(755,root,root) %{_bindir}/dpl-tests-*
143     %attr(755,root,root) %{_bindir}/dpl-dbus-test-service
144     %attr(755,root,root) %{_bindir}/wrt-tests-*
145     %attr(755,root,root) %{_bindir}/wrt_dao_tests_prepare_db.sh
146     %{_datadir}/dbus-1/services/org.tizen.DBusTestService.service
147     /opt/share/wrt/wrt-commons/tests/*
148 %endif
149
150 %files devel
151 %{_includedir}/dpl-efl/*
152 %{_libdir}/pkgconfig/*.pc