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 BuildRequires: pkg-config
22 %define terminfo() %{_datadir}/%{0}/%{1}
23 %define tabset() %{_datadir}/%{0}/%{1}
26 Summary: New curses Libraries
29 Url: http://invisible-island.net/ncurses/ncurses.html
30 Source0: ncurses-%{version}.tar.gz
32 Source4: ncurses-rpmlintrc
34 Source7: baselibs.conf
35 Source1001: ncurses.manifest
36 %global _sysconfdir /etc
37 %global _miscdir %{_datadir}/misc
38 %global _incdir %{_includedir}
39 %global root %{_tmppath}/%{name}-%{version}-store
42 As soon as a text application needs to directly control its output to
43 the screen (if it wants to place the cursor at location (x,y) then
44 write text), ncurses is used. The panel and the forms libraries are
45 included in this package. These new libraries support color, special
46 characters, and panels.
49 %package -n ncurses-utils
50 Summary: Tools using the new curses libraries
53 Provides: ncurses:%{_bindir}/tput
55 %description -n ncurses-utils
56 The ncurses based utilities are as follows:
58 clear -- emits clear-screen for current terminal
60 tabs -- set tabs on a terminal
62 toe -- table of entries utility
64 tput -- shell-script access to terminal capabilities.
66 tset -- terminal-initialization utility
68 reset -- terminal initialization utility
70 %package -n terminfo-base
71 Summary: A terminal descriptions database
74 Provides: ncurses:%{_datadir}/tabset
76 %description -n terminfo-base
77 This is the terminfo basic database, maintained in the ncurses package.
78 This database is the official successor to the 4.4BSD termcap file and
79 contains information about any known terminal. The ncurses library
80 makes use of this database to use terminals correctly.
83 %package -n libncurses
84 Summary: The New curses Libraries
87 Requires: terminfo-base
88 Provides: ncurses = %{version}
89 Obsoletes: ncurses < %{version}
90 Recommends: ncurses-utils = %{version}
92 %description -n libncurses
93 The ncurses library is used by the most curses based terminal
94 applications for controling its output and input to the screen.
97 %package -n libncurses6
98 Summary: The New curses Libraries
100 Group: Base/Libraries
101 Requires: terminfo-base
102 Provides: ncurses = 6.0
104 %description -n libncurses6
105 The ncurses library is used by the most curses based terminal
106 applications for controling its output and input to the screen.
109 Summary: A terminal descriptions database
110 License: Public-Domain
111 Group: Base/Utilities
113 %description -n terminfo
114 This is the terminfo reference database, maintained in the ncurses
115 package. This database is the official successor to the 4.4BSD termcap
116 file and contains information about any known terminal. The ncurses
117 library makes use of this database to use terminals correctly. If you
118 just use the Linux console, xterm, and VT100, you probably will not
119 need this database -- a minimal /usr/share/terminfo tree for these
120 terminals is already included in the terminfo-base package.
122 %package -n ncurses-devel
123 Summary: Include Files and Libraries mandatory for Development
125 Group: Base/Development
126 Provides: ncurses:%{_incdir}/ncurses.h
127 Requires: ncurses = %{version}-%{release}
128 Requires: libncurses = %{version}-%{release}
129 Requires: libncurses6 = %{version}-%{release}
131 %description -n ncurses-devel
132 This package contains all necessary include files and libraries needed
133 to develop applications that require these.
136 %setup -q -n ncurses-%{version}
138 rm -vf include/ncurses_dll.h
148 test -n "${flag}" -a -n "${var}" || return
155 if echo 'int main () { return 0; }' | \
156 ${CC:-gcc} -Werror $flag -o /dev/null -xc - > /dev/null 2>&1 ; then
157 eval $var=\${$var:+\$$var\ }$flag
161 if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
162 eval $var=\${$var:+\$$var\ }$flag
164 if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then
165 eval $var=\${$var:+\$$var\ }$flag
171 test ! -f /.buildenv || . /.buildenv
173 FALLBK="xterm,linux,vt100,vt102"
176 CFLAGS="${RPM_OPT_FLAGS} -pipe -D_REENTRANT"
177 if [[ "$BUILD_BASENAME" = debug-* ]] ; then
178 CFLAGS="${CFLAGS} -g -DTRACE"
180 cflags -Wl,-O2 LDFLAGS
181 cflags -Wl,-Bsymbolic-functions LDFLAGS
182 cflags -Wl,--hash-size=8599 LDFLAGS
183 cflags -Wl,--as-needed LDFLAGS
185 test -n "$TERM" || TERM=linux
187 export CC CFLAGS CXX CXXFLAGS GZIP TERM LDFLAGS
189 # Detect 64bit architecures and be sure that
190 # we use an unsigned long for chtype to be
191 # backward compatible with ncurses 5.4
193 echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 -
195 WITHCHTYPE="--with-chtype=long"
198 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCES -D_FILE_OFFSET_BITS=64"
202 # For security of some configure and install scripts
204 TMPDIR=$(mktemp -d /tmp/ncurses.XXXXXXXX) || exit 1
205 trap 'rm -rf ${TMPDIR}' EXIT
208 # No --enable-term-driver as this had crashed last time
209 # in ncurses/tinfo/lib_setup.c due to the fact that
210 # _nc_globals.term_driver was a NULL function pointer
212 # No --enable-tcap-names because we may have to recompile
213 # programs or foreign programs won't work
215 # No --enable-safe-sprintf because this seems to
216 # crash on some architectures
218 # No --enable-xmc-glitch because this seems to break yast2
219 # on console/konsole (no magic cookie support on those?)
221 # No --with-termlib=tinfo because libncurses depend on
222 # libtinfo (is linked with) and therefore there is no
223 # advantage about splitting of a libtinfo (IMHO).
225 touch --reference=README config.sub config.guess
230 --without-manpage-tbl \
233 --with-manpage-format=gzip \
234 --with-manpage-renames=${PWD}/man/man_db.renames \
235 --with-manpage-aliases \
236 --with-ospeed=speed_t \
239 --with-termlib=tinfo \
241 --with-xterm-kbs=del \
242 --disable-root-environ \
244 --disable-overwrite \
247 --disable-xmc-glitch \
252 --enable-no-padding \
256 --with-pkg-config-libdir=%{_libdir}/pkgconfig \
261 --disable-reentrant \
262 --disable-ext-mouse \
264 --disable-ext-colors \
265 --enable-weak-symbols \
266 --enable-wgetch-events \
267 --enable-pthreads-eintr \
268 --enable-string-hacks \
269 --prefix=%{_prefix} \
270 --exec-prefix=%{_prefix}\
271 --libdir=%{_libdir} \
272 --datadir=%{_datadir} \
273 --mandir=%{_mandir} \
274 --includedir=%{_incdir} \
277 --disable-tic-depends \
279 #--with-pkg-config-libdir=%{_libdir}/pkgconfig \
283 c=$(grep '^ *$ *\./configure' config.log)
285 # This is a hack to be able to boot strap
286 # a libncurses with correct fallback.c.
288 make %{?_smp_mflags} -C include
289 make %{?_smp_mflags} -C ncurses fallback.c FALLBACK_LIST=""
290 make %{?_smp_mflags} -C progs termsort.c transform.h infocmp tic
291 rm -f ncurses/fallback.c
292 PATH=$PWD/progs:$OPATH
293 LD_LIBRARY_PATH=$PWD/lib
294 export LD_LIBRARY_PATH PATH
300 export BUILD_TIC=/usr/bin/tic
302 export BUILD_TIC=$PWD/../progs/tic
304 $BUILD_TIC -I -r -e $FALLBK ../misc/terminfo.src > terminfo.src
305 $BUILD_TIC -o $TERMINFO -s terminfo.src
306 sh -e ./tinfo/MKfallback.sh $TERMINFO ../misc/terminfo.src $BUILD_TIC ${FALLBK//,/ } > fallback.c
309 cp -p fallback.c ../fallback.c.backup
312 unset LD_LIBRARY_PATH
314 # Refresh second install path
319 # Now rebuild libncurses and do the rest of this job
321 find -name fallback.o | xargs -r rm -vf
322 cp fallback.c.backup ncurses/fallback.c
325 inc=%{_incdir}/ncurses
326 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
327 make install DESTDIR=%{root} includedir=${inc} libdir=${lib}
328 ln -sf ${inc##*/}/{curses,ncurses,term,termcap}.h %{root}${inc%%/*}/
329 sh %{S:6} --cflags "-I${inc}" --libs "-lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses5-config
331 # Now use --with-pthread for reentrant pthread support (abi > 5).
333 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --disable-widec --disable-ext-colors --without-progs
334 find -name fallback.o | xargs -r rm -vf
335 cp fallback.c.backup ncurses/fallback.c
337 lib=%{_libdir}/ncurses6
338 inc=%{_incdir}/ncurses6/ncurses
339 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
340 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
341 ln -sf ${inc##*/}/{curses,ncurses,term}.h %{root}${inc%%/*}/
342 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncurses" --libs "-ltinfo" %{root}%{_bindir}/ncurses6-config
344 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1
347 # Now use --enable-widec for UTF8/wide character support.
348 # The libs with 16 bit wide characters are binary incompatible
349 # to the normal 8bit wide character libs.
351 eval ./${c#*./} --disable-ext-mouse --enable-widec --disable-ext-colors --without-progs
352 find -name fallback.o | xargs -r rm -vf
353 cp fallback.c.backup ncurses/fallback.c
356 inc=%{_incdir}/ncursesw
357 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
358 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
359 sh %{S:6} --cflags "-I${inc}" --libs "-lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw5-config
361 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw5-config.1
364 # Do both --enable-widec and --with-pthread (abi > 5).
366 eval ./${c#*./} --with-pthread --enable-reentrant --enable-ext-mouse --enable-widec --enable-ext-colors --without-progs
367 find -name fallback.o | xargs -r rm -vf
368 cp fallback.c.backup ncurses/fallback.c
370 lib=%{_libdir}/ncurses6
371 inc=%{_incdir}/ncurses6/ncursesw
372 # must not use %jobs here (would lead to: ln: ncurses.h already exists)
373 make install.libs install.includes DESTDIR=%{root} includedir=${inc} libdir=${lib}
374 sh %{S:6} --cflags "-I${inc} -I${inc%%/*}" --libs "-L${lib} -lncursesw" --libs "-ltinfo" %{root}%{_bindir}/ncursesw6-config
376 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncursesw6-config.1
382 (cd %{root}/; tar -cpsSf - *)|tar -xpsSf - -C %{buildroot}/
384 #mkdir -p %{buildroot}/%{_lib}
385 for model in libncurses libncursest libncursesw libncursestw libtinfo
387 #for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
388 # test -e "${lib}" || continue
389 # mv "${lib}" %{buildroot}/%{_lib}/ || continue
391 for lib in %{buildroot}/%{_libdir}/${model}.so.%{abi} ; do
392 test -e "${lib}" || continue
393 test -L "${lib}" || continue
394 lib=${lib#%{buildroot}}
395 lnk=%{buildroot}%{_libdir}/${model}.so
399 echo '/* GNU ld script */' > ${lnk}
400 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
402 #*) ln -sf ${lib} %{buildroot}%{_libdir}/${model}.so
407 lnk=%{buildroot}%{_libdir}/libtermcap.so
408 echo '/* GNU ld script */' > ${lnk}
409 echo "INPUT(AS_NEEDED(-ltinfo))" >> ${lnk}
411 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
412 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
413 chmod a-x %{buildroot}/%{_libdir}/lib*.a
414 if test -d %{buildroot}%{_libdir}/ncurses6 ; then
415 mv %{buildroot}%{_libdir}/ncurses6/*.so.6* %{buildroot}%{_libdir}/
416 for lib in %{buildroot}%{_libdir}/ncurses6/*.so
419 lib=/%{_libdir}/${lib##*/}.6
423 echo '/* GNU ld script */' > ${lnk}
424 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
427 test -L "${lnk}" || continue
431 test -L "${lnk}" || continue
432 ln -sf ../${lib##*/} ${lnk}
435 for model in libncurses libncursest libncursesw libncursestw libtinfo
437 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
438 test -e "${lib}" || continue
439 #mv "${lib}" %{buildroot}/%{_lib}/ || continue
441 for lib in %{buildroot}/%{_libdir}/${model}.so.6 ; do
442 test -e "${lib}" || continue
443 test -L "${lib}" || continue
444 lib=${lib#%{buildroot}}
445 lnk=%{buildroot}%{_libdir}/ncurses6/${model}.so
449 echo '/* GNU ld script */' > ${lnk}
450 echo 'SEARCH_DIR(%{_libdir}/ncurses6)' >> ${lnk}
451 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
453 *) : #ln -sf ${lib} %{buildroot}%{_libdir}/ncurses6/${model}.so
457 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
458 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
459 chmod a-x %{buildroot}/%{_libdir}/ncurses6/lib*.a
461 test -n "%{buildroot}" || ldconfig -N
462 mkdir -p %{buildroot}%{_defaultdocdir}/ncurses
463 bzip2 -c misc/terminfo.src > misc/terminfo.src.bz2
464 install -m 644 misc/terminfo.src.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
465 install -m 644 doc/html/*.html %{buildroot}%{_defaultdocdir}/ncurses/
466 bzip2 doc/ncurses-intro.doc -c > doc/ncurses-intro.txt.bz2
467 install -m 644 doc/ncurses-intro.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
468 bzip2 doc/hackguide.doc -c > doc/hackguide.txt.bz2
469 install -m 644 doc/hackguide.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
470 install -m 644 README %{buildroot}%{_defaultdocdir}/ncurses/
471 install -m 644 NEWS %{buildroot}%{_defaultdocdir}/ncurses/
472 mkdir -p %{buildroot}%{_sysconfdir}
473 mkdir -p %{buildroot}%{_miscdir}
474 LD_LIBRARY_PATH=$PWD/lib
475 export LD_LIBRARY_PATH
477 { echo "# See annotated version in %{_defaultdocdir}/ncurses/terminfo.src.bz2"
479 BUILD_TIC=/usr/bin/tic
481 BUILD_TIC=$PWD/../progs/tic
483 $BUILD_TIC -C -r ../misc/terminfo.src | grep -E -v '^#'; } > termcap
484 # Gererate new termcap entries for various linux consoles
486 TERMINFO=%{buildroot}%{_datadir}/terminfo \
488 install -m 0644 termcap.new %{buildroot}%{_miscdir}/termcap
490 unset LD_LIBRARY_PATH
491 if test `%{_bindir}/id -u` = '0' ; then
492 chown root:root %{buildroot}%{_miscdir}/termcap
493 chmod 0644 %{buildroot}%{_miscdir}/termcap
495 ln -sf %{_miscdir}/termcap %{buildroot}%{_sysconfdir}/termcap
496 (cat > default.list) <<-EOF
504 %{terminfo g/gnome-rh72}
505 %{terminfo k/klone+color}
508 %{terminfo l/linux-m}
509 %{terminfo l/linux-nic}
514 %{terminfo s/screen-w}
515 %{terminfo s/screen-256color}
517 %{terminfo u/unknown}
521 %{terminfo v/vt220-8}
522 %{terminfo v/vt220-8bit}
526 %{terminfo x/xterm-color}
527 %{terminfo x/xterm-256color}
528 %{terminfo x/xterm-basic}
529 %{terminfo x/xterm-nic}
530 %{terminfo x/xterm-r6}
532 find %{buildroot}%{tabset ""} %{buildroot}%{terminfo ""} \
533 \( -type f -or -type l \) | \
534 sed "s@^%{buildroot}@@g" | \
535 grep -v -F -x -f default.list \
537 rm -f %{buildroot}%{_prefix}/lib/terminfo
539 %post -n libncurses -p /sbin/ldconfig
541 %postun -n libncurses -p /sbin/ldconfig
543 %post -n libncurses6 -p /sbin/ldconfig
545 %postun -n libncurses6 -p /sbin/ldconfig
547 %files -n terminfo-base -f default.list
548 %manifest %{name}.manifest
549 %defattr(-,root,root)
550 %{_sysconfdir}/termcap
551 %config %{_miscdir}/termcap
552 %dir %{_datadir}/tabset/
553 %dir %{_datadir}/terminfo/
554 %dir %{_datadir}/terminfo/*/
556 %files -n ncurses-utils
557 %manifest %{name}.manifest
558 %defattr(-,root,root)
565 %doc %{_mandir}/man1/clear.1.gz
566 %doc %{_mandir}/man1/reset.1.gz
567 %doc %{_mandir}/man1/tabs.1.gz
568 %doc %{_mandir}/man1/toe.1.gz
569 %doc %{_mandir}/man1/tput.1.gz
570 %doc %{_mandir}/man1/tset.1.gz
571 %doc %{_mandir}/man5/*.gz
574 %manifest %{name}.manifest
575 %defattr(-,root,root)
576 %{_libdir}/lib*.so.5*
578 %files -n libncurses6
579 %manifest %{name}.manifest
580 %defattr(-,root,root)
581 %{_libdir}/lib*.so.6*
583 %files -n ncurses-devel
584 %manifest %{name}.manifest
585 %defattr(-,root,root)
586 %dir %{_defaultdocdir}/ncurses/
587 %doc %{_defaultdocdir}/ncurses/*
588 %{_bindir}/ncurses*-config
593 %dir %{_incdir}/ncurses/
594 %dir %{_incdir}/ncursesw/
595 %dir %{_incdir}/ncurses6/
596 %dir %{_incdir}/ncurses6/ncurses/
597 %dir %{_incdir}/ncurses6/ncursesw/
599 %{_incdir}/ncurses*/*.h
600 %{_incdir}/ncurses*/*/*.h
601 %dir %{_libdir}/ncurses6/
604 %{_libdir}/pkgconfig/*.pc
605 %{_libdir}/ncurses6/lib*.a
606 %{_libdir}/ncurses6/lib*.so
607 %doc %{_mandir}/man1/*-config.1.gz
608 %doc %{_mandir}/man1/captoinfo.1.gz
609 %doc %{_mandir}/man1/infocmp.1.gz
610 %doc %{_mandir}/man1/infotocap.1.gz
611 %doc %{_mandir}/man1/tic.1.gz
612 %doc %{_mandir}/man3/*.gz
613 %doc %{_mandir}/man7/*.gz
616 %files -f extension.list -n terminfo
617 %manifest %{name}.manifest
618 %defattr(-,root,root)