website view en/doc/scratchbook/base-ncurses.html @ rev 1344

Resize balinor logo to 120px
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jan 22 23:02:15 2021 +0100 (2021-01-22)
parents c2f9d5d0f314
children
line source
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>SliTaz Scratchbook - Base Ncurses</title>
6 <meta name="description" content="">
7 <meta name="expires" content="never">
8 <meta name="modified" content="2008-11-22 17:00:00">
9 <meta name="publisher" content="www.slitaz.org">
10 <meta name="author" content="Christophe Lincoln">
11 <link rel="shortcut icon" href="favicon.ico">
12 <link rel="stylesheet" href="book.css">
13 </head>
14 <body>
16 <!-- Header and quick navigation -->
17 <div id="header">
18 <div align="right" id="quicknav">
19 <span id="top"></span>
20 <a href="base-apps.html">Base apps</a> |
21 <a href="index.html">Table of contents</a> |
22 <a href="locale.html">Locale &amp; i18n</a>
23 </div>
24 <h1><font color="#3E1220">SliTaz Scratchbook</font></h1>
25 </div>
27 <!-- Content. -->
28 <div id="content">
29 <div class="content-right"></div>
32 <h2><font color="#df8f06">Ncurses libraries and applications</font></h2>
33 <p>
34 Installation and configuration of ncurses libraries and applications.
35 </p>
36 <ul>
37 <li><a href="#about">About the chapter.</a> - Description and environmental
38 variable ($fs)</li>
39 <li><a href="#ncurses">ncurses-5.6</a> - Utilities and libraries for terminal.</li>
40 <li><a href="#clex">clex-3.16</a> - File manager.</li>
41 <li><a href="#nano">nano-2.0.6</a> - Advanced text editor with colored syntax.</li>
42 <li><a href="#retawq">retawq-0.2.6c</a> - Navigate the web in text
43 mode using ncurses.</li>
44 <li><a href="#htop">htop-0.6.5</a> - System process viewer.</li>
45 <li><a href="#dialog">dialog-1.1-20070409</a> - GUI shell scripts.</li>
46 <li><a href="#ninvaders">ninvaders-0.1.1</a> - Space Invaders clone.</li>
47 <li><a href="#bastet">bastet-0.41</a> - Bastard Tetris clone.</li>
48 <li><a href="#rhapsody">rhapsody-0.28b</a> - IRC chat client.</li>
49 <li><a href="#initramfs-iso">Generate the initramfs and an ISO image.</a></li>
50 </ul>
52 <h3 id="about">About</h3>
53 <p>
54 This chapter describes the construction and installation of some ncurses applications
55 and libraries in SliTaz. The procedure consists of moving into the /src directory,
56 downloading the sources for the application in question, unpacking, reading the README or
57 INSTALL file(s), compiling and installing the binary in SliTaz. Once the applications
58 are installed, we can create a new initramfs, copy it to the root of the CD-ROM and generate
59 a new ISO image. For this you can also use <code>mktaziso</code> in
60 <a href="http://doc.slitaz.org/en:cookbook:slitaztools">SliTaz tools</a>.
61 </p>
62 <h4>Assign an environment variable ($fs)</h4>
63 <p>
64 An environmental variable can't specify the path to the directory, just the name of the directory.
65 We will affect a variable ‘$fs’ to indicate the path to the root filesystem
66 (rootfs). To do this, we venture into the working directory SliTaz/, and type:
67 </p>
68 <pre> # export fs=$PWD/rootfs
69 </pre>
70 <p>
71 To check:
72 </p>
73 <pre> # echo $fs
74 </pre>
76 <h3 id="ncurses">ncurses-5.6 - Terminal utilities and libraries</h3>
77 <p>
78 ncurses (<a href="http://dickey.his.com/ncurses/">dickey.his.com/ncurses/</a>) contains
79 functions to display text in different ways on the screen of a Linux terminal and also provides
80 the terminfo file. Ncurses libraries are used among others by retawq, nano and some games.
81 We install the libraries in /lib and the rest in /usr/bin with a small strip to clean the executables:
82 </p>
83 <pre> # cd src
84 # wget ftp://invisible-island.net/ncurses/ncurses-5.6.tar.gz
85 # tar xzf ncurses-5.6.tar.gz
86 # cd ncurses-5.6
87 # ./configure --prefix=/usr \
88 --libdir=/lib --sysconfdir=/etc \
89 --infodir=/usr/share/info --mandir=/usr/share/man \
90 --with-shared --without-debug --without-ada
91 # make
92 # make DESTDIR=$PWD/_pkg install
93 # strip -v _pkg/lib/*
94 # strip -v _pkg/usr/bin/*
95 </pre>
96 <p>
97 Copy the libncurses library and some applications in SliTaz. The reset utility is used at the end of
98 the rcS initialization script to remove the Linux logo. If you wish, you can copy the associated utilities
99 (tic, tack, toe, etc), being careful not to delete the link to BusyBox:
100 </p>
101 <pre> # cp -a _pkg/lib/libncurses.so* $fs/lib
102 # cp -ia _pkg/usr/bin/{clear,ncurses5-config,tset,reset} \
103 $fs/usr/bin
104 </pre>
105 <p>
106 Copy terminfo files, we only use a few files. If you want more, you can copy:
107 </p>
108 <pre> # mkdir -v $fs/usr/share/terminfo
109 # mkdir -v $fs/usr/share/terminfo/{a,l,r,v,x}
110 # cp _pkg/usr/share/terminfo/a/ansi \
111 $fs/usr/share/terminfo/a
112 # cp _pkg/usr/share/terminfo/l/linux \
113 $fs/usr/share/terminfo/l
114 # cp _pkg/usr/share/terminfo/r/rxvt \
115 $fs/usr/share/terminfo/r
116 # cp _pkg/usr/share/terminfo/x/{xterm,xterm-color,xterm-new,xterm-vt220} \
117 $fs/usr/share/terminfo/x
118 # cp _pkg/usr/share/terminfo/v/{vt100,vt102*} \
119 $fs/usr/share/terminfo/v
120 </pre>
121 <p>
122 Copy the tabset files:
123 </p>
124 <pre> # cp -a _pkg/usr/share/tabset $fs/usr/share
125 </pre>
127 <h3 id="clex">clex-3.16 - File Manager</h3>
128 <p>
129 CLEX (<a href="http://www.clex.sk/">http://www.clex.sk/</a>) is a small ncurses file
130 manager (160 KB). The configuration file (rc) is ~/clexrc; ~/.clexbm is used for
131 bookmarks:
132 </p>
133 <pre> # cd ..
134 # wget http://www.clex.sk/download/clex-3.16.tar.gz
135 # tar xzf clex-3.16.tar.gz
136 # cd clex-3.16
137 # ./configure --prefix=/usr --infodir=/usr/share/info \
138 --mandir=/usr/share/man
139 # make
140 # make DESTDIR=$PWD/_pkg install
141 # strip -v _pkg/usr/bin/clex
142 </pre>
143 <p>
144 Install the clex binary in the rootfs of SliTaz:
145 </p>
146 <pre> # cp _pkg/usr/bin/clex $fs/usr/bin
147 </pre>
148 <h4>libs</h4>
149 <p>
150 If we execute the <code>ldd</code> command on clex, the following dependancies should be displayed:
151 </p>
152 <pre class="script"> libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x40025000)
153 libc.so.6 =&gt; /lib/libc.so.6 (0x40064000)
154 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
155 </pre>
157 <h3 id="nano">nano-2.0.6 - Advanced Text Editor</h3>
158 <p>
159 GNU nano (<a href="http://www.nano-editor.org/">www.nano-editor.org</a>) is a well known,
160 fast, effective GNU/Linux text editor that supports colored syntax.
161 This is the default text editor in SliTaz:
162 </p>
163 <pre> # cd ..
164 # wget http://www.nano-editor.org/dist/v2.0/nano-2.0.6.tar.gz
165 # tar xzf nano-2.0.6.tar.gz
166 # cd nano-2.0.6
167 # ./configure --enable-all --enable-extra --prefix=/usr \
168 --infodir=/usr/share/info --mandir=/usr/share/man \
169 --sysconfdir=/etc
170 # make
171 # make DESTDIR=$PWD/_pkg install
172 # strip -v _pkg/usr/bin/nano
173 </pre>
174 <p>
175 Copy the nano binary and the rnano link in SliTaz:
176 </p>
177 <pre> # cp -a _pkg/usr/bin/* $fs/usr/bin
178 </pre>
179 <p>
180 Copy the configuration files in _pkg/usr/share/nano to our rootfs:
181 </p>
182 <pre> # cp -a _pkg/usr/share/nano $fs/usr/share
183 </pre>
184 <h4>libs</h4>
185 <p>
186 If we execute the <code>ldd</code> command on nano, the following dependancies
187 should be displayed:
188 </p>
189 <pre class="script"> libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x40025000)
190 libc.so.6 =&gt; /lib/libc.so.6 (0x40064000)
191 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
192 </pre>
193 <h4>locale</h4>
194 <p>
195 About the language, you can copy the .mo files created when installing nano from
196 /usr/share/locale/(fr,en,de,es,etc)/LC_MESSAGES to the rootfs. Example for the French language:
197 </p>
198 <pre> # cp -a _pkg/usr/share/locale/fr/LC_MESSAGES $fs/usr/share/locale/fr
199 </pre>
200 <h4>Customize nano</h4>
201 <p>
202 You can customize nano via /etc/nanorc or ~/.nanorc for each user of the system. It's in
203 this file that you can define the colors used by nano through the files in /usr/share/nano.
204 You will find a broad example of this file in the archive of nano and
205 <a href="http://doc.slitaz.org/en:cookbook:slitaztools">SliTaz tools</a>.
206 </p>
207 <p>
208 For a system configuration file, you can copy the file in SliTaz tools to /etc in the rootfs:
209 </p>
210 <pre> # cd ..
211 # cp -a slitaz-tools-1.1/etc/nanorc $fs/etc
212 </pre>
214 <h3 id="retawq">retawq-0.2.6c - Text mode Web browser</h3>
215 <p>
216 retawq (<a href="http://retawq.sourceforge.net/">retawq.sourceforge.net</a>)
217 is a small text-only web browser. We only flag a few useful options when configuring,
218 retawq needs terminfo files, libncurses libraries and libthread:
219 </p>
220 <pre> # wget http://switch.dl.sourceforge.net/sourceforge/retawq/retawq-0.2.6c.tar.gz
221 # tar xzf retawq-0.2.6c.tar.gz
222 # cd retawq-0.2.6c
223 # ./configure --enable-i18n --enable-local-cgi --path-prefix=/usr \
224 --path-doc=/usr/share/doc/retawq --path-man=/usr/share/man
225 # make
226 # strip -v retawq
227 </pre>
228 <p>
229 Copy the retawq binary in SliTaz:
230 </p>
231 <pre> # cp retawq $fs/usr/bin
232 </pre>
233 <h4>libs</h4>
234 <pre class="script"> libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x40025000)
235 libpthread.so.0 =&gt; /lib/libpthread.so.0 (0x40064000)
236 libc.so.6 =&gt; /lib/libc.so.6 (0x40074000)
237 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
238 </pre>
239 <p>
240 You can copy the lipthread library from your host system or use the minimum package
241 glibc-2.3.6 distributed by SliTaz:
242 </p>
243 <pre> # cp -a /lib/libpthread* $fs/lib
244 # strip --strip-unneeded $fs/lib/*
245 </pre>
246 <h4>locale</h4>
247 <p>
248 For language, you can copy the .mo files in /i18n of the retawq archive to
249 /usr/share/locale/(fr,en,es,etc)/LC_MESSAGES. Example for the French language,
250 renaming the file to retawq.mo:
251 </p>
252 <pre> # cp -v i18n/fr.mo $fs/usr/share/locale/fr/LC_MESSAGES/retawq.mo
253 </pre>
254 <h4>Customize retawq</h4>
255 <p>
256 To personalize retawq, you can use a ~/.retawq directory containing a config file.
257 You can also save bookmarks (html) in the root directory of the user. You will find an
258 examples/ in the archive of retawq (or SliTaz tools) containing a bookmarks.html
259 page with a list of favorite web sites. You can also copy the docs (/documents) from retawq
260 to /usr/share/doc/retawq.
261 </p>
263 <h3 id="htop">htop-6.0.5 - System process viewer</h3>
264 <p>
265 htop (<a href="http://htop.sourceforge.net/">htop.sourceforge.net/</a>) is software
266 that displays system processes using ncurses.
267 </p>
268 <p>
269 Returning to the /src directory, download, unpack, configure, compile and clean (with strip):
270 </p>
271 <pre> # cd ..
272 # wget http://switch.dl.sourceforge.net/sourceforge/htop/htop-0.6.5.tar.gz
273 # tar xzf htop-0.6.5.tar.gz
274 # cd htop-0.6.5
275 # ./configure --prefix=/usr --mandir=/usr/share/man
276 # make
277 # make DESTDIR=$PWD/_pkg install
278 # strip -v _pkg/usr/bin/htop
279 </pre>
280 <p>
281 Copy the htop binary in SliTaz:
282 </p>
283 <pre> # cp _pkg/usr/bin/htop $fs/usr/bin
284 </pre>
285 <p>
286 You can still copy the htop icon found in: _pkg/usr/share/pixmaps.
287 </p>
288 <h4>libs</h4>
289 <pre class="script"> libm.so.6 =&gt; /lib/libm.so.6 (0xb7f97000)
290 libncurses.so.5 =&gt; /lib/libncurses.so.5 (0xb7f55000)
291 libc.so.6 =&gt; /lib/libc.so.6 (0xb7e20000)
292 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0xb7fc9000)
293 </pre>
295 <h3 id="dialog">dialog-1.1.20070409 - GUI shell scripts</h3>
296 <p>
297 dialog (<a href="http://invisible-island.net/dialog/dialog.html">invisible-island.net/dialog/dialog.html</a>),
298 is a utility to build GUI-based consoles:
299 </p>
300 <pre> # cd ..
301 # wget ftp://invisible-island.net/dialog/dialog.tar.gz
302 # tar xzf dialog.tar.gz
303 # cd dialog-1.1-20070409
304 # ./configure --enable-nls --with-ncurses --prefix=/usr \
305 --sysconfdir=/etc --mandir=/usr/share/man
306 # make
307 # make DESTDIR=$PWD/_pkg install
308 # strip -v _pkg/usr/bin/dialog
309 </pre>
310 <p>
311 Copy dialog binary in SliTaz:
312 </p>
313 <pre> # cp _pkg/usr/bin/dialog $fs/usr/bin
314 </pre>
315 <h4>libs</h4>
316 <pre class="script"> libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x40027000)
317 libm.so.6 =&gt; /lib/libm.so.6 (0x40066000)
318 libc.so.6 =&gt; /lib/libc.so.6 (0x40089000)
319 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
320 </pre>
321 <h4>locale</h4>
322 <p>
323 You can install locale files if you wish:
324 </p>
325 <pre> # cp -a _pkg/usr/share/locale/fr $fs/usr/share/locale
326 </pre>
327 <p>
328 The dialog configuration file is /etc/dialogrc and/or ~/.dialogrc for each user.
329 There are also full examples of scripts in the /sample directory in the sources of dialog.
330 </p>
332 <h3 id="ninvaders">Ninvaders-0.1.1 - Space Invaders clone</h3>
333 <p>
334 ninvaders (<a href="http://ninvaders.sourceforge.net/">http://ninvaders.sourceforge.net/</a>)
335 is a clone of the popular Space Invaders game (46 KB). We begin by placing ourselves in the
336 /src directory, then we download, untar, compile, clean using strip and copy the nInvaders binary
337 in /usr/games of SliTaz:
338 </p>
339 <pre> # cd ..
340 # wget http://ovh.dl.sourceforge.net/sourceforge/ninvaders/ninvaders-0.1.1.tar.gz
341 # tar xzf ninvaders-0.1.1.tar.gz
342 # cd ninvaders-0.1.1
343 # make
344 # strip -v nInvaders
345 # cp nInvaders $fs/usr/games
346 </pre>
348 <h3 id="bastet">bastet-0.41 - Bastard Tetris clone</h3>
349 <p>
350 A game of Tetris (17 KB):
351 </p>
352 <pre> # wget http://fph.altervista.org/prog/bastet-0.41.tgz
353 # tar xzf bastet-0.41.tgz
354 # cd bastet-0.41
355 # make
356 # strip bastet
357 # cp bastet $fs/usr/games
358 # mkdir -p $fs/var/games
359 # touch $fs/var/games/bastet.scores
360 # chmod 666 $fs/var/games/bastet.scores
361 </pre>
363 <h3 id="rhapsody">rhapsody-0.28b - IRC chat client</h3>
364 <p>
365 Rhapsody (<a href="http://rhapsody.sourceforge.net/">http://rhapsody.sourceforge.net/</a>)
366 is a fast and lightweight chat client supporting the IRC protocol. It provides a menu for
367 managing servers, channels and configuration. It is therefore easy to use:
368 </p>
369 <pre> # cd ..
370 # wget http://switch.dl.sourceforge.net/sourceforge/rhapsody/rhapsody_0.28b.tgz
371 # tar xzf rhapsody_0.28b.tgz
372 # cd rhapsody-0.28b
373 # ./configure -i /usr/bin -d /usr/share/doc/rhapsody
374 # make
375 # strip -v rhapsody
376 </pre>
377 <p>
378 Install the binary and help files in SliTaz. We must adjust permissions on
379 these files so that everyone can read:
380 </p>
381 <pre> # cp rhapsody $fs/usr/bin
382 # mkdir $fs/usr/share/doc/rhapsody
383 # cp -a help $fs/usr/share/doc/rhapsody/help
384 # chmod 644 $fs/usr/share/doc/rhapsody/help/*
385 </pre>
386 <h4>libs</h4>
387 <p>
388 Rhapsody uses the following libraries:
389 </p>
390 <pre class="script"> libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x40026000)
391 libc.so.6 =&gt; /lib/libc.so.6 (0x40066000)
392 /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000))
393 </pre>
394 <h4>Rhapsody use the following libraries:</h4>
395 <p>
396 You can customize rhapsody via ~/.rhapsodyrc or use &lt;Ctrl+T&gt; for options:
397 </p>
399 <h3 id="initramfs-iso">Generate the initramfs and an ISO image</h3>
400 <p>
401 To create a new ISO image, you can use ‘mktaziso’ in SliTaz tools.
402 Or you can create a new initramfs image, copy it to /boot in the root of the CD-ROM
403 (rootcd) and finally generate an ISO image with genisoimage:
404 </p>
405 <pre> # cd $fs
406 # find . -print | cpio -o -H newc | gzip -9 &gt; ../rootfs.gz
407 # cd ..
408 # cp rootfs.gz rootcd/boot
409 # genisoimage -R -o slitaz-cooking.iso -b boot/isolinux/isolinux.bin \
410 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
411 -V "SliTaz" -input-charset iso8859-1 -boot-info-table rootcd
412 </pre>
413 <h4>Following chapter</h4>
414 <p>
415 The next chapter describes the installation of the
416 <a href="locale.html">locales</a>
417 and i18n.
418 </p>
421 <!-- End of content -->
422 </div>
424 <!-- Footer. -->
425 <div id="footer">
426 <div class="footer-right"></div>
427 <a href="#top">Top of the page</a> |
428 <a href="index.html">Table of contents</a>
429 </div>
431 <div id="copy">
432 Copyright &copy; <span class="year"></span> <a href="http://www.slitaz.org/en/">SliTaz</a> -
433 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
434 Documentation is under
435 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
436 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
437 </div>
439 </body>
440 </html>