1
00:00:00,000 --> 00:00:14,519
Hey guys and welcome back.

2
00:00:14,519 --> 00:00:20,859
So now what I want to do is to walk you through the actual process of downloading a particular

3
00:00:20,859 --> 00:00:26,120
package with our source code and being able to actually build from that source code so

4
00:00:26,120 --> 00:00:31,920
that we have a fully functioning and working program as opposed to being able to just rely

5
00:00:31,920 --> 00:00:36,079
on our nice package manager such as apt to do such a thing.

6
00:00:36,079 --> 00:00:40,400
So let's get an example of what we are talking about then.

7
00:00:40,400 --> 00:00:46,600
So like I say, the very first thing that we're going to have to do is to obtain that particular

8
00:00:46,600 --> 00:00:47,600
source code.

9
00:00:47,600 --> 00:00:51,560
This can be a source code for any particular application that you so choose.

10
00:00:51,560 --> 00:00:57,500
In this case here, I'm just going to download the source code for a very simple game called

11
00:00:57,500 --> 00:00:58,500
Ang Band.

12
00:00:58,500 --> 00:01:03,719
So the reality is we've got to go and get this source code to what I will do is I will

13
00:01:03,719 --> 00:01:06,960
just close this just now and I'll go to my browser.

14
00:01:06,960 --> 00:01:08,520
Okay, open up Firefox.

15
00:01:08,520 --> 00:01:11,680
Let me just close this and I will go to Google.

16
00:01:11,680 --> 00:01:12,680
Okay.

17
00:01:12,680 --> 00:01:17,520
Okay, so all I've done is search for the name Ang Band and source code.

18
00:01:17,520 --> 00:01:20,500
So what I'm going to do is you can go to get up if you want.

19
00:01:20,500 --> 00:01:23,719
In this case here, I will just go to the website.

20
00:01:23,719 --> 00:01:25,420
So we click on the website here.

21
00:01:25,420 --> 00:01:29,700
We can see indeed we have this link to download the source code.

22
00:01:29,700 --> 00:01:32,340
You see that version four to four.

23
00:01:32,340 --> 00:01:36,900
If I just click on this, we can see here, this is now going to download this particular

24
00:01:36,900 --> 00:01:37,900
file.

25
00:01:37,900 --> 00:01:38,900
Notice the extension.

26
00:01:38,900 --> 00:01:40,980
We've got dot tar dot GZ.

27
00:01:40,980 --> 00:01:44,099
That could also be dot TGZ as we already know.

28
00:01:44,099 --> 00:01:48,659
So what I will do is this will now be in my downloads.

29
00:01:48,659 --> 00:01:54,259
If I go back to my terminal right here, if I do an LS, let's CD into the downloads directory.

30
00:01:54,259 --> 00:01:55,979
We're doing LS.

31
00:01:55,979 --> 00:01:59,459
Now we have this tar file which has been compressed.

32
00:01:59,459 --> 00:02:02,500
Now we know it is a dot GZ extension.

33
00:02:02,500 --> 00:02:07,659
This means that we can ultimately extract this using Gunzip if we so wish.

34
00:02:07,659 --> 00:02:11,300
So what I can say is Gunzip and then the name of the file.

35
00:02:11,300 --> 00:02:18,340
If I enter and I do an LS, I now have this tar file and I can say tar and extract.

36
00:02:18,340 --> 00:02:25,379
Angband and I can say dash fail and then Angband and if I enter, if I do an LS now, we can

37
00:02:25,379 --> 00:02:29,379
see here we actually have this new directory structure.

38
00:02:29,379 --> 00:02:30,379
This is what I was talking about.

39
00:02:30,379 --> 00:02:36,020
So if I go into this particular directory and I do an LS, we can see all of these different

40
00:02:36,020 --> 00:02:38,099
files and directories.

41
00:02:38,099 --> 00:02:42,980
Now it is a good idea, very good practice to look at this particular file here.

42
00:02:42,979 --> 00:02:49,419
This is a mark down file as denoted by the dot MD extension and it's called the readme.

43
00:02:49,419 --> 00:02:52,979
This is something you're going to see very, very often when you're dealing with software.

44
00:02:52,979 --> 00:02:56,780
You'll see this all the time on places like GitHub, for example.

45
00:02:56,780 --> 00:03:02,259
And it's where a particular developer can signal to you instructions about this particular

46
00:03:02,259 --> 00:03:03,259
program.

47
00:03:03,259 --> 00:03:06,939
So it's a good idea that we actually do read the readme mark down file.

48
00:03:06,939 --> 00:03:12,019
So let's go into this and we can see here it tells us the information about the game

49
00:03:12,060 --> 00:03:13,060
itself.

50
00:03:13,060 --> 00:03:17,420
It's just a little graphical dungeon adventure game and it tells us how to install it.

51
00:03:17,420 --> 00:03:22,340
We can go to here to get the information or we can compile it ourselves by clicking this

52
00:03:22,340 --> 00:03:23,900
link to get the instructions.

53
00:03:23,900 --> 00:03:26,939
We can also see how to play the game and how to get help.

54
00:03:26,939 --> 00:03:30,460
You might actually get much more information and a readme.

55
00:03:30,460 --> 00:03:32,700
This is a very simple and minimal readme.

56
00:03:32,700 --> 00:03:35,020
So don't just think it's always going to look like this.

57
00:03:35,020 --> 00:03:39,700
You can get far more information, including crucial dependencies and whatnot.

58
00:03:39,700 --> 00:03:41,740
So let's exit out of this for now.

59
00:03:41,780 --> 00:03:47,460
You will notice though that we have this configure script and we can tell, of course, it is an

60
00:03:47,460 --> 00:03:52,860
executable because of the coloration, but a better way to check is if we do an LS-L,

61
00:03:52,860 --> 00:03:57,740
we can see here the actual permissions tells us it is executable.

62
00:03:57,740 --> 00:04:00,620
So this is this configure file I was talking about.

63
00:04:00,620 --> 00:04:07,100
Now, one thing before we even get started, before we can actually do things like compilation,

64
00:04:07,100 --> 00:04:10,060
we actually need a compiler ourselves.

65
00:04:10,060 --> 00:04:15,300
The compiler is going to be the program that is going to transform the human readable source

66
00:04:15,300 --> 00:04:18,180
code into machine readable binary.

67
00:04:18,180 --> 00:04:20,939
So we absolutely need to do this first.

68
00:04:20,939 --> 00:04:23,340
Now we can have different types of compilers.

69
00:04:23,340 --> 00:04:26,420
Say for example, we have one called LLVM.

70
00:04:26,420 --> 00:04:32,620
A very popular one is called the GNU-C compiler, otherwise known as GCC.

71
00:04:32,620 --> 00:04:37,340
Now in order to be able to get these compilers along with other essential commands, you can

72
00:04:37,379 --> 00:04:40,699
do so via your particular package manager.

73
00:04:40,699 --> 00:04:45,179
So if you happen to be on Red Hat, you could use DNF or YUM.

74
00:04:45,179 --> 00:04:49,019
In the case of me, I'm using a Debian-based system.

75
00:04:49,019 --> 00:04:51,659
So I will use the apt package manager.

76
00:04:51,659 --> 00:04:58,779
So I will say sudo apt install and I will say build hyphen essential and then ceiling or

77
00:04:58,779 --> 00:04:59,779
clang.

78
00:04:59,779 --> 00:05:05,179
If I hit enter here and I'll type in my password for my super user privileges hit enter.

79
00:05:05,220 --> 00:05:07,620
I will then say yes and hit enter.

80
00:05:07,620 --> 00:05:12,220
And this is going to allow me to install the package so that I have access to my compiler.

81
00:05:12,220 --> 00:05:16,980
So when I go through the process of compilation, I can actually transform that human readable

82
00:05:16,980 --> 00:05:20,100
source code into the machine readable binary.

83
00:05:20,100 --> 00:05:23,220
Okay, so that is now successfully installed.

84
00:05:23,220 --> 00:05:27,139
What I want to do is I want to actually use this configure script.

85
00:05:27,139 --> 00:05:33,060
Now you may recall the way we can actually execute a particular file is by saying dot slash

86
00:05:33,060 --> 00:05:34,180
and then the name of the file.

87
00:05:34,180 --> 00:05:36,339
So we can say dot slash configure.

88
00:05:36,339 --> 00:05:40,420
And remember, if we want to happen to change the particular location, we can use this

89
00:05:40,420 --> 00:05:44,300
prefix option and then specify a particular location.

90
00:05:44,300 --> 00:05:47,540
In my case right now, I will just leave it as it is.

91
00:05:47,540 --> 00:05:50,740
So if I hit enter, okay, that has ran through some basic checks.

92
00:05:50,740 --> 00:05:54,740
If we scroll on up, we can see all the different types of checks it is doing.

93
00:05:54,740 --> 00:05:59,060
Say for example, if the C compiler is working, yes, checking for particular command such

94
00:05:59,060 --> 00:06:03,019
as the remove command, the move command, the copy command.

95
00:06:03,019 --> 00:06:06,299
If we keep on scrolling, we see all of these checks going through.

96
00:06:06,299 --> 00:06:08,699
We can see here where the install path is.

97
00:06:08,699 --> 00:06:10,459
Remember that location we talked about.

98
00:06:10,459 --> 00:06:12,500
Use our local very common one indeed.

99
00:06:12,500 --> 00:06:17,339
We'll actually see where our documentation will be stored as well as some information

100
00:06:17,339 --> 00:06:18,579
relating to our front ends.

101
00:06:18,579 --> 00:06:20,539
We can see here X11.

102
00:06:20,539 --> 00:06:22,699
No, we do not have the ability for X11.

103
00:06:22,699 --> 00:06:29,259
We have missing libraries and we can also see other configurations such as SDL2 that indeed

104
00:06:29,259 --> 00:06:30,259
is disabled.

105
00:06:30,500 --> 00:06:35,539
So you may actually need to resolve a particular dependency if you want to have particular

106
00:06:35,539 --> 00:06:36,539
features enabled.

107
00:06:36,539 --> 00:06:43,459
Say for example, this dependency right here, SDL2, this relates to sound and this is what

108
00:06:43,459 --> 00:06:45,980
Angband actually needs to play sound.

109
00:06:45,980 --> 00:06:49,180
So what we actually need to do here is to get a particular library.

110
00:06:49,180 --> 00:06:55,219
Now the library that SDL2 needs is one called libSDL2.

111
00:06:55,220 --> 00:07:01,860
So in order to be able to use SDL2, what I'm going to do is say sudo apt install and on

112
00:07:01,860 --> 00:07:10,260
Debian based systems, the library is lib SDL2-dev and if I hit enter, this is now going to install

113
00:07:10,260 --> 00:07:16,060
this and I hit yes, run through the installation and just give it a minute or two to complete.

114
00:07:16,060 --> 00:07:21,380
So now what we can actually do is we can run the configure command once again, but we will

115
00:07:21,379 --> 00:07:26,740
now attempt to enable SDL2 now that we have resolved this missing dependency.

116
00:07:26,740 --> 00:07:28,740
So we'll try again, we will say configure.

117
00:07:28,740 --> 00:07:31,500
In fact, let me just clear the screen to make it a little bit cleaner.

118
00:07:31,500 --> 00:07:36,420
I'll say configure and just like the way we could pass in the prefix option, I will pass

119
00:07:36,420 --> 00:07:41,339
in the option to enable SDL2 and it would help if I could spell SDL2.

120
00:07:41,339 --> 00:07:42,339
There we go.

121
00:07:42,339 --> 00:07:45,860
So if I hit enter, we run through the same checks once again.

122
00:07:45,860 --> 00:07:48,740
Okay, if we do an LS, let's just clear the screen.

123
00:07:48,740 --> 00:07:52,340
Now what we're going to do is we're going to make use of this make file.

124
00:07:52,340 --> 00:07:53,980
We go in and have a quick look at it.

125
00:07:53,980 --> 00:07:55,900
We can see what we have right here.

126
00:07:55,900 --> 00:07:59,939
Again we just see all this type of programming logic that we don't have to worry about too

127
00:07:59,939 --> 00:08:00,939
much.

128
00:08:00,939 --> 00:08:06,620
Just understand that the make command is going to actually be able to read these instructions

129
00:08:06,620 --> 00:08:08,540
and build as necessary.

130
00:08:08,540 --> 00:08:10,300
So we'll close this just now.

131
00:08:10,300 --> 00:08:14,740
And if I just issued the make commands, this will begin to perform all the actions needed

132
00:08:14,740 --> 00:08:16,259
to compile the program.

133
00:08:16,259 --> 00:08:18,699
If I hit enter, we're getting to the source directory.

134
00:08:18,699 --> 00:08:20,099
It's going to begin compiling.

135
00:08:20,099 --> 00:08:24,899
We can see here all the compilation steps and this may take a few minutes depending on

136
00:08:24,899 --> 00:08:25,899
your system.

137
00:08:25,899 --> 00:08:29,500
And as we can see here, there's a lot of compilation going on.

138
00:08:29,500 --> 00:08:32,500
So just be patient and there we go right there.

139
00:08:32,500 --> 00:08:38,259
Now if I happen to say which Aang band, we're not actually going to see any information.

140
00:08:38,259 --> 00:08:42,980
We want to have this command available as a system wide executable.

141
00:08:42,980 --> 00:08:46,539
So this is what we're going to do with the make install command.

142
00:08:46,539 --> 00:08:51,700
And like I say, because we're going to be copying files to very particular directories, these

143
00:08:51,700 --> 00:08:55,820
directories are protected by root access.

144
00:08:55,820 --> 00:08:57,659
So we're going to have to use the sudo command.

145
00:08:57,659 --> 00:09:01,100
So we'll say sudo make install.

146
00:09:01,100 --> 00:09:05,139
And if I hit enter, this is going to go through the same process of getting into particular

147
00:09:05,139 --> 00:09:09,620
directories and it will do some copying to particular locations.

148
00:09:09,620 --> 00:09:15,220
And now once this is done, if I say which Aang band, we can actually see here this command

149
00:09:15,220 --> 00:09:19,820
is now available and again within the user local directory.

150
00:09:19,820 --> 00:09:26,259
So if I clear this and I just say Aang band and hit enter, look at this, our little game

151
00:09:26,259 --> 00:09:29,379
has now actually appeared on our system.

152
00:09:29,379 --> 00:09:31,659
And how do we actually get this game on our system?

153
00:09:31,659 --> 00:09:37,259
We just downloaded the source code as a tar file, which was compressed.

154
00:09:37,259 --> 00:09:38,700
We decompressed it.

155
00:09:38,700 --> 00:09:44,900
We then downloaded a particular compiler so that we could run the configure command to

156
00:09:44,900 --> 00:09:49,660
ensure the checks that the project could indeed be built and create the make file.

157
00:09:49,660 --> 00:09:54,300
We then used the make command to read the instructions within that make file to build

158
00:09:54,300 --> 00:09:55,340
the program.

159
00:09:55,340 --> 00:10:00,780
And then we use the make install command with super user privileges to make this a system

160
00:10:00,780 --> 00:10:04,820
wide command that we can actually use from anywhere within the system.

161
00:10:04,820 --> 00:10:08,660
If I just close this for now and if I go to a completely different directory, let's

162
00:10:08,660 --> 00:10:13,540
maybe say go into the root directory and then I don't know, let's maybe go into it

163
00:10:13,540 --> 00:10:15,580
say somewhere completely random.

164
00:10:15,580 --> 00:10:22,140
I can still say Aang band to enter and load that game because like I say, we have used

165
00:10:22,140 --> 00:10:25,140
the make install command to make it system wide and accessible.

166
00:10:25,140 --> 00:10:31,220
So hopefully now seeing this process in action, the actual process of compilation from source

167
00:10:31,220 --> 00:10:33,060
code is a little bit clearer.

168
00:10:33,059 --> 00:10:36,979
Like I say, it does take a little bit of practice to get the process clear in your mind.

169
00:10:36,979 --> 00:10:41,859
But once you do see how it's done, then you really just repeat the same type of processes

170
00:10:41,859 --> 00:10:44,379
independent of the source code you're trying to compile.

171
00:10:44,379 --> 00:10:48,099
Okay, so that is us for the configuration of installing from source code.

172
00:10:48,099 --> 00:10:49,659
I hope this has been informative for you.

173
00:10:49,659 --> 00:10:51,179
I'd like to thank you for viewing.

