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