Hey guys and welcome back. So now that we have the basics of packaging under our belts,
let's now talk about some of the processes around building and actually installing from
this source code that we've downloaded. Now the reality is there are some particular scripts
and commands that we have to understand to enact this process. And the very first thing
I want to talk to you about is that once we download our source code and then you go through
the process of uncompressing it, what you're going to see is a directory structure. Now
within this directory structure, you're going to see well a whole bunch of subdirectories
as well as other files. Now one of these files that we're going to see is going to be a configure
file, meaning that is actually the name of the file. Now when I say file, what it is, it actually
is an executable script. Now what this script's purpose is, is that it's going to check and ensure
that this particular project can actually be built. So it will run these particular checks if
there are no problems, everything will be a okay. However, if we do happen to run into a particular
problem, then we will be alerted to this issue. Now not just this, once we actually run the
configure script, what it's actually going to do is going to generate and create something called a
make file. And that is make with a capital M. Now once we generate this particular file within it,
what we're going to have are very particular instructions that is actually going to allow
us to build the project. Okay, so think about it, we download the source code file, we will
decompress it, we will then be left with a directory like structure. Once we go into that
directory, we will see more folders and files. One of the files will be this configure script.
Once we execute configure, that will create the make file, which is going to allow us to build
the project. Now the make file itself that we generate, that is going to contain the instructions
how we actually build this particular project. When we actually want to build the project, however,
we will use the make command and this is make with a lowercase m. Now it is this command
that reads the make file that will actually go through the process of building and compiling the
actual program. And when I say compiling the program, this is actually going to take the data we have
and generate the binary that we need. Now, after this process, we will have this binary file,
i.e. our working program. But what we want to be able to do is we want to have access to this
particular file throughout our system, just the way that the LS command, say for example, actually
comes from within user bin LS. But as we know, we can use the LS command right throughout the system
just by typing LS. However, in the same way, we want to have our binary program accessible from
everywhere within the file system. And the way we can do this is we will actually use the make
install command. Now, what this is actually going to do, it's going to install the compile program
to a particular location. Now this location might be a default location, if you do not specify a
particular location. But the reality is, is that in that earlier step, when we talked about the
configure script, we could actually execute this configure script with a particular option, we
could do dash dash and then the word prefix. And the prefix keyword is going to allow it to specify
a particular location. This is whereabouts our compile program is going to be located. Now,
like I said before, we can expect to see software built in a location like user forward slash local,
but by using the configure script with this dash dash prefix option, and I'm going to tell
if I could write this correctly, it should be prefix. There we go. This option will allow us to
change this particular location. If we so choose not the time recommending you do so, but the option
is indeed there for you. So say for example, if we wanted to use the configure script, we would say
dot slash configure to execute the binary. And then we can say dash dash prefix, and then equals,
and then we could give a particular location user src, blah, blah, blah, whatever it may be, or
perhaps you want to put it into the opt directory. Say for example, this is going to allow you to do
such a thing. So really, we download the source, we extract the compressed files, we then use the
configure script to generate the make file, we then use the make command, which will actually read
the contents, i.e. the instructions within that make file. And then we can use that make install
commands to compile that program into a particular location, such that it is available throughout
our script. Now, when you happen to use the make install command, you want to be doing this with
super user privileges, i.e. pseudo make install. The reason for this is going to have to get access
to a lot of administrator restricted files and locations. So just be aware of this, if you do
not have super user privileges, you may run into problems trying to use the make install command.
Now, one last thing I want to talk to you about before we actually get to get hands on and walk
through this process so we can actually see an action is the concept of patching. Now,
what this means is that, well, you may have actually got some familiarity with it, maybe say
when you're on your laptop or you're on your phone, you may see that you get an update to install a
security patch. All this ultimately means is that the software has been updated and a change has been
made. So really, if you happen to find, say, for example, a bug in your software, this may be a
security bug, for example, if you want to be able to fix this problem, you would want to issue a
patch to your software. Now, the reality is what the patch is, the patch is the difference between
the original software, i.e. the original source code and the new version of that code. Now,
when you actually have some changes to be made, we can actually draw a comparison between the
original file, we'll call this the OG, so the new file. Within Linux, we actually have the diff
command, which can assess and compare what is in this file, compared to what is in this file,
and actually just present to us the differences between these files. Now, the actual result of
this diff command, i.e. the differences between these files, that can actually be used to convert
the files from the old version to the new version, the patched version, if you will. And indeed,
when we want to do such a thing, we actually have something called the patch utility, and the patch
utility is going to make use of this patch file. The patch file being simply the file that actually
contains the differences generated by that diff command, and it's going to apply those differences
to the files. So really, the diff command can be used to generate the differences between the two
files. We can then make a patch file with those differences, and then we can use the patch utility
on that patch file to generate this new patched software. So really, I know the process of
building from source code can be a little bit confusing. We have these different make files,
and the make command, and the make install command. It honestly is quite difficult to follow in your
first introduced to the concept. The best way that I've found to be able to get your head around these
concepts is to get hands on yourself and to see the process in action. Well, the good news is,
is that that is exactly what we're going to be doing in the very next nuggets. I hope this has
been informative for you, and I'd like to thank you for viewing.