tizen 2.3.1 release
[framework/web/wearable/wrt-commons.git] / packaging / wrt-commons.spec
1 #git:framework/web/wrt-commons
2 Name:       wrt-commons
3 Summary:    Wrt common library
4 Version:    0.2.196_w8
5 Release:    1
6 Group:      Development/Libraries
7 License:    Apache-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(capi-appfw-application)
14 BuildRequires:  pkgconfig(libssl)
15 BuildRequires:  pkgconfig(sqlite3)
16 BuildRequires:  pkgconfig(dlog)
17 BuildRequires:  pkgconfig(glib-2.0)
18 BuildRequires:  pkgconfig(gio-2.0)
19 BuildRequires:  pkgconfig(db-util)
20 BuildRequires:  pkgconfig(zlib)
21 BuildRequires:  pkgconfig(libpcrecpp)
22 BuildRequires:  pkgconfig(icu-i18n)
23 BuildRequires:  pkgconfig(libxml-2.0)
24 BuildRequires:  pkgconfig(openssl)
25 BuildRequires:  pkgconfig(libiri)
26 BuildRequires:  pkgconfig(libidn)
27 BuildRequires:  pkgconfig(minizip)
28 BuildRequires:  boost-devel
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 Requires:   boost-devel
38
39 %description devel
40 Wrt common library development headers
41
42 %prep
43 %setup -q
44
45 %define with_tests 0
46 %if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1"
47     %define with_tests 1
48 %endif
49
50 %define with_child 0
51 %if "%{WITH_CHILD}" == "ON" || "%{WITH_CHILD}" == "Y" || "%{WITH_CHILD}" == "YES" || "%{WITH_CHILD}" == "TRUE" || "%{WITH_CHILD}" == "1"
52     %define with_child 1
53 %endif
54
55 %build
56 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
57 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
58 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
59
60 export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
61
62 cmake . -DVERSION=%{version} \
63         -DDPL_LOG="OFF"      \
64         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
65         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
66         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} \
67         %{?WITH_CHILD:-DWITH_CHILD=%WITH_CHILD}
68 make %{?jobs:-j%jobs}
69
70 %install
71 mkdir -p %{buildroot}/usr/share/license
72 cp LICENSE %{buildroot}/usr/share/license/%{name}
73 %make_install
74
75 %clean
76 rm -rf %{buildroot}
77
78 %post
79 mkdir -p /opt/share/widget/system
80 mkdir -p /opt/share/widget/user
81 mkdir -p /opt/share/widget/exec
82 mkdir -p /opt/share/widget/data/Public
83 mkdir -p /usr/lib/wrt-plugins
84
85 #Don't reset DB when install on QEMU (during other packages building witch GBS)
86 if [ -z "$EMULATOR_ARCHS" ]; then
87     if [ -z ${2} ]; then
88         echo "This is new install of wrt-commons"
89         echo "Calling /usr/bin/wrt_commons_reset_db.sh"
90         /usr/bin/wrt_commons_reset_db.sh
91     else
92         # Find out old and new version of databases
93         WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"`
94         WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
95         echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
96         echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
97
98         if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} ]
99         then
100             if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} ]
101             then
102                 echo "Equal database detected so db installation ignored"
103             else
104                 echo "Calling /usr/bin/wrt_commons_reset_db.sh"
105                 /usr/bin/wrt_commons_reset_db.sh
106             fi
107         else
108             echo "Calling /usr/bin/wrt_commons_reset_db.sh"
109             /usr/bin/wrt_commons_reset_db.sh
110         fi
111     fi
112 fi
113
114 mkdir -p /usr/etc/ace
115 mkdir -p /usr/apps/org.tizen.policy
116
117 # Set Smack label for db files
118 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
119 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
120 chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db
121 chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db-journal
122 chsmack -a '*' /opt/usr/dbspace/.wrt_i18n.db
123 chsmack -a '*' /opt/usr/dbspace/.wrt_i18n.db-journal
124
125 echo "[WRT] wrt-commons postinst done ..."
126
127 %files
128 %manifest wrt-commons.manifest
129 %{_libdir}/*.so
130 %{_libdir}/*.so.*
131 %{_datadir}/wrt-engine/*
132 %{_datadir}/license/%{name}
133 %attr(755,root,root) %{_bindir}/wrt_commons_create_clean_db.sh
134 %attr(755,root,root) %{_bindir}/wrt_commons_reset_db.sh
135 %if %{with_tests}
136     %attr(755,root,root) %{_bindir}/wrt-commons-tests-*
137     %attr(755,root,root) %{_bindir}/wrt_dao_tests_prepare_db.sh
138     %attr(755,root,root) %{_bindir}/wrt_db_localization_prepare.sh
139     %{_datadir}/dbus-1/services/org.tizen.DBusTestService.service
140     /opt/share/wrt/wrt-commons/tests/*
141     /opt/share/widget/tests/localization/*
142 %endif
143
144 %files devel
145 %{_includedir}/dpl-efl/*
146 %{_libdir}/pkgconfig/*.pc