packaging: enable socket-based activation for the native API.
[profile/ivi/speech-recognition.git] / packaging / speech-recognition.spec
1 %{!?_with_debug:%{!?_without_debug:%define _with_debug 1}}
2 %{!?_with_sphinx:%{!?_without_sphinx:%define _with_sphinx 1}}
3 %{!?_with_festival:%{!?_without_festival:%define _with_festival 1}}
4 %{!?_with_wrt:%{!?_without_wrt:%define _with_wrt 1}}
5 %{!?_with_dbus:%{!?_without_dbus:%define _without_dbus 1}}
6 %{!?_with_systemd:%{!?_without_systemd:%define _with_systemd 1}}
7
8 Summary: Speech recognition service for Tizen
9 Name: speech-recognition
10 Version: 0.0.5
11 Release: 0
12 License: BSD-3-Clause
13 Group: Base/Utilities
14 URL: https://github.com/otcshare/speech-recognition
15 Source0: %{name}-%{version}.tar.gz
16
17 BuildRequires: pkgconfig(libpulse)
18
19 # Termporarily had to replace these with explicit package-dependencies,
20 # because the murphy pkgconfig files lack the correct version (needs to
21 # be fixed) and now we need a new enough murphy with native-types support.
22 # Switch these back once this is fixed on the murphy side.
23
24 # BuildRequires: pkgconfig(murphy-common) >= 0.0.42
25 # BuildRequires: pkgconfig(murphy-pulse) >= 0.0.42
26 # BuildRequires: pkgconfig(murphy-glib) >= 0.0.42
27
28 BuildRequires: murphy-devel >= 0.0.43
29 BuildRequires: murphy-glib-devel >= 0.0.43
30 BuildRequires: murphy-pulse-devel >= 0.0.43
31
32 BuildRequires: pkgconfig(libudev)
33 BuildRequires: pkgconfig(json)
34 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
35 BuildRequires: pkgconfig(pocketsphinx)
36 BuildRequires: pkgconfig(sphinxbase)
37 %endif
38 %if %{?_with_festival:1}%{!?_with_festival:0}
39 BuildRequires: festival-devel
40 Requires: festival
41 %endif
42 %if %{?_with_dbus:1}%{!?_with_dbus:0}
43 BuildRequires: pkgconfig(dbus-1)
44 %endif
45 Requires: pulseaudio
46 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
47 Requires: sphinxbase
48 Requires: pocketsphinx
49 %endif
50 %if %{?_with_systemd:1}%{!?_with_systemd:0}
51 BuildRequires: pkgconfig(libsystemd-daemon)
52 %endif
53
54 %description
55 SRS/Winthorpe speech recognition system service.
56
57 %package devel
58 Summary: The header files and libraries needed for SRS/Winthorpe clients
59 Group: Development/Libraries
60 Requires: %{name} = %{version}
61
62 %description devel
63 This package contains header files and libraries necessary for development.
64
65 %package tests
66 Summary: Various test binaries for SRS/Winthorpe
67 Group: Development/Debug
68 Requires: %{name} = %{version}
69
70 %description tests
71 This package contains various test binaries for SRS/Winthorpe.
72
73 %prep
74 %setup -q -n %{name}-%{version}
75
76 %build
77 %if %{?_with_debug:1}%{!?_with_debug:0}
78 export CFLAGS="-O0 -g3"
79 export CXXFLAGS="-O0 -g3"
80 V="V=1"
81 %endif
82
83 CONFIG_OPTIONS=""
84
85 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
86 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-sphinx"
87 %else
88 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-sphinx"
89 %endif
90
91 %if %{?_with_festival:1}%{!?_with_festival:0}
92 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-festival"
93 %else
94 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-festival"
95 %endif
96
97 %if %{?_with_wrt:1}%{!?_with_wrt:0}
98 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-wrt-client"
99 %else
100 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-wrt-client"
101 %endif
102
103 %if %{?_with_dbus:1}%{!?_with_dbus:0}
104 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-dbus"
105 %else
106 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-dbus"
107 %endif
108
109 %if %{?_with_systemd:1}%{!?_with_systemd:0}
110 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-systemd"
111 %else
112 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-systemd"
113 %endif
114
115
116 ./bootstrap && \
117     %configure $CONFIG_OPTIONS && \
118     make
119
120 %install
121 rm -fr $RPM_BUILD_ROOT
122
123 %make_install
124
125 # Install dictionaries, configuration and service files.
126 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} \
127     $RPM_BUILD_ROOT%{_sysconfdir}/speech-recognition \
128     $RPM_BUILD_ROOT/lib/systemd/user \
129     $RPM_BUILD_ROOT%{_datadir}/speech-recognition/dictionaries/demo \
130     $RPM_BUILD_ROOT%{_libdir}/srs/scripts \
131     $RPM_BUILD_ROOT%{_datadir}/dbus-1/services
132
133 /usr/bin/install -m 644 packaging/speech-recognition.conf \
134     $RPM_BUILD_ROOT%{_sysconfdir}/speech-recognition
135 /usr/bin/install -m 644 packaging/speech-recognition.service \
136     $RPM_BUILD_ROOT/lib/systemd/user
137 %if %{?_with_systemd:1}%{!?_with_systemd:0}
138 /usr/bin/install -m 644 packaging/speech-recognition.socket \
139     $RPM_BUILD_ROOT/lib/systemd/user
140 %endif
141 /usr/bin/install -m 644 \
142     -t $RPM_BUILD_ROOT%{_datadir}/speech-recognition/dictionaries/demo \
143     dictionaries/demo/demo.*
144 /usr/bin/install -m 755 packaging/start-speech-service.sh \
145      $RPM_BUILD_ROOT%{_libdir}/srs/scripts
146 /usr/bin/install -m 755 packaging/org.tizen.srs.service \
147      $RPM_BUILD_ROOT%{_datadir}/dbus-1/services
148
149 %clean
150 rm -rf $RPM_BUILD_ROOT
151
152 %post
153 ldconfig
154 %if %{?_with_systemd:1}%{!?_with_systemd:0}
155 systemctl --user enable speech-recognition.socket
156 %endif
157
158 %preun
159 %if %{?_with_systemd:1}%{!?_with_systemd:0}
160 systemctl --user disable speech-recognition.socket
161 %endif
162
163 %postun
164 ldconfig
165
166 %files
167 %defattr(-,root,root,-)
168 %{_sbindir}/srs-daemon
169 %if %{?_with_dbus:1}%{!?_with_dbus:0}
170 %{_bindir}/srs-client
171 %endif
172 %{_libdir}/srs
173 %{_libdir}/libsrs*.so.*
174 %{_sysconfdir}/speech-recognition/speech-recognition.conf
175 %{_datadir}/speech-recognition/dictionaries
176 /lib/systemd/user/speech-recognition.service
177 %if %{?_with_systemd:1}%{!?_with_systemd:0}
178 /lib/systemd/user/speech-recognition.socket
179 %endif
180 %{_datadir}/dbus-1/services/org.tizen.srs.service
181
182 %files devel
183 %defattr(-,root,root,-)
184 %{_includedir}/srs
185 %{_libdir}/libsrs*.so
186 %{_libdir}/pkgconfig/srs*.pc
187
188 %files tests
189 %defattr(-,root,root,-)
190 %{_bindir}/srs-native-client