The original motivation for this HOWTO is so that FORTRAN users on the Eee can do superb graphics things; from simple graphs to complex 3d surfaces and objects, and nice stuff like geographical map projections.
However, this isn't just for FORTRAN; the DISLIN library can be called from Java, Perl, Python, and, for all I know, other languages as well. For more details, see the README file when you've installed the package.
DISLIN is licenced freely under the GPL for non-commercial use; if you want commercial licences (inexpensive), see the website.
You will find the DISLIN Home page at [http://www.mps.mpg.de/dislin/] - all the material here is presented courtesy of the Max Planck Institute for Solar System Research.
The download we want is at [http://www.mps.mpg.de/dislin/redhat9.html]. The file we want is the first in the top box, “dislin-9.2.linux.tar.gz”. “9.2” is the current version - this may be changed to a higher number by the time you are reading this - to check that you have the right file, see that the “Compiler” entry on the same line in the box includes the word “gfortran”.
Mouse over this file name and right-click, then “Save As”. Save to an appropriate folder on your Eee - I have created a folder called “myapps” which we'll use in this example. The file is over 10MB, so it will take a while to download.
Open a terminal with Ctrl-Alt-T or other method of your choice.
Change to the subdirectory where you have saved the download, and issue the command
ls
to check that you have the file - you should see “dislin-9.2.linux.tar.gz” (or a file with a higher number in the name). Now issue the command (replacing the “9.2” with the number you have if this is different)
gzip -d dislin-9.2.linux.tar.gz
and use “ls” again to check that the name of the file has now changed to “dislin-9.2.linux.tar”. Now issue the command
tar xvf dislin-9.2.linux.tar
You should see a list of file name lines zip past on the console. Repeating the “ls” command should show you that you now have a new subdirectory called “dislin-9.2” (or a higher number). Change into this directory with the command
cd dislin-9.2
Now change to a superuser with a bash shell by the command
sudo bash
and set up the DISLIN environment variable with
export DISLIN=/usr/local/dislin
The command
./INSTALL
will now install DISLIN. Again, you should get a list of messages zipping by. You're just about done. All we have to do now is set environment variables permanently so that future sessions know where DISLIN is. Using the editor of your choice, edit the file /etc/bash.bashrc, add the following lines at the end, and save it:
export DISLIN=/usr/local/dislin
PATH=${PATH}:${DISLIN}/bin
LD_LIBRARY_PATH=$DISLIN:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
The command
nano bash.bashrc
will call up a simple editor if you're not familiar with any other.
Now edit the file /etc/profile and add the same lines to the bottom of this file and save it. Now, if you're paranoid like me, check that the lines you've added are 100% correct by listing the two files to the console and proofreading them - the “cat” command is your friend here. For example,
cat /etc/profile
We now have to compile the DISLIN module for our specific distro.
cd /usr/local/dislin/gf gfortran -c dislin.f90
And finally, we have to grab a library that DISLIN needs (libXm.so.3). First, edit your /etc/apt/sources.list file so that it contains the line:
deb ftp://ftp.uk.debian.org/debian sarge non-free
and issue the commands
apt-get update apt-get install libmotif3 cp /usr/X11R6/lib/libXm.so.3 /usr/local/dislin
and then, if you've any sense, re-edit your sources.list file to remove the debian sarge repository line.
There! That wasn't too difficult, was it? Now close your terminal session, because we want to make sure in the next step that things will work in new sessions. What we have to do now is create a sample program source file, compile, and link it against the DISLIN libraries. First, though, we check that the installation went properly. Open a new terminal, and issue the command
disman
If you did everything properly, you will now get the interactive manual for DISLIN. If you don't get this, go back and check, find out what you did wrong, and fix it. This manual tells you all you need to know about adding DISLIN functions to your FORTRAN code, from simple graphs to complex 3d graphics and geographical functions like map projections.
Closing the manual should take you back to your terminal.
Next, go to the example pages for DISLIN - [http://www.mps.mpg.de/dislin/exa_f90.html]. Save this page to an appropriate place on your Eee (I have a subdirectory under my “myapps” directory called “src” - short for “source code” - this means I can keep my source code separate from the standard stuff, which is handy and less confusing). Using the program editor of your choice (and if you don't know one by now, what are you coding FORTRAN for?) separate out the individual files and save them with an extension of “f90”, for example “exa12.f90”.
When you have done this, you can compile, link, and run them all at one go with a command like this:
gf95link -a e12
where “e12” is the name of your program which you saved as “e12.f90” . You'll get pretty pictures, like:
For some reason this screenshot clips the pretty picture - shows fine on the Eee - Hmm.