Building my first packages.

I downloaded two packages: hello and wget

You can get them from this page: http://www.gnu.org/software/software.html#allgnupkgs

First package: hello

This is a simple package that will print out “Hello world!” when run. It’s designed for people to get familiar with building packages (like me).

Let’s begin!

After downloading it, I extracted the tarball:

tar -xvzf hello-2.8.tar.gz

Which left me with a folder called hello-2.8

Here are the contents of that folder:

ABOUT-NLS
AUTHORS
ChangeLog
config.in 
configure.ac 
COPYING
GNU
makefile
lib
maint.mk
Makefile.in
NEWS
README 
src 
THANKS 
aclocal.m4 
build-aux 
ChangeLog.O 
configure 
contrib 
doc 
INSTALL 
m4 
Makefile.am 
man 
po 
README-release 
tests 
TODO

I opened up the README file, then the INSTALL file to read instructions on how to build this package.

From the instructions, it seemed like a simple process.. ./configure, make, then make install.

Let’s do it. When doing these commands, I’m going to append the time command in front so I can see how long each step takes. I’ll snip out most of the output.

$ time ./configure

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes

~snip~

config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

real    0m14.678s
user    0m5.160s
sys    0m6.559s

As we can see, it took about 15 seconds to run the configure script. Next is make. I did not include most of the output as it was far too long.

$ time make

~snip~

Making all in src
make[2]: Entering directory `/home/rudolf/Downloads/hello-2.8/src'
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I..  -I../lib -I../lib   -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc  -g -O2   -o hello hello.o  ../lib/libhello.a 
make[2]: Leaving directory `/home/rudolf/Downloads/hello-2.8/src'
Making all in doc
make[2]: Entering directory `/home/rudolf/Downloads/hello-2.8/doc'
make[2]: Nothing to be done for `all'....

~snip~

real 0m0.878s
user 0m0.531s
sys 0m0.362s

This command took less than a second.

Finally, we’ll finish with make install. This step requires root privileges.

$ sudo time make install

~snip~

Making install in man
make[1]: Entering directory `/home/rudolf/Downloads/hello-2.8/man'
make[2]: Entering directory `/home/rudolf/Downloads/hello-2.8/man'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/man/man1" || /usr/bin/mkdir -p "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 hello.1 '/usr/local/share/man/man1'
make[2]: Leaving directory `/home/rudolf/Downloads/hello-2.8/man'
make[1]: Leaving directory `/home/rudolf/Downloads/hello-2.8/man'
Making install in tests
make[1]: Entering directory `/home/rudolf/Downloads/hello-2.8/tests'
make[2]: Entering directory `/home/rudolf/Downloads/hello-2.8/tests'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/rudolf/Downloads/hello-2.8/tests'
make[1]: Leaving directory `/home/rudolf/Downloads/hello-2.8/tests'
make[1]: Entering directory `/home/rudolf/Downloads/hello-2.8'
make[2]: Entering directory `/home/rudolf/Downloads/hello-2.8'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/rudolf/Downloads/hello-2.8'
make[1]: Leaving directory `/home/rudolf/Downloads/hello-2.8'

3.35user 1.78system 0:05.27elapsed 97%CPU (0avgtext+0avgdata 23000maxresident)k
0inputs+664outputs (0major+347690minor)pagefaults 0swaps

No problems installing, but the time function didn’t seem to output correctly. Looks like it took about 5.27 seconds.

Now, let’s test out the program!

To do that, all I have to type is hello in the terminal.

[rudolf@rudolf-netbook]$ hello
Hello, world!

Success!

The next package is wget.

Second package: wget

Building this package is exactly the same as hello.

Here are the commands I used in order:

tar -xzvf wget-1.14.tar.gz
cd wget-1.14
./configure
make
make install

And thankfully, no problems during the build process! To test the program:

$ wget
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.

Looks like it installed OK.

That’s it for these two!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s