<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2171/18/9/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Build+Environment">Creating a Build Environment</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~pabelanger">Paul Belanger</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Install required software <br>{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">$ sudo apt-get install build-essential devscripts ubuntu-dev-tools debhelper dh-make pbuilder svn-buildpackage debian-archive-keyring ccache <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">$ sudo apt-get install build-essential pbuilder debian-archive-keyring ccache <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <div>
<ul>
    <li><a href='#CreatingaBuildEnvironment-InstallUbuntu10.04%28Lucid%29'>Install Ubuntu 10.04 (Lucid)</a></li>
    <li><a href='#CreatingaBuildEnvironment-EnableBackports'>Enable Backports</a></li>
    <li><a href='#CreatingaBuildEnvironment-UpgradeLucidtothelatestrelease%3A'>Upgrade Lucid to the latest release:</a></li>
    <li><a href='#CreatingaBuildEnvironment-Installrequiredsoftware'>Install required software</a></li>
    <li><a href='#CreatingaBuildEnvironment-pbuilder'>pbuilder</a></li>
<ul>
    <li><a href='#CreatingaBuildEnvironment-Debian'>Debian</a></li>
    <li><a href='#CreatingaBuildEnvironment-Ubuntu'>Ubuntu</a></li>
</ul>
    <li><a href='#CreatingaBuildEnvironment-svnbuildpackage'>svn-buildpackage</a></li>
    <li><a href='#CreatingaBuildEnvironment-quilt'>quilt</a></li>
    <li><a href='#CreatingaBuildEnvironment-devscripts'>devscripts</a></li>
    <li><a href='#CreatingaBuildEnvironment-CreateaGPGKey'>Create a GPG Key</a></li>
    <li><a href='#CreatingaBuildEnvironment-Seealso'>See also</a></li>
</ul></div>

<h2><a name="CreatingaBuildEnvironment-InstallUbuntu10.04%28Lucid%29"></a>Install Ubuntu 10.04 (Lucid)</h2>
<p><a href="/wiki/display/~pabelanger/Installing+Ubuntu+10.04+%28Lucid%29" title="Installing Ubuntu 10.04 (Lucid)">Installing Ubuntu 10.04 &#40;Lucid&#41;</a></p>

<h2><a name="CreatingaBuildEnvironment-EnableBackports"></a>Enable Backports</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ sudo apt-get install python-software-properties
$ sudo add-apt-repository "deb http://ca.archive.ubuntu.com/ubuntu/ $(lsb_release --short --codename)-backports main universe"</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-UpgradeLucidtothelatestrelease%3A"></a>Upgrade Lucid to the latest release:</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get autoremove
$ sudo reboot</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-Installrequiredsoftware"></a>Install required software</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ sudo apt-get install build-essential pbuilder debian-archive-keyring ccache</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-pbuilder"></a>pbuilder</h2>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ sudo mkdir -p /var/cache/pbuilder/ccache</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ sudo vi /etc/pbuilder/pbuilderrc</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>/etc/pbuilder/pbuilderrc</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">export CCACHE_DIR="/var/cache/pbuilder/ccache"
export PATH=”/usr/lib/ccache:${PATH}”
EXTRAPACKAGES="ccache"
BINDMOUNTS="${CCACHE_DIR}"

# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="wheezy"
STABLE_CODENAME="squeeze"
OLDSTABLE_CODENAME="lenny"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
 
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $OLDSTABLE_CODENAME
    "unstable" "testing" "stable" "oldstable")
 
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("oneiric" "natty" "maverick" "lucid")
 
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="ftp.us.debian.org"
UBUNTU_MIRROR="mirrors.kernel.org"
 
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] &amp;&amp; [ -r "debian/changelog" ]; then
    DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}')
    # Use the unstable suite for certain suite values.
    if $(echo "experimental UNRELEASED" | grep -q $DIST); then
        DIST="$UNSTABLE_CODENAME"
    fi
fi
 
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
: ${DIST:="$(lsb_release --short --codename)"}
 
# Optionally change Debian release states in $DIST to their names.
case "$DIST" in
    unstable)
        DIST="$UNSTABLE_CODENAME"
        ;;
    testing)
        DIST="$TESTING_CODENAME"
        ;;
    stable)
        DIST="$STABLE_CODENAME"
        ;;
    oldstable)
        DIST="$OLDSTABLE_CODENAME"
        ;;
esac
 
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
: ${ARCH:="$(dpkg --print-architecture)"}
 
NAME="$DIST"
if [ -n "${ARCH}" ]; then
    NAME="$NAME-$ARCH"
    DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi

DEBBUILDOPTS="-b"
if [ "${ARCH}" == "i386" ]; then
    DEBBUILDOPTS="-B"
fi

BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
# Optionally, set BASEPATH (and not BASETGZ) if using cowbuilder
# BASEPATH="/var/cache/pbuilder/$NAME/base.cow/"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build/"
 
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
    # Debian configuration
    MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
    COMPONENTS="main contrib non-free"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
    # Ubuntu configuration
    MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
    COMPONENTS="main restricted universe multiverse"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
    OTHERMIRROR="$OTHERMIRROR|deb ${MIRRORSITE} ${DISTRIBUTION}-updates ${COMPONENTS}|deb ${MIRRORSITE} ${DISTRIBUTION}-security ${COMPONENTS}"
else
    echo "Unknown distribution: $DIST"
    exit 1
fi</pre>
</div></div>

<h3><a name="CreatingaBuildEnvironment-Debian"></a>Debian</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ for x in unstable testing stable; do for y in i386 amd64; do sudo DIST=${x} ARCH=${y} pbuilder create; done; done</pre>
</div></div>

<h3><a name="CreatingaBuildEnvironment-Ubuntu"></a>Ubuntu</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ for x in lucid maverick natty; do for y in i386 amd64; do sudo DIST=${x} ARCH=${y} pbuilder create; done; done</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-svnbuildpackage"></a>svn-buildpackage</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ vi ~/.svn-buildpackage.conf</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">svn-builder=debuild
svn-noautodch</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-quilt"></a>quilt</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ vi ~/.quiltrc</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">QUILT_PATCHES="debian/patches"

QUILT_PATCH_OPTS="--unified-reject-files"
QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
QUILT_DIFF_OPTS="--show-c-function"
QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-devscripts"></a>devscripts</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ vi ~/.devscripts</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes
DEBCHANGE_MAINTTRAILER=no
DEBUILD_ROOTCMD=fakeroot
DEBUILD_LINTIAN=yes
DEBUILD_LINDA=yes
DEFAULT_DEBRELEASE_DEBS_DIR=../build-area/
USCAN_DESTDIR=../tarballs</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-CreateaGPGKey"></a>Create a GPG Key</h2>
<p><a href="https://help.ubuntu.com/community/GnuPrivacyGuardHowto" class="external-link" rel="nofollow">https://help.ubuntu.com/community/GnuPrivacyGuardHowto</a></p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">$ vi ~/.bashrc</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">export DEBFULLNAME='Paul Belanger'
export DEBEMAIL='pabelanger@digium.com'
export GPGKEY=8C3B0FA6
export EDITOR=vi</pre>
</div></div>

<h2><a name="CreatingaBuildEnvironment-Seealso"></a>See also</h2>
<ul>
        <li><a href="https://wiki.ubuntu.com/PackagingGuide/Complete" class="external-link" rel="nofollow">Ubuntu Packaging Guide</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Build+Environment">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=10650187&revisedVersion=28&originalVersion=27">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/AST/Creating+a+Build+Environment?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>