When working on the project on your own computer you have had to install some software you probably didn't have before, such as Guile or Texinfo. But when you did that you didn't take the sources written by the authors: instead you used the packaging system of your distribution and just installed binary executables and library, already compiled by somebody else. You didn't see the sources at all.
Today, you will look at how the authors work with well-packaged source packages; we will download a well-written program in source form, we will look at it, configure, compile it and run it.
You will have to do many of the same activities for the project.
By the way, please don't ask me again what the project is all about: there's a whole page about it, and I have explained it again in the mailing list (even in French). If you haven't started yet, start as soon as possible.
You can find some practical suggestions at the bottom of the first TP page.
When I say "source package" here I'm referring to what the software authors prepare. The software as provided by the software authors is often called upstream. We will only work with upstream software today.
Some people, me included, like to use the sources instead of binary compiled by somebody else whenever possible. Today you will see some advantages.
If for some crazy reason you are not subscribed to the mailing list yet,
please do it now.
Use the web interface linked above; it's easy and you shouldn't need my assistance.
A student noticed that the page may ask you to accept certificates. Don't worry, the server is at LIPN, Université Paris 13; it's safe.
Some people gave me their e-mail address handwritten on paper. I've tried interpreting their handwriting to the best of my ability, but some addresses were written in a very indistinct way. If in doubt, subscribe now; the system will not let you subscribe more than once using the same address, so you will never get more than one copy of each message.
We will use GNU Hello. It's just a very well-packaged "hello world" program, which is used in GNU as an example of how a good source package should look.
Download the latest version GNU Hello from ftp://ftp.gnu.org/gnu/hello/, and uncompress the tarball into some temporary directory; then enter the new directory containing the sources.
For example (before trying this, go to ftp://ftp.gnu.org/gnu/hello/ and explore a little; also look at ftp://ftp.gnu.org/gnu/):
cd /tmp wget ftp://ftp.gnu.org/gnu/hello/hello-2.7.tar.gz tar xfv hello-2.7.tar.gz cd hello-2.7
What's there in hello-2.7 ? Look around:
ls -XFsh --colorThere are many files and subdirectories. You should recognize at least some of them.
Open some files with an editor. Are they binary files, or source files? Why, in your opinion?
What programming language is GNU Hello written in? Is it more or less complex than you thought? Why?
What license is GNU Hello distributed under? Where are copyright and license notices?
Read the complete INSTALL file, top-to-bottom. You will understand most of it, and it is something everybody should have read at least once.
Before going on, you should know the answers to the following questions:
You don't have administrator privileges on the lab machines, and I don't either. So, can we still install the software?
Yes, but in our own directories. It's the same trick I use to let you access Guile (compiled and installed by me): the command line written in red at the top of the page gives you access to my directories (read-only, just because I chose so). Today you will use your directories.
Create a new prefix directory in your home directory: we will install everything there and in its subdirectories. We will call your prefix directory ~/usr (which is to say, the usr directory will be directly contained by your home directory).
Let's create the prefix directory:
Let's add the appropriate subdirectories of ~/usr to the directories which are automatically searched for executables, libraries, man pages and so on. We will use my add-prefix script for this:
source ~10706282/add-prefix ~/usr
The subdirectories of ~/usr don't exist yet, but they will be automatically created when installing GNU Hello.
Just like the "red" line above, you have to re-execute the line above if you open a new shell, so that your prefix is actually searched for when needed.
I will not explain how my add-prefix script works, but you can read it if you're interested. Ask me if you want to know some detail.
So, since we're not the machine administrators, we can't follow the simplified instruction shown at the top of INSTALL; but we can still do something very simple.
Let's configure the software (what does it mean? You should know it now if you read INSTALL; otherwise ask me) so that it will use your prefix. It's very simple. Go to source directory:
cd /tmp/hello-2.7And configure:
./configure --prefix=~/usrDamn, that didn't work! That's because we used the ~ abbreviation.
Let's write the path in extended form:
The last line should work. configure dynamically examines the system to check its features. You should understand most of its output.
A Makefile has been generated now. Where does it come from? Can you understand it? Why is it so difficult to read, in your opinion?
We can finally compile:
It shouldn't take long, because of course Hello is a simple porgram.
Now the software is installed. Does it work? Let's run GNU Hello:
It works! Oh, the excitement.
We have installed the software in your own prefix. It was easy, wasn't it? Look at what has been created:
You should recognize many files.
Change your language environment so that messages are displayed in a language different from English. Run hello again. Did it greet you in a different language?
How did it do that? Look at the sources to find the answer.
Where is the hello documentation? Look for it. In which format is it? Where is the documentation source? Can you generate other formats? (The answer is yes). Do it.
Can you understand how configure was generated? And Makefile?
Who are the authors of GNU Hello? How do they work? Do they use bzr? Can you get the latest source snapshot? Do they have a mailing list similar to ours? Do they have a bug tracking system similar to our Bugzilla installation?
Choose another GNU source package which seems simple, configure it, compile it and install it from sources in your private prefix.
Tell me which one you want to try, I can help and give you suggestions.
How should we package Scheme programs, such as our turtle graphics project? What is different, compared to GNU Hello? Search for answers.
I've said before that some people, me included, like to use the sources instead of binary compiled by somebody else whenever possible.
Can you recognize some advantages in working with sources? Do you also see disadvantages?
Back to my home page...