Lab 2A: Building Open Source Software Packages

     Today I will be building the open source GNU package less. Less is a really handy tool for file reading that lets you traverse backwards as well as forwards through the file. Unlike it's cousin more, less does not have to read the entirety of a file before starting so its great for quickly accessing large files.

     The first step is to get the code for it on the server. I am building on AArchie so I will use wget to download the tar file (http://ftp.gnu.org/gnu/less/less-530.tar.gz):


     Now I have the compressed tar file a simple tar -xzf less-530.tar.gz  command (-x for extract, -z for decompression with gzip, -f since we are decompressing a file) will unpack it so I can begin my build. I now have a less-530 directory in my working directory and once I move into it I can see the guts of the less package:

     The safest choice from here to ensure I don't break my build is to check the README file to see if there are any set up instructions to follow. I was in luck with a clear and numbered set of steps to follow. The first step is to isolate and unpack the source code which I had already done in decompressing it so I can move straight to step two, generate a Makefile and defines.h through the sh configure command.

     Doing so will cascade a bunch of checks but the most important to look at are the last three:

- configure: creating ./config.status
- config.status: creating Makefile
- config.status: creating defines.h

These three lines let me know that my Makefile and defines.h have been created and quick ls command confirms it:

     My next step is to run make and as the read me states "watch the fun", before I do though I will have a read through the Makefile to help me understand what it is doing. And done! With somewhat of a better understanding of the process its time for the magic. Mercifully less is a pretty lightweight package so the make only took a minute rather than a few hours. An ls command shows me that there are three new executable files in the directory less, lessecho and lesskey (the ones in green):


     Finally, to make sure my build is functional and I haven't missed a step or an error along the way I ran ./less README and sure enough it is working perfectly. 


      As a last note, since I don't want to install the package just build it, I skipped the final step from the README which is to run make install.




Comments

Popular posts from this blog

Lab 3: Compiled C Code

Lab 1: Investigating Open Source Development

Lab 4: Assembler