You are on page 1of 13

Packaging a C# Desktop Application for Debian-based Distros

Barry W. Block
bwb@fireflysoftware.com
29 Aug, 2013
(rev g
!ote" #$is tutorial is base% o& t$e Introduction to Debian Packaging w$ic$ ca& be fou&% $ere"
$tt's"((wiki.%ebia&.org()&tro*ebia&+ackagi&g,)&tro%uctio&-to-*ebia&-+ackagi&g. .a&y t$a&ks to its aut$or(s for
'rovi%i&g suc$ a straig$t/forwar% tutorial t$at eve& a &oob like myself coul% follow it. 0/
!ote" #$is +*1 is $oste% o& 2crib%.com.
1
Before worki&g t$roug$ t$e tutorial, be sure t$at you $ave t$e latest revisio& by
%ow&loa%i&g t$e .+*1 from 2crib%.com. #$is tutorial re3uires t$at you co'y comma&%s i&to t$e 4i&u5 termi&al. For this to
work properly, you should work from a downloaded .PDF file and not directly from the Scribd web page.
Introduction
2o you6ve bee& worki&g tirelessly for mo&t$s o& e&%, 'olis$i&g t$at wo&%erful 7, %eskto' a''licatio&
of yours a&% &ow you6re rea%y to s$are it wit$ all of t$ose w$o use *ebia&/base% 4i&u5 %istros but you
$ave&6t a clue $ow to 'ackage it8 !ot to worry9 +ackagi&g a''licatio&s (i&clu%i&g 7,(.o&o
a''licatio&s for i&clusio& i&to t$e *ebia& re'ositories is&6t as %ifficult as you mig$t t$i&k. :avi&g
attem'te% 'ackagi&g my ow& 7, a''licatio&s o& 4i&u5 i& t$e 'ast
2
, ) was more t$a& 'leasa&tly
sur'rise% to fi&% rece&tly t$at t$e 'rocess $as become almost trivial com'are% to w$at it o&ce was a&%
)6m certai& t$at ot$ers coul% be&efit from t$e rece&t success t$at )6ve $a% wit$ 'ackagi&g my ow&
a''licatio&.
)& t$is tutorial )6ll ste' you t$roug$ t$e 'rocess of 'ackagi&g a 7, %eskto' a''licatio& from t$e grou&%
u', starti&g wit$ &ot$i&g more t$a& t$e a''licatio&6s source. #$e first ste' will be to create a ;tarball<
from t$e %irectory t$at co&tai&s t$e source. =sse&tially, a ;tarball< is &ot$i&g more t$a& a& arc$ive of
t$e source co%e a&% scri'ts or makefiles t$at are &ee%e% to buil% a 'iece of software. )t6s t$is arc$ive
file t$at 4i&u5 users ofte& buil% a& a''licatio& from w$e& t$eir 4i&u5 %istro %oes&6t yet $ave t$e
%esire% a''licatio& i& its re'ositories. 4ikewise, it6s t$is same arc$ive file t$at a *ebia& 'ackager ofte&
starts wit$ w$e& 'ackagi&g a& ;u'stream< %evelo'er6s a''licatio& for i&clusio& i& t$e *ebia&
re'ositories.
1 #$e +*1 ca& be fou&% o& 2crib% at" $tt'"((www.scrib%.com(%oc(1>09>??@0(+ackagi&g/a/7/*eskto'/A''licatio&/for/
*ebia&/base%/*istros.
2 )6ve bee& a $a''y co&vert to 4i&u5 si&ce about 200A.
1
:ere, we will be acti&g t$e 'art of t$e *ebia& 'ackager e5ce't t$at i&stea% of starti&g wit$ a tarball,
we6ll $ave to create o&e ourselves, from t$e a''licatio&6s source. Bverall, t$e ste's i& t$e 'rocess of
buil%i&g t$e *ebia& (bi&ary 'ackage are as follows"
1. 7reate a tarball of t$e source t$at6s bei&g 'ackage%.
2. #o t$e %irectory from w$ic$ t$is tarball was create%, a%% a debian sub%irectory a&% 'o'ulate it
wit$ various 'ackagi&g/relate% files.
3. Buil% t$e 'ackage.
@. #est i&stall t$e 'ackage.
Just Some Preliminaries
All of t$e ste's of t$is tutorial were worke% out wit$ my com'uter ru&&i&g o& a 4i&u5 live 7* (i&
'articular, t$e 4i&u5 .i&t 1C live 7*, .A#= ('ro&ou&ce% ;may-tay e%itio&.
3
) $ig$ly recomme&%
t$at a&yo&e worki&g t$roug$ t$is tutorial %o so w$ile also ru&&i&g o& a live 7*(D2B, virtual +7, a
Eu&k com'uter etc., if o&ly for t$e 'eace of mi&% it may bri&g i& k&owi&g t$at, &o matter w$at mistakes
are ma%e, your system is reaso&ably safe from $arm.
@
Fra&te%, t$is mig$t &ot be a 'recautio& t$at
everyo&e ca& co&ve&ie&tly take, so w$atever works best for you. Gust be aware t$at t$ere coul% be
some risk of %amage as a result of i&stalli&g a& im'ro'erly create% 'ackage a&% t$at you alo&e assume
all risk of a&y suc$ %amage t$at mig$t occur to your system if you c$oose to take &o 'recautio&.
)6m goi&g to assume t$at you6ll be worki&g from a live 7*(D2B a&% if &ot, you may &ee% to a%Eust t$e
i&structio&s a bit $ere a&% t$ere. )6ll also assume t$at you k&ow $ow to co&&ect to t$e i&ter&et o&ce you
$ave boote% i&to t$e live 7*.
As &ote% at t$e begi&&i&g of t$is %ocume&t, this tutorial should not be followed directly from the
Scribd web page as t$e co'yi&g of comma&%s i&to t$e termi&al will &ot work as e5'ecte%. )f t$e
i&structio&s below re3uire t$at you ru& a set of comma&%s, (two or more comma&%s you s$oul% be
able to select a&% co'y all of t$em i&to t$e 4i&u5 termi&al i& o&e go. W$e& worki&g %irectly from t$e
2crib% 'age t$is fails to work a&% you must select(co'y a si&gle li&e at a time w$ic$ ki&% of %efeats t$e
w$ole 'ur'ose of usi&g t$e termi&al to e5'e%ite worki&g t$roug$ t$e tutorial i& t$e first 'lace.
Really Getting Started
Wit$ all of t$at out of t$e way, let6s get starte%. 1or our 'ackagi&g work, we6ll &ee% to i&stall some
%evelo'me&t tools. As wit$ ot$er *ebia&/base% %istros, i& t$e .A#= e%itio& of 4i&u5 .i&t, t$e FD)
way to %o t$is woul% be to o'e& u' t$e Synaptic Package anager, or ;+ackage .a&ager< as it6s calle%
3 Hou ca& %ow&loa% t$e latest .i&t ;live 7*< images at $tt'"((www.li&u5mi&t.com(%ow&loa%.'$'. ) like worki&g from a
live 7* w$e& ve&turi&g i&to u&familiar locales of t$e 4i&u5 la&%sca'e as it 'rovi%es a co&ve&ie&t mea&s of maki&g
mistakes wit$out bei&g brutally 'u&is$e% as a result. A&ot$er a%va&tage of e5'loiti&g live 7*s $ere is t$at a&yo&e ca&
follow alo&g i& a 4i&u5 tutorial regar%less of t$e B(2 t$ey6re curre&tly ru&&i&g. W$et$er your %eskto'6s u&%erlyi&g
o'erati&g system is 4i&u5, B2I or Wi&%ows, a live 7* %oes&6t care.
@ )f you %o %eci%e to boot from a live image, you6ll &ee% to use a rece&t 4i&u5 %istro release w$ic$ is still su''orte% so
t$at software 'ackages ca& be i&stalle% o&to it.
2
i& t$e .i&t me&u. :owever, for e5'e%ie&cy, we6ll use t$e trie% a&% true met$o% of... the terminal. Bk,
sto' yer s$aki&6Jit6s &ot t$at ba%9 )& fact, t$e termi&al is our frie&% $ere. #rust me. 0/
2o, go a$ea% a&% o'e& t$e termi&al
C
a&% ru& t$e followi&g comma&%"
sudo ap-ge updae
#o make ru&&i&g t$e comma&% easier, you ca& co'y it i&to your termi&al a&% 'ress t$e =&ter key.
Better yet, you ca& sim'ly select the abo!e te"t and drag it straight into the terminal. !ote t$at
%e'e&%i&g o& w$et$er you selecte% t$e traili&g e&%/of/li&e, you may still &ee% to 'ress t$e =&ter key
afterwar%s so t$at t$e comma&% gets e5ecute%.
2o, w$at t$e above comma&% %oes is u'%ate t$e 'ackage cac$e so t$at t$e system $as t$e latest
'ackage i&formatio& available w$e& 'ackages are i&stalle%. )t s$oul% ge&erate 3uite a bit of te5t out'ut
but u&less you see lots of error stateme&ts
>
, everyt$i&g s$oul% be fi&e.
!e5t, we6ll begi& i&stalli&g some software 'ackages. Ku& t$is comma&% i& t$e termi&al"
sudo ap-ge insa11 bui1d-essenia1 devscrips debhe1per gdebi gi
W$e& aske% ;*o you wa&t to co&ti&ue8< Eust 'ress ;y< followe% by t$e =&ter key. )f t$e curre&t versio&
of a 'ackage is alrea%y i&stalle% o& your system (as will likely be t$e case for bot$ gdebi a&% git if
you6re ru&&i&g 4i&u5 .i&t, you6ll be tol% so as s$ow& $ere"
min@min ~ $ sudo ap-ge insa11 gi

gi is a1ready he newes version.

After i&stalli&g t$e above 'ackages, t$e &e5t ste' is to obtai& t$e a''licatio& source t$at we wa&t to
'ackage. 1or t$is 'ur'ose, we6re goi&g to %ow&loa% t$e source for my mo%est 7, %eskto' a''licatio&,
Pipe#rench w$ic$ is $oste% o& Fit$ub.
!ote" Alt$oug$ +i'eWre&c$6s versio& mig$t be somet$i&g ot$er t$a& ;1.0< w$e& you work t$roug$ t$is tutorial, we6ll
&o&et$eless co&si%er its versio& to be ;1.0< for our 'ur'oses $ere. W$e& it comes time for you to actually 'ackage your ow&
software for i&clusio& i&to t$e software re'ositories, you6ll wa&t to use w$atever versio& &umber is curre&t for your
software.
)& t$e termi&al, ru& t$e followi&g comma&%s"
cd ~/es'op
m'dir RipeWrench-Rac'aging
cd RipeWrench-Rac'aging
gi c1one gi://gihub.com/bb1oc'/RipeWrench.gi pipewrench-1.0
#$is creates a %irectory, ;L(*eskto'(+i'eWre&c$/+ackagi&g('i'ewre&c$/1.0< a&% t$e& %ow&loa%s t$e
source for +i'eWre&c$ i&to it. )t6s from t$is %irectory t$at we6ll create our tarball arc$ive. B&ce
arc$ive%, t$is %irectory ('i'ewre&c$/1.0 will become t$e arc$ive6s to'/level %irectory a&% it must be
C #o %o t$is i& 4i&u5 .i&t(.A#= you woul% 'ress t$e ;Wi&%ows< key, ty'e ;term<, %ow&/arrow o&ce to ;#ermi&al< a&%
'ress =&ter.
> *i% you forget to co&&ect to t$e i&ter&et8
3
&ame% accor%i&g to *ebia& 'olicy. )& 'articular, its &ame s$oul% a%$ere to t$is format"
M'ackage &ameN/Mversio&N
:ere, M'ackage &ameN is sim'ly ;'i'ewre&c$< a&% Mversio&N is t$e versio& of t$e software itself (a&%
agai&, we6ll Eust assume it to be ;1.0<. #y'ically, a 'ackager worki&g from a& e5isti&g ;u'stream<
tarball woul% $ave to re&ame t$is to'/level %irectory after e5tracti&g t$e tarball i& or%er to meet t$ese
formatti&g re3uireme&ts0 $owever, i& t$is case, )6ve 'rovi%e% t$e e5tra argume&t to t$e above ;git
clo&e< comma&% so t$at t$e +i'eWre&c$ source is %ow&loa%e% i&to t$e 'ro'erly &ame% %irectory.
#$e &e5t ste' i& t$e se3ue&ce is to actually create t$e tarball arc$ive. *ebia& 'olicy re3uires t$at a
tarball be &ame% a very s'ecific way. )& 'articular, it s$oul% be &ame% as follows"
M'ackage &ameN-Mversio&N.orig.Marc$ive ty'eN
:ere, bot$ M'ackage &ameN a&% Mversio&N are t$e same as we saw 'reviously. #$e Marc$ive ty'eN ca&
be o&e of ma&y %iffere&t arc$ive file e5te&sio&s, but we6ll be usi&g ;.tar.gO< for our tarball6s file
e5te&sio&. 2o, wit$ t$at i&/mi&%, our tarball will be &ame%, ;'i'ewre&c$-1.0.orig.tar.gO<. !otice t$at
t$e $y'$e& (/ use% 'reviously to se'arate t$e 'ackage &ame a&% versio& i& t$e to'/level %irectory $as
bee& re'lace% i& t$e tarball6s &ame by a& u&%erscore (-.
We6re &ow rea%y to create t$e tarball, e5ce't for o&e mi&or 'roblem. =very git re'ository co&tai&s a
$i%%e& ;.git< %irectory w$ic$ we %o&6t wa&t to be i&clu%e% i& our *ebia& 'ackage a&% so we s$oul%
%elete it before 'rocee%i&g. 1rom t$e termi&al, e&ter a&% ru& t$e followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0
rm -rf .gi
#$is s$oul% remove t$e ;.git< %irectory, maki&g t$e +i'eWre&c$ source all clea& a&% 'ro'er i&
're'aratio& to $ave its 'icture take&. 0/ !ow, from t$e termi&al, ru& t$e followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging
ar -cvzf pipewrench_1.0.orig.ar.gz pipewrench-1.0
#$is results i& our muc$ a&tici'ate% source tarball, 'i'ewre&c$$%.&.orig.tar.g' bei&g create% i& t$e
Pipe#rench-Packaging %irectory.
!ote" )t6s wort$ %rawi&g atte&tio& to w$ere t$e tarball is create% $ere because t$e 'ackagi&g tools actually e5'ect it to resi%e
at t$is locatio& relative to t$e mai& (to'/level source %irectory.
!ote" B&ce you6ve create% a tarball from t$e source, be sure &ot to e%it t$e source wit$out also e%iti&g t$e corres'o&%i&g
source co&tai&e% i& t$e tarballJt$e two must remai& i& sy&c or you6ll get errors w$e& buil%i&g t$e 'ackage.
@
Debianiing t!e Source
!ow t$at we $ave our tarball, we6re &ow goi&g to begi& ;%ebia&iOi&g< t$e source by a%%i&g a debian
%irectory be&eat$ t$e 'i'ewre&c$/1.0 %irectory. 1rom t$e termi&al, ru& t$e followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0
m'dir debian
)&si%e of t$is &ew debian sub%irectory, we6ll create t$e followi&g 'ackagi&g files"
c$a&gelog
com'at
co&trol
co'yrig$t
i&stall
'i'ewre&c$.li&ks
'i'ewre&c$.ma&'ages
rules
source(format
Packaging File: changelog
#$e changelog file is a recor% of all c$a&ges t$at are ma%e to t$e *ebia& 'ackage. Bei&g as t$e 'ackage
we6re creati&g is &ew, t$ere will be but a si&gle recor%e% e&try i& t$e log i&%icati&g t$e 'ackage6s i&itial
creatio&. As *ebia& 'ackagi&g tools are rat$er strict w$e& it comes to t$e formatti&g of 'ackagi&g files
overall, care must be take& to 'ro'erly format t$e co&te&ts of t$e changelog file. 1ortu&ately, t$ere6s a
tool t$at ca& $el' us to 'ro'erly create our changelog file. #$at tool is dch. 1rom t$e termi&al, ru& t$e
followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0
dch --creae -v 1.0-1 --pac'age pipewrench
#$is will create t$e i&itial changelog file a&% t$e& 'rese&t you wit$ a list of e%itors from w$ic$ you ca&
c$oose o&e to fi&is$ e%iti&g t$e file. #$e %efault c$oice is (ano, a sim'le, lig$tweig$t termi&al base%
e%itor t$at6s i&stalle% o& virtually every 4i&u5 %istro. #$ose w$o are followi&g t$e tutorial from a
.i&t(.A#= live 7*(D2B may wis$ to e5it (ano a&% use .A#=6s te5t e%itor Pluma w$ic$ is a clo&e
of t$e 'o'ular g)dit0 $owever, (ano is certai&ly u' to t$e task if you %o&6t mi&% becomi&g familiar
wit$ its D).
)f you6re ru&&i&g from t$e live 7*, t$e changelog file t$at6s create% will look somet$i&g like t$is"
pipewrench (1.0-1) UNRELEASE, urgency=1ow
* Iniia1 re1ease. (C1oses: #XXXXXX)
-- Live session user <min@min> Tue, 13 Aug 2013 19:14:39 +0000
C
#$e ;/1< t$at we a%%e% to t$e software6s versio& i& ru&&i&g t$e %c$ comma&% ca& be see& o& t$e first
li&e of t$e ge&erate% changelog file. )t re'rese&ts t$e *ebia& 'ackage versio&. 2o accor%i&g to t$e
changelog, t$e 'ackage we6re creati&g will be of 'ackagi&g versio& 1. )f we were to later make c$a&ges
to t$e 'ackagi&g (i.e., a c$a&ge ma%e i&si%e of t$e %ebia& sub%irectory, we6% $ave to ;bum'< t$is latter
'art of t$e overall versio& &umber to ;/2<.
1or t$e 'ur'oses of t$is tutorial, leave ;D!K=4=A2=*< as is. #$is fiel% woul% &ormally i&%icate to
t$e 'ackagi&g tool w$ere t$e &ewly create% *ebia& bi&ary 'ackage s$oul% be u'loa%e% to. By leavi&g
t$is as ;D!K=4=A2=*<, &o u'loa% ca& be 'erforme% a&% t$is is w$at we wa&t $ere.
#$e ;urge&cyPlow< is fi&e for our 'ur'oses. 4eave it as is.
#$e ;(7loses" ,IIIIII< fiel% is &ormally a mea&s of automati&g t$e closi&g of t$e ;bug< t$at a&
u'%ate% *ebia& 'ackage is mea&t to fi5 (if i&%ee% t$e 'ackage was i&te&%e% as a 'atc$. 1or our
'ur'oses, t$is te5t ca& eit$er be remove% or it ca& be ig&ore%. Hour c$oice. )f ig&ore%, it will sim'ly
result i& a war&i&g later t$at wo&6t sto' us from bei&g able to i&stall t$e 'ackage.
As for t$e last li&e, t$e 'ackagi&g tool attem'ts to guess w$o t$e 'ackager is a&% i& my case it t$i&ks
t$at )6m ;4ive sessio& user< a&% t$at my email a%%ress is ;mi&t@mi&t<. Ke'laci&g t$e former wit$ your
full &ame a&% t$e latter wit$ your email will elimi&ate a&ot$er war&i&g t$at woul% ot$erwise be
ge&erate% later.
2o, t$at6s it for t$e changelog file. Hou ca& save t$e c$a&ges to it a&% close it.
Packaging File: compat
#$e compat file i&%icates w$at versio& of %eb$el'er is re3uire% i& or%er to buil% a 'ackage. Accor%i&g
to t$e tutorial t$at t$is o&e is base% o&, t$e compat file s$oul% co&tai& Eust t$e %igit ;A< i& it so, from
t$e termi&al, ru& t$e followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0/debian
echo 8 >compa
#$is will create t$e compat file. !otice t$at t$ere6s a s'ace followi&g t$e %igit, ;A<. Wit$out it, our
compat file woul% still be create%, but it woul% $ave &o co&te&ts.
Packaging File: control
#$e co&trol file 'rovi%es some %etails co&cer&i&g t$e source a&% bi&ary 'ackages. As suc$, it is s'lit
i&to two mai& sectio&s" t$e first o&e i&volvi&g t$e source 'ackage a&% t$e latter o&e, t$e bi&ary
'ackage.
>
1ollowi&g is t$e co&trol file t$at we will use"
Source: pipewrench
Secion: deve1
Rrioriy: opiona1
Mainainer: Barry B1oc' <bwb@firef1ysofware.com>
Bui1d-epends: debhe1per (>= 7.0.50~),
c1i-common-dev (>= 0.7),
1ibmono-ci1-dev,
mono-deve1 (>= 2.6.7),
mono-xbui1d,
1ibg'2.0-ci1-dev (>= 2.12.10),
1ibg1ade2.0-ci1-dev (>= 2.12.10)
Sandards-Version: 3.9.5
Rac'age: pipewrench
Archiecure: any
epends: ${c1i:epends}, ${misc:epends}
escripion: Easi1y ransform ex ino oher forms using sac'ab1e fi1ers
RipeWrench is a high-1eve1 ex scriping oo1 ha a11ows you o easi1y
ransform ex, (i.e. 1iss, command oupu, HTML, config fi1es, 1og fi1es,
source code, CSV daa, ec.) from one form o anoher wih re1aive ease.
In a RipeWrench scrip, here's no need o creae condiiona1 or 1ooping
consrucs or even o dec1are variab1es. You simp1y "sac'" fi1ers o ge
he resu1s you wan. And when you're done bui1ding your "pipe scrip"
using RipeWrench's edior, you can expor i for use a he command 1ine
(or in she11 scrips).
#$e Source fiel% (re3uire% s'ecifies t$e &ame of t$e source 'ackage.
#$e Section fiel% s'ecifies t$e sectio& of t$e %istributio& t$at t$e 'ackage goes i&to. :ere, ;%evel<
tra&slates to ;'rogrammer tools<.
#$e Priority fiel% is ;t$e 'riority of t$e 'ackage (o&e of 6re3uire%6, 6im'orta&t6, 6sta&%ar%6, 6o'tio&al6 or
6e5tra6. )& ge&eral a 'ackage is 6o'tio&al6 u&less it6s 6esse&tial6 for a sta&%ar% fu&ctio&i&g system, i.e.,
booti&g or &etworki&g fu&ctio&ality. A 'ackage s$oul% be 6e5tra6 rat$er t$a& 6o'tio&al6 if it co&flicts wit$
a&ot$er 6o'tio&al6 'ackage, or if it6s &ot i&te&%e% to be use% o& a sta&%ar% %eskto' i&stallatio&. !otable
e5am'le of 6e5tra6 'ackages are %ebuggi&g 'ackages.<
?
#$e aintainer fiel% (re3uire% s'ecifies w$o is res'o&sible for mai&tai&i&g t$e 'ackage.
#$e *uild-Depends fiel% s'ecifies t$e 'ackages t$at must be i&stalle% i& or%er to buil% t$is 'ackage.
!ote $ere t$at t$e li&es are i&%e&te% usi&g spaces.
#$e Standards-+ersion fiel% s'ecifies t$e most rece&t versio& of t$e *ebia& 'olicy ma&ual for w$ic$
t$e 'ackage com'lies.
#$e Package fiel% (re3uire% s'ecifies t$e &ame of t$e bi&ary 'ackage.
? )&tro%uctio& to *ebia& +ackagi&g0 $tt's"((wiki.%ebia&.org()&tro*ebia&+ackagi&g,)&tro%uctio&-to-*ebia&-+ackagi&g
?
#$e ,rchitecture fiel% (re3uire% s'ecifies w$ic$ $ar%ware arc$itectures t$e bi&ary 'ackage is e5'ecte%
to work o&. 2'ecific arc$itectures like i3A> or am%>@ ca& be liste%0 $owever, it is commo& to use two
s'ecial %esig&atio&s"
A value of ;a&y< mea&s t$at t$e software is co%e% i& a 'ortable fas$io& so t$at it will fu&ctio&
o& all arc$itectures but a se'arate bi&ary 'ackage must still be built for eac$ arc$itecture.
A value of ;all< mea&s t$at t$e software will ru& o& a&y arc$itecture but o&ly o&e 'ackage
&ee%s to be built t$at ca& be use% across all of t$em.
#$e Depends fiel% s'ecifies t$e 'ackages t$at must be i&stalle% i& or%er to ru& t$e software t$at t$is
'ackage i&stalls. Hou ca& ma&ually %etermi&e a&% list eac$ re3uire% 'ackage i&%ivi%ually but t$at ca&
be te%ious a&% error/'ro&e. 1or a& a''licatio& ru&&i&g o& .o&o, you ca& sim'ly s'ecify ;Q
Rcli"*e'e&%sS, QRmisc"*e'e&%sS< as t$e value of t$e Depends fiel% a&% most, if &ot all of t$e
a''licatio&6s %e'e&%e&cies will be automatically %etermi&e% for you.
#$e Description fiel% (re3uire% 'rovi%es bot$ s$ort a&% lo&g %escri'tio&s of t$e 'ackage, mea&t to be
of use to e&%/users of t$e 'ackage. #$is %escri'tio& is w$at6s %is'laye% w$e& you i&stall t$e bi&ary
'ackage usi&g g%ebi or similar FD). Be mi&%ful of t$e formatti&g of t$e control file6s %escri'tio& fiel%.
B& t$e same li&e as ;*escri'tio&"< is t$e s$ort %escri'tio&. All li&es followi&g it are 'art of t$e lo&g
%escri'tio& a&% eac$ of t$ose are i&%e&te% by a si&gle space. !ote also t$at se&te&ces are t$emselves
followe% by a si&gle s'ace a&% !B# by two s'aces.
1or a%%itio&al i&formatio& regar%i&g t$e control file6s fiel%s, 'lease see t$e *ebia& 'olicy ma&ual at
$tt'"((www.%ebia&.org(%oc(%ebia&/'olicy.
!ow, back to t$e buil%i&g of our 'ackage. Hou &ee% &ot e&ter all of t$e control file6s fiel%s by $a&%.
2im'ly co'y t$e above te5t i&to your ow& control file create% be&eat$ t$e debian %irectory.
!ote" Be sure to format t$e co'ie% te5t e"actly t$e same as you see above. #e5t co'ie% from +*1 files ty'ically e5clu%es
bla&k li&es a&% a&y lea%i&g w$ite s'ace.
A
Packaging File: copyright
#$e copyright file is a& im'orta&t 'art of a *ebia& 'ackage but as t$is tutorial is co&cer&e% o&ly wit$
t$e tec$&ical as'ects of buil%i&g a *ebia& 'ackage, we6ll sim'ly create a& em'ty copyright file. 1rom
t$e termi&al, ru& t$e followi&g comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0/debian
ouch copyrigh
#$is creates a& em'ty file &ame% ;co'yrig$t<.
A ) %o&6t k&ow if t$is is a& i&$ere&t 'roblem of t$e +*1 structure itself, or a& issue i&volvi&g t$e 'articular +*1 viewer
t$at6s use%0 all ) k&ow is t$at it6s a&&oyi&g.
A
Packaging File: install
#$e install file is use% to i&struct t$e buil% 'rocess w$ere to ;i&stall< eac$ file of t$e 'ackage6s 'ayloa%.
=ac$ li&e of t$e file co&tai&s i&formatio& for co'yi&g a file from somew$ere wit$i& t$e source subtree
to a %esti&atio& be&eat$ (usr.
1or +i'eWre&c$, t$e install file co&tai&s t$e followi&g li&es"
Exras/Linux/pipewrench usr/bin
Exras/Linux/pc1 usr/bin
Exras/Linux/pipewrench.des'op usr/share/app1icaions
Exras/pipewrench.png usr/share/icons
LinGUI/bin/Re1ease/RipeWrench.exe usr/1ib/pipewrench
RCL/bin/Re1ease/RCL.exe usr/1ib/pipewrench
Shared/bin/Re1ease/Shared.d11 usr/1ib/pipewrench
REAME usr/share/doc/pipewrench
Exras/userguide.pdf usr/share/pipewrench
Exras/emos usr/share/pipewrench
As you ca& see, t$e file is 'rocesse% relative to t$e mai& (to'/level source %irectory (w$ic$ i& our case
is t$e o&e co&tai&i&g t$e +i'eWre&c$.sl& file.
Agai&, t$ere6s &o &ee% to ty'e t$e above li&es i&to your install file. 2im'ly co'y t$e above te5t i&to it.
Packaging File: <package>.links
#$e -package..links fileJw$ic$ is use% by %eb$el'er6s dh$linkJis use% to create symlinks %uri&g
'ackage i&stallatio&. #$e o&e for +i'eWre&c$ s$oul% co&tai& t$e followi&g li&es"
usr/share/pipewrench/userguide.pdf usr/1ib/pipewrench/userguide.pdf
usr/share/pipewrench/emos usr/1ib/pipewrench/emos
=ac$ li&e re'rese&ts a symlink t$at &ee%s to be create%. #$e first 'at$ o& eac$ li&e is t$e file (or
%irectory bei&g li&ke% to a&% t$e seco&% 'at$ is t$at of t$e symlink t$at6s bei&g create%.
2im'ly create a pipewrench.links file be&eat$ t$e debian %irectory a&% co'y t$e above te5t i&to it.
Packaging File: <package>.manpages
#$e -package..manpages fileJw$ic$ is use% by %eb$el'er6s dh$installmanJis use% to i&stall a
'ackage6s ma&ual 'ages %uri&g 'ackage i&stallatio&. #$e o&e for +i'eWre&c$ s$oul% co&tai& t$e
followi&g li&es"
Exras/Linux/pipewrench.1
Exras/Linux/pc1.1
As you ca& see, eac$ li&e is Eust a 'at$ to a ;ma& 'age< file a&% like wit$ t$e install file, t$e 'at$s are
s'ecifie% relative to t$e mai& (to'/level source %irectory.
2im'ly create a pipewrench.manpages file be&eat$ t$e debian %irectory a&% co'y t$e above te5t i&to it.
9
Packaging File: rules
#$e rules file is a make file t$at %irects t$e buil%i&g of your 'ackage. 1ollowi&g is t$e rules file )6m
usi&g to 'ackage +i'eWre&c$"
#!/usr/bin/ma'e -f
%:
dh $@ --wih=c1i
override_dh_auo_bui1d:
xbui1d $(CURIR)/RipeWrench.s1n /p:Configuraion=Re1ease
override_dh_auo_c1ean:
xbui1d $(CURIR)/RipeWrench.s1n /p:Configuraion=Re1ease /:C1ean
As t$e rules file is a make file, eac$ li&e e&%i&g wit$ a colo& (" is calle% a ;target< a&% all of t$e
i&%e&te% li&es t$at follow it re'rese&t t$e ;reci'e< for creati&g t$at target a&% eac$ of t$em must be
i&%e&te% by Eust a si&gle tab c$aracter. Agai&, you ca& Eust co'y t$e above te5t i&to your ow& rules file.
Bf course, w$e& 'ackagi&g your ow& software, you6ll wa&t to e%it ;+i'eWre&c$.sl&< to w$atever is
a''ro'riate i& your case.
!ote" 4ike wit$ t$e control file, t$e rules file must be formatte% carefully. Agai&, w$e& t$e above te5t is co'ie% from t$is
+*1, any blank lines and leading whitespace might get e"cluded and need to be restored in the resulting te"t . #$e bla&k
li&es are&6t absolutely &ecessary i& a make file like t$is0 $owever, t$e i&%e&te% li&es followi&g eac$ target must be i&%e&te%
usi&g Eust a si&gle tab c$aracter.
Packaging File: source/format
#$e last file we &ee% to create be&eat$ t$e debian %irectory is t$e format file co&tai&e% wit$i& t$e
source sub%irectory. )t merely s'ecifies t$e versio& of t$e source 'ackage6s format. All you &ee% to %o
$ere is ru& t$e followi&g comma&%s from t$e termi&al"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0/debian
m'dir source
echo "3.0 (qui1)" >source/forma
"uilding t!e Package
:o'efully, at t$is Eu&cture we $ave a 'ro'erly/co&structe% debian sub%irectory to su''ort buil%i&g of
our 'ackage. A& im'orta&t &e5t ste' t$at we wa&t to take $ere is to create a back u' of our work %o&e
t$us far. #$is is ma%e im'orta&t by t$e fact t$at a&y buil% attem't ca& co&ceivably ;%irty< our worki&g
subtree, re3uiri&g us to 'erform a clea& u' before we ca& attem't a&ot$er buil% a&% we %o&6t &ee% t$e
e5tra $assle w$e& we6re worki&g out 'roblems t$at mig$t arise %uri&g t$e 'rocess of buil%i&g a
'ackage. 2o, let6s make a& arc$ive of all of our work %o&e by ru&&i&g t$e followi&g comma&%s from
t$e termi&al"
cd ~/es'op
ar -cvzf RipeWrench-Rac'aging.ar.gz RipeWrench-Rac'aging
10
2o &ow we $ave somet$i&g to revert back to if we e&cou&ter a&y troubles. )6ve %o&e my best to limit
$ow ofte& you will &ee% to revert your worki&g subtree back to t$e origi&al state0 $owever, i& a &ormal
situatio&, mistakes ma%e i& setti&g u' t$e debian %irectory (or eve& t$ose %irectories source %irectories
outsi%e of it ca& cause you to &ee% to start over. :ere6s t$e t$i&g" #hen you do encounter a mistake
made, don/t make the changes directly to your working subtree0make them to your back up of it. #$at
way, you6re &ot $avi&g to re/%o 'rior c$a&ges ma%e eac$ time you e&cou&ter a 'roblem t$at &ee%s to be
fi5e%.
)t6s &ow time to try our first buil%9 #$e buil% &ee%s to be i&itiate% from t$e mai& (to'/level source
%irectory w$ic$ agai& is t$e o&e co&tai&i&g Pipe#rench.sln i& it. 1rom t$e termi&al, ru& t$e followi&g
comma&%s"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0
debui1d -us -uc
D&less your system was alrea%y set u' to buil% a F#T s$ar' a''licatio&, c$a&ces are t$at you6ll see a
message $ere com'lai&i&g about missi&g buil% %e'e&%e&cies. #$e message s$oul% i&clu%e a li&e
similar to t$is o&e"
dp'g-chec'bui1ddeps: Unme bui1d dependencies: c1i-common-dev (>= 0.7)
1ibmono-ci1-dev mono-deve1 (>= 2.6.7) mono-xbui1d 1ibg'2.0-ci1-dev (>=
2.12.10) 1ibg1ade2.0-ci1-dev (>= 2.12.10)
Kecall, i& t$e control file, we s'ecifie% a &umber of 'ackages t$at $ave to be i&stalle% o& our system i&
or%er for us to buil% our 'ackage. #$ese are t$e 'ackages liste% i& t$e build-depends fiel%. We Eust
sim'ly &ee% to i&stall t$em. 1rom t$e termi&al, you6ll &ee% to ru& a comma&% of t$is ge&eral form"
sudo ap-ge insa11 <1is of missing pac'ages de1imied by spaces>
Bf course, ;Mlist of missi&g 'ackages %elimite% by s'acesN< &ee%s to be re'lace% by t$e actual list of
'ackages t$at were re'orte% as &ot bei&g i&stalle% o& your system. )& 'ractice, you o&ly &ee% to co'y
t$e list of re'orte% missi&g %e'e&%e&cies a&% e%it out everyt$i&g i& 'are&t$eses.
2o, for e5am'le, if t$e above error message a''lies i& your case (a&% it may, if you6re ru&&i&g from t$e
4i&u5 .i&t(.A#= live 7*, you6% wa&t to ru& t$e followi&g two comma&%s (i&%ivi%ually from t$e
termi&al"
sudo ap-ge insa11 c1i-common-dev 1ibmono-ci1-dev mono-deve1
A&% &ow, t$e seco&% o&e"
sudo ap-ge insa11 mono-xbui1d 1ibg'2.0-ci1-dev 1ibg1ade2.0-ci1-dev
!ote" Bf course, t$ese two comma&%s coul%6ve bee& combi&e% i&to a si&gle o&e $ere but t$e resulti&g comma&% woul% $ave
;wra''e%< o&to a seco&% li&e a&% you woul%&6t $ave bee& able to co'y it i&to t$e termi&al wit$out 'roblems (t$e wra''e%
'art of t$e comma&% woul% be i&ter'rete% by t$e s$ell as a& e&tirely %isti&ct comma&%, w$ic$ woul%&6t be too cool. A&%, as
luck woul% $ave it, you ca&6t eve& co'y t$e two comma&%s toget$er i&to t$e termi&al to ru& t$emJw$ic$ is w$y ) se'arate%
t$em $ereJbecause attem'ti&g t$at results i& &eit$er comma&% ru&&i&g at all.
!ow, after $avi&g e&cou&tere% t$is 'articular 'roblem, (t$at bei&g missi&g %e'e&%e&cies it6s 'robably
11
&ot &ecessary to revert back to t$e origi&al worki&g subtree0 but, for 'ractice sake, w$y &ot %o it
a&yway8 Fo a$ea% a&% re&ame t$e Pipe#rench-Packaging %irectory so t$at it6s out of our way by
ru&&i&g t$e followi&g comma&%s from t$e termi&al"
cd ~/es'op
mv RipeWrench-Rac'aging RipeWrench-Rac'aging-o1d
!ow e5tract t$e arc$ive, +i'eWre&c$-Packaging.tar.g' t$at s$oul% still be resi%i&g i& t$e *eskto'
%irectory w$ere we create% it. 1rom t$e termi&al, ru& t$is comma&%"
ar -xvzf RipeWrench-Rac'aging.ar.gz
!ow t$e worki&g subtree is back to a 'risti&e starti&g 'oi&t a&% we ca& attem't a&ot$er buil%"
cd ~/es'op/RipeWrench-Rac'aging/pipewrench-1.0
debui1d -us -uc
cd ..
#$is time $o'efully, all you will see ge&erate% are war&i&g messages a&% &ot errors. )f, at t$e e&% of t$e
out'ut ge&erate%, lintian %i%&6t ge&erate a&y actual errors (all of its messages are 'rece%e% by ;W"< a&%
&ot ;="<, t$e& t$ere oug$t to be a fres$ly/built %ebia& 'ackage waiti&g for you i& t$e curre&t %irectory.
Hou ca& 3uickly c$eck t$is from t$e termi&al by ru&&i&g t$e followi&g comma&%"
1s -1 *.deb

)f you see a file liste% &ame% pipewrench$%.&-%$""".deb, 1where 2""" is representati!e of the
architecture of the 3inu" li!e 4D that you/re running from0either 2i567 or 2amd789, t$e&
co&gratulatio&s, you/!e built a Debian package of a 4:;ono application starting from source<
Installing and Running t!e Package
Bk, 'er$a's it6s a little early to celebrate... 4et6s see if t$e 'ackage will i&stall a&% ru&. #o i&stall it, ru&
t$e followi&g comma&% from t$e termi&al (after first c$a&gi&g ;555< to eit$er ;i3A>< or ;am%>@< as
'er your setu'"
sudo gdebi pipewrench_1.0-1_xxx.deb
)f t$e i&stall goes accor%i&g to 'la& t$e& you oug$t to fi&% +i'eWre&c$ i& t$e %eskto' e&viro&me&t6s
mai& me&u. )f you6re ru&&i&g 4i&u5 .i&t(.A#= e%itio&, you ca& Eust 'ress t$e ;Wi&%ows< key a&%
ty'e ;'i'e< a&% it s$oul% a''ear o& t$e rig$t si%e of t$e me&u. Gust %ow& arrow to it a&% 'ress =&ter to
ru& it.
4ikewise, t$e comma&% li&e com'o&e&t of +i'eWre&c$, (+74 s$oul% be accessible from t$e termi&al.
#o ru& it, e&ter t$e followi&g i&to t$e termi&al"
pc1
Hou s$oul% be 'rese&te% wit$ +746s $el' scree&.
12
Well, t$at about wra's it u' for 'ackagi&g a .o&o(7, a''licatio& o& a *ebia&/base% system. #$oug$
t$is tutorial focuses o& a somew$at &arrow e5am'le of 'ackagi&g a&% it certai&ly leaves out ma&y of
t$e fi&er 'oi&ts of *ebia& 'ackagi&g, $o'efully t$ere6s e&oug$ $ere t$at it will $el' 'ut you o& t$e rig$t
track to 'ackagi&g your ow& 7, a''licatio&s9
)f you fou&% t$is tutorial to be $el'ful, 'lease leave a comme&t o& 4i&u5 .i&t6s commu&ity 'ortal at
$tt'"((commu&ity.li&u5mi&t.com(tutorial(view(13?3.
U 201@, Barry Block
13

You might also like