Add the script file for 3.0 OS upgrade
[platform/core/connectivity/bluetooth-share.git] / packaging / bluetooth-share.spec
index b2e49a8..0dcaebd 100644 (file)
@@ -1,12 +1,20 @@
-%define _optdir /opt
+%define TZ_COMM_DATA /opt/usr/data/
+%define upgrade_script_path /usr/share/upgrade/scripts
+%define upgrade_data_path /usr/share/upgrade/data
 
 Name:       bluetooth-share
 Summary:    Bluetooth file share Agent
-Version:    0.0.46
-Release:    2
-Group:      TO_BE/FILLED_IN
-License:    Apache License, Version 2.0
+Version:    0.0.47
+Release:    0
+Group:      Network & Connectivity/Bluetooth
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+Source1002: libbluetooth-share.manifest
+Source1003: libbluetooth-share-devel.manifest
+Source1004: init_db.sh
+Requires(post): coreutils
+Requires(post): smack
 BuildRequires:  cmake
 BuildRequires:  gettext-tools
 BuildRequires:  pkgconfig(appcore-efl)
@@ -14,17 +22,28 @@ BuildRequires:  pkgconfig(bluetooth-api)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(calendar-service2)
-BuildRequires:  pkgconfig(contacts-service2)
+BuildRequires:  pkgconfig(sqlite3)
+BuildRequires:  pkgconfig(ecore)
+# Same check as in tizen-extensions-crosswalk. A per-package or global
+# bcond would be better, but for now let's follow Crosswalk's approach.
+#%if "%{profile}" == "mobile"
+#BuildRequires:  pkgconfig(calendar-service2)
+#BuildRequires:  pkgconfig(contacts-service2)
+#%endif
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(syspopup-caller)
-BuildRequires:  pkgconfig(pmapi)
-BuildRequires:  pkgconfig(sysman)
+BuildRequires:  pkgconfig(deviced)
 BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(db-util)
-BuildRequires:  pkgconfig(libprivilege-control)
 BuildRequires:  pkgconfig(capi-content-media-content)
+BuildRequires:  pkgconfig(storage)
+BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(cynara-client)
+BuildRequires:  pkgconfig(cynara-session)
+BuildRequires:  pkgconfig(cynara-creds-dbus)
+BuildRequires:  pkgconfig(eventsystem)
+BuildRequires:  pkgconfig(storage)
 
 %description
 Bluetooth File Share Agent
@@ -47,84 +66,62 @@ Development package for libbluetooth-share
 
 %prep
 %setup -q
+cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} .
 
 %build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+
+export CFLAGS+=" -fpie -fvisibility=hidden"
+export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+
+%cmake . \
+       -DCMAKE_INSTALL_PREFIX=%{_prefix}
 make
 
 %install
-rm -rf %{buildroot}
 %make_install
-mkdir -p  %{buildroot}%{_optdir}/share/bt-ftp
+
+install -D -m 0755 %{SOURCE1004} %{buildroot}%{TZ_COMM_DATA}/%{name}/init_db.sh
+install -D -m 0644 packaging/bluetooth-share.service %{buildroot}%{_libdir}/systemd/system/bluetooth-share.service
+
+mkdir -p %{buildroot}%{upgrade_script_path}
+mkdir -p %{buildroot}%{upgrade_data_path}
+cp -f packaging/bluetooth-share_upgrade.sh %{buildroot}%{upgrade_script_path}
+cp -f packaging/init_db.sh %{buildroot}%{upgrade_data_path}
 
 %post
-# For the FTP server folder
-if  [ ! -e /opt/share/bt-ftp ]
-then
-       mkdir -p  /opt/share/bt-ftp
-fi
-
-if  [ ! -e /opt/share/bt-ftp/Media ]
-then
-       ln -s /opt/usr/media /opt/share/bt-ftp/Media
-fi
-
-if  [ ! -e /opt/share/bt-ftp/SD_External ]
-then
-       ln -s /opt/storage/sdcard /opt/share/bt-ftp/SD_External
-fi
-
-vconftool set -tf bool memory/private/bluetooth-share/quickpanel_clear_btn_status FALSE -g 6520 -i
-vconftool set -tf bool memory/private/bluetooth-share/opp_server_init FALSE -g 6520 -i
-
-if [ ! -f /opt/dbspace/.bluetooth_trasnfer.db ]
-then
-       sqlite3 /opt/dbspace/.bluetooth_trasnfer.db 'PRAGMA journal_mode = PERSIST;
-        create table if not exists inbound (
-               id INTEGER PRIMARY KEY autoincrement,
-               sid INTEGER,
-               tr_status INTEGER,
-               file_path TEXT,
-               dev_name TEXT,
-               timestamp INTEGER default 0,
-               addr TEXT
-       );
-       create table if not exists outbound (
-               id INTEGER PRIMARY KEY autoincrement,
-               sid INTEGER,
-               tr_status INTEGER,
-               file_path TEXT,
-               dev_name TEXT,
-               timestamp INTEGER default 0,
-               addr TEXT
-       );
-       '
-fi
-
-chown :5000 /opt/dbspace/.bluetooth_trasnfer.db
-chown :5000 /opt/dbspace/.bluetooth_trasnfer.db-journal
-chmod 660 /opt/dbspace/.bluetooth_trasnfer.db
-chmod 660 /opt/dbspace/.bluetooth_trasnfer.db-journal
-
-if [ -f /usr/lib/rpm-plugins/msm.so ]
-then
-chsmack -a 'bt_share::db' /opt/dbspace/.bluetooth_trasnfer.db
-chsmack -a 'bt_share::db' /opt/dbspace/.bluetooth_trasnfer.db-journal
-fi
+/sbin/ldconfig
+%{TZ_COMM_DATA}/%{name}/init_db.sh
+ln -sf %{_libdir}/systemd/system/bluetooth-share.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+
+%post -n libbluetooth-share-devel -p /sbin/ldconfig
+
+%post -n libbluetooth-share -p /sbin/ldconfig
+
+%postun -n libbluetooth-share-devel -p /sbin/ldconfig
+
+%postun -n libbluetooth-share -p /sbin/ldconfig
 
 %files
-%manifest bluetooth-share.manifest
+%manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_bindir}/bluetooth-share
-%{_datadir}/dbus-1/services/org.bluetooth.share.service
-%{_optdir}/share/bt-ftp
+#%{_datadir}/dbus-1/system-services/org.bluetooth.share.service
+%{TZ_COMM_DATA}/%{name}/init_db.sh
+%{_libdir}/systemd/system/bluetooth-share.service
+%{upgrade_script_path}/bluetooth-share_upgrade.sh
+%{upgrade_data_path}/init_db.sh
 
 %files -n libbluetooth-share
+%manifest libbluetooth-share.manifest
 %defattr(-, root, root)
 %{_libdir}/libbluetooth-share-api.so.0.*
 
 %files -n libbluetooth-share-devel
+%manifest libbluetooth-share-devel.manifest
 %defattr(-, root, root)
-/usr/include/bluetooth-share-api/bluetooth-share-api.h
+%{_includedir}/bluetooth-share-api/bluetooth-share-api.h
 %{_libdir}/libbluetooth-share-api.so
 %{_libdir}/pkgconfig/bluetooth-share-api.pc