2046b5c596a560f45f54740394d945675325d137
[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.3
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 BuildRequires: pkgconfig(murphy-common)
18 BuildRequires: pkgconfig(murphy-pulse)
19 BuildRequires: pkgconfig(murphy-glib)
20 BuildRequires: pkgconfig(libudev)
21 BuildRequires: pkgconfig(json)
22 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
23 BuildRequires: pkgconfig(pocketsphinx)
24 BuildRequires: pkgconfig(sphinxbase)
25 %endif
26 %if %{?_with_festival:1}%{!?_with_festival:0}
27 BuildRequires: festival-devel
28 %endif
29 %if %{?_with_dbus:1}%{!?_with_dbus:0}
30 BuildRequires: pkgconfig(dbus-1)
31 %endif
32
33 Requires: pulseaudio
34 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
35 Requires: sphinxbase
36 Requires: pocketsphinx
37 %endif
38 %if %{?_with_festival:1}%{!?_with_festival:0}
39 BuildRequires: festival-devel
40 Requires: festival
41 %endif
42
43
44 %description
45 SRS/Winthorpe speech recognition system service.
46
47 %package doc
48 Summary: Documentation
49 Group: Development/Tools
50
51 %description doc
52 Documentation for the speech recognition service.
53
54 %prep
55 %setup -q -n %{name}-%{version}
56
57 %build
58 %if %{?_with_debug:1}%{!?_with_debug:0}
59 export CFLAGS="-O0 -g3"
60 export CXXFLAGS="-O0 -g3"
61 V="V=1"
62 %endif
63
64 CONFIG_OPTIONS=""
65
66 %if %{?_with_sphinx:1}%{!?_with_sphinx:0}
67 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-sphinx"
68 %else
69 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-sphinx"
70 %endif
71
72 %if %{?_with_festival:1}%{!?_with_festival:0}
73 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-festival"
74 %else
75 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-festival"
76 %endif
77
78 %if %{?_with_wrt:1}%{!?_with_wrt:0}
79 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-wrt-client"
80 %else
81 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-wrt-client"
82 %endif
83
84 %if %{?_with_dbus:1}%{!?_with_dbus:0}
85 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-dbus"
86 %else
87 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-dbus"
88 %endif
89
90
91 ./bootstrap && \
92     %configure $CONFIG_OPTIONS && \
93     make
94
95 %install
96 rm -fr $RPM_BUILD_ROOT
97
98 %make_install
99
100 # Install dictionaries, configuration and service files.
101 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig \
102     $RPM_BUILD_ROOT/lib/systemd/user \
103     $RPM_BUILD_ROOT%{_sysconfdir}/speech-recognition \
104     $RPM_BUILD_ROOT%{_datadir}/speech-recognition/dictionaries/demo \
105     $RPM_BUILD_ROOT%{_libdir}/srs/scripts \
106     $RPM_BUILD_ROOT%{_datadir}/dbus-1/services
107
108 /usr/bin/install -m 644 packaging/speech-recognition.conf \
109     $RPM_BUILD_ROOT%{_sysconfdir}/speech-recognition
110 /usr/bin/install -m 644 packaging/speech-recognition.env \
111     $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/speech-recognition
112 /usr/bin/install -m 644 packaging/speech-recognition.service \
113     $RPM_BUILD_ROOT/lib/systemd/user
114 /usr/bin/install -m 644 \
115     -t $RPM_BUILD_ROOT%{_datadir}/speech-recognition/dictionaries/demo \
116     dictionaries/demo/demo.*
117 /usr/bin/install -m 755 packaging/start-speech-service.sh \
118      $RPM_BUILD_ROOT%{_libdir}/srs/scripts
119 /usr/bin/install -m 755 packaging/org.tizen.srs.service \
120      $RPM_BUILD_ROOT%{_datadir}/dbus-1/services
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %post
126 ldconfig
127
128 %postun
129 ldconfig
130
131 %files
132 %defattr(-,root,root,-)
133 %{_sbindir}/srs-daemon
134 %if %{?_with_dbus:1}%{!?_with_dbus:0}
135 %{_bindir}/srs-client
136 %endif
137 %{_libdir}/srs
138 %{_sysconfdir}/speech-recognition/speech-recognition.conf
139 %{_sysconfdir}/sysconfig/speech-recognition
140 %{_datadir}/speech-recognition/dictionaries
141 /lib/systemd/user/speech-recognition.service
142 %{_datadir}/dbus-1/services/org.tizen.srs.service
143
144 %files doc
145 %defattr(-,root,root,-)
146 %doc AUTHORS COPYING ChangeLog INSTALL NEWS README