Previous Next Table of Contents

4. Example Package Installation - xearth

You have just blown the money for a holiday pony-trekking to Reykjavik, on a Linux box. You've just spent 2 weekends assembling it, you want results.

RedHat packages come with pre-configured Linux installations of many packages, but you want the authors original (more recent) version.

Many authors ship binaries for impatient customers, many authors take pride in the fact that they don't have to.

If you have never installed a source package before, you have a simple chain of steps to follow. At any stage, the process could fail, requiring you to roll up your sleeves, and do some work.

Some developers have an exclusion clause - if you can't read a Makefile, you shouldn't be equipped with gcc. Others are less enlightened, and do the work for you. Often a makefile will need minor adjustment to suit you, and reading the Makefile often helps to understand the package.

I used to have an open-mind, until I hit so called 'helpful productive gui-building' packages, with cranky Makefiles, and overnight compilations. I think those people must have come from a cobol background. Now I see the first make error message, as a warning of others to come. (often proved wrong).

4.1 cmd - a useful utility

This is command to create (locate) commands.

        #!/bin/sh
        # cmd
        # set -x
        if LINE=`type $1`
        then
                FILE=`echo $LINE | awk '{print $3}'`
        else
                FILE=/usr/local/bin/$1
        fi
        vi $FILE
        if [ -f $FILE ]
        then
                set -x
                [ -x $FILE ] || chmod 755 $FILE
        fi

4.2 mk - a useful utility

You can make your life easier by pasting the following into a shell script. Don't forget chmod 775 /usr/local/bin/mk

        #!/bin/sh
        # mk - simple wrapper for make
        # keeps output in a log file

        LOGFILE=gps.out

        ( echo ; date ; echo ; echo "# make $*" ; echo ) >> $LOGFILE

        make "$@" 2>&1 | tee -a $LOGFILE
Now instead of typing make or make install you type mk.

The result is much the same, except that the screen output is also written to a logfile. Interactive make scripts may have a problem with tee not displaying the text soon enough, but this is rare.

Now: every time you see make, type mk instead!.

4.3 xearth

Installing xearth is really easy, the descrition of how-to do it takes only a few lines (read the README and INSTALL on the disks). The only information you've GOT to have, is that it's called 'xearth' and it is excellent.

The Raven Issue-One LOGO, was produced using xearth. When you run it, it gets updated every 5 minutes, and displays the names of major cities.

Persoanlly, I use it as desktop clock. I know it's the end of my shift when it's light in Bombay.

4.4 Pre-requirements

I hate pre-conditions, but like a lot of X11 software, you have to have X11 running. Issue-One has a section on /etc/XF86Config.

You will need to have gcc, the gnu c compiler installed, and all the correct LIBS installed. This is likely to be done - if you installed the recommended parts of the Slackware d-diskset, and the x-diskset. Fortunately, people like Pat Volkerding, have done the really hard word of making a system that boots and runs and runs.

4.5 Locating xearth on disk4 - sunsite

If you have the InfoMagic archives, you will find it on disk 4, the sunsite mirror disk. If you have copied the Infomagic /cdrom/ls_lr from disk one to /tmp/ls_lr, you can seartch for it by name. If you don't have the CDROMs, but do have Internet access, you can ftp it.

######## grep -i xearth /tmp/ls_ls/LDR_9511_ls_lr ########

Oct 31 16:48       114148 disc2/RedHat/RPMS/xearth-1.0-2.i386.rpm
Oct 31 16:58       154693 disc2/RedHat/SRPMS/xearth-1.0-2.src.rpm

Oct 17 10:56       115688 disc3/debian/debian-1.0/binary/x11/xearth-1.0-1.deb
Oct 17 10:56         5549 disc3/debian/debian-1.0/source/x11/xearth-1.0-1.diff.gz
Oct 17 10:56       157845 disc3/debian/debian-1.0/source/x11/xearth-1.0-1.tar.gz

Oct 12 1994           825 disc4/X11/xapps/graphics/xearth+fvwm.diff.lsm
Oct 12 1994          2966 disc4/X11/xapps/graphics/xearth+fvwm.diff.tar.gz
Jun  5 1994          1106 disc4/X11/xapps/graphics/xearth-0.92.lsm
Jun  5 1994        324815 disc4/X11/xapps/graphics/xearth-0.92.tar.gz

Aug  1 1993        124098 disc5/tsx-11/binaries/usr.bin.X11/xearth-bin.tar.gz
This shows that 'xearth' is an ingredient of several distributions. It hints that different versions are available, and that the sunsite version is slightly older. It also shows that someone did a few patches to make it run differently with fvwm, to do a slightly different task.

I think xearth-0.92 is the most recent, othan than for Amigas.

I ignored the older than 1 year, warning, and the 0.92 version level. If it hadn't worked, I would probably have used rpm to load the RedHap package, or looked at the debian (fsf-gnu) distribution. Note that product versions IS a problem, and someone should catalogue everything, along with WHEN new versions appeared, so we can see HOW long versions were contemporary for, and when development was ongoing, or occasional.

It also helps support find what else was running at that time (eg when the CDROM was made, typical other version levels or other packages).

I used the version from sunsite.

4.6 cd /cdrom/X11/xapps/graphics/

This is where the xearth package source is. You must have the correct CDROM mounted.

4.7 mkdir /tmp/pkgs_cd

Make a directory where you build various packages from the cd's.

During 'make install', many packages copy the necessary files to /usr/local/bin, and others. xearth does this.

This means the source directory can be deleted, or left available for browsing. /tmp/pkgs_cd is a good place to unpack and play with files from the cd-rom. If you like them, you should move them to wherever you chose to put it. /usr/local/src/package_name/.

        mkdir /tmp/pkgs_cd
        chown gps /tmp/pkgs_cd # ie your user
        mkdir /tmp/pkgs_ftp 

If you are desperate for disk space, and want to kill something, look in /tmp. (and /var/log, and /usr/tmp, and /usr/docs, and /usr/lib/package...).

Packages as Self Contained Units

Many packages have default configurations that 'contain' all the files in the package's home directory. Some even put their own tmp and log files in there too!. Others use /tmp/package and /var/log/package.

All xearth files get created in /tmp/pkgs_cd/xearth-0.92

No root password required

xearth compiled and ran as a plain user. root login was later needed to install the files into /usr/X11/bin. If you are trusting, you can do all the installation as root.

The idea is that the root password is used occasionally. The package is built as sys-op (you), and can be tested by sysop, then you decide if you want to run make install as root.

Most reputable packages can be trusted, and most of the ones you will handle are, but if a package needs root permission to install, the question is why?

4.8 tar -C /tmp/pkgs_cd -zxf ./xearth-0.92.tar.gz

Unpack the archive you have just found, into the directory you specified.

This runs the 'tar' command (tape archive), telling it to use /tmp/pkgs_cd as the -C current directory. Ie it does a cd /tmp/pkgs_cd to write the files, but finds and loads xearth from ./.

The -f FILENAME, options tells tar the name of the TAR-FILE to work on. Note that tar won't allow anything else between the -f and FILENAME.

The -z option tells tar that the TAR-FILE is gnu-zip compressed, and needs the builtin gzip utiltiy.

The -x option means EXTRACT all files from the archive. To get a table of contents, use -ztf instead of -zxf.

If you have 'mc' you can let it help you. The command line keys are : It can also browse .tgz files

4.9 cd /tmp/pkgs_cd/xearth-0.92

Notice that the package created a sub-directory, with all its files in. This is known as polite behavior. Some packages create lots of files in the top directory (/tmp/pkgs_cd or wherever you were), they require you to delete and do again.

xearth is also practical. It numbers the directory by the version number of the package. This means that xearth 1.0 source will go into a different directory. Thank-you Kirk Lauritz Johnson tuna@cag.lcs.mit.edu

Browse the files, you should find INSTALL, README and HISTORY at the top of the list. Reading the INSTALL tells you how to build and install it.

4.10 xmkmf

x-make-makefile, is a utility to create Makefiles. The package designer has done a lot of work, and told xmkmf what to look for. Remember that the package has to compile on Linux, and SUN, and SVR4, and ...

xmkmf scans your machine, and makes a few relevent adjustments to the Makefile (it generates a new one from Makefile.in).

4.11 make

The make command, reads the Makefile, and picks a default target (the first in the Makefile is usually called all :-) It then looks to see if any work is needed to bring TARGET upto date.

In this case, it calls gcc to compile xearth.c and link it with the other files, to make a binary executable

4.12 make install ; make install.man

You should run as a plain user as much as possible, but when installing you will need a second window, logged-in as root, to complete the installation.

make install copies the necessary files onto the system directories. The source is not copied, and can be deleted (sooner or later).

Most applications can be tested as a plain user, and don't need root permissions at all, until they need to create files in a system bin directory.

4.13 xearth -pos "fixed 62.4 -51.1" -grid &

You don't need any parameters, xearth is enough.

The & tells the shell to run this command in the background. Most X11 applications run this way.

If you don't, it makes it easier to use CTRL-C to generate an Intr. If you forget, and wish to use that tty, but don't want to quit the program, use CTRL-Z followed by bg %1.

The suspended job gets resumed as a background style process. A background process is one that the foreground isn't waiting for.

4.14 man xearth

This shows the range of options that xearth has.

4.15 vi  /.xinitrc

This is one of the X11 startup files. It doesn't have to exist, but if it does, it must contain olvwm or fvwm. By adding xearth to it, it will get stared automatically, when you start X11. If it doesn't, it could be a sign that you are running as someone else.

        # /HOME/.xinitrc
        # run by shell during openwin or startx
        # must call window-manager-wm

        xhost pigeon
        xhost kestrel
        raven.tcl &
        sleep 2
        clock &
        xearth -pos "fixed 62.4 -51.1" -grid &
        olvwm
        # fvwm

4.16 delete xearth-0.96

Its easiest to use 'mc' to delete directories, rm is prone to typing errors.

You no-longer need the source online. You can re-generate it from the CDROM, and the installed package has its files installed elsewhere. You can delete the directory, or leave it there for later.

        cd /tmp/pkgs_ftp
        rm -rf xearth-0.96

4.17 Worked example - done!

This is how many packages install. They work out of the box, they don't blow-up during make, and they do something real-neat asap.

Other packages mentioned in Raven will have LESS help, telling you to what what worked here. If it doesn't work, investigate. Always check for README files, and such.

Regrettably, not every package works perfectly. Personally I discard those that don't, as any trick to make it work takes ages to find, and gets forgotten. However it often happens for no fault of the package. Particularly if the package used to work perfectly with a.out, but needs a different set of libraries, or linking options to work with ELF.

4.18 configure

Instead of xmkmf (or as well as!), some packages have a configure script that configures the compilation, and installation. It probably sets the names of spool directories, but doesn't really configure the RUNNING application.

That is usually an /etc/package.conf file, or other.

4.19 make linux

Some packages avoid the added complexity of configure, but do provide Makfile customisations for specific systems. Many EXPECT you to edit (or at least view) the Makefile, and may provide a make linux target.

4.20 package_elf-01.tgz

Some applications come in both source and ready-compiled packages. This particularly applies to Motif apps, where you need to spend £100 to get the Motif compilation libraries. If you don't have them, download the STATICALLY linked binaries. The DYNAMICALLY linked binaries are smaller, as the shared Motif Libraries are already on your disk.

Often the binary package, won't contain the documentation, or background information, then you have to ftp both.

4.21 old_lib.so

If the linker or loader can't find a necessary library, you may have to install the package that brings it, or hunt on the CDROM's for support for old environments.

eg A program compiled for X11R5 will (often) still work on X11R6, but it will require the old libraries to be installed. Slackware ususally has packages of outdated-libraries for exactly this reason.


Previous Next Table of Contents