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 -cpSf - *)|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.5 ; 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
406 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
407 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.*
408 chmod a-x %{buildroot}/%{_libdir}/lib*.a
409 if test -d %{buildroot}%{_libdir}/ncurses6 ; then
410 mv %{buildroot}%{_libdir}/ncurses6/*.so.6* %{buildroot}%{_libdir}/
411 for lib in %{buildroot}%{_libdir}/ncurses6/*.so
414 lib=/%{_libdir}/${lib##*/}.6
418 echo '/* GNU ld script */' > ${lnk}
419 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
422 test -L "${lnk}" || continue
426 test -L "${lnk}" || continue
427 ln -sf ../${lib##*/} ${lnk}
430 for model in libncurses libncursest libncursesw libncursestw libtinfo
432 for lib in %{buildroot}%{_libdir}/${model}.so.* ; do
433 test -e "${lib}" || continue
434 #mv "${lib}" %{buildroot}/%{_lib}/ || continue
436 for lib in %{buildroot}/%{_libdir}/${model}.so.6 ; do
437 test -e "${lib}" || continue
438 test -L "${lib}" || continue
439 lib=${lib#%{buildroot}}
440 lnk=%{buildroot}%{_libdir}/ncurses6/${model}.so
444 echo '/* GNU ld script */' > ${lnk}
445 echo 'SEARCH_DIR(%{_libdir}/ncurses6)' >> ${lnk}
446 echo "INPUT(${lib} AS_NEEDED(-ltinfo))" >> ${lnk}
448 *) : #ln -sf ${lib} %{buildroot}%{_libdir}/ncurses6/${model}.so
452 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
453 chmod 0755 %{buildroot}/%{_libdir}/lib*.so.6*
454 chmod a-x %{buildroot}/%{_libdir}/ncurses6/lib*.a
456 test -n "%{buildroot}" || ldconfig -N
457 mkdir -p %{buildroot}%{_defaultdocdir}/ncurses
458 bzip2 -c misc/terminfo.src > misc/terminfo.src.bz2
459 install -m 644 misc/terminfo.src.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
460 install -m 644 doc/html/*.html %{buildroot}%{_defaultdocdir}/ncurses/
461 bzip2 doc/ncurses-intro.doc -c > doc/ncurses-intro.txt.bz2
462 install -m 644 doc/ncurses-intro.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
463 bzip2 doc/hackguide.doc -c > doc/hackguide.txt.bz2
464 install -m 644 doc/hackguide.txt.bz2 %{buildroot}%{_defaultdocdir}/ncurses/
465 install -m 644 README %{buildroot}%{_defaultdocdir}/ncurses/
466 install -m 644 NEWS %{buildroot}%{_defaultdocdir}/ncurses/
467 mkdir -p %{buildroot}%{_sysconfdir}
468 mkdir -p %{buildroot}%{_miscdir}
469 LD_LIBRARY_PATH=$PWD/lib
470 export LD_LIBRARY_PATH
472 { echo "# See annotated version in %{_defaultdocdir}/ncurses/terminfo.src.bz2"
474 BUILD_TIC=/usr/bin/tic
476 BUILD_TIC=$PWD/../progs/tic
478 $BUILD_TIC -C -r ../misc/terminfo.src | grep -E -v '^#'; } > termcap
479 # Gererate new termcap entries for various linux consoles
481 TERMINFO=%{buildroot}%{_datadir}/terminfo \
483 install -m 0644 termcap.new %{buildroot}%{_miscdir}/termcap
485 unset LD_LIBRARY_PATH
486 if test `%{_bindir}/id -u` = '0' ; then
487 chown root:root %{buildroot}%{_miscdir}/termcap
488 chmod 0644 %{buildroot}%{_miscdir}/termcap
490 ln -sf %{_miscdir}/termcap %{buildroot}%{_sysconfdir}/termcap
491 (cat > default.list) <<-EOF
499 %{terminfo g/gnome-rh72}
500 %{terminfo k/klone+color}
503 %{terminfo l/linux-m}
504 %{terminfo l/linux-nic}
509 %{terminfo s/screen-w}
510 %{terminfo s/screen-256color}
512 %{terminfo u/unknown}
516 %{terminfo v/vt220-8}
517 %{terminfo v/vt220-8bit}
521 %{terminfo x/xterm-color}
522 %{terminfo x/xterm-256color}
523 %{terminfo x/xterm-basic}
524 %{terminfo x/xterm-nic}
525 %{terminfo x/xterm-r6}
527 find %{buildroot}%{tabset ""} %{buildroot}%{terminfo ""} \
528 \( -type f -or -type l \) | \
529 sed "s@^%{buildroot}@@g" | \
530 grep -v -F -x -f default.list \
532 rm -f %{buildroot}%{_prefix}/lib/terminfo
534 %post -n libncurses -p /sbin/ldconfig
536 %postun -n libncurses -p /sbin/ldconfig
538 %post -n libncurses6 -p /sbin/ldconfig
540 %postun -n libncurses6 -p /sbin/ldconfig
542 %files -n terminfo-base -f default.list
543 %manifest %{name}.manifest
544 %defattr(-,root,root)
545 %license package/debian/copyright
546 %{_sysconfdir}/termcap
547 %config %{_miscdir}/termcap
548 %dir %{_datadir}/tabset/
549 %dir %{_datadir}/terminfo/
550 %dir %{_datadir}/terminfo/*/
552 %files -n ncurses-utils
553 %manifest %{name}.manifest
554 %defattr(-,root,root)
555 %license package/debian/copyright
564 %manifest %{name}.manifest
565 %defattr(-,root,root)
566 %license package/debian/copyright
567 %{_libdir}/lib*.so.5*
569 %files -n libncurses6
570 %manifest %{name}.manifest
571 %defattr(-,root,root)
572 %license package/debian/copyright
573 %{_libdir}/lib*.so.6*
575 %files -n ncurses-devel
576 %manifest %{name}.manifest
577 %defattr(-,root,root)
578 %license package/debian/copyright
579 %{_bindir}/ncurses*-config
584 %dir %{_incdir}/ncurses/
585 %dir %{_incdir}/ncursesw/
586 %dir %{_incdir}/ncurses6/
587 %dir %{_incdir}/ncurses6/ncurses/
588 %dir %{_incdir}/ncurses6/ncursesw/
590 %{_incdir}/ncurses*/*.h
591 %{_incdir}/ncurses*/*/*.h
592 %dir %{_libdir}/ncurses6/
595 %{_libdir}/pkgconfig/*.pc
596 %{_libdir}/ncurses6/lib*.a
597 %{_libdir}/ncurses6/lib*.so
599 %files -f extension.list -n terminfo
600 %manifest %{name}.manifest
601 %defattr(-,root,root)
602 %license package/debian/copyright
605 %license package/debian/copyright
606 %dir %{_defaultdocdir}/ncurses/
607 %doc %{_defaultdocdir}/ncurses/*