Ncurses libraries and applications

Installation and configuration of ncurses libraries and applications.

About

This chapter describes the construction and installation of some ncurses applications and libraries in SliTaz. The procedure consists of moving into the /src directory, downloading the sources for the application in question, unpacking, reading the README or INSTALL file(s), compiling and installing the binary in SliTaz. Once the applications are installed, we can create a new initramfs, copy it to the root of the cdrom and generate a new ISO image. For this you can also use mktaziso in SliTaz tools.

Assign an environment variable ($fs)

An environmental variable can't specify the path to the directory, just the name of the directory. We will affect a variable '$fs' to indicate the path to the root filesystem (rootfs). To do this, we venture into the working directory SliTaz/, and type:

 # export fs=$PWD/rootfs

To check:

 # echo $fs

ncurses-5.6 - Terminal utilities and libraries

ncurses (dickey.his.com/ncurses/) contains functions to display text in different ways on the screen of a Linux terminal and also provides the terminfo file. Ncurses libraries are used among others by retawq, nano and some games. We install the libraries in /lib and the rest in /usr/bin with a small strip to clean the executables:

 # cd src
 # wget ftp://invisible-island.net/ncurses/ncurses-5.6.tar.gz
 # tar xzf ncurses-5.6.tar.gz
 # cd ncurses-5.6
 # ./configure --prefix=/usr \
   --libdir=/lib --sysconfdir=/etc \
   --infodir=/usr/share/info --mandir=/usr/share/man \
   --with-shared --without-debug --without-ada
 # make
 # make DESTDIR=$PWD/_pkg install
 # strip -v _pkg/lib/*
 # strip -v _pkg/usr/bin/*

Copy the libncurses library and some applications in SliTaz. The reset utility is used at the end of the rcS initialization script to remove the Linux logo. If you wish, you can copy the associated utilities (tic, tack, toe, etc), being careful not to delete the link to BusyBox:

 # cp -a _pkg/lib/libncurses.so* $fs/lib
 # cp -ia _pkg/usr/bin/{clear,ncurses5-config,tset,reset} \
   $fs/usr/bin

Copy terminfo files, we only use a few files. If you want more, you can copy:

 # mkdir -v $fs/usr/share/terminfo
 # mkdir -v $fs/usr/share/terminfo/{a,l,r,v,x}
 # cp _pkg/usr/share/terminfo/a/ansi \
   $fs/usr/share/terminfo/a
 # cp _pkg/usr/share/terminfo/l/linux \
   $fs/usr/share/terminfo/l
 # cp _pkg/usr/share/terminfo/r/rxvt \
   $fs/usr/share/terminfo/r
 # cp _pkg/usr/share/terminfo/x/{xterm,xterm-color,xterm-new,xterm-vt220} \
   $fs/usr/share/terminfo/x
 # cp _pkg/usr/share/terminfo/v/{vt100,vt102*} \
   $fs/usr/share/terminfo/v

Copy the tabset files:

 # cp -a _pkg/usr/share/tabset $fs/usr/share

clex-3.16 - File Manager

CLEX (http://www.clex.sk/) is a small ncurses file manager (160 KB). The configuration file (rc) is ~/clexrc; ~/.clexbm is used for bookmarks:

 # cd ..
 # wget http://www.clex.sk/download/clex-3.16.tar.gz
 # tar xzf clex-3.16.tar.gz
 # cd clex-3.16
 # ./configure --prefix=/usr --infodir=/usr/share/info \
   --mandir=/usr/share/man
 # make
 # make DESTDIR=$PWD/_pkg install
 # strip -v _pkg/usr/bin/clex

Install the clex binary in the rootfs of SliTaz:

 # cp _pkg/usr/bin/clex $fs/usr/bin

libs

If we execute the ldd command on clex, the following dependancies should be displayed:

        libncurses.so.5 => /lib/libncurses.so.5 (0x40025000)
        libc.so.6 => /lib/libc.so.6 (0x40064000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

nano-2.0.6 - Advanced Text Editor

GNU nano (www.nano-editor.org) is a well known, fast, effective GNU/Linux text editor that supports colored syntax. This is the default text editor in SliTaz:

 # cd ..
 # wget http://www.nano-editor.org/dist/v2.0/nano-2.0.6.tar.gz
 # tar xzf nano-2.0.6.tar.gz
 # cd nano-2.0.6
 # ./configure --enable-all --enable-extra --prefix=/usr \
   --infodir=/usr/share/info --mandir=/usr/share/man \
   --sysconfdir=/etc
 # make
 # make DESTDIR=$PWD/_pkg install
 # strip -v _pkg/usr/bin/nano

Copy the nano binary and the rnano link in SliTaz:

 # cp -a _pkg/usr/bin/* $fs/usr/bin

Copy the configuration files in _pkg/usr/share/nano to our rootfs:

 # cp -a _pkg/usr/share/nano $fs/usr/share

libs

If we execute the ldd command on nano, the following dependancies should be displayed:

        libncurses.so.5 => /lib/libncurses.so.5 (0x40025000)
        libc.so.6 => /lib/libc.so.6 (0x40064000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

locale

About the language, you can copy the .mo files created when installing nano from /usr/share/locale/(fr,en,de,es,etc)/LC_MESSAGES to the rootfs. Example for the French language:

 # cp -a _pkg/usr/share/locale/fr/LC_MESSAGES $fs/usr/share/locale/fr

Customize nano

You can customize nano via /etc/nanorc or ~/.nanorc for each user of the system. It's in this file that you can define the colors used by nano through the files in /usr/share/nano. You will find a broad example of this file in the archive of nano and SliTaz tools.

For a system configuration file, you can copy the file in SliTaz tools to /etc in the rootfs:

 # cd ..
 # cp -a slitaz-tools-1.1/etc/nanorc $fs/etc

retawq-0.2.6c - Text mode Web browser

retawq (retawq.sourceforge.net) is a small text-only web browser. We only flag a few useful options when configuring, retawq needs terminfo files, libncurses libraries and libthread:

 # wget http://switch.dl.sourceforge.net/sourceforge/retawq/retawq-0.2.6c.tar.gz
 # tar xzf retawq-0.2.6c.tar.gz
 # cd retawq-0.2.6c
 # ./configure --enable-i18n --enable-local-cgi --path-prefix=/usr \
   --path-doc=/usr/share/doc/retawq --path-man=/usr/share/man
 # make
 # strip -v retawq

Copy the retawq binary in SliTaz:

 # cp retawq $fs/usr/bin

libs

        libncurses.so.5 => /lib/libncurses.so.5 (0x40025000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x40064000)
        libc.so.6 => /lib/libc.so.6 (0x40074000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

You can copy the lipthread library from your host system or use the minimum package glibc-2.3.6 distributed by SliTaz:

 # cp -a /lib/libpthread* $fs/lib
 # strip --strip-unneeded $fs/lib/*

locale

For language, you can copy the .mo files in /i18n of the retawq archive to /usr/share/locale/(fr,en,es,etc)/LC_MESSAGES. Example for the French language, renaming the file to retawq.mo:

 # cp -v i18n/fr.mo $fs/usr/share/locale/fr/LC_MESSAGES/retawq.mo

Customize retawq

To personalize retawq, you can use a ~/.retawq directory containing a config file. You can also save bookmarks (html) in the root directory of the user. You will find an examples/ in the archive of retawq (or SliTaz tools) containing a bookmarks.html page with a list of favorite web sites. You can also copy the docs (/documents) from retawq to /usr/share/doc/retawq.

htop-6.0.5 - System process viewer

htop (htop.sourceforge.net/) is software that displays system processes using ncurses.

Returning to the /src directory, download, unpack, configure, compile and clean (with strip):

 # cd ..
 # wget http://switch.dl.sourceforge.net/sourceforge/htop/htop-0.6.5.tar.gz
 # tar xzf htop-0.6.5.tar.gz
 # cd htop-0.6.5
 # ./configure --prefix=/usr --mandir=/usr/share/man
 # make
 # make DESTDIR=$PWD/_pkg install
 # strip -v _pkg/usr/bin/htop

Copy the htop binary in SliTaz:

 # cp _pkg/usr/bin/htop $fs/usr/bin

You can still copy the htop icon found in: _pkg/usr/share/pixmaps.

libs

        libm.so.6 => /lib/libm.so.6 (0xb7f97000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb7f55000)
        libc.so.6 => /lib/libc.so.6 (0xb7e20000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fc9000)

dialog-1.1.20070409 - GUI shell scripts

dialog (invisible-island.net/dialog/dialog.html), is a utility to build GUI-based consoles:

 # cd ..
 # wget ftp://invisible-island.net/dialog/dialog.tar.gz
 # tar xzf dialog.tar.gz
 # cd dialog-1.1-20070409
 # ./configure --enable-nls --with-ncurses --prefix=/usr \
   --sysconfdir=/etc --mandir=/usr/share/man
 # make
 # make DESTDIR=$PWD/_pkg install
 # strip -v _pkg/usr/bin/dialog

Copy dialog binary in SliTaz:

 # cp _pkg/usr/bin/dialog $fs/usr/bin

libs

        libncurses.so.5 => /lib/libncurses.so.5 (0x40027000)
        libm.so.6 => /lib/libm.so.6 (0x40066000)
        libc.so.6 => /lib/libc.so.6 (0x40089000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

locale

You can install locale files if you wish:

 # cp -a _pkg/usr/share/locale/fr $fs/usr/share/locale

The dialog configuration file is /etc/dialogrc and/or ~/.dialogrc for each user. There are also full examples of scripts in the /sample directory in the sources of dialog.

Ninvaders-0.1.1 - Space Invaders clone

ninvaders (http://ninvaders.sourceforge.net/) is a clone of the popular Space Invaders game (46 KB). We begin by placing ourselves in the /src directory, then we download, untar, compile, clean using strip and copy the nInvaders binary in /usr/games of SliTaz:

 # cd ..
 # wget http://ovh.dl.sourceforge.net/sourceforge/ninvaders/ninvaders-0.1.1.tar.gz
 # tar xzf ninvaders-0.1.1.tar.gz
 # cd ninvaders-0.1.1
 # make
 # strip -v nInvaders
 # cp nInvaders $fs/usr/games

bastet-0.41 - Bastard Tetris clone

A game of Tetris (17 KB):

 # wget http://fph.altervista.org/prog/bastet-0.41.tgz
 # tar xzf bastet-0.41.tgz
 # cd bastet-0.41
 # make
 # strip bastet
 # cp bastet $fs/usr/games
 # mkdir -p $fs/var/games
 # touch $fs/var/games/bastet.scores
 # chmod 666 $fs/var/games/bastet.scores

rhapsody-0.28b - IRC chat client

Rhapsody (http://rhapsody.sourceforge.net/) is a fast and lightweight chat client supporting the IRC protocol. It provides a menu for managing servers, channels and configuration. It is therefore easy to use:

 # cd ..
 # wget http://switch.dl.sourceforge.net/sourceforge/rhapsody/rhapsody_0.28b.tgz
 # tar xzf rhapsody_0.28b.tgz
 # cd rhapsody-0.28b
 # ./configure -i /usr/bin -d /usr/share/doc/rhapsody
 # make
 # strip -v rhapsody

Install the binary and help files in SliTaz. We must adjust permissions on these files so that everyone can read:

 # cp rhapsody $fs/usr/bin
 # mkdir $fs/usr/share/doc/rhapsody
 # cp -a help $fs/usr/share/doc/rhapsody/help
 # chmod 644 $fs/usr/share/doc/rhapsody/help/*

libs

Rhapsody uses the following libraries:

        libncurses.so.5 => /lib/libncurses.so.5 (0x40026000)
        libc.so.6 => /lib/libc.so.6 (0x40066000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000))

Rhapsody use the following libraries:

You can customize rhapsody via ~/.rhapsodyrc or use <Ctrl+T> for options:

Generate the initramfs and an ISO image

To create a new ISO image, you can use 'mktaziso' in SliTaz tools. Or you can create a new initramfs image, copy it to /boot in the root of the cdrom (rootcd) and finally generate an ISO image with genisoimage:

 # cd $fs
 # find . -print | cpio -o -H newc | gzip -9 > ../rootfs.gz
 # cd ..
 # cp rootfs.gz rootcd/boot
 # genisoimage -R -o slitaz-cooking.iso -b boot/isolinux/isolinux.bin \
   -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
   -V "SliTaz" -input-charset iso8859-1 -boot-info-table rootcd

Following chapter

The next chapter describes the installation of the locales and i18n.

Copyright © SliTaz - GNU General Public License;
Documentation is under GNU Free Documentation License and code is valid xHTML 1.0.