website view pt/doc/scratchbook/base-ncurses.html @ rev 551

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