2 Summary: Geofence Server for Tizen
5 Group: Location/Service
7 Source0: %{name}-%{version}.tar.gz
8 Source1: geofence-server.service
10 %if "%{?profile}" == "tv"
11 ExcludeArch: %{arm} %ix86 x86_64
14 Requires(post): sqlite
15 Requires(post): lbs-server
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(libcore-context-manager)
34 #BuildRequires: pkgconfig(tapi)
35 #BuildRequires: pkgconfig(capi-telephony-network-info)
36 #BuildRequires: pkgconfig(capi-context-manager)
37 BuildRequires: pkgconfig(capi-geofence-manager)
38 BuildRequires: pkgconfig(libtzplatform-config)
39 BuildRequires: capi-geofence-manager-plugin-devel
43 Geofence Server for Tizen
51 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
52 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
53 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
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} \
65 #[Workaround] create service file for systemd
66 mkdir -p %{buildroot}%{_unitdir_user}/default.target.wants
67 install -m 644 %{SOURCE1} %{buildroot}%{_unitdir_user}/geofence-server.service
68 ln -s ../geofence-server.service %{buildroot}%{_unitdir_user}/default.target.wants/geofence-server.service
71 if [ ! -e "$GEOFENCE_SERVER_DB_PATH" ]
75 mkdir -p %{buildroot}/opt/dbspace
76 sqlite3 %{buildroot}/opt/dbspace/.geofence-server.db 'PRAGMA journal_mode = PERSIST;
77 CREATE TABLE Places ( place_id INTEGER PRIMARY KEY AUTOINCREMENT, access_type INTEGER, place_name TEXT NOT NULL, app_id TEXT NOT NULL);
78 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);
79 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);
80 CREATE TABLE FenceGeopointWifi ( fence_id INTEGER, bssid TEXT, ssid TEXT, FOREIGN KEY(fence_id) REFERENCES GeoFence(fence_id) ON DELETE CASCADE);
81 CREATE TABLE FenceBssid ( fence_id INTEGER, bssid TEXT, ssid TEXT, FOREIGN KEY(fence_id) REFERENCES Geofence(fence_id) ON DELETE CASCADE);'
91 GEOFENCE_SERVER_DB_PATH="/opt/dbspace/.geofence-server.db"
93 # geofence-server db file
94 chown system:system /opt/dbspace/.geofence-server.db
95 chown system:system /opt/dbspace/.geofence-server.db-journal
96 # Change geofence-server db file permissions
97 chmod 660 /opt/dbspace/.geofence-server.db
98 chmod 660 /opt/dbspace/.geofence-server.db-journal
101 %postun -p /sbin/ldconfig
104 %manifest geofence-server.manifest
105 %defattr(-,root,root,-)
106 /usr/bin/geofence-server
108 /usr/share/dbus-1/services/org.tizen.lbs.Providers.GeofenceServer.service
110 %config %{_sysconfdir}/dbus-1/session.d/geofence-server.conf
112 #[Workaround] create service file for systemd
113 %{_unitdir_user}/geofence-server.service
114 %{_unitdir_user}/default.target.wants/geofence-server.service
117 %package -n location-geofence-server
118 Summary: Geofence Server for Tizen
119 Group: Development/Libraries
120 Requires: %{name} = %{version}-%{release}
122 %description -n location-geofence-server
123 Geofence Server for Tizen
125 %post -n location-geofence-server
128 %postun -n location-geofence-server
131 %files -n location-geofence-server
132 %manifest location-geofence-server.manifest
133 %{_libdir}/geofence/module/libgeofence.so*