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