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