<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2176/25/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/Packaging+pjproject">Packaging pjproject</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://wiki.asterisk.org/wiki/display/~mjordan">Matt Jordan</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <div>
<ul>
    <li><a href='#Packagingpjproject-Introduction'>1. Introduction</a></li>
    <li><a href='#Packagingpjproject-GettingStarted'>2. Getting Started</a></li>
<ul>
    <li><a href='#Packagingpjproject-WhatisGoingtoBeDone'>2.1. What is Going to Be Done</a></li>
<ul>
    <li><a href='#Packagingpjproject-pjprojectWorkRequired'>2.1.1. pjproject Work Required</a></li>
<ul>
    <li><a href='#Packagingpjproject-TheCurrentBuildSystem'>2.1.1.1. The Current Build System</a></li>
    <li><a href='#Packagingpjproject-LibraryTypes'>2.1.1.2. Library Types</a></li>
    <li><a href='#Packagingpjproject-TargetNames'>2.1.1.3. Target Names</a></li>
    <li><a href='#Packagingpjproject-ThirdPartyLibraries'>2.1.1.4. Third Party Libraries</a></li>
    <li><a href='#Packagingpjproject-BuildHygiene'>2.1.1.5. Build Hygiene</a></li>
</ul>
</ul>
    <li><a href='#Packagingpjproject-WhereisitGoingtoHappen'>2.2. Where is it Going to Happen</a></li>
</ul>
    <li><a href='#Packagingpjproject-NextSteps'>3. Next Steps</a></li>
</ul></div>


<h1><a name="Packagingpjproject-Introduction"></a>1. Introduction</h1>

<p><b>pjproject</b> is a collection of libraries and utilities for building and testing SIP applications. Asterisk currently "bundles" a copy of pjproject, however this is undesirable for a variety of reasons. However, the pjproject constituents are not available as packages for common Linux distributions or as suitable pre-compiled binaries for popular target platforms. The Asterisk community would benefit from the existence of these packages and so is motivated to, at the very least, contribute to the creation of a package-ready <b>pjproject</b> distribution and an initial set of packages for CentOS and a distribution that supports the installation of header files and libraries according to a given platform's standards and best practices. Given that <b>pjsip</b> (the SIP implementation library included in <b>pjproject</b>) is currently the <em>first choice</em> as a basis for the next generation SIP channel driver to be included in Asterisk 12, it is appropriate to address packaging <b>pjproject</b> now.</p>

<p><em>Note: Research for this page was done by Brent Eagles.</em></p>

<h1><a name="Packagingpjproject-GettingStarted"></a>2. Getting Started</h1>

<p>Recognizing the importance to Asterisk and the Asterisk community, Digium is endeavoring to take the lead by committing resources to the initial phases of packaging <b>pjproject</b>. Seeing as "why" has already answered, let us address some of the other typical questions.</p>

<h2><a name="Packagingpjproject-WhatisGoingtoBeDone"></a>2.1. What is Going to Be Done</h2>

<p>It is reasonable that initial packaging efforts focus on a select number of targets that will:</p>
<ul>
        <li>be representative of typical packaging efforts</li>
        <li>be relevant to existing activities of the developers doing the work, in this case Digium.</li>
</ul>


<p>With this in consideration, the current effort will focus on runtime and developer RPMs for CentOS and a source archive with a build system that supports creating shared libraries for the relevant <b>pjproject</b> libraries and installation targets for runtime and developer installs. The runtime RPM and install targets include the shared libraries that make up the runtime functionality of the relevant <b>pjproject</b> libraries. The developer RPM and install targets install the header files and any additional resources required to build Asterisk. Installing the developer package or portions of <b>pjproject</b> are not required for <em>running</em> Asterisk. In addition binary RPMs, a source RPM (SRPM) must also be created to support subsequent packaging efforts and updates to <b>pjproject</b> that may be necessary in the related time frame.</p>

<p>Please note that the goal of the initial packaging effort is to focus only on the portions of <b>pjproject</b> that are relevant to Asterisk. Currently those are:</p>
<ul>
        <li>PJSIP</li>
        <li>PJNATHelper</li>
        <li>PJLib</li>
        <li>PJSIPSIMPLE</li>
        <li>PJSIPUA</li>
        <li>PJLIBUtil</li>
        <li>PJMedia</li>
</ul>


<p>In addition to packaging <b>pjproject</b>, the Asterisk build system will be modified to build against an installed <b>pjproject</b> instead of a bundled copy as it is now. The <tt>install_prereq</tt> script will also be modified to download, build and install <b>pjproject</b> if necessary.</p>

<h3><a name="Packagingpjproject-pjprojectWorkRequired"></a>2.1.1. pjproject Work Required</h3>

<h4><a name="Packagingpjproject-TheCurrentBuildSystem"></a>2.1.1.1. The Current Build System</h4>

<p>The <b>pjproject</b> build system is a sort of autoconf/makefile hybrid. Compiler and linker flags, etc. are stored in files named according to their intended target system. The values required for generating the names for the files are calculated during the configure step. The makefiles then include an "options" file that is a hash of the option file type and one of the variables calculated when "configure" was run. The values may be overridden at build type by modifying one or more files specifically set aside for this purpose: e.g. user.mak, config_site.h.</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Overriding "defines" and build time variables has seem rather hit-or-miss at times. Usually the issue ends up being that another value (or values) must also be modified.</td></tr></table></div>
<p>The existing build system <b>may</b> be a suitable foundation for building for packages with certain modifications.</p>

<h4><a name="Packagingpjproject-LibraryTypes"></a>2.1.1.2. Library Types</h4>

<p>To satisfy LGPL and packaging requirements, the libraries need to be constructed as shared libraries and the executable images linked against them.</p>

<h4><a name="Packagingpjproject-TargetNames"></a>2.1.1.3. Target Names</h4>

<p><b>pjproject</b> target names are constructed from the library name and details about the target. Whatever the motive, this naming scheme is not consistent with the typical library or executable naming schemes used on the target distributions. The naming makes it rather difficult to build against as a third party library as the naming algorithm must be replicated in the client build system. Installation target names typically do not include system details and also have version numbers and with major version and unversioned symbolic links to the current shared library version.</p>

<h4><a name="Packagingpjproject-ThirdPartyLibraries"></a>2.1.1.4. Third Party Libraries</h4>

<p><b>pjproject</b> contains some third party contributions for codec's etc.. There may be licensing concerns if these contributions are required by Asterisk or the <b>pjproject</b> packages. This may mean "unbundling" third party libraries and creating packages for the ones that are required by Asterisk if they do not exist.</p>

<h4><a name="Packagingpjproject-BuildHygiene"></a>2.1.1.5. Build Hygiene</h4>

<p>The pjproject build tends to be rather full of warnings, etc. Package maintainers may prefer to see this cleaned up. It certainly would not hurt. If the current build system is to be used as a foundation, then build issues need to be resolved such as bugs in dependency generation or build system corruption when builds are interrupted.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Resolving these issues tends not to be difficult. However, considering the number of libraries, verification of the build system and installation is time consuming.</td></tr></table></div>
<h2><a name="Packagingpjproject-WhereisitGoingtoHappen"></a>2.2. Where is it Going to Happen</h2>

<p>A new git repository will host a copy of <b>pjproject</b> that is being packaged as well as the required build system modifications, RPM spec file and any required shell scripts. Once completed, the <b>pjproject</b> archive will be made available for download and the RPMs will be available from the Asterisk YUM repository.</p>

<h1><a name="Packagingpjproject-NextSteps"></a>3. Next Steps</h1>

<p>There a multiple possible directions that may be taken once the initial packaging effort is complete. Ideally the build system contributions would be adopted upstream to the <b>pjproject</b> authors and maintainers (Teluu). Packaging work for additional distributions should be significantly advanced by the efforts of the initial phases, allowing other interested contributors to take the lead in creating and maintaining other packages.</p>
    </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/Packaging+pjproject">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Packaging+pjproject?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>