Initialize Tizen 2.3
[framework/web/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_w7
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:  pkgconfig(minizip)
27 %if "%{_repository}" == "wearable"
28 BuildRequires:  boost-devel
29 %endif
30
31 %description
32 Wrt common library
33
34 %package devel
35 Summary:    Wrt common library development headers
36 Group:      Development/Libraries
37 Requires:   %{name} = %{version}
38 %if "%{_repository}" == "wearable"
39 Requires:   boost-devel
40 %endif
41
42 %description devel
43 Wrt common library development headers
44
45 %prep
46 %setup -q
47
48 %define with_tests 0
49 %if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1"
50     %define with_tests 1
51 %endif
52
53 %define with_child 0
54 %if "%{WITH_CHILD}" == "ON" || "%{WITH_CHILD}" == "Y" || "%{WITH_CHILD}" == "YES" || "%{WITH_CHILD}" == "TRUE" || "%{WITH_CHILD}" == "1"
55     %define with_child 1
56 %endif
57
58 %if "%{CARD_VIEWER_SUPPORT}" == "ON" || "%{CARD_VIEWER_SUPPORT}" == "Y" || "%{CARD_VIEWER_SUPPORT}" == "YES" || "%{CARD_VIEWER_SUPPORT}" == "TRUE" || "%{CARD_VIEWER_SUPPORT}" == "1"
59     %define CARD_VIEWER_SUPPORT 1
60 %endif
61
62 %build
63 %if 0%{?sec_build_binary_debug_enable}
64 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
65 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
66 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
67 %endif
68
69 %if "%{_repository}" == "wearable"
70 ln -sf build_wearable build
71 ln -sf etc_wearable etc
72 ln -sf modules_wearable modules
73 %else
74 ln -sf build_mobile build
75 ln -sf etc_mobile etc
76 ln -sf modules_mobile modules
77 %endif
78
79 export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
80
81 cmake . -DVERSION=%{version} \
82         -DDPL_LOG="OFF"      \
83         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
84         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
85         %{?CARD_VIEWER_SUPPORT:-DCARD_VIEWER_SUPPORT=%CARD_VIEWER_SUPPORT} \
86         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} \
87         %{?WITH_CHILD:-DWITH_CHILD=%WITH_CHILD}
88 make %{?jobs:-j%jobs}
89
90 %install
91 mkdir -p %{buildroot}/usr/share/license
92 cp LICENSE %{buildroot}/usr/share/license/%{name}
93 %make_install
94
95 %clean
96 rm -rf %{buildroot}
97
98 %post
99 mkdir -p /opt/share/widget/system
100 mkdir -p /opt/share/widget/user
101 mkdir -p /opt/share/widget/exec
102 mkdir -p /opt/share/widget/data/Public
103 mkdir -p /usr/lib/wrt-plugins
104
105 #Don't reset DB when install on QEMU (during other packages building witch GBS)
106 if [ -z "$BUILD_ARCH" ]; then
107     if [ -z ${2} ]; then
108         echo "This is new install of wrt-commons"
109         echo "Calling /usr/bin/wrt_commons_reset_db.sh"
110         /usr/bin/wrt_commons_reset_db.sh
111     else
112         # Find out old and new version of databases
113         WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"`
114         WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_`
115         echo "OLD wrt database version ${WRT_OLD_DB_VERSION}"
116         echo "NEW wrt database version ${WRT_NEW_DB_VERSION}"
117
118         if [ ${WRT_OLD_DB_VERSION} -a ${WRT_NEW_DB_VERSION} ]
119         then
120             if [ ${WRT_NEW_DB_VERSION} = ${WRT_OLD_DB_VERSION} ]
121             then
122                 echo "Equal database detected so db installation ignored"
123             else
124                 echo "Calling /usr/bin/wrt_commons_reset_db.sh"
125                 /usr/bin/wrt_commons_reset_db.sh
126             fi
127         else
128             echo "Calling /usr/bin/wrt_commons_reset_db.sh"
129             /usr/bin/wrt_commons_reset_db.sh
130         fi
131     fi
132 fi
133
134 mkdir -p /usr/etc/ace
135 mkdir -p /usr/apps/org.tizen.policy
136
137 # Set Smack label for db files
138 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
139 chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
140 chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db
141 chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db-journal
142 chsmack -a '*' /opt/usr/dbspace/.wrt_i18n.db
143 chsmack -a '*' /opt/usr/dbspace/.wrt_i18n.db-journal
144
145 echo "[WRT] wrt-commons postinst done ..."
146
147 %files
148 %manifest wrt-commons.manifest
149 %{_libdir}/*.so
150 %{_libdir}/*.so.*
151 %{_datadir}/wrt-engine/*
152 %{_datadir}/license/%{name}
153 %attr(755,root,root) %{_bindir}/wrt_commons_create_clean_db.sh
154 %attr(755,root,root) %{_bindir}/wrt_commons_reset_db.sh
155 %if %{with_tests}
156     %attr(755,root,root) %{_bindir}/wrt-commons-tests-*
157     %attr(755,root,root) %{_bindir}/wrt_dao_tests_prepare_db.sh
158     %attr(755,root,root) %{_bindir}/wrt_db_localization_prepare.sh
159     %{_datadir}/dbus-1/services/org.tizen.DBusTestService.service
160     /opt/share/wrt/wrt-commons/tests/*
161     /opt/share/widget/tests/localization/*
162 %endif
163
164 %files devel
165 %{_includedir}/dpl-efl/*
166 %{_libdir}/pkgconfig/*.pc