View Source

h3. Debian package "hello-world"

In order to package a dummy "hello-world", it's assumed that you have the required software to do it installed and that you follow all the needed steps. It's also assumed that you are running an operating system that allows .deb package installation.

For the impatient, download file [^hello.tar.gz] (contains the necessary files to the "hello-world" package) and go straight ahead to [build process section|#buildProcess].

Contents of hello.tar.gz: 
!hello-world_directory_contents.png|align=left,border=1!\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
* changelog - Contains information about version number, revision, distribution, and urgency. ([More info|http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#changelog]).
{code}
hello-world (1.0.0) unstable; urgency=low

* Initial Release.

-- Helder Silva <hsilva@keep.pt> Wed, 08 Feb 2012 09:59:32 +0000
{code}
* compat - Specifies the compatibility mode. Nowadays, it goes from 1 (default) to 9, each one specifying particular behaviour of some of the tasks execute in particular targets of the build process. ([More info|http://www.debian.org/doc/manuals/maint-guide/dother.en.html#compat]).
{code}
8
{code}
* control - Contains important information of the package, namely the package name, maintainer, dependencies (build dependencies, execution dependencies) and others, that are useful for package related programs: dpkg, apt-get, etc. ([More info|http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control]).
{code}
Source: hello-world
Section: misc
Priority: extra
Maintainer: Hélder Silva <hsilva@keep.pt>
Build-Depends: debhelper (>= 8.0.0), perl
Standards-Version: 3.9.2
Homepage: http://www.keep.pt/

Package: hello-world
Architecture: all
Depends: ${misc:Depends}
Description: This is a dummy package with a hello world echo script
This is the long description...
This is the long description...
This is the long description...
This is the long description...
This is the long description...
{code}
* copyrights - Contains information about copyrights and licences associated both to the "program" files and package related files ([More info|http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#copyright]).
{code}
Format: http://dep.debian.net/deps/dep5
Upstream-Name: hello-world

Files: *
Copyright: 2012 Hélder Silva <hsilva@keep.pt>
License: LGPL-2.0+

Files: debian/*
Copyright: 2012 Hélder Silva <hsilva@keep.pt>
License: LGPL-2.0+

License: LGPL-2.0+
This package is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in "/usr/share/common-licenses/LGPL-2".
{code}
* dirs - Contains information about directories that must exist or be created upon package installation ([More info|http://www.debian.org/doc/manuals/maint-guide/dother.en.html#dirs]).
{code}
usr/bin
{code}
*PS:* This file isn't really needed as /usr/bin is created by default on system installation.
* hello-world.manpages - Specifies the name of the man pages files that are going to be installed ([More info|http://www.debian.org/doc/manuals/maint-guide/dother.en.html#manpages]).
{code}
debian/hello-world.1
{code}
* hello-word.pod - Man page described using POD (Perl Old Documentation) format, that is going to be transformed in nroff format in the Debian package creation process.
{code}
=head1 NAME

hello-world - This is a dummy package with a hello world echo script.

=head1 SYNOPSIS

hello-world

=head1 DESCRIPTION
This is the long description...
This is the long description...
This is the long description...
This is the long description...
This is the long description...

=head1 AUTHORS

B<hello-world> was written by Helder Silva <hsilva@keep.pt>.

This manual page was written by Helder Silva <hsilva@keep.pt>.
=cut
{code}
* install - File describing the install directory for the hello-world script ([More info|http://www.debian.org/doc/manuals/maint-guide/dother.en.html#install]).
{code}
hello-world usr/bin/
{code}
* README - Contains information about the program.
{code}
The Debian Package hello-world
----------------------------

Comments regarding the Package

-- Helder Silva <hsilva@keep.pt> Wed, 08 Feb 2012 09:59:32 +0000
{code}
* rules - Debian specific makefile for package generation ([More info|http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#rules]).
{code}
#!/usr/bin/make -f

%:
dh $@

override_dh_clean:
dh_clean
rm -f debian/hello-world.1
override_dh_auto_build:
dh_auto_build
pod2man --section=1 --release=$(VERSION) --center "" debian/hello-world.pod > debian/hello-world.1
{code}
* format - Debian file stating the format of the package. It must be either "3.0 (native)" for Debian native packages or "3.0 (quilt)" for everything else ([More info|http://www.debian.org/doc/manuals/maint-guide/dother.en.html#sourcef]).
{code}
3.0 (native)
{code}
* hello-word - Hello world shell script.
{code}
#!/bin/sh

echo "Hello world!"
{code}

Descriptive steps to build, install and run the content of the package:
{anchor:buildProcess}
# Extract the archive content
{code}
tar xzf hello.tar.gz
{code}
# Build
{code}
cd hello/hello-world_1.0.0/
dpkg-buildpackage
{code}
# Verify package with lintian
{code}
cd ../
lintian hello-world_1.0.0_all.deb
{code}
# Install
{code}
sudo dpkg -i hello-world_1.0.0_all.deb
{code}
# Run it&nbsp;
{code}
hello-world
{code}