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