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
31 Source4: ncurses-rpmlintrc
33 Source7: baselibs.conf
34 %global _sysconfdir /etc
35 %global _miscdir %{_datadir}/misc
36 %global _incdir %{_includedir}
37 %global root %{_tmppath}/%{name}-%{version}-store
38 %global abi %(ver=%{version}; echo ${ver%.*})
41 As soon as a text application needs to directly control its output to
42 the screen (if it wants to place the cursor at location (x,y) then
43 write text), ncurses is used. The panel and the forms libraries are
44 included in this package. These new libraries support color, special
45 characters, and panels.
51 Thomas E. Dickey <dickey@invisible-island.net>
52 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
53 Eric S. Raymond <esr@thyrsus.com>
54 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
57 %package -n ncurses-utils
58 Summary: Tools using the new curses libraries
61 Provides: ncurses:%{_bindir}/tput
63 %description -n ncurses-utils
64 The ncurses based utilities are as follows:
66 clear -- emits clear-screen for current terminal
68 tabs -- set tabs on a terminal
70 toe -- table of entries utility
72 tput -- shell-script access to terminal capabilities.
74 tset -- terminal-initialization utility
76 reset -- terminal initialization utility
82 Thomas E. Dickey <dickey@invisible-island.net>
83 Eric S. Raymond <esr@thyrsus.com>
84 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
85 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
88 %package -n terminfo-base
89 Summary: A terminal descriptions database
92 Provides: ncurses:%{_datadir}/tabset
94 %description -n terminfo-base
95 This is the terminfo basic database, maintained in the ncurses package.
96 This database is the official successor to the 4.4BSD termcap file and
97 contains information about any known terminal. The ncurses library
98 makes use of this database to use terminals correctly.
104 Thomas E. Dickey <dickey@invisible-island.net>
105 Eric S. Raymond <esr@thyrsus.com>
109 %package -n libncurses
110 Summary: The New curses Libraries
112 Group: System/Libraries
113 Requires: terminfo-base
114 Provides: ncurses = %{version}
115 Obsoletes: ncurses < %{version}
116 Recommends: ncurses-utils = %{version}
118 %description -n libncurses
119 The ncurses library is used by the most curses based terminal
120 applications for controling its output and input to the screen.
126 Thomas E. Dickey <dickey@invisible-island.net>
127 Eric S. Raymond <esr@thyrsus.com>
128 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
129 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
134 %package -n libncurses6
135 Summary: The New curses Libraries
137 Group: System/Libraries
138 Requires: terminfo-base
140 Provides: ncurses = 6.0
142 Provides: ncurses = %{version}
145 %description -n libncurses6
146 The ncurses library is used by the most curses based terminal
147 applications for controling its output and input to the screen.
153 Thomas E. Dickey <dickey@invisible-island.net>
154 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
155 Eric S. Raymond <esr@thyrsus.com>
156 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
160 Summary: A terminal descriptions database
161 License: SUSE-Public-Domain
164 %description -n terminfo
165 This is the terminfo reference database, maintained in the ncurses
166 package. This database is the official successor to the 4.4BSD termcap
167 file and contains information about any known terminal. The ncurses
168 library makes use of this database to use terminals correctly. If you
169 just use the Linux console, xterm, and VT100, you probably will not
170 need this database -- a minimal /usr/share/terminfo tree for these
171 terminals is already included in the terminfo-base package.
177 Eric S. Raymond <esr@thyrsus.com>
178 Thomas E. Dickey <dickey@invisible-island.net>
180 %package -n ncurses-devel
181 Summary: Include Files and Libraries mandatory for Development
183 Group: Development/Libraries/C and C++
184 Provides: ncurses:%{_incdir}/ncurses.h
185 Requires: ncurses = %{version}-%{release}
187 Requires: libncurses6 = %{version}-%{release}
189 Requires: libncurses = %{version}-%{release}
190 Requires: libncurses6 = %{version}-%{release}
193 %description -n ncurses-devel
194 This package contains all necessary include files and libraries needed
195 to develop applications that require these.
201 Thomas E. Dickey <dickey@invisible-island.net>
202 Juergen Pfeifer <Juergen.Pfeifer@t-online.de>
203 Eric S. Raymond <esr@thyrsus.com>
204 Zeyd M. Ben-Halim <zmbenhal@netcom.com>
209 %setup -q -n ncurses-%{version}
210 rm -vf include/ncurses_dll.h
220 test -n "${flag}" -a -n "${var}" || return
227 if echo 'int main () { return 0; }' | \
228 ${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
229 eval $var=\${$var:+\$$var\ }$flag
233 if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
234 eval $var=\${$var:+\$$var\ }$flag
236 if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
237 eval $var=\${$var:+\$$var\ }$flag
243 test ! -f /.buildenv || . /.buildenv
245 FALLBK="xterm,linux,vt100,vt102"
248 CFLAGS="${RPM_OPT_FLAGS} -pipe -D_REENTRANT"
249 if [[ "$BUILD_BASENAME" = debug-* ]] ; then
250 CFLAGS="${CFLAGS} -g -DTRACE"
252 cflags -Wl,-O2 LDFLAGS
253 cflags -Wl,-Bsymbolic-functions LDFLAGS
254 cflags -Wl,--hash-size=8599 LDFLAGS
255 cflags -Wl,--as-needed LDFLAGS
257 test -n "$TERM" || TERM=linux
259 export CC CFLAGS CXX CXXFLAGS GZIP TERM LDFLAGS
261 # Detect 64bit architecures and be sure that
262 # we use an unsigned long for chtype to be
263 # backward compatible with ncurses 5.4
265 echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 -
267 WITHCHTYPE="--with-chtype=long"
270 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCES -D_FILE_OFFSET_BITS=64"
274 # For security of some configure and install scripts
276 TMPDIR=$(mktemp -d /tmp/ncurses.XXXXXXXX) || exit 1
277 trap 'rm -rf ${TMPDIR}' EXIT
280 # No --enable-term-driver as this had crashed last time
281 # in ncurses/tinfo/lib_setup.c due to the fact that
282 # _nc_globals.term_driver was a NULL function pointer
284 # No --enable-tcap-names because we may have to recompile
285 # programs or foreign programs won't work
287 # No --enable-safe-sprintf because this seems to
288 # crash on some architectures
290 # No --enable-xmc-glitch because this seems to break yast2
291 # on console/konsole (no magic cookie support on those?)
293 # No --with-termlib=tinfo because libncurses depend on
294 # libtinfo (is linked with) and therefore there is no
295 # advantage about splitting of a libtinfo (IMHO).
297 touch --reference=README config.sub config.guess
302 --without-manpage-tbl \
305 --with-manpage-format=gzip \
306 --with-manpage-renames=${PWD}/man/man_db.renames \
307 --with-manpage-aliases \
308 --with-ospeed=speed_t \
311 --with-termlib=tinfo \
313 --with-xterm-kbs=del \
314 --disable-root-environ \
316 --disable-overwrite \
319 --disable-xmc-glitch \
324 --enable-no-padding \
334 --enable-ext-colors \
337 --disable-reentrant \
338 --disable-ext-mouse \
340 --disable-ext-colors \
342 --enable-weak-symbols \
343 --enable-wgetch-events \
344 --enable-pthreads-eintr \
345 --enable-string-hacks \
346 --prefix=%{_prefix} \
347 --exec-prefix=%{_prefix}\
348 --libdir=%{_libdir} \
349 --datadir=%{_datadir} \
350 --mandir=%{_mandir} \
351 --includedir=%{_incdir} \
354 --disable-tic-depends \
359 c=$(grep '^ *$ *\./configure' config.log)
361 # This is a hack to be able to boot strap
362 # a libncurses with correct fallback.c.
364 make %{?_smp_mflags} -C include
365 make %{?_smp_mflags} -C ncurses fallback.c FALLBACK_LIST=""
366 make %{?_smp_mflags} -C progs termsort.c transform.h infocmp tic
367 rm -f ncurses/fallback.c
368 PATH=$PWD/progs:$OPATH
369 LD_LIBRARY_PATH=$PWD/lib
370 export LD_LIBRARY_PATH PATH
376 export BUILD_TIC=/usr/bin/tic
378 export BUILD_TIC=$PWD/../progs/tic
380 $BUILD_TIC -I -r -e $FALLBK ../misc/terminfo.src > terminfo.src
381 $BUILD_TIC -o $TERMINFO -s terminfo.src
382 sh -e ./tinfo/MKfallback.sh $TERMINFO ../misc/terminfo.src $BUILD_TIC ${FALLBK//,/ } > fallback.c
385 cp -p fallback.c ../fallback.c.backup
388 unset LD_LIBRARY_PATH
390 # Refresh second install path
395 # Now rebuild libncurses and do the rest of this job
397 find -name fallback.o | xargs -r rm -vf
398 cp fallback.c.backup ncurses/fallback.c
401 inc=%{_incdir}/ncurses
402 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
403 make install DESTDIR=%{root} includedir=${inc} libdir=${lib}
404 ln -sf ${inc##*/}/{curses,ncurses,term,termcap}.h %{root}${inc%%/*}/
405 sh %{S:6} --cflags "-I${inc}" --libs "-lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses5-config
408 # Now use --with-pthread for reentrant pthread support (abi > 5).
410 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --disable-widec --disable-ext-colors --without-progs
411 find -name fallback.o | xargs -r rm -vf
412 cp fallback.c.backup ncurses/fallback.c
414 lib=%{_libdir}/ncurses6
415 inc=%{_incdir}/ncurses6/ncurses
416 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
417 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
418 ln -sf ${inc##*/}/{curses,ncurses,term}.h %{root}${inc%%/*}/
419 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses6-config
421 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1
425 # Now use --enable-widec for UTF8/wide character support.
426 # The libs with 16 bit wide characters are binary incompatible
427 # to the normal 8bit wide character libs.
430 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
432 eval ./${c#*./} --disable-ext-mouse --enable-widec --disable-ext-colors --without-progs
434 find -name fallback.o | xargs -r rm -vf
435 cp fallback.c.backup ncurses/fallback.c
438 inc=%{_incdir}/ncursesw
439 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
440 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
441 sh %{S:6} --cflags "-I${inc}" --libs "-lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw5-config
443 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw5-config.1
447 # Do both --enable-widec and --with-pthread (abi > 5).
449 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
450 find -name fallback.o | xargs -r rm -vf
451 cp fallback.c.backup ncurses/fallback.c
453 lib=%{_libdir}/ncurses6
454 inc=%{_incdir}/ncurses6/ncursesw
455 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
456 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
457 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw6-config
459 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw6-config.1
466 (cd %{root}/; tar -cpsSf - *)|tar -xpsSf - -C %{buildroot}/
468 mkdir %{buildroot}/%{_lib}
469 for model in libncurses libncursest libncursesw libncursestw libtinfo
471 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
472 test -e "${lib}" || continue
473 mv "${lib}" %{buildroot}/%{_lib}/ || continue
475 for lib in %{buildroot}/%{_lib}/${model}.so.%{abi} ; do
476 test -e "${lib}" || continue
477 test -L "${lib}" || continue
478 lib=${lib#%{buildroot}}
479 lnk=%{buildroot}%{_libdir}/${model}.so
483 echo '/* GNU ld script */' > ${lnk}
484 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
486 *) ln -sf ${lib} %{buildroot}%{_libdir}/${model}.so
491 lnk=%{buildroot}%{_libdir}/libtermcap.so
492 echo '/* GNU ld script */' > ${lnk}
493 echo "INPUT(AS_NEEDED(-ltinfo))" >> ${lnk}
495 chmod 0755 %{buildroot}/%{_lib}/lib*.so.*
496 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
497 chmod a-x %{buildroot}/%{_libdir}/lib*.a
499 if test -d %{buildroot}%{_libdir}/ncurses6 ; then
500 mv %{buildroot}%{_libdir}/ncurses6/*.so.6* %{buildroot}%{_libdir}/
501 for lib in %{buildroot}%{_libdir}/ncurses6/*.so
504 lib=/%{_lib}/${lib##*/}.6
508 echo '/* GNU ld script */' > ${lnk}
509 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
512 test -L "${lnk}" || continue
516 test -L "${lnk}" || continue
517 ln -sf ../${lib##*/} ${lnk}
520 for model in libncurses libncursest libncursesw libncursestw libtinfo
522 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
523 test -e "${lib}" || continue
524 mv "${lib}" %{buildroot}/%{_lib}/ || continue
526 for lib in %{buildroot}/%{_lib}/${model}.so.6 ; do
527 test -e "${lib}" || continue
528 test -L "${lib}" || continue
529 lib=${lib#%{buildroot}}
530 lnk=%{buildroot}%{_libdir}/ncurses6/${model}.so
534 echo '/* GNU ld script */' > ${lnk}
535 echo 'SEARCH_DIR(%{_libdir}/ncurses6)' >> ${lnk}
536 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
538 *) ln -sf ${lib} %{buildroot}%{_libdir}/ncurses6/${model}.so
542 chmod 0755 %{buildroot}/%{_lib}/lib*.so.6*
543 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
544 chmod a-x %{buildroot}/%{_libdir}/ncurses6/lib*.a
547 test -n "%{buildroot}" || ldconfig -N
548 mkdir -p %{buildroot}%{_defaultdocdir}/ncurses
549 bzip2 -c misc/terminfo.src > misc/terminfo.src.bz2
550 install -m 644 misc/terminfo.src.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
551 install -m 644 doc/html/*.html %{buildroot}%{_defaultdocdir}/ncurses/
552 bzip2 doc/ncurses-intro.doc -c > doc/ncurses-intro.txt.bz2
553 install -m 644 doc/ncurses-intro.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
554 bzip2 doc/hackguide.doc -c > doc/hackguide.txt.bz2
555 install -m 644 doc/hackguide.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
556 install -m 644 %{S:3} %{buildroot}%{_defaultdocdir}/ncurses/
557 install -m 644 README %{buildroot}%{_defaultdocdir}/ncurses/
558 install -m 644 NEWS %{buildroot}%{_defaultdocdir}/ncurses/
559 mkdir -p %{buildroot}%{_sysconfdir}
560 mkdir -p %{buildroot}%{_miscdir}
561 LD_LIBRARY_PATH=$PWD/lib
562 export LD_LIBRARY_PATH
564 { echo "# See annotated version in %{_defaultdocdir}/ncurses/terminfo.src.bz2"
566 BUILD_TIC=/usr/bin/tic
568 BUILD_TIC=$PWD/../progs/tic
570 $BUILD_TIC -C -r ../misc/terminfo.src | grep -E -v '^#'; } > termcap
571 # Gererate new termcap entries for various linux consoles
573 TERMINFO=%{buildroot}%{_datadir}/terminfo \
575 install -m 0644 termcap.new %{buildroot}%{_miscdir}/termcap
577 unset LD_LIBRARY_PATH
578 if test `%{_bindir}/id -u` = '0' ; then
579 chown root:root %{buildroot}%{_miscdir}/termcap
580 chmod 0644 %{buildroot}%{_miscdir}/termcap
582 ln -sf %{_miscdir}/termcap %{buildroot}%{_sysconfdir}/termcap
583 (cat > default.list) <<-EOF
589 %{terminfo a/arpanet}
593 %{terminfo g/gnome-rh72}
594 %{terminfo k/klone+color}
598 %{terminfo l/linux-m}
599 %{terminfo l/linux-nic}
602 %{terminfo n/network}
607 %{terminfo s/screen-w}
608 %{terminfo s/screen-256color}
611 %{terminfo u/unknown}
615 %{terminfo v/vt220-8}
616 %{terminfo v/vt220-8bit}
620 %{terminfo x/xterm-color}
621 %{terminfo x/xterm-256color}
622 %{terminfo x/xterm-basic}
623 %{terminfo x/xterm-nic}
624 %{terminfo x/xterm-r6}
626 find %{buildroot}%{tabset ""} %{buildroot}%{terminfo ""} \
627 \( -type f -or -type l \) | \
628 sed "s@^%{buildroot}@@g" | \
629 grep -v -F -x -f default.list \
631 rm -f %{buildroot}%{_prefix}/lib/terminfo
634 %post -n libncurses -p /sbin/ldconfig
636 %postun -n libncurses -p /sbin/ldconfig
639 %post -n libncurses6 -p /sbin/ldconfig
641 %postun -n libncurses6 -p /sbin/ldconfig
643 %files -n terminfo-base -f default.list
644 %defattr(-,root,root)
645 %{_sysconfdir}/termcap
646 %config %{_miscdir}/termcap
647 %dir %{_datadir}/tabset/
648 %dir %{_datadir}/terminfo/
649 %dir %{_datadir}/terminfo/*/
651 %files -n ncurses-utils
652 %defattr(-,root,root)
659 %doc %{_mandir}/man1/clear.1.gz
660 %doc %{_mandir}/man1/reset.1.gz
661 %doc %{_mandir}/man1/tabs.1.gz
662 %doc %{_mandir}/man1/toe.1.gz
663 %doc %{_mandir}/man1/tput.1.gz
664 %doc %{_mandir}/man1/tset.1.gz
665 %doc %{_mandir}/man5/*.gz
669 %defattr(-,root,root)
671 %{_libdir}/lib*.so.5*
674 %files -n libncurses6
675 %defattr(-,root,root)
677 %{_libdir}/lib*.so.6*
679 %files -n ncurses-devel
680 %defattr(-,root,root)
681 %dir %{_defaultdocdir}/ncurses/
682 %doc %{_defaultdocdir}/ncurses/*
683 %{_bindir}/ncurses*-config
688 %dir %{_incdir}/ncurses/
689 %dir %{_incdir}/ncursesw/
690 %dir %{_incdir}/ncurses6/
691 %dir %{_incdir}/ncurses6/ncurses/
692 %dir %{_incdir}/ncurses6/ncursesw/
694 %{_incdir}/ncurses*/*.h
695 %{_incdir}/ncurses*/*/*.h
696 %dir %{_libdir}/ncurses6/
699 %{_libdir}/ncurses6/lib*.a
700 %{_libdir}/ncurses6/lib*.so
701 %doc %{_mandir}/man1/*-config.1.gz
702 %doc %{_mandir}/man1/captoinfo.1.gz
703 %doc %{_mandir}/man1/infocmp.1.gz
704 %doc %{_mandir}/man1/infotocap.1.gz
705 %doc %{_mandir}/man1/tic.1.gz
706 %doc %{_mandir}/man3/*.gz
707 %doc %{_mandir}/man7/*.gz
710 %files -f extension.list -n terminfo
711 %defattr(-,root,root)