2 # spec file for package ncurses
4 # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
6 # All modifications and additions to the file contributed by third parties
7 # remain the property of their copyright owners, unless otherwise agreed
8 # upon. The license for this file, and modifications and additions to the
9 # file, is the same license as for the pristine package itself (unless the
10 # license for the pristine package is not an Open Source License, in which
11 # case the license is the MIT License). An "Open Source License" is a
12 # license that conforms to the Open Source Definition (Version 1.9)
13 # published by the Open Source Initiative.
19 #!BuildIgnore: terminfo
20 BuildRequires: gcc-c++
21 %define terminfo() %{_datadir}/%{0}/%{1}
22 %define tabset() %{_datadir}/%{0}/%{1}
25 Summary: New curses Libraries
28 Url: http://invisible-island.net/ncurses/ncurses.html
29 Source0: ncurses-%{version}.tar.bz2
30 Source1: ncurses-%{version}-patches.tar.bz2
33 Source4: ncurses-rpmlintrc
34 Source5: tack-1.07-20120303.tar.bz2
36 Source7: baselibs.conf
37 Patch0: ncurses-%{version}.dif
38 Patch1: ncurses-5.9-overflow.dif
39 Patch3: ncurses-5.9-overwrite.dif
40 Patch4: ncurses-5.7-tack.dif
41 Patch5: ncurses-5.9-environment.dif
42 BuildRoot: %{_tmppath}/%{name}-%{version}-build
43 %global _sysconfdir /etc
44 %global _miscdir %{_datadir}/misc
45 %global _incdir %{_includedir}
46 %global root %{_tmppath}/%{name}-%{version}-store
47 %global abi %(ver=%{version}; echo ${ver%.*})
50 As soon as a text application needs to directly control its output to
51 the screen (if it wants to place the cursor at location (x,y) then
52 write text), ncurses is used. The panel and the forms libraries are
53 included in this package. These new libraries support color, special
54 characters, and panels.
60 Thomas E. Dickey <dickey@invisible-island.net>
61 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
62 Eric S. Raymond <esr@thyrsus.com>
63 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
66 %package -n ncurses-utils
67 Summary: Tools using the new curses libraries
70 Provides: ncurses:%{_bindir}/tput
72 %description -n ncurses-utils
73 The ncurses based utilities are as follows:
75 clear -- emits clear-screen for current terminal
77 tabs -- set tabs on a terminal
79 toe -- table of entries utility
81 tput -- shell-script access to terminal capabilities.
83 tset -- terminal-initialization utility
85 reset -- terminal initialization utility
91 Thomas E. Dickey <dickey@invisible-island.net>
92 Eric S. Raymond <esr@thyrsus.com>
93 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
94 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
97 %package -n terminfo-base
98 Summary: A terminal descriptions database
101 Provides: ncurses:%{_datadir}/tabset
103 %description -n terminfo-base
104 This is the terminfo basic database, maintained in the ncurses package.
105 This database is the official successor to the 4.4BSD termcap file and
106 contains information about any known terminal. The ncurses library
107 makes use of this database to use terminals correctly.
113 Thomas E. Dickey <dickey@invisible-island.net>
114 Eric S. Raymond <esr@thyrsus.com>
118 %package -n libncurses
119 Summary: The New curses Libraries
121 Group: System/Libraries
122 Requires: terminfo-base
123 Provides: ncurses = %{version}
124 Obsoletes: ncurses < %{version}
125 Recommends: ncurses-utils = %{version}
127 %description -n libncurses
128 The ncurses library is used by the most curses based terminal
129 applications for controling its output and input to the screen.
135 Thomas E. Dickey <dickey@invisible-island.net>
136 Eric S. Raymond <esr@thyrsus.com>
137 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
138 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
143 %package -n libncurses6
144 Summary: The New curses Libraries
146 Group: System/Libraries
147 Requires: terminfo-base
149 Provides: ncurses = 6.0
151 Provides: ncurses = %{version}
154 %description -n libncurses6
155 The ncurses library is used by the most curses based terminal
156 applications for controling its output and input to the screen.
162 Thomas E. Dickey <dickey@invisible-island.net>
163 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
164 Eric S. Raymond <esr@thyrsus.com>
165 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
169 Summary: A terminal descriptions database
170 License: SUSE-Public-Domain
173 %description -n terminfo
174 This is the terminfo reference database, maintained in the ncurses
175 package. This database is the official successor to the 4.4BSD termcap
176 file and contains information about any known terminal. The ncurses
177 library makes use of this database to use terminals correctly. If you
178 just use the Linux console, xterm, and VT100, you probably will not
179 need this database -- a minimal /usr/share/terminfo tree for these
180 terminals is already included in the terminfo-base package.
186 Eric S. Raymond <esr@thyrsus.com>
187 Thomas E. Dickey <dickey@invisible-island.net>
189 %package -n ncurses-devel
190 Summary: Include Files and Libraries mandatory for Development
192 Group: Development/Libraries/C and C++
193 Provides: ncurses:%{_incdir}/ncurses.h
194 Requires: %{_bindir}/tack
195 Requires: ncurses = %{version}-%{release}
197 Requires: libncurses6 = %{version}-%{release}
199 Requires: libncurses = %{version}-%{release}
200 Requires: libncurses6 = %{version}-%{release}
203 %description -n ncurses-devel
204 This package contains all necessary include files and libraries needed
205 to develop applications that require these.
211 Thomas E. Dickey <dickey@invisible-island.net>
212 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
213 Eric S. Raymond <esr@thyrsus.com>
214 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
218 Summary: Terminfo action checker
220 Group: Development/Tools/Building
221 Provides: ncurses-devel:%{_bindir}/tack
222 Requires: ncurses = %{version}-%{release}
225 This package contains the tack utility to help to build a new terminfo
226 entry describing an unknown terminal. It can also be used to test the
227 correctness of an existing entry, and to develop the correct pad
228 timings needed to ensure that screen updates do not fall behind the
229 incoming data stream.
235 Daniel Weaver <danw@znyx.com>
236 Eric S. Raymond <esr@thyrsus.com>
239 %setup -q -n ncurses-%{version}
241 rm -f Ada95/src/terminal_interface-curses.adb
243 tar Oxfj %{S:1} | patch -p1 -s
246 %patch -P 1 -p0 -b .of
247 %patch -P 3 -p0 -b .ow
248 %patch -P 4 -p0 -b .hs
249 %patch -P 5 -p0 -b .lc
250 %patch -P 0 -p0 -b .p0
251 rm -vf include/ncurses_dll.h
261 test -n "${flag}" -a -n "${var}" || return
268 if echo 'int main () { return 0; }' | \
269 ${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
270 eval $var=\${$var:+\$$var\ }$flag
274 if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
275 eval $var=\${$var:+\$$var\ }$flag
277 if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
278 eval $var=\${$var:+\$$var\ }$flag
284 test ! -f /.buildenv || . /.buildenv
286 FALLBK="xterm,linux,vt100,vt102"
289 CFLAGS="${RPM_OPT_FLAGS} -pipe -D_REENTRANT"
290 if [[ "$BUILD_BASENAME" = debug-* ]] ; then
291 CFLAGS="${CFLAGS} -g -DTRACE"
293 cflags -Wl,-O2 LDFLAGS
294 cflags -Wl,-Bsymbolic-functions LDFLAGS
295 cflags -Wl,--hash-size=8599 LDFLAGS
296 cflags -Wl,--as-needed LDFLAGS
298 test -n "$TERM" || TERM=linux
300 export CC CFLAGS CXX CXXFLAGS GZIP TERM LDFLAGS
302 # Detect 64bit architecures and be sure that
303 # we use an unsigned long for chtype to be
304 # backward compatible with ncurses 5.4
306 echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 -
308 WITHCHTYPE="--with-chtype=long"
311 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCES -D_FILE_OFFSET_BITS=64"
315 # For security of some configure and install scripts
317 TMPDIR=$(mktemp -d /tmp/ncurses.XXXXXXXX) || exit 1
318 trap 'rm -rf ${TMPDIR}' EXIT
321 # No --enable-term-driver as this had crashed last time
322 # in ncurses/tinfo/lib_setup.c due to the fact that
323 # _nc_globals.term_driver was a NULL function pointer
325 # No --enable-tcap-names because we may have to recompile
326 # programs or foreign programs won't work
328 # No --enable-safe-sprintf because this seems to
329 # crash on some architectures
331 # No --enable-xmc-glitch because this seems to break yast2
332 # on console/konsole (no magic cookie support on those?)
334 # No --with-termlib=tinfo because libncurses depend on
335 # libtinfo (is linked with) and therefore there is no
336 # advantage about splitting of a libtinfo (IMHO).
338 touch --reference=README config.sub config.guess
343 --without-manpage-tbl \
346 --with-manpage-format=gzip \
347 --with-manpage-renames=${PWD}/man/man_db.renames \
348 --with-manpage-aliases \
349 --with-ospeed=speed_t \
352 --with-termlib=tinfo \
354 --with-xterm-kbs=del \
355 --disable-root-environ \
357 --disable-overwrite \
360 --disable-xmc-glitch \
365 --enable-no-padding \
375 --enable-ext-colors \
378 --disable-reentrant \
379 --disable-ext-mouse \
381 --disable-ext-colors \
383 --enable-weak-symbols \
384 --enable-wgetch-events \
385 --enable-pthreads-eintr \
386 --enable-string-hacks \
387 --prefix=%{_prefix} \
388 --exec-prefix=%{_prefix}\
389 --libdir=%{_libdir} \
390 --datadir=%{_datadir} \
391 --mandir=%{_mandir} \
392 --includedir=%{_incdir} \
395 --disable-tic-depends \
400 c=$(grep '^ *$ *\./configure' config.log)
402 # This is a hack to be able to boot strap
403 # a libncurses with correct fallback.c.
405 make %{?_smp_mflags} -C include
406 make %{?_smp_mflags} -C ncurses fallback.c FALLBACK_LIST=""
407 make %{?_smp_mflags} -C progs termsort.c transform.h infocmp tic
408 rm -f ncurses/fallback.c
409 PATH=$PWD/progs:$OPATH
410 LD_LIBRARY_PATH=$PWD/lib
411 export LD_LIBRARY_PATH PATH
417 export BUILD_TIC=/usr/bin/tic
419 export BUILD_TIC=$PWD/../progs/tic
421 $BUILD_TIC -I -r -e $FALLBK ../misc/terminfo.src > terminfo.src
422 $BUILD_TIC -o $TERMINFO -s terminfo.src
423 sh -e ./tinfo/MKfallback.sh $TERMINFO ../misc/terminfo.src $BUILD_TIC ${FALLBK//,/ } > fallback.c
426 cp -p fallback.c ../fallback.c.backup
429 unset LD_LIBRARY_PATH
431 # Refresh second install path
436 # Now rebuild libncurses and do the rest of this job
438 find -name fallback.o | xargs -r rm -vf
439 cp fallback.c.backup ncurses/fallback.c
442 inc=%{_incdir}/ncurses
443 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
444 make install DESTDIR=%{root} includedir=${inc} libdir=${lib}
445 ln -sf ${inc##*/}/{curses,ncurses,term,termcap}.h %{root}${inc%%/*}/
446 sh %{S:6} --cflags "-I${inc}" --libs "-lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses5-config
448 # Check for tack program on base of above ncurses
450 LD_LIBRARY_PATH=$PWD/lib
451 export LD_LIBRARY_PATH PATH
453 %if 0%{?qemu_user_space_build:1}%{?_crossbuild}
454 echo "Skipping LDD test due to running under QEMU / cross-building"
459 unset LD_LIBRARY_PATH
460 test ! -L tack || rm -f tack
463 # Now use --with-pthread for reentrant pthread support (abi > 5).
465 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --disable-widec --disable-ext-colors --without-progs
466 find -name fallback.o | xargs -r rm -vf
467 cp fallback.c.backup ncurses/fallback.c
469 lib=%{_libdir}/ncurses6
470 inc=%{_incdir}/ncurses6/ncurses
471 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
472 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
473 ln -sf ${inc##*/}/{curses,ncurses,term}.h %{root}${inc%%/*}/
474 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses6-config
476 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1
480 # Now use --enable-widec for UTF8/wide character support.
481 # The libs with 16 bit wide characters are binary incompatible
482 # to the normal 8bit wide character libs.
485 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
487 eval ./${c#*./} --disable-ext-mouse --enable-widec --disable-ext-colors --without-progs
489 find -name fallback.o | xargs -r rm -vf
490 cp fallback.c.backup ncurses/fallback.c
493 inc=%{_incdir}/ncursesw
494 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
495 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
496 sh %{S:6} --cflags "-I${inc}" --libs "-lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw5-config
498 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw5-config.1
502 # Do both --enable-widec and --with-pthread (abi > 5).
504 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
505 find -name fallback.o | xargs -r rm -vf
506 cp fallback.c.backup ncurses/fallback.c
508 lib=%{_libdir}/ncurses6
509 inc=%{_incdir}/ncurses6/ncursesw
510 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
511 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
512 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw6-config
514 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw6-config.1
521 (cd %{root}/; tar -cpsSf - *)|tar -xpsSf - -C %{buildroot}/
523 mkdir %{buildroot}/%{_lib}
524 for model in libncurses libncursest libncursesw libncursestw libtinfo
526 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
527 test -e "${lib}" || continue
528 mv "${lib}" %{buildroot}/%{_lib}/ || continue
530 for lib in %{buildroot}/%{_lib}/${model}.so.%{abi} ; do
531 test -e "${lib}" || continue
532 test -L "${lib}" || continue
533 lib=${lib#%{buildroot}}
534 lnk=%{buildroot}%{_libdir}/${model}.so
538 echo '/* GNU ld script */' > ${lnk}
539 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
541 *) ln -sf ${lib} %{buildroot}%{_libdir}/${model}.so
546 lnk=%{buildroot}%{_libdir}/libtermcap.so
547 echo '/* GNU ld script */' > ${lnk}
548 echo "INPUT(AS_NEEDED(-ltinfo))" >> ${lnk}
550 chmod 0755 %{buildroot}/%{_lib}/lib*.so.*
551 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
552 chmod a-x %{buildroot}/%{_libdir}/lib*.a
554 if test -d %{buildroot}%{_libdir}/ncurses6 ; then
555 mv %{buildroot}%{_libdir}/ncurses6/*.so.6* %{buildroot}%{_libdir}/
556 for lib in %{buildroot}%{_libdir}/ncurses6/*.so
559 lib=/%{_lib}/${lib##*/}.6
563 echo '/* GNU ld script */' > ${lnk}
564 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
567 test -L "${lnk}" || continue
571 test -L "${lnk}" || continue
572 ln -sf ../${lib##*/} ${lnk}
575 for model in libncurses libncursest libncursesw libncursestw libtinfo
577 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
578 test -e "${lib}" || continue
579 mv "${lib}" %{buildroot}/%{_lib}/ || continue
581 for lib in %{buildroot}/%{_lib}/${model}.so.6 ; do
582 test -e "${lib}" || continue
583 test -L "${lib}" || continue
584 lib=${lib#%{buildroot}}
585 lnk=%{buildroot}%{_libdir}/ncurses6/${model}.so
589 echo '/* GNU ld script */' > ${lnk}
590 echo 'SEARCH_DIR(%{_libdir}/ncurses6)' >> ${lnk}
591 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
593 *) ln -sf ${lib} %{buildroot}%{_libdir}/ncurses6/${model}.so
597 chmod 0755 %{buildroot}/%{_lib}/lib*.so.6*
598 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
599 chmod a-x %{buildroot}/%{_libdir}/ncurses6/lib*.a
602 test -n "%{buildroot}" || ldconfig -N
603 mkdir -p %{buildroot}%{_defaultdocdir}/ncurses
604 bzip2 -c misc/terminfo.src > misc/terminfo.src.bz2
605 install -m 644 misc/terminfo.src.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
606 install -m 644 doc/html/*.html %{buildroot}%{_defaultdocdir}/ncurses/
607 bzip2 doc/ncurses-intro.doc -c > doc/ncurses-intro.txt.bz2
608 install -m 644 doc/ncurses-intro.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
609 bzip2 doc/hackguide.doc -c > doc/hackguide.txt.bz2
610 install -m 644 doc/hackguide.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
611 install -m 644 %{S:3} %{buildroot}%{_defaultdocdir}/ncurses/
612 install -m 644 README %{buildroot}%{_defaultdocdir}/ncurses/
613 install -m 644 NEWS %{buildroot}%{_defaultdocdir}/ncurses/
614 mkdir -p %{buildroot}%{_sysconfdir}
615 mkdir -p %{buildroot}%{_miscdir}
616 LD_LIBRARY_PATH=$PWD/lib
617 export LD_LIBRARY_PATH
619 { echo "# See annotated version in %{_defaultdocdir}/ncurses/terminfo.src.bz2"
621 BUILD_TIC=/usr/bin/tic
623 BUILD_TIC=$PWD/../progs/tic
625 $BUILD_TIC -C -r ../misc/terminfo.src | grep -E -v '^#'; } > termcap
626 # Gererate new termcap entries for various linux consoles
628 TERMINFO=%{buildroot}%{_datadir}/terminfo \
630 install -m 0644 termcap.new %{buildroot}%{_miscdir}/termcap
632 unset LD_LIBRARY_PATH
633 if test `%{_bindir}/id -u` = '0' ; then
634 chown root:root %{buildroot}%{_miscdir}/termcap
635 chmod 0644 %{buildroot}%{_miscdir}/termcap
637 ln -sf %{_miscdir}/termcap %{buildroot}%{_sysconfdir}/termcap
638 (cat > default.list) <<-EOF
644 %{terminfo a/arpanet}
648 %{terminfo g/gnome-rh72}
649 %{terminfo k/klone+color}
653 %{terminfo l/linux-m}
654 %{terminfo l/linux-nic}
657 %{terminfo n/network}
662 %{terminfo s/screen-w}
663 %{terminfo s/screen-256color}
666 %{terminfo u/unknown}
670 %{terminfo v/vt220-8}
671 %{terminfo v/vt220-8bit}
675 %{terminfo x/xterm-color}
676 %{terminfo x/xterm-256color}
677 %{terminfo x/xterm-basic}
678 %{terminfo x/xterm-nic}
679 %{terminfo x/xterm-r6}
681 find %{buildroot}%{tabset ""} %{buildroot}%{terminfo ""} \
682 \( -type f -or -type l \) | \
683 sed "s@^%{buildroot}@@g" | \
684 grep -v -F -x -f default.list \
686 rm -f %{buildroot}%{_prefix}/lib/terminfo
689 %post -n libncurses -p /sbin/ldconfig
691 %postun -n libncurses -p /sbin/ldconfig
694 %post -n libncurses6 -p /sbin/ldconfig
696 %postun -n libncurses6 -p /sbin/ldconfig
698 %files -n terminfo-base -f default.list
699 %defattr(-,root,root)
700 %{_sysconfdir}/termcap
701 %config %{_miscdir}/termcap
702 %dir %{_datadir}/tabset/
703 %dir %{_datadir}/terminfo/
704 %dir %{_datadir}/terminfo/*/
706 %files -n ncurses-utils
707 %defattr(-,root,root)
714 %doc %{_mandir}/man1/clear.1.gz
715 %doc %{_mandir}/man1/reset.1.gz
716 %doc %{_mandir}/man1/tabs.1.gz
717 %doc %{_mandir}/man1/toe.1.gz
718 %doc %{_mandir}/man1/tput.1.gz
719 %doc %{_mandir}/man1/tset.1.gz
720 %doc %{_mandir}/man5/*.gz
724 %defattr(-,root,root)
726 %{_libdir}/lib*.so.5*
729 %files -n libncurses6
730 %defattr(-,root,root)
732 %{_libdir}/lib*.so.6*
734 %files -n ncurses-devel
735 %defattr(-,root,root)
736 %dir %{_defaultdocdir}/ncurses/
737 %doc %{_defaultdocdir}/ncurses/*
738 %{_bindir}/ncurses*-config
743 %dir %{_incdir}/ncurses/
744 %dir %{_incdir}/ncursesw/
745 %dir %{_incdir}/ncurses6/
746 %dir %{_incdir}/ncurses6/ncurses/
747 %dir %{_incdir}/ncurses6/ncursesw/
749 %{_incdir}/ncurses*/*.h
750 %{_incdir}/ncurses*/*/*.h
751 %dir %{_libdir}/ncurses6/
754 %{_libdir}/ncurses6/lib*.a
755 %{_libdir}/ncurses6/lib*.so
756 %doc %{_mandir}/man1/*-config.1.gz
757 %doc %{_mandir}/man1/captoinfo.1.gz
758 %doc %{_mandir}/man1/infocmp.1.gz
759 %doc %{_mandir}/man1/infotocap.1.gz
760 %doc %{_mandir}/man1/tic.1.gz
761 %doc %{_mandir}/man3/*.gz
762 %doc %{_mandir}/man7/*.gz
765 %defattr(-,root,root)
767 %doc %{_mandir}/man1/tack.1.gz
769 %files -f extension.list -n terminfo
770 %defattr(-,root,root)