2 include "8440head.php";
9 <font color="#931515" size="+3">COMP8440: Build Tips</font>
13 <h1>Building a package</h1>
15 Building a FOSS project can be tricky. You need to work out where
16 to get the source from, you need to install all the package
17 dependencies, and you need to sort through the idiosyncrasies of the
18 packages build system.
20 <h2>Downloading the source</h2>
22 There are a number of common ways to get the source code for a FOSS
23 package. The main ones are:
26 <li>Using the package manager for your distribution</li>
27 <li>Downloading a release tarball</li>
28 <li>Downloading via the projects source code management system</li>
31 <h3>Using the package manager</h3>
33 Nearly all FOSS operating system distributions include a 'package
34 manager' which allows you to manage what software packages are
35 installed on your system. On the COMP8440 Ubuntu lab systems the
36 package manager is called 'apt'.<p>
38 Most package managers have the ability to ask for the source code
39 for a particular package to be downloaded. With apt on Ubuntu the
43 apt-get source PACKAGE
46 This will typically download 4 things in to the current directory:
49 <li>The original tarball of the upstream package
50 <li>A .dsc description of the package
51 <li>A set of compressed patches to the upstream package
52 <li>An unpacked, patched, version of the package that is ready to
56 The original tarball is useful if you want to see what the upstream
57 maintainer provided (this is usually a copy of the official release
58 from the package author).<p>
60 The .dsc file is useful because it contains a text description of the
61 package, and in particular it contains a list of all of the packages
62 build dependencies.<p>
64 The patches show you what changes the distribution made to the package
65 when including it into the distribution. These changes may be just
66 cosmetic, or may fix bugs that are not yet fixed in the official
69 The unpacked source is what you will need to actually build the
70 package yourself. On Debian/Ubuntu systems this source package should
71 contain a directory called 'debian' which contains a 'rules' file that
72 can be used to build the package. If you cd to the unpacked directory,
73 you should be able to build the package using:
79 <h3>Using a release tarball</h3>
81 Once you find the home page for the package you are interested in, you
82 can usually find a 'release tarball'. This contains the source code
83 for an official release of the package.<p>
85 Once you've unpacked that tarball using something like this:
88 tar xvzf package-x.y-z.tar.gz
91 You can start looking at the source code. Usually there is a text file
92 in the top level directory which explains how to build the package, or
93 there may be build instructions on the packages web site. There are
94 many variants on how to build FOSS packages, but some common ones are:
97 <li>A configure script, followed by make
98 <li>A bootstrap.sh script
99 <li>A autogen.sh script, followed by make
100 <li>A build.sh script
103 In each case, you will need to install any package dependencies. See
104 the build dependencies section of this guide.
106 <h3>Using the source code management system</h3>
108 Most FOSS projects use a source code management system. When you are
109 thinking about contributing to a project, this is usually the
110 preferred way to access the source code, as you will have access to
111 the latest developments made by other contributors.<p>
113 There are a wide range of SCMs used by FOSS projects. Some of the more
124 The web site for the project usually gives instructions for how to
125 download the source code using whichever tool is appropriate.<p>
127 Some of the projects you will be working on for COMP8440 have very
128 large source trees, and downloading using a SCM may take a very long
129 time. To save time, we have put copies of a checked out copy of some
130 of the larger projects in /comp8440/sources. To grab one of those use
134 rsync -av /comp8440/sources/wesnoth .
137 Then cd to the directory and use the appropriate SCM to get any
138 updates. For example, if the project uses svn, then use the command:
145 <h2>Build Dependencies</h2>
147 One of the trickier aspects of building a FOSS project can be
148 installing all of the necessary build dependencies. A build dependency
149 is another package that must be installed in order to build the
150 package you want to build.<p>
152 There are several ways to find and install the build dependencies:
155 <li>Look at the package documentation
156 <li>Looking in the dsc file
157 <li>Using your package manager
161 <h3>Looking at the package documentation</h3>
163 Many FOSS projects have developer information on their web sites which
164 describes what packages you need to install in order to build the
165 project. It can sometimes be tricky to match the names in the
166 documentation to the names of the packages in your distribution. Try
167 using the synaptic package manager, or doing a google search for what
168 you are trying to match.
170 <h3>Looking in the dsc file</h3>
172 If you downloaded the package source using 'apt-get source' then the
173 .dsc file should contain a Build-Depends line which lists the packages
174 that this package depends on. That can be a very good starting point
175 for what you need to install.
177 <h3>Using your package manager</h3>
179 Some package managers have a feature that allows you to automatically
180 install all the build dependencies for an already packaged project. For
181 example, on Ubuntu/Debian systems, you can run this:
184 sudo apt-get build-dep PACKAGE
187 That is a very easy way to get the build dependencies installed. Be
188 aware though that if you are trying to install a different version
189 that what the distribution currently has packaged, you may find you
190 need some additional packages.
192 <h3>Trial and error</h3>
194 This approach is just what it sounds like, and it is often needed in
195 addition to one of the methods above. You try and build the package,
196 and you see what errors it gives. You examine the errors and from
197 there try to work out what dependent packages need to be
198 installed. Remember that you often want the 'development' version of
199 the package - so if you have a choice, look for one ending in '-dev'.<p>
201 The search feature in synaptic, or the command 'apt-cache search' is
202 very useful in trying to find the right package.
204 <p><div align="center">
206 print " Last modified: ";
207 $last_modified = getlastmod();
208 print(date("j/m/Y, H:i", $last_modified));
213 include "8440tail.php";