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.
15 # Please submit bugfixes or comments via http://bugs.opensuse.org/
20 %define terminfo() %{_datadir}/%{0}/%{1}
21 %define tabset() %{_datadir}/%{0}/%{1}
25 Summary: New curses Libraries
26 Url: http://invisible-island.net/ncurses/ncurses.html
28 Source0: ncurses-%{version}.tar.bz2
29 Source1: ncurses-%{version}-patches.tar.bz2
32 Source4: ncurses-rpmlintrc
33 Source5: tack-1.07-20120303.tar.bz2
35 Source7: baselibs.conf
36 Patch0: ncurses-%{version}.dif
37 Patch1: ncurses-5.9-overflow.dif
38 Patch3: ncurses-5.9-overwrite.dif
39 Patch4: ncurses-5.7-tack.dif
40 Patch5: ncurses-5.9-environment.dif
41 #!BuildIgnore: terminfo
42 BuildRequires: gcc-c++
43 BuildRoot: %{_tmppath}/%{name}-%{version}-build
44 %global _sysconfdir /etc
45 %global _miscdir %{_datadir}/misc
46 %global _incdir %{_includedir}
47 %global root %{_tmppath}/%{name}-%{version}-store
48 %global abi %(ver=%{version}; echo ${ver%.*})
51 As soon as a text application needs to directly control its output to
52 the screen (if it wants to place the cursor at location (x,y) then
53 write text), ncurses is used. The panel and the forms libraries are
54 included in this package. These new libraries support color, special
55 characters, and panels.
57 %package -n ncurses-utils
59 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
78 %package -n terminfo-base
80 Summary: A terminal descriptions database
82 Provides: ncurses:%{_datadir}/tabset
84 %description -n terminfo-base
85 This is the terminfo basic database, maintained in the ncurses package.
86 This database is the official successor to the 4.4BSD termcap file and
87 contains information about any known terminal. The ncurses library
88 makes use of this database to use terminals correctly.
92 %package -n libncurses
94 Summary: The New curses Libraries
95 Group: System/Libraries
96 Requires: terminfo-base
97 Recommends: ncurses-utils = %{version}
98 Provides: ncurses = %{version}
99 Obsoletes: ncurses < %{version}
101 %description -n libncurses
102 The ncurses library is used by the most curses based terminal
103 applications for controling its output and input to the screen.
107 %package -n libncurses6
109 Summary: The New curses Libraries
110 Group: System/Libraries
111 Requires: terminfo-base
113 Provides: ncurses = 6.0
115 Provides: ncurses = %{version}
118 %description -n libncurses6
119 The ncurses library is used by the most curses based terminal
120 applications for controling its output and input to the screen.
123 License: SUSE-Public-Domain
124 Summary: A terminal descriptions database
127 %description -n terminfo
128 This is the terminfo reference database, maintained in the ncurses
129 package. This database is the official successor to the 4.4BSD termcap
130 file and contains information about any known terminal. The ncurses
131 library makes use of this database to use terminals correctly. If you
132 just use the Linux console, xterm, and VT100, you probably will not
133 need this database -- a minimal /usr/share/terminfo tree for these
134 terminals is already included in the terminfo-base package.
136 %package -n ncurses-devel
138 Summary: Include Files and Libraries mandatory for Development
139 Group: Development/Libraries/C and C++
140 Requires: %{_bindir}/tack
141 Requires: ncurses = %{version}
142 Provides: ncurses:%{_incdir}/ncurses.h
144 Requires: libncurses6 = %{version}
146 Requires: libncurses = %{version}
147 Requires: libncurses6 = %{version}
150 %description -n ncurses-devel
151 This package contains all necessary include files and libraries needed
152 to develop applications that require these.
156 Summary: Terminfo action checker
157 Group: Development/Tools/Building
158 Requires: ncurses = %{version}
159 Provides: ncurses-devel:%{_bindir}/tack
162 This package contains the tack utility to help to build a new terminfo
163 entry describing an unknown terminal. It can also be used to test the
164 correctness of an existing entry, and to develop the correct pad
165 timings needed to ensure that screen updates do not fall behind the
166 incoming data stream.
169 %setup -q -n ncurses-%{version}
171 rm -f Ada95/src/terminal_interface-curses.adb
173 tar Oxfj %{SOURCE1} | patch -p1 -s
181 rm -vf include/ncurses_dll.h
191 test -n "${flag}" -a -n "${var}" || return
198 if echo 'int main () { return 0; }' | \
199 ${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
200 eval $var=\${$var:+\$$var\ }$flag
204 if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
205 eval $var=\${$var:+\$$var\ }$flag
207 if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
208 eval $var=\${$var:+\$$var\ }$flag
214 test ! -f /.buildenv || . /.buildenv
216 FALLBK="xterm,linux,vt100,vt102"
219 CFLAGS="%{optflags} -pipe -D_REENTRANT"
220 if [[ "$BUILD_BASENAME" = debug-* ]] ; then
221 CFLAGS="${CFLAGS} -g -DTRACE"
223 cflags -Wl,-O2 LDFLAGS
224 cflags -Wl,-Bsymbolic-functions LDFLAGS
225 cflags -Wl,--hash-size=8599 LDFLAGS
226 cflags -Wl,--as-needed LDFLAGS
228 test -n "$TERM" || TERM=linux
230 export CC CFLAGS CXX CXXFLAGS GZIP TERM LDFLAGS
232 # Detect 64bit architecures and be sure that
233 # we use an unsigned long for chtype to be
234 # backward compatible with ncurses 5.4
236 echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 -
238 WITHCHTYPE="--with-chtype=long"
241 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCES -D_FILE_OFFSET_BITS=64"
245 # For security of some configure and install scripts
247 TMPDIR=$(mktemp -d /tmp/ncurses.XXXXXXXX) || exit 1
248 trap 'rm -rf ${TMPDIR}' EXIT
251 # No --enable-term-driver as this had crashed last time
252 # in ncurses/tinfo/lib_setup.c due to the fact that
253 # _nc_globals.term_driver was a NULL function pointer
255 # No --enable-tcap-names because we may have to recompile
256 # programs or foreign programs won't work
258 # No --enable-safe-sprintf because this seems to
259 # crash on some architectures
261 # No --enable-xmc-glitch because this seems to break yast2
262 # on console/konsole (no magic cookie support on those?)
264 # No --with-termlib=tinfo because libncurses depend on
265 # libtinfo (is linked with) and therefore there is no
266 # advantage about splitting of a libtinfo (IMHO).
268 touch --reference=README config.sub config.guess
273 --without-manpage-tbl \
276 --with-manpage-format=gzip \
277 --with-manpage-renames=${PWD}/man/man_db.renames \
278 --with-manpage-aliases \
279 --with-ospeed=speed_t \
282 --with-termlib=tinfo \
284 --with-xterm-kbs=del \
285 --disable-root-environ \
287 --disable-overwrite \
290 --disable-xmc-glitch \
295 --enable-no-padding \
305 --enable-ext-colors \
308 --disable-reentrant \
309 --disable-ext-mouse \
311 --disable-ext-colors \
313 --enable-weak-symbols \
314 --enable-wgetch-events \
315 --enable-pthreads-eintr \
316 --enable-string-hacks \
317 --prefix=%{_prefix} \
318 --exec-prefix=%{_prefix}\
319 --libdir=%{_libdir} \
320 --datadir=%{_datadir} \
321 --mandir=%{_mandir} \
322 --includedir=%{_incdir} \
325 --disable-tic-depends \
330 c=$(grep '^ *$ *\./configure' config.log)
332 # This is a hack to be able to boot strap
333 # a libncurses with correct fallback.c.
335 make %{?_smp_mflags} -C include
336 make %{?_smp_mflags} -C ncurses fallback.c FALLBACK_LIST=""
337 make %{?_smp_mflags} -C progs termsort.c transform.h infocmp tic
338 rm -f ncurses/fallback.c
339 PATH=$PWD/progs:$OPATH
340 LD_LIBRARY_PATH=$PWD/lib
341 export LD_LIBRARY_PATH PATH
347 export BUILD_TIC=/usr/bin/tic
349 export BUILD_TIC=$PWD/../progs/tic
351 $BUILD_TIC -I -r -e $FALLBK ../misc/terminfo.src > terminfo.src
352 $BUILD_TIC -o $TERMINFO -s terminfo.src
353 sh -e ./tinfo/MKfallback.sh $TERMINFO ../misc/terminfo.src $BUILD_TIC ${FALLBK//,/ } > fallback.c
356 cp -p fallback.c ../fallback.c.backup
359 unset LD_LIBRARY_PATH
361 # Refresh second install path
366 # Now rebuild libncurses and do the rest of this job
368 find -name fallback.o | xargs -r rm -vf
369 cp fallback.c.backup ncurses/fallback.c
372 inc=%{_incdir}/ncurses
373 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
374 make install DESTDIR=%{root} includedir=${inc} libdir=${lib}
375 ln -sf ${inc##*/}/{curses,ncurses,term,termcap}.h %{root}${inc%%/*}/
376 sh %{SOURCE6} --cflags "-I${inc}" --libs "-lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses5-config
378 # Check for tack program on base of above ncurses
380 LD_LIBRARY_PATH=$PWD/lib
381 export LD_LIBRARY_PATH PATH
383 %if 0%{?qemu_user_space_build:1}%{?_crossbuild}
384 echo "Skipping LDD test due to running under QEMU / cross-building"
389 unset LD_LIBRARY_PATH
390 test ! -L tack || rm -f tack
393 # Now use --with-pthread for reentrant pthread support (abi > 5).
395 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --disable-widec --disable-ext-colors --without-progs
396 find -name fallback.o | xargs -r rm -vf
397 cp fallback.c.backup ncurses/fallback.c
399 lib=%{_libdir}/ncurses6
400 inc=%{_incdir}/ncurses6/ncurses
401 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
402 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
403 ln -sf ${inc##*/}/{curses,ncurses,term}.h %{root}${inc%%/*}/
404 sh %{SOURCE6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses6-config
406 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1
410 # Now use --enable-widec for UTF8/wide character support.
411 # The libs with 16 bit wide characters are binary incompatible
412 # to the normal 8bit wide character libs.
415 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
417 eval ./${c#*./} --disable-ext-mouse --enable-widec --disable-ext-colors --without-progs
419 find -name fallback.o | xargs -r rm -vf
420 cp fallback.c.backup ncurses/fallback.c
423 inc=%{_incdir}/ncursesw
424 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
425 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
426 sh %{SOURCE6} --cflags "-I${inc}" --libs "-lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw5-config
428 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw5-config.1
432 # Do both --enable-widec and --with-pthread (abi > 5).
434 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
435 find -name fallback.o | xargs -r rm -vf
436 cp fallback.c.backup ncurses/fallback.c
438 lib=%{_libdir}/ncurses6
439 inc=%{_incdir}/ncurses6/ncursesw
440 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
441 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
442 sh %{SOURCE6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw6-config
444 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw6-config.1
451 (cd %{root}/; tar -cpsSf - *)|tar -xpsSf - -C %{buildroot}/
453 mkdir %{buildroot}/%{_lib}
454 for model in libncurses libncursest libncursesw libncursestw libtinfo
456 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
457 test -e "${lib}" || continue
458 mv "${lib}" %{buildroot}/%{_lib}/ || continue
460 for lib in %{buildroot}/%{_lib}/${model}.so.%{abi} ; do
461 test -e "${lib}" || continue
462 test -L "${lib}" || continue
463 lib=${lib#%{buildroot}}
464 lnk=%{buildroot}%{_libdir}/${model}.so
468 echo '/* GNU ld script */' > ${lnk}
469 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
471 *) ln -sf ${lib} %{buildroot}%{_libdir}/${model}.so
476 lnk=%{buildroot}%{_libdir}/libtermcap.so
477 echo '/* GNU ld script */' > ${lnk}
478 echo "INPUT(AS_NEEDED(-ltinfo))" >> ${lnk}
480 chmod 0755 %{buildroot}/%{_lib}/lib*.so.*
481 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
482 chmod a-x %{buildroot}/%{_libdir}/lib*.a
484 if test -d %{buildroot}%{_libdir}/ncurses6 ; then
485 mv %{buildroot}%{_libdir}/ncurses6/*.so.6* %{buildroot}%{_libdir}/
486 for lib in %{buildroot}%{_libdir}/ncurses6/*.so
489 lib=/%{_lib}/${lib##*/}.6
493 echo '/* GNU ld script */' > ${lnk}
494 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
497 test -L "${lnk}" || continue
501 test -L "${lnk}" || continue
502 ln -sf ../${lib##*/} ${lnk}
505 for model in libncurses libncursest libncursesw libncursestw libtinfo
507 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
508 test -e "${lib}" || continue
509 mv "${lib}" %{buildroot}/%{_lib}/ || continue
511 for lib in %{buildroot}/%{_lib}/${model}.so.6 ; do
512 test -e "${lib}" || continue
513 test -L "${lib}" || continue
514 lib=${lib#%{buildroot}}
515 lnk=%{buildroot}%{_libdir}/ncurses6/${model}.so
519 echo '/* GNU ld script */' > ${lnk}
520 echo 'SEARCH_DIR(%{_libdir}/ncurses6)' >> ${lnk}
521 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
523 *) ln -sf ${lib} %{buildroot}%{_libdir}/ncurses6/${model}.so
527 chmod 0755 %{buildroot}/%{_lib}/lib*.so.6*
528 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
529 chmod a-x %{buildroot}/%{_libdir}/ncurses6/lib*.a
532 test -n %{buildroot} || ldconfig -N
533 mkdir -p %{buildroot}%{_defaultdocdir}/ncurses
534 bzip2 -c misc/terminfo.src > misc/terminfo.src.bz2
535 install -m 644 misc/terminfo.src.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
536 install -m 644 doc/html/*.html %{buildroot}%{_defaultdocdir}/ncurses/
537 bzip2 doc/ncurses-intro.doc -c > doc/ncurses-intro.txt.bz2
538 install -m 644 doc/ncurses-intro.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
539 bzip2 doc/hackguide.doc -c > doc/hackguide.txt.bz2
540 install -m 644 doc/hackguide.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
541 install -m 644 %{SOURCE3} %{buildroot}%{_defaultdocdir}/ncurses/
542 install -m 644 README %{buildroot}%{_defaultdocdir}/ncurses/
543 install -m 644 NEWS %{buildroot}%{_defaultdocdir}/ncurses/
544 mkdir -p %{buildroot}%{_sysconfdir}
545 mkdir -p %{buildroot}%{_miscdir}
546 LD_LIBRARY_PATH=$PWD/lib
547 export LD_LIBRARY_PATH
549 { echo "# See annotated version in %{_defaultdocdir}/ncurses/terminfo.src.bz2"
551 BUILD_TIC=/usr/bin/tic
553 BUILD_TIC=$PWD/../progs/tic
555 $BUILD_TIC -C -r ../misc/terminfo.src | grep -E -v '^#'; } > termcap
556 # Gererate new termcap entries for various linux consoles
558 TERMINFO=%{buildroot}%{_datadir}/terminfo \
560 install -m 0644 termcap.new %{buildroot}%{_miscdir}/termcap
562 unset LD_LIBRARY_PATH
563 if test `%{_bindir}/id -u` = '0' ; then
564 chown root:root %{buildroot}%{_miscdir}/termcap
565 chmod 0644 %{buildroot}%{_miscdir}/termcap
567 ln -sf %{_miscdir}/termcap %{buildroot}%{_sysconfdir}/termcap
568 (cat > default.list) <<-EOF
574 %{terminfo a/arpanet}
578 %{terminfo g/gnome-rh72}
579 %{terminfo k/klone+color}
583 %{terminfo l/linux-m}
584 %{terminfo l/linux-nic}
587 %{terminfo n/network}
592 %{terminfo s/screen-w}
593 %{terminfo s/screen-256color}
596 %{terminfo u/unknown}
600 %{terminfo v/vt220-8}
601 %{terminfo v/vt220-8bit}
605 %{terminfo x/xterm-color}
606 %{terminfo x/xterm-256color}
607 %{terminfo x/xterm-basic}
608 %{terminfo x/xterm-nic}
609 %{terminfo x/xterm-r6}
611 find %{buildroot}%{tabset ""} %{buildroot}%{terminfo ""} \
612 \( -type f -or -type l \) | \
613 sed "s@^%{buildroot}@@g" | \
614 grep -v -F -x -f default.list \
616 rm -f %{buildroot}%{_prefix}/lib/terminfo
619 %post -n libncurses -p /sbin/ldconfig
621 %postun -n libncurses -p /sbin/ldconfig
624 %post -n libncurses6 -p /sbin/ldconfig
626 %postun -n libncurses6 -p /sbin/ldconfig
628 %files -n terminfo-base -f default.list
629 %defattr(-,root,root)
630 %{_sysconfdir}/termcap
631 %config %{_miscdir}/termcap
632 %dir %{_datadir}/tabset/
633 %dir %{_datadir}/terminfo/
634 %dir %{_datadir}/terminfo/*/
636 %files -n ncurses-utils
637 %defattr(-,root,root)
644 %doc %{_mandir}/man1/clear.1.gz
645 %doc %{_mandir}/man1/reset.1.gz
646 %doc %{_mandir}/man1/tabs.1.gz
647 %doc %{_mandir}/man1/toe.1.gz
648 %doc %{_mandir}/man1/tput.1.gz
649 %doc %{_mandir}/man1/tset.1.gz
650 %doc %{_mandir}/man5/*.gz
654 %defattr(-,root,root)
656 %{_libdir}/lib*.so.5*
659 %files -n libncurses6
660 %defattr(-,root,root)
662 %{_libdir}/lib*.so.6*
664 %files -n ncurses-devel
665 %defattr(-,root,root)
666 %dir %{_defaultdocdir}/ncurses/
667 %doc %{_defaultdocdir}/ncurses/*
668 %{_bindir}/ncurses*-config
673 %dir %{_incdir}/ncurses/
674 %dir %{_incdir}/ncursesw/
675 %dir %{_incdir}/ncurses6/
676 %dir %{_incdir}/ncurses6/ncurses/
677 %dir %{_incdir}/ncurses6/ncursesw/
679 %{_incdir}/ncurses*/*.h
680 %{_incdir}/ncurses*/*/*.h
681 %dir %{_libdir}/ncurses6/
684 %{_libdir}/ncurses6/lib*.a
685 %{_libdir}/ncurses6/lib*.so
686 %doc %{_mandir}/man1/*-config.1.gz
687 %doc %{_mandir}/man1/captoinfo.1.gz
688 %doc %{_mandir}/man1/infocmp.1.gz
689 %doc %{_mandir}/man1/infotocap.1.gz
690 %doc %{_mandir}/man1/tic.1.gz
691 %doc %{_mandir}/man3/*.gz
692 %doc %{_mandir}/man7/*.gz
695 %defattr(-,root,root)
697 %doc %{_mandir}/man1/tack.1.gz
699 %files -f extension.list -n terminfo
700 %defattr(-,root,root)