Fix .service and install it into dbus system service directory
[platform/core/connectivity/bluetooth-share.git] / packaging / bluetooth-share.spec
1 %define _optdir /opt
2
3 Name:       bluetooth-share
4 Summary:    Bluetooth file share Agent
5 Version:    0.0.47
6 Release:    2
7 Group:      Connectivity/Bluetooth
8 License:    Apache License, Version 2.0
9 Source0:    %{name}-%{version}.tar.gz
10 Source1001:     %{name}.manifest
11 Source1002:     libbluetooth-share.manifest
12 Source1003:     libbluetooth-share-devel.manifest
13 Requires(post): vconf
14 Requires(post): coreutils
15 Requires(post): sqlite
16 Requires(post): smack
17 BuildRequires:  cmake
18 BuildRequires:  gettext-tools
19 BuildRequires:  pkgconfig(appcore-efl)
20 BuildRequires:  pkgconfig(bluetooth-api)
21 BuildRequires:  pkgconfig(glib-2.0)
22 BuildRequires:  pkgconfig(aul)
23 BuildRequires:  pkgconfig(dlog)
24 BuildRequires:  pkgconfig(calendar-service2)
25 BuildRequires:  pkgconfig(contacts-service2)
26 BuildRequires:  pkgconfig(vconf)
27 BuildRequires:  pkgconfig(syspopup-caller)
28 BuildRequires:  pkgconfig(pmapi)
29 BuildRequires:  pkgconfig(sysman)
30 BuildRequires:  pkgconfig(notification)
31 BuildRequires:  pkgconfig(appsvc)
32 BuildRequires:  pkgconfig(db-util)
33 BuildRequires:  pkgconfig(libprivilege-control)
34 BuildRequires:  pkgconfig(capi-content-media-content)
35
36 %description
37 Bluetooth File Share Agent
38
39 %package -n libbluetooth-share
40 Summary:    Bluetooth share library
41 Group:      Development/Libraries
42 Requires:   %{name} = %{version}-%{release}
43
44 %description -n libbluetooth-share
45 Bluetooth share library
46
47 %package -n libbluetooth-share-devel
48 Summary:    Development package for libbluetooth-share
49 Group:      Development/Libraries
50 Requires:   %{name} = %{version}-%{release}
51
52 %description -n libbluetooth-share-devel
53 Development package for libbluetooth-share
54
55 %prep
56 %setup -q
57 cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} .
58
59 %build
60 export CFLAGS+=" -fpie -fvisibility=hidden"
61 export LDFLAGS+=" -Wl,--rpath=/usr/%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
62
63 %cmake .
64 make
65
66 %install
67 %make_install
68 mkdir -p  %{buildroot}%{_optdir}/share/bt-ftp
69
70 %post
71 # For the FTP server folder
72 if  [ ! -e /opt/share/bt-ftp ]
73 then
74         mkdir -p  /opt/share/bt-ftp
75 fi
76
77 if  [ ! -e /opt/share/bt-ftp/Media ]
78 then
79         ln -s /opt/usr/media /opt/share/bt-ftp/Media
80 fi
81
82 if  [ ! -e /opt/share/bt-ftp/SD_External ]
83 then
84         ln -s /opt/storage/sdcard /opt/share/bt-ftp/SD_External
85 fi
86
87 if [ ! -f /opt/usr/dbspace/.bluetooth_trasnfer.db ]
88 then
89         sqlite3 /opt/usr/dbspace/.bluetooth_trasnfer.db 'PRAGMA journal_mode = PERSIST;
90         create table if not exists inbound (
91                 id INTEGER PRIMARY KEY autoincrement,
92                 sid INTEGER,
93                 tr_status INTEGER,
94                 file_path TEXT,
95                 dev_name TEXT,
96                 timestamp INTEGER default 0,
97                 addr TEXT,
98                 type TEXT,
99                 content TEXT
100         );
101         create table if not exists outbound (
102                 id INTEGER PRIMARY KEY autoincrement,
103                 sid INTEGER,
104                 tr_status INTEGER,
105                 file_path TEXT,
106                 dev_name TEXT,
107                 timestamp INTEGER default 0,
108                 addr TEXT,
109                 type TEXT,
110                 content TEXT
111         );
112         '
113 fi
114
115 chown :5000 /opt/usr/dbspace/.bluetooth_trasnfer.db
116 chown :5000 /opt/usr/dbspace/.bluetooth_trasnfer.db-journal
117 chmod 660 /opt/usr/dbspace/.bluetooth_trasnfer.db
118 chmod 660 /opt/usr/dbspace/.bluetooth_trasnfer.db-journal
119
120 if [ -f /usr/lib/rpm-plugins/msm.so ]
121 then
122 chsmack -a 'bt_share::db' /opt/usr/dbspace/.bluetooth_trasnfer.db
123 chsmack -a 'bt_share::db' /opt/usr/dbspace/.bluetooth_trasnfer.db-journal
124 fi
125
126 %post -n libbluetooth-share-devel -p /sbin/ldconfig
127
128 %post -n libbluetooth-share -p /sbin/ldconfig
129
130 %postun -n libbluetooth-share-devel -p /sbin/ldconfig
131
132 %postun -n libbluetooth-share -p /sbin/ldconfig
133
134 %files
135 %manifest %{name}.manifest
136 /opt/etc/smack/accesses.d/bluetooth-share.rule
137 %defattr(-,root,root,-)
138 %{_bindir}/bluetooth-share
139 %{_datadir}/dbus-1/system-services/org.bluetooth.share.service
140 %{_optdir}/share/bt-ftp
141
142 %files -n libbluetooth-share
143 %manifest libbluetooth-share.manifest
144 %defattr(-, root, root)
145 %{_libdir}/libbluetooth-share-api.so.0.*
146
147 %files -n libbluetooth-share-devel
148 %manifest libbluetooth-share-devel.manifest
149 %defattr(-, root, root)
150 /usr/include/bluetooth-share-api/bluetooth-share-api.h
151 %{_libdir}/libbluetooth-share-api.so
152 %{_libdir}/pkgconfig/bluetooth-share-api.pc