1
00:00:00,000 --> 00:00:18,760
Hey guys and welcome back. So now that we have the basics of packaging under our belts,

2
00:00:18,760 --> 00:00:23,920
let's now talk about some of the processes around building and actually installing from

3
00:00:23,920 --> 00:00:29,240
this source code that we've downloaded. Now the reality is there are some particular scripts

4
00:00:29,239 --> 00:00:35,679
and commands that we have to understand to enact this process. And the very first thing

5
00:00:35,679 --> 00:00:40,640
I want to talk to you about is that once we download our source code and then you go through

6
00:00:40,640 --> 00:00:46,200
the process of uncompressing it, what you're going to see is a directory structure. Now

7
00:00:46,200 --> 00:00:51,280
within this directory structure, you're going to see well a whole bunch of subdirectories

8
00:00:51,280 --> 00:00:58,200
as well as other files. Now one of these files that we're going to see is going to be a configure

9
00:00:58,200 --> 00:01:04,480
file, meaning that is actually the name of the file. Now when I say file, what it is, it actually

10
00:01:04,480 --> 00:01:11,760
is an executable script. Now what this script's purpose is, is that it's going to check and ensure

11
00:01:11,760 --> 00:01:19,320
that this particular project can actually be built. So it will run these particular checks if

12
00:01:19,320 --> 00:01:25,480
there are no problems, everything will be a okay. However, if we do happen to run into a particular

13
00:01:25,480 --> 00:01:33,439
problem, then we will be alerted to this issue. Now not just this, once we actually run the

14
00:01:33,439 --> 00:01:38,439
configure script, what it's actually going to do is going to generate and create something called a

15
00:01:38,439 --> 00:01:46,680
make file. And that is make with a capital M. Now once we generate this particular file within it,

16
00:01:46,680 --> 00:01:52,120
what we're going to have are very particular instructions that is actually going to allow

17
00:01:52,200 --> 00:01:58,200
us to build the project. Okay, so think about it, we download the source code file, we will

18
00:01:58,200 --> 00:02:03,960
decompress it, we will then be left with a directory like structure. Once we go into that

19
00:02:03,960 --> 00:02:09,240
directory, we will see more folders and files. One of the files will be this configure script.

20
00:02:09,240 --> 00:02:14,439
Once we execute configure, that will create the make file, which is going to allow us to build

21
00:02:14,439 --> 00:02:21,439
the project. Now the make file itself that we generate, that is going to contain the instructions

22
00:02:21,439 --> 00:02:27,759
how we actually build this particular project. When we actually want to build the project, however,

23
00:02:27,759 --> 00:02:35,039
we will use the make command and this is make with a lowercase m. Now it is this command

24
00:02:35,039 --> 00:02:41,360
that reads the make file that will actually go through the process of building and compiling the

25
00:02:41,360 --> 00:02:47,360
actual program. And when I say compiling the program, this is actually going to take the data we have

26
00:02:47,360 --> 00:02:54,720
and generate the binary that we need. Now, after this process, we will have this binary file,

27
00:02:54,720 --> 00:03:01,200
i.e. our working program. But what we want to be able to do is we want to have access to this

28
00:03:01,200 --> 00:03:06,960
particular file throughout our system, just the way that the LS command, say for example, actually

29
00:03:06,960 --> 00:03:13,440
comes from within user bin LS. But as we know, we can use the LS command right throughout the system

30
00:03:13,520 --> 00:03:20,159
just by typing LS. However, in the same way, we want to have our binary program accessible from

31
00:03:20,159 --> 00:03:26,079
everywhere within the file system. And the way we can do this is we will actually use the make

32
00:03:26,079 --> 00:03:32,879
install command. Now, what this is actually going to do, it's going to install the compile program

33
00:03:32,879 --> 00:03:39,360
to a particular location. Now this location might be a default location, if you do not specify a

34
00:03:39,360 --> 00:03:45,200
particular location. But the reality is, is that in that earlier step, when we talked about the

35
00:03:45,200 --> 00:03:50,800
configure script, we could actually execute this configure script with a particular option, we

36
00:03:50,800 --> 00:03:56,720
could do dash dash and then the word prefix. And the prefix keyword is going to allow it to specify

37
00:03:56,720 --> 00:04:02,480
a particular location. This is whereabouts our compile program is going to be located. Now,

38
00:04:02,479 --> 00:04:09,759
like I said before, we can expect to see software built in a location like user forward slash local,

39
00:04:09,759 --> 00:04:15,679
but by using the configure script with this dash dash prefix option, and I'm going to tell

40
00:04:15,679 --> 00:04:21,039
if I could write this correctly, it should be prefix. There we go. This option will allow us to

41
00:04:21,599 --> 00:04:27,839
change this particular location. If we so choose not the time recommending you do so, but the option

42
00:04:27,919 --> 00:04:33,039
is indeed there for you. So say for example, if we wanted to use the configure script, we would say

43
00:04:33,039 --> 00:04:38,879
dot slash configure to execute the binary. And then we can say dash dash prefix, and then equals,

44
00:04:38,879 --> 00:04:44,799
and then we could give a particular location user src, blah, blah, blah, whatever it may be, or

45
00:04:44,799 --> 00:04:50,639
perhaps you want to put it into the opt directory. Say for example, this is going to allow you to do

46
00:04:50,639 --> 00:04:57,359
such a thing. So really, we download the source, we extract the compressed files, we then use the

47
00:04:57,360 --> 00:05:04,400
configure script to generate the make file, we then use the make command, which will actually read

48
00:05:04,400 --> 00:05:10,560
the contents, i.e. the instructions within that make file. And then we can use that make install

49
00:05:10,560 --> 00:05:16,560
commands to compile that program into a particular location, such that it is available throughout

50
00:05:16,560 --> 00:05:22,000
our script. Now, when you happen to use the make install command, you want to be doing this with

51
00:05:22,079 --> 00:05:28,959
super user privileges, i.e. pseudo make install. The reason for this is going to have to get access

52
00:05:28,959 --> 00:05:34,639
to a lot of administrator restricted files and locations. So just be aware of this, if you do

53
00:05:34,639 --> 00:05:40,639
not have super user privileges, you may run into problems trying to use the make install command.

54
00:05:40,639 --> 00:05:45,759
Now, one last thing I want to talk to you about before we actually get to get hands on and walk

55
00:05:45,759 --> 00:05:51,600
through this process so we can actually see an action is the concept of patching. Now,

56
00:05:51,600 --> 00:05:56,720
what this means is that, well, you may have actually got some familiarity with it, maybe say

57
00:05:56,720 --> 00:06:03,120
when you're on your laptop or you're on your phone, you may see that you get an update to install a

58
00:06:03,120 --> 00:06:10,640
security patch. All this ultimately means is that the software has been updated and a change has been

59
00:06:10,640 --> 00:06:15,280
made. So really, if you happen to find, say, for example, a bug in your software, this may be a

60
00:06:15,280 --> 00:06:21,200
security bug, for example, if you want to be able to fix this problem, you would want to issue a

61
00:06:21,199 --> 00:06:28,479
patch to your software. Now, the reality is what the patch is, the patch is the difference between

62
00:06:28,479 --> 00:06:35,759
the original software, i.e. the original source code and the new version of that code. Now,

63
00:06:35,759 --> 00:06:41,519
when you actually have some changes to be made, we can actually draw a comparison between the

64
00:06:41,519 --> 00:06:49,279
original file, we'll call this the OG, so the new file. Within Linux, we actually have the diff

65
00:06:49,359 --> 00:06:55,919
command, which can assess and compare what is in this file, compared to what is in this file,

66
00:06:55,919 --> 00:07:02,159
and actually just present to us the differences between these files. Now, the actual result of

67
00:07:02,159 --> 00:07:09,119
this diff command, i.e. the differences between these files, that can actually be used to convert

68
00:07:09,119 --> 00:07:15,279
the files from the old version to the new version, the patched version, if you will. And indeed,

69
00:07:15,279 --> 00:07:21,279
when we want to do such a thing, we actually have something called the patch utility, and the patch

70
00:07:21,279 --> 00:07:28,559
utility is going to make use of this patch file. The patch file being simply the file that actually

71
00:07:28,559 --> 00:07:34,959
contains the differences generated by that diff command, and it's going to apply those differences

72
00:07:34,959 --> 00:07:40,639
to the files. So really, the diff command can be used to generate the differences between the two

73
00:07:40,639 --> 00:07:47,279
files. We can then make a patch file with those differences, and then we can use the patch utility

74
00:07:47,279 --> 00:07:53,759
on that patch file to generate this new patched software. So really, I know the process of

75
00:07:53,759 --> 00:07:58,719
building from source code can be a little bit confusing. We have these different make files,

76
00:07:58,719 --> 00:08:03,839
and the make command, and the make install command. It honestly is quite difficult to follow in your

77
00:08:03,839 --> 00:08:09,360
first introduced to the concept. The best way that I've found to be able to get your head around these

78
00:08:09,439 --> 00:08:15,680
concepts is to get hands on yourself and to see the process in action. Well, the good news is,

79
00:08:15,680 --> 00:08:19,840
is that that is exactly what we're going to be doing in the very next nuggets. I hope this has

80
00:08:19,840 --> 00:08:23,040
been informative for you, and I'd like to thank you for viewing.

