]> git.pld-linux.org Git - packages/brltty.git/blob - brltty.spec
0e2064ab85afc74a8ed58b093dd6dc3acf6e2902
[packages/brltty.git] / brltty.spec
1 Summary:        Braille display driver for Linux/Unix
2 Summary(pl.UTF-8):   Sterownik do wyświetlaczy Braille'a
3 Name:           brltty
4 Version:        3.7.2
5 Release:        4
6 Group:          Daemons
7 License:        GPL
8 URL:            http://mielke.cc/brltty/
9 Source0:        http://mielke.cc/brltty/releases/%{name}-%{version}.tar.gz
10 # Source0-md5:  0ae3da8252783a4d20e1ed4e55cede5b
11 Patch0:         %{name}-slash.patch
12 BuildRequires:  autoconf >= 2.53
13 BuildRequires:  automake
14 BuildRequires:  bison
15 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
16
17 %description
18 BRLTTY is a background process (daemon) which provides access to the
19 Linux/Unix console (when in text mode) for a blind person using a
20 refreshable Braille display. It drives the Braille display, and
21 provides complete screen review functionality. Some speech capability
22 has also been incorporated.
23
24 %description -l pl.UTF-8
25 BRLTTY jest demonem, który udostępnia dostęp do linuksowej konsoli (w
26 trybie tekstowym) dla niewidomych używających wyświetlaczy Braille'a z
27 odświeżaniem (refreshable Braille display). BRLTTY steruje
28 wyświetlaczem Braille'a i dostarcza funkcjonalność całkowitego
29 przeglądu ekranu. Do tego pakietu została włączona możliwość syntezy
30 mowy.
31
32 %package -n brlapi
33 Summary:        Application Programming Interface for BRLTTY
34 Summary(pl.UTF-8):   API do BRLTTY
35 Group:          Applications/System
36
37 %description -n brlapi
38 This package provides the run-time support for the Application
39 Programming Interface to BRLTTY.
40
41 Install this package if you have an application which directly
42 accesses a refreshable Braille display.
43
44 %description -n brlapi -l pl.UTF-8
45 Ten pakiet zawiera środowisko uruchomieniowe dla programów
46 korzystających z API BRLTTY.
47
48 Zainstaluj ten pakiet jeśli masz aplikację, która bezpośrednio używa
49 wyświetlacza Braille'a z odświeżaniem.
50
51 %package -n brlapi-devel
52 Summary:        Headers and documentation for BrlAPI
53 Summary(pl.UTF-8):   Pliki nagłówkowe i dokumentacja do BrlAPI
54 Group:          Development/Libraries
55 Requires:       brlapi = %{version}-%{release}
56
57 %description -n brlapi-devel
58 This package provides the header files, shared object linker
59 reference, and reference documentation for BrlAPI (the Application
60 Programming Interface to BRLTTY). It enables the implementation of
61 applications which take direct advantage of a refreshable Braille
62 display in order to present information in ways which are more
63 appropriate for blind users and/or to provide user interfaces which
64 are more specifically atuned to their needs.
65
66 Install this package if you're developing or maintaining an
67 application which directly accesses a refreshable Braille display.
68
69 %description -n brlapi-devel -l pl.UTF-8
70 Ten pakiet zawiera pliki nagłówkowe oraz dokumentację do BrlAPI (API
71 do BRLTTY). BrlAPI pozwala implementować aplikacje, które bezpośrednio
72 korzystają z wyświetlaczy Braille'a dostarczając interfejs użytkownika
73 bardziej przystosowany dla osób niewidomych.
74
75 Zainstaluj ten pakiet, jeśli tworzysz lub nadzorujesz aplikację
76 korzystającą bezpośrednio z odświeżalnych wyświetlaczy Braille'a.
77
78 %package -n brlapi-static
79 Summary:        Static BrlAPI library
80 Summary(pl.UTF-8):   Statyczna biblioteka BrlAPI
81 Group:          Development/Libraries
82 Requires:       brlapi-devel = %{version}-%{release}
83
84 %description -n brlapi-static
85 This is package with static BrlAPI library.
86
87 %description -n brlapi-static -l pl.UTF-8
88 Ten pakiet zawiera statyczną wersję biblioteki BrlAPI.
89
90 %prep
91 %setup -q
92 %patch0 -p1
93
94 %build
95 %{__aclocal}
96 %{__autoconf}
97 cp -f /usr/share/automake/config.sub acdir
98 %configure \
99         --with-install-root="$RPM_BUILD_ROOT" \
100         --disable-tainted-components \
101         --enable-api
102 %{__make}
103
104 directory="doc"
105 mkdir -p "$directory"
106 for file in `find . \( -path "./$directory" -o -path ./Documents \) -prune -o \( -name 'README*' -o -name '*.txt' -o -name '*.html' -o -name '*.sgml' -o \( -path "./Bootdisks/*" -type f -perm +ugo=x \) \) -print`
107 do
108         mkdir -p "$directory/${file%/*}"
109         cp -rp "$file" "$directory/$file"
110 done
111
112 %install
113 rm -rf $RPM_BUILD_ROOT
114 %{__make} install
115 install Documents/brltty.conf $RPM_BUILD_ROOT%{_sysconfdir}
116
117 %clean
118 rm -rf $RPM_BUILD_ROOT
119
120 %pre
121 # The pre-install scriptlet.
122
123 # If a configuration file already exists then rpm installs the new one as
124 # <path>.rpmnew. If this is done then the .rpmnew file is overwritten if it
125 # already exists.
126
127 # There's no explicit way to tell if a configuration file has been installed
128 # as itself or as a .rpmnew file. The way we'll figure it out, therefore, is by
129 # erasing the .rpmnew file now so that we can see if it gets created later.
130 rm -f "%{_sysconfdir}/brltty.conf.rpmnew"
131
132 %post
133 # The post-install scriptlet.
134
135 # If BRLTTY's boot parameter has been specified then update the just installed
136 # configuration file template to reflect the options supplied thereby.
137
138 # First, we need to determine which file to update. If there's a .rpmnew file
139 # then update it since a previous configuration file must already have existed.
140 file="%{_sysconfdir}/brltty.conf"
141 new="${file}.rpmnew"
142 [ -f "${new}" ] && file="${new}"
143
144 # Update the configuration file template via the Bootdisks/bp2cf script.
145 # Include it right within this scriptlet so that it needn't be installed.
146 # Imbed it within a subshell to ensure that it won't impact this scriptlet.
147 (
148         # First, set bp2cf's command line arguments.
149         set -- -u -f "${file}"
150
151 #!/bin/sh
152 ###############################################################################
153 # BRLTTY - A background process providing access to the Linux console (when in
154 #          text mode) for a blind person using a refreshable Braille display.
155 #
156 # Copyright (C) 1995-2003 by The BRLTTY Team. All rights reserved.
157 #
158 # BRLTTY comes with ABSOLUTELY NO WARRANTY.
159 #
160 # This is free software, placed under the terms of the
161 # GNU General Public License, as published by the Free Software
162 # Foundation.  Please see the file COPYING for details.
163 #
164 # Web Page: http://mielke.cc/brltty/
165 #
166 # This software is maintained by Dave Mielke <dave@mielke.cc>.
167 ###############################################################################
168
169 # Convert the boot parameter to configuration file directives.
170 # If /proc is mounted then use the brltty= boot parameter in /proc/cmdline.
171 # If /proc is not mounted then use the brltty environment variable.
172 # Invoke with -h for usage information.
173
174 programName="${0##*/}"
175 programMessage()
176 {
177         echo 2>&1 "${programName}: ${1}"
178 }
179 syntaxError()
180 {
181         programMessage "${1}"
182         exit 2
183 }
184 internalError()
185 {
186         programMessage "${1}"
187         exit 3
188 }
189
190 configurationFile=""
191 requestedAction=create
192 deviceTranslation=none
193 requestedParameter=""
194 OPTIND=1
195 while getopts ":f:cundop:h" option
196 do
197         case "${option}" in
198             f) configurationFile="${OPTARG}";;
199             c) requestedAction=create;;
200             u) requestedAction=update;;
201             n) deviceTranslation=none;;
202             d) deviceTranslation=devfs;;
203             o) deviceTranslation=old;;
204             p) requestedParameter="${OPTARG}";;
205             h)
206                 cat <<EOF
207 Usage: ${programName} [option ...]
208 -f file  The configuration file to create/update.
209 -c       Create the configuration file (write to stdout if no -f).
210 -u       Update the configuration file (copying from stdin to stdout if no -f).
211 -n       Do not translate device paths.
212 -d       Do old-style to devfs device path translation.
213 -o       Do devfs to old-style device path translation.
214 -p [driver][,[device][,[table]]]
215          Explicitly specify the boot parameter.
216 -h       Display this usage summary.
217 EOF
218                 exit 0
219                 ;;
220             \?) syntaxError "unknown option: -${OPTARG}";;
221             :) syntaxError "missing value: -${OPTARG}";;
222             *) internalError "unimplemented option: -${option}";;
223         esac
224 done
225 shift "`expr $OPTIND - 1`"
226 [ "${#}" -eq 0 ] || syntaxError "too many parameters."
227
228 case "${requestedAction}" in
229     create)
230         putConfigurationLine()
231         {
232                 echo "${1}" || exit 4
233         }
234         startConfigurationFile()
235         {
236                 [ -n "${configurationFile}" ] && exec >"${configurationFile}"
237                 putConfigurationLine "`makeHeaderLine Created`"
238                 putConfigurationLine "`makeParameterLine`"
239                 putConfigurationLine ""
240         }
241         putConfigurationDirective()
242         {
243                 putConfigurationLine "${1} ${2}"
244         }
245         finalizeConfigurationFile()
246         {
247                 :
248         }
249         ;;
250     update)
251         putSedCommand()
252         {
253                 sedScript="${sedScript}
254 ${1}"
255         }
256         startConfigurationFile()
257         {
258                 if [ -n "${configurationFile}" ]; then
259                         [ -e "${configurationFile}" ] || syntaxError "file not found: ${configurationFile}"
260                         [ -f "${configurationFile}" ] || syntaxError "not a file: ${configurationFile}"
261                         [ -r "${configurationFile}" ] || syntaxError "file not readable: ${configurationFile}"
262                         [ -w "${configurationFile}" ] || syntaxError "file not writable: ${configurationFile}"
263                         outputFile="${configurationFile}.new"
264                         exec <"${configurationFile}" >"${outputFile}"
265                 fi
266                 sedScript=""
267                 putSedCommand "1i\\
268 `makeHeaderLine Updated`\\
269 `makeParameterLine`\\
270 "
271         }
272         putConfigurationDirective()
273         {
274                 value="`echo "${2}" | sed -e 's%\\([/\\]\\)%\\\\\\1%g'`"
275                 putSedCommand "/^ *#\\(${1} .*\\)/s//\\1/"
276                 putSedCommand "/^ *\\(${1}\\) .*/s//\\1 ${value}/"
277         }
278         finalizeConfigurationFile()
279         {
280                 sed -e "${sedScript}"
281                 [ -n "${outputFile}" ] && mv -f "${outputFile}" "${configurationFile}"
282         }
283         ;;
284     *) internalError "unimplemented action: ${requestedAction}";;
285 esac
286
287 translateDevice_none()
288 {
289         :
290 }
291 translateDevice_devfs()
292 {
293         minor="${device#ttyS}"
294         if [ "${minor}" != "${device}" ]; then
295                 device="tts/${minor}"
296                 return 0
297         fi
298         minor="${device#lp}"
299         if [ "${minor}" != "${device}" ]; then
300                 device="printers/${minor}"
301                 return 0
302         fi
303         programMessage "unsupported old-style device: ${device}"
304 }
305 translateDevice_old()
306 {
307         major="${device%%/*}"
308         if [ "${major}" != "${device}" ]; then
309                 minor="${device#*/}"
310                 case "${major}" in
311                     tts) devfs="ttyS${minor}";;
312                     printers) devfs="lp${minor}";;
313                 esac
314         fi
315         if [ -n "${devfs}" ]; then
316                 device="${devfs}"
317         else
318                 programMessage "unsupported devfs device: ${device}"
319         fi
320 }
321
322 makeHeaderLine()
323 {
324         echo "# ${1} by brltty-bp2cf`date +' on %Y-%m-%d at %H:%M:%S %Z (UTC%z)'`."
325 }
326 makeParameterLine()
327 {
328         echo "# Boot Parameter:${bootParameter}"
329 }
330 putConfigurationFile()
331 {
332         startConfigurationFile
333         [ -n "${brailleDriver}" ] && putConfigurationDirective "braille-driver" "${brailleDriver}"
334         [ -n "${brailleDevice}" ] && {
335         device="`echo "${brailleDevice}" | sed -e 's%//*%/%g' -e 's%^/dev/%%'`"
336         if [ "${device#/}" = "${device}" ]; then
337                 translateDevice_${deviceTranslation}
338         fi
339         putConfigurationDirective "braille-device" "${device}"
340         }
341         [ -n "${textTable}" ] && putConfigurationDirective "text-table" "${textTable}"
342         finalizeConfigurationFile
343 }
344 parseBootParameter()
345 {
346         bootParameter="${bootParameter} ${1}"
347         number=1
348         while [ "${number}" -le 3 ]; do
349                 cut="cut -d, -f${number}"
350                 [ "${number}" -gt 1 ] && cut="${cut} -s"
351                 operand="`echo ${1} | ${cut}`"
352                 if [ -n "${operand}" ]; then
353                         case "${number}" in
354                             1) brailleDriver="${operand}";;
355                             2) brailleDevice="${operand}";;
356                             3) textTable="${operand}";;
357                         esac
358                 fi
359                 number="`expr ${number} + 1`"
360         done
361 }
362 putBootParameter()
363 {
364         parseBootParameter "${1}"
365         putConfigurationFile
366 }
367 parseBootCommand()
368 {
369         found=false
370         while [ "${#}" -gt 0 ]; do
371                 case "${1}" in
372                     "brltty="*)
373                         found=true
374                         parseBootParameter "${1#*=}"
375                         ;;
376                 esac
377                 shift
378         done
379         "${found}" && putConfigurationFile
380 }
381
382 brailleDriver=""
383 brailleDevice=""
384 textTable=""
385 bootCommandFile="/proc/cmdline"
386 if [ -n "${requestedParameter}" ]; then
387         putBootParameter "${requestedParameter}"
388 elif [ -f "${bootCommandFile}" ]; then
389         parseBootCommand `cat "${bootCommandFile}"`
390 elif [ -n "${brltty}" ]; then
391         putBootParameter "${brltty}"
392 fi
393 exit 0
394 )
395
396 %post   -n brlapi -p /sbin/ldconfig
397 %postun -n brlapi -p /sbin/ldconfig
398
399 %files
400 %defattr(644,root,root,755)
401 %doc Documents/{Manual.sgml,Manual.txt,Manual-HTML,ChangeLog,TODO} doc/*
402 %attr(755,root,root) %{_bindir}/brltty
403 %attr(755,root,root) %{_bindir}/brltty-*
404 %attr(755,root,root) %{_bindir}/xbrlapi
405 %dir %{_libdir}/brltty
406 %dir %{_sysconfdir}/brltty
407 %attr(755,root,root) %{_libdir}/brltty/*.so
408 %dir %{_libdir}/brltty
409 %{_sysconfdir}/brltty
410 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/brltty.conf
411 %{_mandir}/man1/*
412
413 %files -n brlapi
414 %defattr(644,root,root,755)
415 %attr(755,root,root) %{_libdir}/libbrlapi.so.*
416 %doc Documents/BrlAPI.sgml Documents/BrlAPI.txt Documents/BrlAPI-HTML
417
418 %files -n brlapi-devel
419 %defattr(644,root,root,755)
420 %doc Documents/BrlAPIref-HTML Documents/README.Gnopernicus
421 %attr(755,root,root) %{_libdir}/libbrlapi.so
422 %{_includedir}/brltty
423 %{_mandir}/man3/*
424
425 %files -n brlapi-static
426 %defattr(644,root,root,755)
427 %{_libdir}/libbrlapi.a
This page took 0.081802 seconds and 2 git commands to generate.