sync with tizen_2.4
[platform/core/location/geofence-server.git] / packaging / geofence-server.spec
1 Name:       geofence-server
2 Summary:    Geofence Server for Tizen
3 Version:    0.4.0
4 Release:    1
5 Group:      Location/Service
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1:    geofence-server.service
9
10 %if "%{?profile}" == "tv"
11 ExcludeArch: %{arm} %ix86 x86_64
12 %endif
13
14 Requires(post): sqlite
15 Requires(post): lbs-server
16 BuildRequires:  cmake
17 BuildRequires:  pkgconfig(glib-2.0)
18 BuildRequires:  pkgconfig(network)
19 BuildRequires:  pkgconfig(vconf)
20 BuildRequires:  pkgconfig(dlog)
21 BuildRequires:  pkgconfig(geofence-dbus)
22 BuildRequires:  pkgconfig(gio-unix-2.0)
23 BuildRequires:  pkgconfig(sqlite3)
24 BuildRequires:  pkgconfig(db-util)
25 BuildRequires:  pkgconfig(alarm-service)
26 BuildRequires:  pkgconfig(deviced)
27 BuildRequires:  pkgconfig(vconf)
28 BuildRequires:  pkgconfig(vconf-internal-keys)
29 BuildRequires:  pkgconfig(capi-appfw-app-manager)
30 BuildRequires:  pkgconfig(capi-location-manager)
31 BuildRequires:  pkgconfig(capi-network-wifi)
32 BuildRequires:  pkgconfig(capi-network-bluetooth)
33 BuildRequires:  pkgconfig(secure-storage)
34 BuildRequires:  pkgconfig(libcore-context-manager)
35 #BuildRequires:  pkgconfig(tapi)
36 #BuildRequires:  pkgconfig(capi-telephony-network-info)
37 #BuildRequires:  pkgconfig(capi-context-manager)
38 BuildRequires:  pkgconfig(capi-geofence-manager)
39 BuildRequires:  capi-geofence-manager-plugin-devel
40 Requires:  sys-assert
41
42 %description
43 Geofence Server for Tizen
44
45
46 %prep
47 %setup -q
48
49
50 %build
51 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
52 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
53 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
54
55 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
56 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
57         -DLIB_DIR=%{_libdir} -DSYSCONF_DIR=%{_sysconfdir} \
58
59 make %{?jobs:-j%jobs}
60
61 %install
62 rm -rf %{buildroot}
63 %make_install
64
65 if [ ! -e "$GEOFENCE_SERVER_DB_PATH" ]
66 then
67
68 # create db
69 mkdir -p %{buildroot}/opt/dbspace
70 sqlite3 %{buildroot}/opt/dbspace/.geofence-server.db 'PRAGMA journal_mode = PERSIST;
71         CREATE TABLE Places ( place_id INTEGER PRIMARY KEY AUTOINCREMENT, access_type INTEGER, place_name TEXT NOT NULL, app_id TEXT NOT NULL);
72         CREATE TABLE GeoFence ( fence_id INTEGER PRIMARY KEY AUTOINCREMENT, place_id INTEGER, enable INTEGER, app_id TEXT NOT NULL, geofence_type INTEGER, access_type INTEGER, running_status INTEGER, FOREIGN KEY(place_id) REFERENCES Places(place_id) ON DELETE CASCADE);
73         CREATE TABLE FenceGeocoordinate ( fence_id INTEGER , latitude TEXT NOT NULL, longitude TEXT NOT NULL, radius TEXT NOT NULL, address TEXT, FOREIGN KEY(fence_id) REFERENCES GeoFence(fence_id) ON DELETE CASCADE);
74         CREATE TABLE FenceGeopointWifi ( fence_id INTEGER, bssid TEXT, ssid TEXT, FOREIGN KEY(fence_id) REFERENCES GeoFence(fence_id) ON DELETE CASCADE);
75         CREATE TABLE FenceBssid ( fence_id INTEGER, bssid TEXT, ssid TEXT, FOREIGN KEY(fence_id) REFERENCES Geofence(fence_id) ON DELETE CASCADE);'
76 fi
77
78 %clean
79 rm -rf %{buildroot}
80
81 %post
82 GEOFENCE_SERVER_DB_PATH="/opt/dbspace/.geofence-server.db"
83
84 # geofence-server db file
85 chown system:system /opt/dbspace/.geofence-server.db
86 chown system:system /opt/dbspace/.geofence-server.db-journal
87 ## Change geofence-server db file permissions
88 chmod 660 /opt/dbspace/.geofence-server.db
89 chmod 660 /opt/dbspace/.geofence-server.db-journal
90
91 %postun -p /sbin/ldconfig
92
93 %files
94 %manifest geofence-server.manifest
95 %defattr(-,system,system,-)
96 /usr/bin/geofence-server
97 /usr/share/dbus-1/system-services/org.tizen.lbs.Providers.GeofenceServer.service
98 /opt/dbspace/.*.db*
99 %config %{_sysconfdir}/dbus-1/system.d/geofence-server.conf
100
101 %package -n location-geofence-server
102 Summary:    Geofence Server for Tizen
103 Group:      Development/Libraries
104 Requires:   %{name} = %{version}-%{release}
105
106 %description -n location-geofence-server
107 Geofence Server for Tizen
108
109 %post -n location-geofence-server
110 /sbin/ldconfig
111
112 %postun -n location-geofence-server
113 /sbin/ldconfig
114
115 %files -n location-geofence-server
116 %manifest location-geofence-server.manifest
117 %{_libdir}/geofence/module/libgeofence.so*