node-alljoyn
Version:
Access Alljoyn service functions
138 lines (97 loc) • 5.34 kB
HTML
<title>Building the AllJoyn source</title>
<h1>Overview</h1>
<p>The source code for AllJoyn is stored in a set of git projects that can be
cloned individually or as a group using the <code>repo</code> tool.</p>
<p>AllJoyn is currently supported on the following target platforms:</p>
<ul>
<li>Ubuntu 9.10 through 10.10 (x86 and x86-64)</li>
<li>Android 2.2 (Froyo+/NexusOne) (ARM)</li>
</ul>
<h1>Prerequisites</h1>
<h2>General Prerequisites</h2>
<ul>
<li><a href="http://git.wiki.kernel.org/index.php/Installation">git</a> - Used for source code repository access</li>
<li><a href="http://source.android.com/source/git-repo.html">repo</a> - A tool used to manage projects that consist of multiple git
projects</li>
<li><a href="http://www.scons.org/">Scons</a> - A software construction tool (Make replacement) used to
build AllJoyn</li>
</ul>
<h2>Linux Prerequites</h2>
<ul>
<li><code>apt-get install libssl-dev</code></li>
</ul>
<h2>Android Prerequisites for Google baseline phones (G1, Nexus One, etc)</h2>
<ul>
<li><a href="http://android.git.kernel.org/">Android Source</a> - Required for building Android targets</li>
<li><a href="http://developer.android.com/sdk/index.html">Android SDK</a> - Required for installing Android targets</li>
<li><a href="http://developer.android.com/sdk/ndk/index.html">Android NDK</a> - Required for Android targets</li>
<li><a href="http://www.eclipse.org/">Eclipse</a> - Used to build Java based AllJoyn demos for Android.</li>
</ul>
<h2>Java Prerequisites</h2>
<ul>
<li>Java 6 sun-java5-jdk <a href="http://packages.ubuntu.com/dapper/sun-java5-jdk">Ubuntu package</a> (Note: Android, as of froyo,
doesn't work well with Java 6)</li>
<li>JUnit 3.8</li>
</ul>
<h2>Documentation Prerequisites</h2>
<ul>
<li><a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a> - Builds documentation from source code</li>
<li><a href="http://www.graphviz.org/">Graphviz Dot</a> - Diagrams class hierarchies</li>
<li><a href="http://www.tug.org/texlive">TeX Live</a> - LaTeX binaries and style sheets for Linux. (Needed if
producing PDF output file in Linux.)</li>
</ul>
<h1>Building the source code</h1>
<p>Use <code>scons</code> <code>-h</code> for some basic settings. In the examples below, any of the
scons variables' default values can be set as environment variables.</p>
<h2>Building for Ubuntu 10.10 (x86 target)</h2>
<pre><code> $ cd <workspace>
$ scons OS=linux CPU=x86
</code></pre>
<h2>Building for Ubuntu 10.10 (x86-64 target)</h2>
<pre><code> $ cd <workspace>
$ scons OS=linux CPU=x86-64
</code></pre>
<h2>Building for Android Froyo (2.2)</h2>
<p>To build for Android it is necessary to indicate where the NDK and the Android
source is installed. The paths to these are idendicated using the
<code>ANDRIOD_NDK</code>, and <code>ANDROID_SRC</code> variables. An example is shown below.</p>
<pre><code> $ cd <workspace>
$ scons OS=android CPU=arm ANDROID_NDK=/usr/local/android-ndk ANDROID_SRC=/home/allseen/android-platform
</code></pre>
<h2>Build variants</h2>
<p>Building in "release mode" removes all symbol information and enables code
optimization. To build in release mode, add the following build variable to
your scons command line:</p>
<pre><code> VARIANT=release
</code></pre>
<p>If the variable is not defined the default configuration is to build the
debug vairant.</p>
<h2>Java Support</h2>
<p>The AllJoyn Java code is built automatically; however, in order to build it,
scons needs to know where the Java tools are located. Set two environment
variables to tell scons where to find the tools:</p>
<pre><code> $ export JAVA_HOME=<path_of_sun-java-5>
$ export CLASSPATH=<path_to_junit/junit4.jar>
</code></pre>
<p>Here are the paths used on a typical Ubuntu installation:</p>
<pre><code> $ export JAVA_HOME="/usr/lib/jvm/java-5-sun"
$ export CLASSPATH="/usr/share/java/junit4.jar"
</code></pre>
<p>In some circumstances scons may not be able to find the Java tools even when
<code>JAVA_HOME</code> is explicitly specified. This issue is described in this <a href="http://kdl-general.blogspot.com/2006/09/attributeerror-sconsenvironment.html">blog
post</a>. In short, the blog says that scons will only search for
sun-java-5 somewhere in <code>/usr/local/bin:/opt/bin:/bin:/usr/bin</code>. As a work
around for this issue you can add a symlink to one of the searched folders,
for example:</p>
<pre><code> /usr/bin/java -> /opt/java/something/bin/java
</code></pre>
<p><strong>NOTE</strong>: currently the scons scripts reqiure these variables to be
defined to bild any of the AllJoyn code.</p>
<h2>Build Products</h2>
<p>A description of the output parameters can be found in the file
<code>build/<OS>/<CPU>/<variant>/dist/README.TXT</code>. For example, for <code>OS=linux</code>,
<code>CPU=x86</code>, <code>VARIANT=release</code> would result in the file being in the
<code>build/linux/x86/release/dist/</code> directory.</p>
<h2>More info on Scons</h2>
<p>The <a href="http://www.scons.org/doc/HTML/scons-user.html%20Scons">Scons User Guide</a> is a good place to learn about the scons build
system.</p>