<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sardonyx+Linden</id>
	<title>Second Life Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sardonyx+Linden"/>
	<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/wiki/Special:Contributions/Sardonyx_Linden"/>
	<updated>2026-07-25T04:07:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(MSVS2005)&amp;diff=69842</id>
		<title>Compiling the viewer (MSVS2005)</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(MSVS2005)&amp;diff=69842"/>
		<updated>2008-06-02T23:20:59Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
{{CompileNav}}&lt;br /&gt;
&lt;br /&gt;
This page explains how you can compile the viewer on Microsoft Windows using Visual Studio 2005 or Visual C++ Express 2005.  Note that Lindens are using VS2003 and the whole setup is a bit easier there, so if you have Visual Studio 2003 available, you should read the list of [[Microsoft Visual Studio|supported Visual studio editions]] and you will get less trouble with it than with VS2005. &lt;br /&gt;
&lt;br /&gt;
Currently, only 32 bit binary is tested.  There seems to be several trials to produce 64 bit Windows .EXE of the viewer.  If you did, please write your experience on this wiki (regardless it was successful or not!)&lt;br /&gt;
&lt;br /&gt;
The following explanation is adjusted for Viewer releases 1.16.0.5 or later.  See an [http://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_%28MSVS2005%29&amp;amp;oldid=22294 older version of this page] for the Viewer releases 1.15 or before.&lt;br /&gt;
&lt;br /&gt;
= Preparing the Development Environment =&lt;br /&gt;
&lt;br /&gt;
== Installing/Configuring VS2005 ==&lt;br /&gt;
&lt;br /&gt;
You need to setup the compiler and Microsoft Development tools as follows:&lt;br /&gt;
* Setup [[Microsoft Visual Studio]]&lt;br /&gt;
&lt;br /&gt;
== Getting other Development Tools ==&lt;br /&gt;
You will also need some open source development tools.&lt;br /&gt;
* [http://www.cmake.org/ CMake 2.4.8]&lt;br /&gt;
* [http://www.cygwin.com/ Cygwin]&lt;br /&gt;
** When you run the cygwin setup utility make sure you have selected to install &#039;&#039;&#039;patchutils&#039;&#039;&#039;, &#039;&#039;&#039;flex&#039;&#039;&#039;, and &#039;&#039;&#039;bison&#039;&#039;&#039; (all located under &amp;quot;devel&amp;quot;) which are not part of the default install. (If you missed one of these, the easiest thing to do is to re-run the entire installation.) Older releases (&amp;lt; r79209) had several hardcoded references that expect Cygwin to be installed at &#039;&#039;&#039;C:\cygwin&#039;&#039;&#039; in the project files, however current releases rely on the build environment configuration instead.&lt;br /&gt;
* [http://www.activestate.com/Products/ActivePython/?mp=1 ActivePython 2.3x or later] - Latest Version seems to be 2.5.2.2.  Compatibility with SL is unsure.&lt;br /&gt;
** It is required but can be avoided if you are compiling 1.18 or later viewers.  Either download and install or hack the prebuild.bat files as described in [http://jira.secondlife.com/browse/VWR-1267 VWR-1267].&lt;br /&gt;
* ActivePerl was recommended for previous versions on this Wiki, but it currently appears, that it is not strictly necessary unless you are planning to build your own version of all libraries (which most likely you don&#039;t want to do).  So for a start it may be safe to skip it.&lt;br /&gt;
*: [http://www.activestate.com/Products/ActivePerl/?mp=1 ActivePerl]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Downloading Source Code =&lt;br /&gt;
&lt;br /&gt;
You can download the Viewer source codes on the [[source downloads]] page.  You can also use a [[version control repository]].&lt;br /&gt;
&lt;br /&gt;
At a minimum, grab the source package and the artwork package, but for a start, also grab the library archive.  Many of the libraries can either be compiled from source or downloaded from other sites (see below), but this will take hours and thus it is easiest to also get the package with libraries compiled by the Lindens.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039;&lt;br /&gt;
* If the directory path you keep the SL source in has a space in it, the batch file that copies message_template.msg will fail. So, if you unzip or checkout the source tree into, e.g., &amp;quot;C:\Projects\Dir with space in name\Etc\linden&amp;quot;, it won&#039;t work!&lt;br /&gt;
* You should also avoid using non-ASCII (national) characters in the paths, although some localized versions of the tool puts some as a default...&lt;br /&gt;
* Unzip or checkout your source tree into a directory that has as short full pathname as possible, since long paths cause some unexpected trouble during the build.&lt;br /&gt;
&lt;br /&gt;
In other words, the easiest way to get this working is to get &#039;&#039;source&#039;&#039;, &#039;&#039;artwork&#039;&#039; and &#039;&#039;libraries&#039;&#039; from the [[source downloads]] page and unpack them all into the same directory/folder, which ideally would be a folder in (or near) the root directory with a short name like &#039;&#039;sl_1_16_0_5&#039;&#039;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Installing Libraries =&lt;br /&gt;
&lt;br /&gt;
SL Viewer depends on some third party libraries.  Some of them are open source, some others are not.&lt;br /&gt;
&lt;br /&gt;
== Open Source Libraries ==&lt;br /&gt;
&lt;br /&gt;
You can download the pre-build open source libraries from LL.  They are available on [[source downloads]] page.  Unzip them into your SL viewer source code directory, maintaining the same directory structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The VS2003 libraries provided in the [[source downloads]] do not fully work with VS2005 compiled binaries. They will compile with the viewer under VS2005, but the VS2003 libraries are not fully STL compliant. The differences of [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrfnonstandardbehavior.asp non-standard behavior in MSVS] are the known cause.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Alternatively, it may be possible to get the source files for the libraries and build by yourself.  See [[Compiling the viewer libraries (MSVS 2003)|the instruction for VS2003 users]] if you try it.  Please note, however, it is not known that VS2005 can successfully compile the libraries.  &#039;&#039;&#039;You have been warned.&#039;&#039;&#039;  (If you can make it, please write the info on this wiki...)&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proprietary Libraries ==&lt;br /&gt;
&lt;br /&gt;
Lindens does not inlcude the following proprietary libraries.  You will need to follow the instructions to acquire below and copy them to the source path.&lt;br /&gt;
&lt;br /&gt;
However, it probably is a good idea to build an empty directory tree for the files below and first copy the files there and once completed, copy the whole tree to the actual source folder (like &#039;&#039;XCOPY OLIB SL_1_16_0_5 /S&#039;&#039;).  The reason is, that these steps are cumbersome and will have to be repeated for each new release (at least if you keep the source for each release in it&#039;s own folder).  If you do not want to do this, of course you can just copy the files directly into the linden source paths.&lt;br /&gt;
&lt;br /&gt;
 rem OLIBS.CMD to build a folder tree for 3rd party libraries and includes&lt;br /&gt;
 md olibs&lt;br /&gt;
 md olibs\linden\&lt;br /&gt;
 md olibs\linden\libraries&lt;br /&gt;
 md olibs\linden\libraries\include&lt;br /&gt;
 md olibs\linden\libraries\i686-win32&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\lib_release&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\lib_debug&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include\GL&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include\quicktime&lt;br /&gt;
 md olibs\linden\indra&lt;br /&gt;
 md olibs\linden\indra\newview&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== Fmod ===&lt;br /&gt;
* Download &amp;amp; extract [http://www.fmod.org/index.php/download fmod 3.75 api for win32] (later versions, like FMOD Ex, are incompatible).&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\inc\fmod.h&amp;quot; to &amp;quot;linden\libraries\include&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\inc\fmod_errors.h&amp;quot; to &amp;quot;linden\libraries\include&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\lib\fmodvc.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_release&amp;quot; and to &amp;quot;linden\libraries\i686-win32\lib_debug&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\fmod.dll&amp;quot; to &amp;quot;linden\indra\newview&amp;quot;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenGL ===&lt;br /&gt;
* Download [http://oss.sgi.com/projects/ogl-sample/sdk.html glext.h, glxext.h, and wglext.h]&lt;br /&gt;
* Copy them to &amp;quot;linden\libraries\i686-win32\include\GL&amp;quot;&lt;br /&gt;
* You don&#039;t need any additional *.lib or *.dll for OpenGL.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ares (viewer 1.18.4 ... for later releases first check if the ares.h and .lib files are in the Linden library package) - works for vs2k8 ===&lt;br /&gt;
* download c-ares 1.4 from [http://daniel.haxx.se/projects/c-ares/ here] and unpack it somewhere&lt;br /&gt;
* open vc.dsw from the c-ares/vc folder&lt;br /&gt;
* remove the adig and ahost projects from the vc workspace&lt;br /&gt;
* add ares_getnameinfo.c to the areslib project&lt;br /&gt;
* for areslib right-click, properties, Code Generation and set Runtime Library to /MT (release) and /MTd (debug)&lt;br /&gt;
* compile debug and release&lt;br /&gt;
* copy all c-ares\*.h files to linden\libraries\include\ares\*.h&lt;br /&gt;
* copy vc\areslib\Debug\*lib to linden\libraries\i686-win32\lib_debug&lt;br /&gt;
* copy vc\areslib\Release\*lib to linden\libraries\i686-win32\lib_release&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== openjpeg (viewer 1.18.4 ... for later releases first check if the openjpeg.lib files are in the Linden library package) ===&lt;br /&gt;
* download the latest OpenJPEG from [http://www.openjpeg.org/ here]&lt;br /&gt;
* open the libopenjpeg.dsw, let it convert and compile it (you&#039;ll need the files from the dllopenjpeg sub-project) &lt;br /&gt;
* copy debug\openjpeg.lib to linden\libraries\i686-win32\lib_debug&lt;br /&gt;
* copy release\openjpeg.lib to linden\libraries\i686-win32\lib_release&lt;br /&gt;
* copy release\openjpeg.dll to linden\indra\newview&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Quicktime &#039;&#039;(optional)&#039;&#039; ===&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; This download requires a registration at the Apple Quicktime website and take a bit of time.  You can avoid using QuickTime if you want, see [[#QuickTime removal|below]] for details.  Remember that your viewer &#039;&#039;&#039;can&#039;t play in-world movies&#039;&#039;&#039; if you do so.&lt;br /&gt;
* Download &amp;amp; install the [http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/203/wa/getSoftware?fileID=20525&amp;amp;code=y&amp;amp;source=x&amp;amp;wosid=4h16WcyMtVfd2P1EffGafkoxFcr Quicktime SDK for Windows]&lt;br /&gt;
* Copy &amp;quot;QuicktimeSDK\Libraries\QTMLClient.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_release&amp;quot; and to  &amp;quot;linden\libraries\i686-win32\lib_debug&amp;quot;.&lt;br /&gt;
* Copy the contents of &amp;quot;QuicktimeSDK\CIncludes&amp;quot; into &amp;quot;linden\libraries\i686-win32\include\quicktime&amp;quot;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Configuring for VS2005 =&lt;br /&gt;
&lt;br /&gt;
Lindens mostly use VS2003 to develop the viewer, but 2005 should work even better.&lt;br /&gt;
&lt;br /&gt;
To configure, go into &amp;lt;code&amp;gt;linden\indra&amp;lt;/code&amp;gt; and run &amp;lt;code&amp;gt;develop.py -G VC80&amp;lt;/code&amp;gt;.  This will create a build directory named &amp;lt;code&amp;gt;build-VC80&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Workarounds ==&lt;br /&gt;
&lt;br /&gt;
There are more compatibility problems between VS2003 and VS2005.  You might need the following code edits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note: probably most or all of this section is out of date.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== test project/crash_logger/updater ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;This is probably out of date.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For whatever reason, the &#039;&#039;&#039;test&#039;&#039;&#039; project doesn&#039;t work under VS2005.  Workaround is to disable it as follows: Right click on the &#039;&#039;&#039;test&#039;&#039;&#039; and choose &#039;&#039;&#039;Unload Project&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you do not plan to create a full download build, you can exclude the &#039;&#039;&#039;win_crash_logger&#039;&#039;&#039; and &#039;&#039;&#039;win_updater&#039;&#039;&#039; from newview&#039;s project dependencies and unload them also.  But be careful with unloading these projects without removing them from the dependencies, because I have seen VS2005 act highly erratic while linking then project when I tried this.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== QuickTime removal ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;This is definitely out of date.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to get Apple QuickTime SDK, you can disable it as follows:&lt;br /&gt;
*linden\indra\llcommon\llpreprocessor.h - near line 58 (the line below &#039;&#039;&#039;#elif LL_WINDOWS&#039;&#039;&#039;)&lt;br /&gt;
 --50: #define LL_QUICKTIME_ENABLED	1&lt;br /&gt;
 ++50: #define LL_QUICKTIME_ENABLED	&#039;&#039;&#039;&#039;&#039;0&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   [[LearCale]]: this appears to be in linden\indra\llmedia\llmediabase.h as of client 1.20&lt;br /&gt;
&lt;br /&gt;
* Pick &#039;&#039;&#039;ReleaseNoOpt&#039;&#039;&#039; in the Solution Configurations drop-down box beside the green arrow under the tool bar, and do the followings on the Solution Explorer frame:&lt;br /&gt;
*Click &#039;&#039;&#039;newview&#039;&#039;&#039; to select it alone.&lt;br /&gt;
**Choose Properties.&lt;br /&gt;
**Under Configuration Properties &amp;gt; Linker &amp;gt; Input, click &#039;&#039;&#039;Additional Dependencies&#039;&#039;&#039; on the right to show a button labeled &amp;quot;&#039;&#039;&#039;...&#039;&#039;&#039;&amp;quot; on it at the very right on the line, then click the &#039;&#039;&#039;...&#039;&#039;&#039; button.&lt;br /&gt;
**Scroll down the list to find &#039;&#039;&#039;qtmlclient.lib&#039;&#039;&#039;.  Delete this single line.&lt;br /&gt;
**Click &#039;&#039;&#039;OK&#039;&#039;&#039; to close the &amp;quot;Additional Dependencies&amp;quot; dialog, then click OK again to close the &amp;quot;newview Property Pages&amp;quot; dialog box.&lt;br /&gt;
* Pick &#039;&#039;&#039;ReleaseForDownload&#039;&#039;&#039; in the Solution Configurations drop-down box. Click &#039;&#039;&#039;newview&#039;&#039;&#039; to select it alone and do the same thing again.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Ready, Set, Build! =&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
* Build either &#039;&#039;&#039;RelWithDebInfo&#039;&#039;&#039; (for debugging) or &#039;&#039;&#039;Release&#039;&#039;&#039; (for production code).&lt;br /&gt;
* To do this, pick either in the Solution Configurations drop-down box beside the green arrow under the tool bar.&lt;br /&gt;
* Select Build-Menu &amp;gt; Build Solution or press F7.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Common compile errors ==&lt;br /&gt;
* See [[common compilation problems]] if you run into other errors while building.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Running ==&lt;br /&gt;
* You can run the viewer by &#039;&#039;&#039;Debug &amp;gt; Start Debugging&#039;&#039;&#039; or &#039;&#039;&#039;Debug &amp;gt; Start Without Debugging&#039;&#039;&#039; in Visual Studio. &lt;br /&gt;
* To run it outside VS, create a shortcut to SecondLife.exe, and change the start location to linden\indra\newview\ (All the .dll will be found there.)&lt;br /&gt;
* Alternately copy the exe (possibly rename it) to your &amp;quot;c:\program files\secondlife&amp;quot; folder.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Debugging Info/Configurations ==&lt;br /&gt;
&amp;lt;b&amp;gt;This section is out of date.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Usually you will either use &#039;&#039;&#039;ReleaseNoOpt&#039;&#039;&#039; or the &#039;&#039;&#039;ReleaseForDownload&#039;&#039;&#039; configuration.&lt;br /&gt;
* &#039;&#039;&#039;ReleaseNoOpt&#039;&#039;&#039; (not optimized) compiles faster and has more debugging information, but this comes at a runtime penalty of about 50% of your FPS in busy areas, compared to ReleaseForDownload build.&lt;br /&gt;
* &#039;&#039;&#039;ReleaseForDownload&#039;&#039;&#039; also has debugging information and runs fine in the debugger (although at times you may miss access to some local variables).&lt;br /&gt;
* &#039;&#039;&#039;ReleaseNoOpt&#039;&#039;&#039; comes with a seperate debugging console window opens and stays open for the duration of your session, but you can access the same information also by pressing Shift+Ctrl+4 in the viewer (all builds).&lt;br /&gt;
* The debug console log can also be redirected to a file if you add &amp;quot;2&amp;gt;secondlife.log&amp;quot; to the command line (Newview, Properties, Debugging, Command line arguments).&lt;br /&gt;
* If you want to build a &#039;&#039;&#039;Debug&#039;&#039;&#039; configuration, see the specific section with compile instructions on [[finding leaks]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problems Running? ==&lt;br /&gt;
* &#039;&#039;&#039;Inventory errors&#039;&#039;&#039;: If you&#039;re getting errors while trying to load your inventory, try [[Help:Stuck logging in|clearing your cache and deleting other temporary files]].&lt;br /&gt;
* &#039;&#039;&#039;Missing smime3 DLL&#039;&#039;&#039;: Those are parts of the integrated web browser.  Copy &#039;smime3.dll&#039;, &#039;nss3.dll&#039;, &#039;softokn3.dll&#039;, and &#039;ssl3.dll&#039; files from your official client&#039;s main folder to &amp;quot;linden\indra\newview&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;Can&#039;t connect&#039;&#039;&#039;: In the debug builds there is a selection box on the login screen to select the server to connect to.  &#039;&#039;&#039;Agni&#039;&#039;&#039; is the production grid, &#039;&#039;&#039;aditi&#039;&#039;&#039; is the beta grid.  (There seems to be a bug in this part of the code, you may have to make your selection, close the viewer and repoen it, before you can connect to the selected grid).&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
= Submit Patches =&lt;br /&gt;
This is probably faaar down the road, but if you make changes to the source and want to submit them, see the page about [[submitting patches]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(MSVS2003)&amp;diff=69841</id>
		<title>Compiling the viewer (MSVS2003)</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(MSVS2003)&amp;diff=69841"/>
		<updated>2008-06-02T23:10:14Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{CompileNav}}&lt;br /&gt;
&lt;br /&gt;
The following instructions are for compiling the Second Life viewer on Windows for Visual Studio .Net 2003.  If you are using more recent versions of Visual Studio, see [[Compiling the viewer (MSVS2005)]]. For other platforms including MacOS and Linux, see [[Compiling the viewer]].&lt;br /&gt;
&lt;br /&gt;
If you get lost, or these instructions are incomplete, see [[communication tools]] for a list of ways to get in touch with people that can help.&lt;br /&gt;
&lt;br /&gt;
== Development Environment ==&lt;br /&gt;
The following dev environment is what LL uses for Windows development.  There is no reason that the Second Life viewer can not be built using other environments, but it will take some extra work.&lt;br /&gt;
&lt;br /&gt;
(Instructions for building the viewer using Microsoft&#039;s Visual Studio .NET 2005 Express can be found [[Compiling the viewer (MSVS2005)|on another page]]. At the time of writing, Express was freely available.)&lt;br /&gt;
&lt;br /&gt;
=== Visual Studio .NET 2003 Professional ===&lt;br /&gt;
* Setup [[Microsoft Visual Studio]].&lt;br /&gt;
&lt;br /&gt;
=== Other Development Tools === &lt;br /&gt;
You will also need some open source development tools.&lt;br /&gt;
==== Required ====&lt;br /&gt;
* [http://www.cmake.org/ CMake 2.4.8]&lt;br /&gt;
* [http://www.cygwin.com/ Cygwin]&lt;br /&gt;
** When you run the cygwin setup utility make sure you have selected to install &#039;&#039;&#039;patchutils&#039;&#039;&#039;, &#039;&#039;&#039;flex&#039;&#039;&#039;, and &#039;&#039;&#039;bison&#039;&#039;&#039; (all located under &amp;quot;devel&amp;quot;) which are not part of the default install. Older releases (&amp;lt; r79209) had several hardcoded references that expect Cygwin to be installed at &#039;&#039;&#039;C:\cygwin&#039;&#039;&#039; in the project files, however current releases rely on the build environment configuration instead.&lt;br /&gt;
* [http://www.activestate.com/Products/ActivePython/?mp=1 ActivePython 2.3x or later] - Latest Version is 2.5.1.1&lt;br /&gt;
** You should install this if compiling 1.18 or later viewers, or else hack the prebuild .bat files as in [http://jira.secondlife.com/browse/VWR-1267 VWR-1267].&lt;br /&gt;
==== Optional ====&lt;br /&gt;
* ActivePerl was recommended for previous versions on this Wiki, but it currently appears that it is not strictly necessary unless you are planning to build your own version of all libraries (which most likely you don&#039;t want to do).  So for a start it may be safe to skip it.&lt;br /&gt;
*: [http://www.activestate.com/Products/ActivePerl/?mp=1 ActivePerl]&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
The easiest way to get this working is to get &#039;&#039;&#039;source&#039;&#039;&#039;, &#039;&#039;&#039;artwork&#039;&#039;&#039; and &#039;&#039;&#039;libraries&#039;&#039;&#039; for the same version from the [[source downloads]] page and unpack them all into the same directory/folder, which ideally would be a folder in (or near) the root directory with a short name like &#039;&#039;sl_1_16_0_5&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Avoid folder names with spaces in them (this means avoid putting the project into your &#039;&#039;My Documents&#039;&#039; folder).&lt;br /&gt;
&lt;br /&gt;
== Open Source Libraries ==&lt;br /&gt;
&lt;br /&gt;
Some libraries can be distributed with the SL source and there is a library package available with the source.  As mentioned above (about the source), you can simply extract the &#039;&#039;&#039;library&#039;&#039;&#039; archive and copy the files to your code directory, maintaining the same directory structure.  &lt;br /&gt;
&lt;br /&gt;
If instead you are interested in compiling these libraries from their source (instead of using the above zip file of precompiled libraries provided by Linden Lab), see [[Compiling the viewer libraries (MSVS 2003)]]&lt;br /&gt;
&lt;br /&gt;
== Other Libraries ==&lt;br /&gt;
&lt;br /&gt;
Linden Lab included all the libraries/includes they can ship with their source, but we can not distribute the source to the following, and you will need to follow the instructions to acquire them, below.&lt;br /&gt;
&lt;br /&gt;
These steps are cumbersome and will have to be repeated for each new release (if you keep the source for each release in it&#039;s own folder).  It is a good idea to build an empty directory tree for the files below, then copy these library files there.  Once completed, copy the whole tree to the actual source folder (like &#039;&#039;XCOPY  olibs  sl_1_16_0_5 /S&#039;&#039;).  You will then only need to repeat the last step for each new release, reusing the tree you have already created.&lt;br /&gt;
&lt;br /&gt;
If you do not want to do this, of course you can just copy the files directly into the linden source paths.&lt;br /&gt;
&lt;br /&gt;
 rem OLIBS.CMD to build a folder tree for 3rd party libraries and includes&lt;br /&gt;
 md olibs&lt;br /&gt;
 md olibs\linden\&lt;br /&gt;
 md olibs\linden\libraries&lt;br /&gt;
 md olibs\linden\libraries\include&lt;br /&gt;
 md olibs\linden\libraries\i686-win32&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\lib_release&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\lib_debug&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include\GL&lt;br /&gt;
 md olibs\linden\libraries\i686-win32\include\quicktime&lt;br /&gt;
 md olibs\linden\indra&lt;br /&gt;
 md olibs\linden\indra\newview&lt;br /&gt;
&lt;br /&gt;
==== Fmod ====&lt;br /&gt;
* Download &amp;amp; extract [http://www.fmod.org/index.php/download fmod 3.75 api for win32] (&#039;&#039;not&#039;&#039; 4.12).&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\inc\fmod.h&amp;quot; to &amp;quot;linden\libraries\include&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\inc\fmod_errors.h&amp;quot; to &amp;quot;linden\libraries\include&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\lib\fmodvc.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_release&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\lib\fmodvc.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_debug&amp;quot;&lt;br /&gt;
* Copy &amp;quot;fmodapi375win\api\fmod.dll&amp;quot; to &amp;quot;linden\indra\newview&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== gl (pre-1.20) ====&lt;br /&gt;
* Download [http://oss.sgi.com/projects/ogl-sample/sdk.html glext.h, glxext.h, and wglext.h]&lt;br /&gt;
* Copy them to &amp;quot;linden\libraries\i686-win32\include\GL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note: From 1.20 forward, LL have found suitable redistributable equivalents and ship them in the source&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quicktime (Optional) ====&lt;br /&gt;
* &#039;&#039;&#039;Note:&#039;&#039;&#039; Quicktime download can be skipped &#039;&#039;&#039;if you can live with a build that does not play in-world movies&#039;&#039;&#039; (some minor modifications to the project are necessary then, see &amp;quot;QuickTime removal&amp;quot; on the build instructions for [[Compiling the viewer (MSVS2005)|Visual Studio 2005]]).&lt;br /&gt;
* Download &amp;amp; install the [http://developer.apple.com/quicktime/download/ Quicktime SDK for Windows]&lt;br /&gt;
* Copy &amp;quot;QuicktimeSDK\Libraries\QTMLClient.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_release&amp;quot;.&lt;br /&gt;
* Copy &amp;quot;QuicktimeSDK\Libraries\QTMLClient.lib&amp;quot; to &amp;quot;linden\libraries\i686-win32\lib_debug&amp;quot;.&lt;br /&gt;
* Copy the contents of &amp;quot;QuicktimeSDK\CIncludes&amp;quot; into &amp;quot;linden\libraries\i686-win32\include\quicktime&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
* Go into the &#039;&#039;&#039;indra&#039;&#039;&#039; folder, and run the &#039;&#039;&#039;develop.py&#039;&#039;&#039; script.&lt;br /&gt;
* Open the &#039;&#039;&#039;indra\build-vc71\SecondLife.sln&#039;&#039;&#039; solution in Visual Studio&lt;br /&gt;
* Build either &#039;&#039;&#039;ReleaseNoOpt&#039;&#039;&#039; (for debugging) or &#039;&#039;&#039;Release&#039;&#039;&#039; (for running or debugging production code).  See [[#Configurations/Debugging Info]] for details on these configurations.&lt;br /&gt;
** Note that the Release build also contains debug information, and can be run in the debugger.&lt;br /&gt;
* To run the executable outside VS, create a shortcut to SecondLife.exe, and change the start location to linden\indra\newview\ (all the .dll will be found there.)&lt;br /&gt;
** Alternately, copy the exe (possibly rename it) to your &amp;quot;c:\program files\second life&amp;quot; folder.&lt;br /&gt;
* There were additional steps required in version 1.15 which seem to be fixed now.  If you are trying to build 1.15 see an [https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_%28MSVS2003%29&amp;amp;oldid=23026 older version of this page].&lt;br /&gt;
&lt;br /&gt;
== Errors while building? ==&lt;br /&gt;
See [[Common compilation problems]] if you run into errors while building.&lt;br /&gt;
&lt;br /&gt;
== Configurations/Debugging Info ==&lt;br /&gt;
* You will usually compile/debug the &#039;&#039;&#039;RelWithDebInfo&#039;&#039;&#039; or Release configuration (&#039;&#039;&#039;Debug&#039;&#039;&#039; should also work but should not really be necessary).&lt;br /&gt;
* &#039;&#039;&#039;RelWithDebInfo&#039;&#039;&#039; compiles faster and has more debugging information, but this comes at a runtime penalty of about 50% of your FPS in busy areas, compared to ReleaseForDownload build.&lt;br /&gt;
* &#039;&#039;&#039;Release&#039;&#039;&#039; runs fine in the debugger, but times you may miss debugger access to some local variables or the debugger may even show wrong values for objects and members, because it is confused by the optimizations.&lt;br /&gt;
* &#039;&#039;&#039;RelWithDebInfo&#039;&#039;&#039; comes with a seperate debugging console window opens and stays open for the duration of your session.&lt;br /&gt;
* You can see the last few lines from the debugger console also by pressing Shift+Ctrl+4 in the viewer (all builds).&lt;br /&gt;
* The debug log (usually in application data) can also be redirected to a more file if you add &amp;quot;-log secondlife.log&amp;quot; to the command line (Newview, Properties, Debugging, Command line arguments).&lt;br /&gt;
* If you want to build a &#039;&#039;&#039;Debug&#039;&#039;&#039; configuration, see the specific section with compile instructions on [[Finding_leaks]]&lt;br /&gt;
&lt;br /&gt;
== Problems Running? ==&lt;br /&gt;
* Viewer Error: &#039;&#039;&#039;Second Life is unable to access a file that it needs.&#039;&#039;&#039;:  Did you neglect to download the Artworks archive from the [[source downloads]] page?  It is in the Viewer column, below the OS-specific Viewer archives.&lt;br /&gt;
* &#039;&#039;&#039;Can&#039;t connect&#039;&#039;&#039;: In the debug builds there is a selection box on the login screen to select the server to connect to.  &#039;&#039;&#039;Agni&#039;&#039;&#039; is the production grid, &#039;&#039;&#039;aditi&#039;&#039;&#039; is the beta grid.  (There seems to be a bug in this part of the code, you may have to make your selection, close the viewer and reopen it, before you can connect to the selected grid).&lt;br /&gt;
* &#039;&#039;&#039;Inventory errors&#039;&#039;&#039;: If you&#039;re getting errors while trying to load your inventory, try [[Help:Stuck logging in|clearing your cache and deleting other temporary files]].&lt;br /&gt;
* If you want to connect to the beta grid, add &#039;&#039;&#039;--aditi&#039;&#039;&#039; to the command line (Newview, Properties, Debugging, Command line argument).&lt;br /&gt;
* &#039;&#039;&#039;Missing smime3 DLL&#039;&#039;&#039;: Those are parts of the integrated web browser.  Copy &#039;smime3.dll&#039;, &#039;nss3.dll&#039;, &#039;softokn3.dll&#039;, and &#039;ssl3.dll&#039; files from your official client&#039;s main folder to &amp;quot;linden\indra\newview&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;assert with star_brightness&#039;&#039;&#039; and/or &#039;&#039;&#039;Black Screen&#039;&#039;&#039; under &#039;&#039;&#039;Windlight&#039;&#039;&#039;: Current distributions of the Windlight source are missing files from the app_settings/windlight folder.  Download the Linden Windlight viewer, install it and copy the files (and subfolders) into your development environment (linden/indra/newview/app_settings/windlight)&lt;br /&gt;
&lt;br /&gt;
== Submit Patches ==&lt;br /&gt;
This is probably far down the road, but if you make changes to the source and want to submit them, see the page about [[Submitting patches|submitting patches]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(Mac_OS_X)&amp;diff=69840</id>
		<title>Compiling the viewer (Mac OS X)</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_(Mac_OS_X)&amp;diff=69840"/>
		<updated>2008-06-02T23:07:30Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Multi-lang}}&lt;br /&gt;
{{CompileNav}}&lt;br /&gt;
&lt;br /&gt;
The following are instructions for building the Second Life viewer on Mac OS X.  For other platforms, see [[Compiling the viewer]]&lt;br /&gt;
&lt;br /&gt;
You will also need to check the &#039;&#039;&#039;Build Notes&#039;&#039;&#039; column of the table on [[source downloads]] page.&lt;br /&gt;
&lt;br /&gt;
= Development Environment =&lt;br /&gt;
&lt;br /&gt;
Most Lindens use XCode 3.0 on Leopard for building on Macintosh computers (though some still use XCode 2.4). For simplicity, we suggest installing everything from the mpkg.&lt;br /&gt;
&lt;br /&gt;
You will need to install the proprietary libraries as well as all of the other third party libraries below. &lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
= Installing Files =&lt;br /&gt;
&lt;br /&gt;
== CMake ==&lt;br /&gt;
&lt;br /&gt;
Install CMake 2.4.8 from [http://www.cmake.org].&lt;br /&gt;
&lt;br /&gt;
== Viewer Source, Libraries, and Artwork ==&lt;br /&gt;
&lt;br /&gt;
The required source code, pre-compiled third-party libraries, and artwork files are available from the [[source downloads]] page.  Download the Mac/Linux (LF) source, the Mac library package, and the Artwork zip file.  &lt;br /&gt;
&lt;br /&gt;
Unpack them into a single directory. The directory that you work in should should have no spaces in the name. For example, from the directory where you downloaded the tarballs (x.x.x.x = version number, e.g., 1.14.0.1.):&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz slviewer-src-x.x.x.x.tar.gz&lt;br /&gt;
 $ tar xvfz slviewer-darwin-libs-x.x.x.x.tar.gz&lt;br /&gt;
 $ unzip slviewer-artwork-x.x.x.x.zip&lt;br /&gt;
&lt;br /&gt;
If you have Stuffit installed on your system, it may automacially unstuff .gz, so use  tar xvf, without the z to extract the tar file. It may also automatically unzip files. Instead of clicking on the file link, right click on the file link and select Download Linked File which will keep .gz and .zip intact.&lt;br /&gt;
&lt;br /&gt;
The exact filenames will differ with the version number. If you open them with the double click file extract, remember that dragging folders on top of each other will overwrite the original contents, not merge them as in Windows.&lt;br /&gt;
&lt;br /&gt;
Check the [[source downloads]] page for any special Build Notes associated with the viewer version, if any.&lt;br /&gt;
&lt;br /&gt;
== Installing Libraries From Scratch (Optional) ==&lt;br /&gt;
&lt;br /&gt;
For convenience, Lindens package up the libraries they are allowed to distribute so you can download and unpack them into your development working directory. The [[#Viewer Source, Libraries, and Artwork|above procedure]] installs pre-compiled third-party library files.  Alternatively, if you want to build the libraries yourself, See [[Compiling the viewer libraries (Mac OS X)|another page]].&lt;br /&gt;
&lt;br /&gt;
== Installing Proprietary Libraries ==&lt;br /&gt;
&lt;br /&gt;
The Viewer depends on some proprietary libraries.  Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages.  (This is due to licensing restrictions.  Don&#039;t ask, Lindens already did, and can&#039;t get permission.  So you do have to get them yourself.)&lt;br /&gt;
&lt;br /&gt;
=== Fmod ===&lt;br /&gt;
#Download &amp;amp; extract [http://www.fmod.org/index.php/download fmod 3.75 programmers api for macintosh].&lt;br /&gt;
#*(You do *not* want the latest version, instead scroll down to v3.75)&lt;br /&gt;
#Copy the extracted files. &#039;&#039;Note the name change for the x86 library.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 $ cp -p fmodapi375mac/api/inc/*.h linden/libraries/include&lt;br /&gt;
 $ cp -p fmodapi375mac/api/lib/libfmod.a linden/libraries/powerpc-darwin/lib_debug&lt;br /&gt;
 $ cp -p fmodapi375mac/api/lib/libfmod.a linden/libraries/powerpc-darwin/lib_release&lt;br /&gt;
 $ cp -p fmodapi375mac/api/lib/libfmodx86.a linden/libraries/i386-darwin/lib_debug/libfmod.a&lt;br /&gt;
 $ cp -p fmodapi375mac/api/lib/libfmodx86.a linden/libraries/i386-darwin/lib_release/libfmod.a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
= Building the Viewer =&lt;br /&gt;
#Go into the &amp;lt;code&amp;gt;linden/indra&amp;lt;/code&amp;gt; directory, and run &amp;lt;code&amp;gt;develop.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
#Launch XCode, open the project file &#039;linden/indra/newview/build-darwin-universal/SecondLife.xcodeproj&#039;, &lt;br /&gt;
#Build the project.&lt;br /&gt;
&lt;br /&gt;
== Build Configurations ==&lt;br /&gt;
&lt;br /&gt;
; Debug: This configuration is more suitable for debugging. The build process will create the SecondLife application targeted for your host architecture.&lt;br /&gt;
; RelWithDebInfo : This configuration is faster than the development version at the cost of some ability to debug. &lt;br /&gt;
; Release : Optimised, without debug info.&lt;br /&gt;
&lt;br /&gt;
== Post Build Steps ==&lt;br /&gt;
To deal with some quirks after building see [http://radio-boomslang.shacknet.nu/~bb/archives/2007/09/16/index.html#e2007-09-16T19_05_06.txt Barney Boomslang post build tips] (not everything there may apply to you, but worth checking)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
= Building the Unit Tests =&lt;br /&gt;
From XCode, open the project &#039;linden/indra/test/MacTester.xcodeproj&#039;, set &#039;MacTester&#039; as the active target, and build.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
= Submitting Patches =&lt;br /&gt;
This is probably far down the road, but if you make changes to the source and want to submit them, see the page about [[Submitting patches|submitting patches]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Microsoft_Windows_Builds&amp;diff=69839</id>
		<title>Microsoft Windows Builds</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Microsoft_Windows_Builds&amp;diff=69839"/>
		<updated>2008-06-02T23:04:40Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{multi-lang}}&lt;br /&gt;
{{CompileNav}}&lt;br /&gt;
On Windows, there are several options on build (compile) environment of the Second Life.&lt;br /&gt;
&lt;br /&gt;
== Linden-Supported Compilers ==&lt;br /&gt;
For current release branches, the single supported MSVS version is:&lt;br /&gt;
&lt;br /&gt;
* Visual Studio .NET 2003 Professional&lt;br /&gt;
&lt;br /&gt;
Build instructions are on: [[Compiling the viewer (MSVS2003)]].&lt;br /&gt;
&lt;br /&gt;
== Community Supported Compilers ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s generally possible to build under these compilers with little or no extra effort:&lt;br /&gt;
* Visual Studio 2005 Professional&lt;br /&gt;
* Visual C++ 2005 Express&lt;br /&gt;
* Visual Studio 2008&lt;br /&gt;
Build instructions are on: [[Compiling the viewer (MSVS2005)]].&lt;br /&gt;
&lt;br /&gt;
== Community Experimental Compilers ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Studio 2008 and Visual C++ 2008 Express ===&lt;br /&gt;
&lt;br /&gt;
Visual Studio 2008 is in need of TLC:&lt;br /&gt;
* Visual Studio 2008&lt;br /&gt;
* Visual C++ 2008 Express&lt;br /&gt;
&lt;br /&gt;
Build instructions are on: [[Compiling the Viewer (MSVS2008)]].&lt;br /&gt;
&lt;br /&gt;
=== Cross compiling with gcc on Linux ===&lt;br /&gt;
&lt;br /&gt;
mingw is in need of TLC:&lt;br /&gt;
* i686-mingw&lt;br /&gt;
&lt;br /&gt;
Build instructions are on: [[Cross compiling the viewer (i686-mingw32)]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=69838</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=69838"/>
		<updated>2008-06-02T23:03:11Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We recently (June 2008) switched to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and Xcode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 9&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.3.0&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Ubuntu 8.04&lt;br /&gt;
| i686&lt;br /&gt;
| gcc 4.2.3&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2008&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
If you want to try a CMake-powered build, it helps to already be familiar with our [[Get source and compile | build process]].&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: we do not yet support CMake 2.6.0.  Please use CMake 2.4.8 instead.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/develop.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we keep source and object files separate.  The &amp;lt;code&amp;gt;develop.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-universal&amp;lt;/code&amp;gt;.  On Windows, it will be &amp;lt;code&amp;gt;build-vc71&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;build-vc80&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;develop.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-universal/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to run from VS2005.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.  If you&#039;re attaching a patch, please try to make sure it has Unix line endings and pathnames, not Windows.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
Please also see the (user contributed) instructions at [http://wiki.secondlife.com/wiki/User:Michelle2_Zenovka/cmake http://wiki.secondlife.com/wiki/User:Michelle2_Zenovka/cmake]&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52636</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52636"/>
		<updated>2008-02-04T18:15:21Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* What are some downsides to CMake? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
If you want to try a CMake-powered build, it helps to already be familiar with our [[Get source and compile | existing build process]].&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.  If you&#039;re attaching a patch, please try to make sure it has Unix line endings and pathnames, not Windows.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;br /&gt;
&lt;br /&gt;
= What are some downsides to CMake? =&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no obvious regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak, which makes the initial learning process daunting.  The docs are mostly organised as reference documentation that assumes that you already know how to use CMake.  This presents a much bigger problem for new projects who are trying to figure out how to establish themselves than for ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages, and it took a lot of effort.&lt;br /&gt;
&lt;br /&gt;
* KitWare mentions that they&#039;re publishing a new edition of their CMake book approximately this week (early February).  I don&#039;t know if they&#039;re publishing the content online under an open license, so it&#039;s not clear to me yet how practically significant this is if you don&#039;t want to spend money on documentation.&lt;br /&gt;
&lt;br /&gt;
The good news, if you have no prior CMake experience, is that it&#039;s easy to modify existing CMake files, because you can look around at existing examples of how things are structured.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52119</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52119"/>
		<updated>2008-01-30T22:59:56Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
If you want to try a CMake-powered build, it helps to already be familiar with our [[Get source and compile | existing build process]].&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.  If you&#039;re attaching a patch, please try to make sure it has Unix line endings and pathnames, not Windows.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;br /&gt;
&lt;br /&gt;
= What are some downsides to CMake? =&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no obvious regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak, which makes the initial learning process daunting.  The docs are mostly organised as reference documentation that assumes that you already know how to use CMake.  This presents a much bigger problem for new projects who are trying to figure out how to establish themselves than for ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages, and it took a lot of effort.&lt;br /&gt;
&lt;br /&gt;
The good news, if you have no prior CMake experience, is that it&#039;s easy to modify existing CMake files, because you can look around at existing examples of how things are structured.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52118</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52118"/>
		<updated>2008-01-30T22:57:00Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Patching guidelines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no obvious regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects who are trying to figure out how to establish themselves than for ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages, and it was a lot of work.&lt;br /&gt;
&lt;br /&gt;
The good news is that if you have no prior experience, it&#039;s much easier to modify existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
If you want to try a CMake-powered build, it helps to already be familiar with our [[Get source and compile | existing build process]].&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.  If you&#039;re attaching a patch, please try to make sure it has Unix line endings and pathnames, not Windows.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52117</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52117"/>
		<updated>2008-01-30T22:55:51Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no obvious regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects who are trying to figure out how to establish themselves than for ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages, and it was a lot of work.&lt;br /&gt;
&lt;br /&gt;
The good news is that if you have no prior experience, it&#039;s much easier to modify existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
If you want to try a CMake-powered build, it helps to already be familiar with our [[Get source and compile | existing build process]].&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52116</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52116"/>
		<updated>2008-01-30T22:53:04Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* What are some downsides to CMake? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no obvious regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects who are trying to figure out how to establish themselves than for ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages, and it was a lot of work.&lt;br /&gt;
&lt;br /&gt;
The good news is that if you have no prior experience, it&#039;s much easier to modify existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52114</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52114"/>
		<updated>2008-01-30T22:50:41Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* What have we tested? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Not every platform has been equally tested, and not every feature is fully functional.  Please help us to track problems by reporting any trouble you run into.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52113</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52113"/>
		<updated>2008-01-30T22:47:45Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* What&amp;#039;s this about? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What have we tested? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve performed test build-and-run cycles on the following platforms.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Debian sarge&lt;br /&gt;
| i386&lt;br /&gt;
| gcc 3.4&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| Fedora 8&lt;br /&gt;
| x86_64&lt;br /&gt;
| gcc 4.1.2&lt;br /&gt;
| standalone&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5 (Leopard)&lt;br /&gt;
| i386&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| 10.5&lt;br /&gt;
| PowerPC&lt;br /&gt;
| Xcode 3.0&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| XP&lt;br /&gt;
| i386&lt;br /&gt;
| VS 2005&lt;br /&gt;
| prebuilt libraries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52112</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52112"/>
		<updated>2008-01-30T22:41:18Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Prebuilt libraries vs. standalone builds */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52111</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52111"/>
		<updated>2008-01-30T22:40:45Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Where&amp;#039;s the built viewer? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
On Windows, the built viewer ought to be able to run from VS2005.  Our Windows CMake expert is on vacation, so I can&#039;t give you more explicit details.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52110</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52110"/>
		<updated>2008-01-30T22:39:51Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Performing a build with CMake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
== Where&#039;s the built viewer? ==&lt;br /&gt;
&lt;br /&gt;
The location of the newly built viewer depends on your platform.  On Linux, it&#039;ll be here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-linux-i686/newview/packaged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X, it will be here by default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
build-darwin-i686/newview/RelWithDebInfo/Second Life.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you change the kind of build you use, the intermediate directory will also change, e.g. from &amp;lt;code&amp;gt;RelWithDebInfo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Release&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52108</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52108"/>
		<updated>2008-01-30T22:36:44Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Configuring your tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
In the CMake world, we&#039;re keeping source and object files separate.  The &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; script will create and populate a build directory for you.  On Linux, this will be named &amp;lt;code&amp;gt;viewer-linux-i686&amp;lt;/code&amp;gt;.  On OS X, it will be &amp;lt;code&amp;gt;build-darwin-i686&amp;lt;/code&amp;gt;.  I don&#039;t remember the directory name on Windows; sorry.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52107</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52107"/>
		<updated>2008-01-30T22:34:00Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Performing a build with CMake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Configuring your tree ==&lt;br /&gt;
&lt;br /&gt;
Before you first run a build, you&#039;ll need to configure things.  There&#039;s an &amp;lt;code&amp;gt;indra/cmake.py&amp;lt;/code&amp;gt; script that will do this for you.  Simply run it from the command line and it will create a reasonably sane default configuration.&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake.py&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!  Please follow the usual contribution agreement guidelines.&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52106</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=52106"/>
		<updated>2008-01-30T22:31:30Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake tells your build system how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake linden&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll also need to download the artwork package, and if you&#039;re linking against our prebuilt libraries, the archive of those files.  You can find links to the appropriate archives in [http://svn.secondlife.com/svn/linden/branches/cmake/doc/asset_urls.txt in SVN].&lt;br /&gt;
&lt;br /&gt;
As with the regular viewer build, unpack the artwork and (if you&#039;re using it) the prebuilt libraries on top of your SVN checkout.&lt;br /&gt;
&lt;br /&gt;
== Linux and Mac OS X ==&lt;br /&gt;
&lt;br /&gt;
Foo.&lt;br /&gt;
&lt;br /&gt;
== Windows ==&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;br /&gt;
&lt;br /&gt;
= JIRA issues =&lt;br /&gt;
&lt;br /&gt;
* {{jira|VWR-2871}} Implement CMake for building the viewer&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44724</id>
		<title>Certified HTTP</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44724"/>
		<updated>2007-12-14T00:34:39Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Retry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;&amp;lt; Back to [[Certified HTTP Project]]&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
The basic goal of Certified HTTP (colloquially known as chttp) is to perform exactly-once messaging between two hosts.&lt;br /&gt;
&lt;br /&gt;
From a standard http client perspective, if the client reads a whole response, then it knows for certain the server handled the request. However, for all other failure modes, the client can&#039;t be sure if the server did, or did-not perform the request function. On the server side, the server can never know if the client ever got the answer or not. For some operations, we need the ability for the client to perform a data-altering operation and be insistent that it occur. In particular, if it isn&#039;t certain that it happened, then it must be able to try again safely.&lt;br /&gt;
&lt;br /&gt;
The bigger picture goal is to make a simple way to conduct reliable delivery and receipt such that general adoption by the wider community is possible. This means that we have to respect HTTP where we can to take advantage of existing tools and methodology and to never contradict common conventions in a REST world.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Join the [https://lists.secondlife.com/cgi-bin/mailman/listinfo/chttpdev mailing list].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Workflow =&lt;br /&gt;
&lt;br /&gt;
The workflow is a specification/pseudocode for what actions both ends of chttp communication need to take to fulfill the requirements.&lt;br /&gt;
&lt;br /&gt;
== Interaction Sequence ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a diagram that describes an everything-works certified http communication.&lt;br /&gt;
&lt;br /&gt;
[[Image:Interaction_sequence.png]]&lt;br /&gt;
&lt;br /&gt;
Of note are the failure points.  These are the effective crash locations of the participants (the failure points on the arrows represent communication failures).  Actions that intervene between two failure points should be deterministic and/or atomic enough that a crash occurring midway through them is functionally identical to a crash occurring at the immediately prior failure point.&lt;br /&gt;
&lt;br /&gt;
The [[Certified HTTP Failure Diagrams]] page (warning: &#039;&#039;&#039;very&#039;&#039;&#039; image-heavy) has a relatively-exhaustive exploration of the way a Certified HTTP implementation should behave in the face of failures.&lt;br /&gt;
&lt;br /&gt;
== Sending a Message ==&lt;br /&gt;
&lt;br /&gt;
The sending-side API looks very much like a normal HTTP method call:&lt;br /&gt;
  response = certified_http.put(url, body)&lt;br /&gt;
&lt;br /&gt;
What happens under the covers is:&lt;br /&gt;
# Generate a globally unique message ID for the message&lt;br /&gt;
# Store the outgoing request (headers and all), including the message id, in a durable store &amp;quot;outbox&amp;quot;, and waits for a response.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Retrieves the request from the outbox.&lt;br /&gt;
## Performs the HTTP request specified by the outbox request and waits for a response.&lt;br /&gt;
## If a response is not forthcoming, for whatever reason, the process retries after a certain period.&lt;br /&gt;
## If the server sends an error code that indicates that the reliable message will never complete (e.g. 501), or a long timeout expires indicating that an absurd amount of time has elapsed, the method throws an exception.&lt;br /&gt;
# Opens a transaction on the durable store&lt;br /&gt;
# Stores the incoming response in a durable inbox.&lt;br /&gt;
# &#039;Tombstones&#039; the message in the outbox, which essentially marks the message as having been received, so that if the application resumes again, it doesn&#039;t resend.&lt;br /&gt;
# Closes the transaction on the durable store&lt;br /&gt;
# If the response contains a header indicating a confirmation url on the recipient, performs an HTTP DELETE on the resource to ack the incoming message.&lt;br /&gt;
&lt;br /&gt;
There are no explicit semantics for the response body, like HTTP itself.  The content will vary depending on the application.&lt;br /&gt;
&lt;br /&gt;
== Receiving a Message ==&lt;br /&gt;
&lt;br /&gt;
The receiver sets up a node in the url hierarchy, just like a regular http node.  When an incoming request comes in, the receiver:&lt;br /&gt;
&lt;br /&gt;
# Stores the incoming request in a durable store &amp;quot;inbox&amp;quot;, if it doesn&#039;t already contain a message with the same ID.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Looks for responses in the outbox matching the incoming message id, and if it finds one, sends it as the response without invoking anything else.&lt;br /&gt;
## Opens a transaction on the database, locking the inbox request&lt;br /&gt;
## Calls the handler method on the receiving node:&lt;br /&gt;
### &amp;lt;code&amp;gt;def handle_put(body, txn):&amp;lt;br/&amp;gt;return &amp;quot;My Response&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
### The handler method can use the open transaction to perform actions in the database that are atomic with the receipt of the message.  Any non-idempotent operation must be done atomically in this way.&lt;br /&gt;
## Stores the return value of the handle method as an outgoing response in the outbox, without closing the transaction. &lt;br /&gt;
## Removes the incoming request from the inbox&lt;br /&gt;
## Closes the transaction&lt;br /&gt;
# Discovers a new item in the outbox, responds to the incoming http request with the response from the outbox, including a url that, if DELETEd, will remove the item from the outbox.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
We have the concept of a &amp;quot;long&amp;quot; time (LT).  The purpose of this time is to ensure that any clients will stop trying a particular request long before the server discards state associated with the request.  This is not a very theoretically &amp;quot;pure&amp;quot; concept, since it relies on all parties conforming to certain (reasonable) assumptions, but we believe that we get significant benefits (lack of explicit negotiation), at little risk of actually entering an incorrect state.   chttp is expected to generate a small amount of bookkeeping data for each message, and there needs to be a way to expire this data in a way that doesn&#039;t involve additional negotiation between servers and clients.  The server should keep data for LT, and clients should not retry messages that are older than LT/2 or similar, so that there is at least LT/2 for a Reliable Host to recover from errors, and LT/2 for clock skew.  LT therefore should be orders of magnitude longer than the longest downtime we expect to see in the system and the largest clock skew we expect to see.  Off the cuff, 30 days seems like a reasonable value for LT.&lt;br /&gt;
&lt;br /&gt;
* chttp is based on http, and can use any facility provided by http 1.1 where not otherwise contradicted.&lt;br /&gt;
** this includes the use of https, pipelining, chunked encoding, proxies, redirects, caches, and headers such as Accept, Accept-Encoding, Expect, and Content-Type.&lt;br /&gt;
** any normal http verb appropriate to context should be accepted, eg POST, PUT, GET, DELETE&lt;br /&gt;
** unless otherwise specified, the http feature set in use is orthogonal and effectively transparent to chttp&lt;br /&gt;
* in any complete chttp exchange the client and server can eventually agree on success or failure of delivery, though it is more important that no ill effects arise when they disagree&lt;br /&gt;
* any message will be effectively received once and only once or not at all&lt;br /&gt;
* the content of the http body must be opaque to chttp&lt;br /&gt;
* the URI of the original request must be opaque to chttp&lt;br /&gt;
* chttp enabled clients and servers can integrate with unreliable tools&lt;br /&gt;
** the chttp server can differentiate reliable requests and respond without reliability guarantees (i.e. act as a normal http server)&lt;br /&gt;
** chttp clients can differentiate reliable responses and handle unreliable servers (i.e. act as a normal http client)&lt;br /&gt;
* the client will persist the local time of sending&lt;br /&gt;
* if there is one the client must either have the persisted outgoing body or the exact same body can be regenerated on the fly&lt;br /&gt;
* the server will persist the local time of message receipt&lt;br /&gt;
* the server must persist the response body or have a mechanism to idempotently generate the same response to the same request&lt;br /&gt;
* all urls with a chttp server behind them are effectively idempotent for all uniquely identified messages&lt;br /&gt;
** the client can retry steadily over a period of LT/2 days&lt;br /&gt;
** the client and server are assumed to almost always be running&lt;br /&gt;
** over that window of opportunity, the same message will always get the same response&lt;br /&gt;
* all persisted data on a single host is ACID&lt;br /&gt;
&lt;br /&gt;
== requirements on top of http ==&lt;br /&gt;
* if the body of the request is non-zero length, the client MUST include a Content-Length header, unless prohibited by section 4.4 of [http://www.w3.org/Protocols/rfc2616/rfc2616.html RFC 2616]&lt;br /&gt;
** the server will look for \r\n\r\n and content length body to consider the request complete&lt;br /&gt;
** an incomplete request will result in 4XX status code&lt;br /&gt;
* if the body of the response is non-zero length, the server must include a Content-Length header&lt;br /&gt;
** the client will look for \r\n\r\n and content length body to consider the response complete&lt;br /&gt;
** the client will retry on an incomplete response&lt;br /&gt;
* Messages can not be terminated by closing the connection -- only positive expressions of message termination (such as Content-Length) can guarantee that a full message is received.&lt;br /&gt;
&lt;br /&gt;
== assumptions ==&lt;br /&gt;
&lt;br /&gt;
* The client and server will not have any significant time discontinuity, i.e., the clock difference between them should be less than LT/100.&lt;br /&gt;
* The client and server will not have clock drift more than LT/100 per day.&lt;br /&gt;
* Both parties exchanging messages are Reliable Hosts (defined below).&lt;br /&gt;
* Generating a globally unique message ID is inexpensive.&lt;br /&gt;
* It is possible to store a large amount of &#039;small&#039; data (such as [[UUID]]s, urls, and date/timestamps) for LT.  &amp;quot;Large&amp;quot; in this case means &amp;quot;as many items as the throughput of a host implies that you could create during LT&amp;quot;.  In other words, storing this small data will never be a resource problem.&lt;br /&gt;
* Any transaction or data handled by this system will become useless well before LT has elapsed.  &lt;br /&gt;
&lt;br /&gt;
; Reliable Host : A reliable host has the following properties:&lt;br /&gt;
* The host has a durable data store of finite size, which can store data in such a way that it is guaranteed to be recoverable even in the face of a certain number of hardware failures.&lt;br /&gt;
* The host will not be down forever.  Either a clone will be brought up on different hardware, or the machine itself will reappear within a day or so. &lt;br /&gt;
* The host can perform {{Wikipedia|ACID|w=n}} operations on the data it contains.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Requiring an opaque body and URI pretty much requires either negotiating an URL beforehand or adding new headers. Since the former was discarded earlier (reliable delivery after setup), we will focus on adding request and response headers.&lt;br /&gt;
&lt;br /&gt;
This is a suggested implementation:&lt;br /&gt;
# chttp enabled servers will behave idempotently with a unique message id on the request&lt;br /&gt;
# the server can request acknowledgment from the client if the request consumes server resources&lt;br /&gt;
&lt;br /&gt;
== Request ==&lt;br /&gt;
A client will start a reliable message by making an HTTP request to a url on a reliable http server. The url may be known in advance or returned as part of an earlier application protocol exchange.  The request must contain two headers on top of the headers required by HTTP/1.1: X-Message-Id and Date.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-ID ===&lt;br /&gt;
A globally unique id.  It must match the regular expression &amp;lt;code&amp;gt;^[A-Za-z0-9-_:]{30,100}$&amp;lt;/code&amp;gt;.  This header is required for all Certified HTTP interactions.&lt;br /&gt;
&lt;br /&gt;
The best practice for generating this id is to combine a client host identifier with a cryptographically secure uuid and a sequence number.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but a a different body has an undefined result.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but with a different header which implies a different response body, eg, the first request specifies &amp;quot;Accept: text/plain&amp;quot; and the second request specifies &amp;quot;Accept: text/html&amp;quot;, the response can be one of:&lt;br /&gt;
&lt;br /&gt;
* The original response.&lt;br /&gt;
* A 4xx indicating that the server has detected the incompatability&lt;br /&gt;
&lt;br /&gt;
It is preferable to return the original response rather than the 4xx, but some implementations may not be able to achieve that.&lt;br /&gt;
&lt;br /&gt;
=== Date ===&lt;br /&gt;
&lt;br /&gt;
The Date header, as specified in RFC2616.  Certified HTTP requires a date header on all requests, which differs somewhat from RFC2616.&lt;br /&gt;
&lt;br /&gt;
== Response ==&lt;br /&gt;
Generally, when the client gets the 2XX back from the server, the message has been delivered. If the server has a response body, then the client will need to acknowledge receipt of the entire body. If the entire body is not read, the client can safely resubmit the exact same request. The server will include a message url in the headers if the client specified a message id on request and the body requires persistence by the server.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-URL ===&lt;br /&gt;
This will be a unique url on the server for the client message id which the client will DELETE upon receipt of the entire response to the request. This will only exist if there is a non-null response body or the server is consuming significant resources to maintain that url. When the client performs the delete, the server can flush all persisted resources other than the fact that the message was sent at some point.&lt;br /&gt;
&lt;br /&gt;
== Status Codes ==&lt;br /&gt;
&lt;br /&gt;
The semantics of Certified HTTP are to retry until the message goes through.  HTTP status codes provide one way of determining whether the message made it or not;  we&#039;ve grouped these status codes into &#039;success&#039; or &#039;retry&#039;.   In many cases they can signify that the client is attempting to send an invalid message, an error in the application logic; these are labeled as &#039;fail&#039;.  There is a third class, where the status code may be ambiguous; e.g. 404, which is often emitted by temporarily-misconfigured webservers, but may also indicate that an incorrect url was chosen.&lt;br /&gt;
&lt;br /&gt;
=== Success ===&lt;br /&gt;
&lt;br /&gt;
These status codes, when received, give the client permission to do whatever cleanup it needs to do, and to return to caller, safe in the assumption that the message was delivered.&lt;br /&gt;
&lt;br /&gt;
* 200 OK&lt;br /&gt;
* 201 Created&lt;br /&gt;
* 203 Non-Authoritative Information&lt;br /&gt;
* 204 No Content&lt;br /&gt;
* 205 Reset Content&lt;br /&gt;
* 206 Partial Content&lt;br /&gt;
* 304 Not Modified&lt;br /&gt;
&lt;br /&gt;
=== Retry ===&lt;br /&gt;
&lt;br /&gt;
These status codes indicate a temporary failure or misconfiguration on the server side, and therefore the client should retry until it gets something different.  All the redirected/proxied messages carry the same message-id.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Retry codes&lt;br /&gt;
|-&lt;br /&gt;
! Status code&lt;br /&gt;
! Notes&lt;br /&gt;
! Implementation&lt;br /&gt;
|-&lt;br /&gt;
| 202 Accepted&lt;br /&gt;
| potentially delaying longer than normal&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 300 Multiple Choices&lt;br /&gt;
| follow redirect&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 301 Moved Permanently&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 302 Found&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 303 See Other&lt;br /&gt;
| retry, using GET&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 305 Use Proxy&lt;br /&gt;
| use proxy&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 307 Temporary Redirect&lt;br /&gt;
| follow redirect only if GET&lt;br /&gt;
| not correct (doesn&#039;t check for GET)&lt;br /&gt;
|-&lt;br /&gt;
| 408 Request Timeout&lt;br /&gt;
| retry with a new message-id and date&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 413 Request Entity Too Large&lt;br /&gt;
| if Retry-After header present&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 502 Bad Gateway&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 503 Service Unavailable&lt;br /&gt;
|&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 504 Gateway Timeout&lt;br /&gt;
|&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Fail ===&lt;br /&gt;
&lt;br /&gt;
If your application logic screws up and picks an improper content-type or messes up the url, then the Certified HTTP subsystem shouldn&#039;t be burdened with retrying forever for a message that will never be delivered.  If it receives these status codes, it will raise an exception to the caller and nuke the outgoing request.&lt;br /&gt;
&lt;br /&gt;
* 400 Bad Request&lt;br /&gt;
* 401 Unauthorized&lt;br /&gt;
* 402 Payment Required&lt;br /&gt;
* 403 Forbidden&lt;br /&gt;
* 410 Gone&lt;br /&gt;
* 411 Length Required&lt;br /&gt;
* 413 Request Entity Too Large (if no Retry-After header present)&lt;br /&gt;
* 414 Request-URI Too Long&lt;br /&gt;
* 415 Unsupported Media Type&lt;br /&gt;
* 416 Requested Range Not Satisfiable&lt;br /&gt;
* 417 Expectation Failed&lt;br /&gt;
* 501 Not Implemented&lt;br /&gt;
* 505 HTTP Version Not Supported&lt;br /&gt;
&lt;br /&gt;
=== Ambiguous ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s a little ambiguous what to do when the client gets one of these status codes, so we think that the application should decide.  There are a few ways to do that:&lt;br /&gt;
# The client raises an exception with a retry() method that can be caught by the application, and retried if the application determines that the exception represented a temporary failure.&lt;br /&gt;
# The application passes a list to the Certified HTTP subsystem that sorts these status codes into &#039;retry&#039; or &#039;fail&#039;.&lt;br /&gt;
# The subsystem uses a heuristic such as retrying for a short period of time then converting to a Fail if still not successful.&lt;br /&gt;
Here&#039;s the list of status codes:&lt;br /&gt;
&lt;br /&gt;
* 303 See Other (retry will use GET even if original used POST)&lt;br /&gt;
* 307 Temporary Redirect (only if POST)&lt;br /&gt;
* 404 Not Found&lt;br /&gt;
* 406 Not Acceptable&lt;br /&gt;
* 407 Proxy Authentication Required&lt;br /&gt;
* 409 Conflict&lt;br /&gt;
* 412 Precondition Failed&lt;br /&gt;
* 500 Internal Server Error&lt;br /&gt;
&lt;br /&gt;
= Related Technologies =&lt;br /&gt;
I believe that all competitors to this fall into one of three categories, specialized message queues, reliable logic tunneled through HTTP, and delivery over HTTP with setup charges.&lt;br /&gt;
&lt;br /&gt;
== traditional message queue technology ==&lt;br /&gt;
This includes products like [http://www-306.ibm.com/software/integration/wmq/ MQ], [http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx MSMQ], and [http://activemq.apache.org/ ActiveMQ].&lt;br /&gt;
&lt;br /&gt;
These technologies are useful, but provide a number of hurdles:&lt;br /&gt;
* No common standards.&lt;br /&gt;
* Integrates a new technology with unknown performance characteristics.&lt;br /&gt;
* Requires significant operational overhead.&lt;br /&gt;
&lt;br /&gt;
Because of this, we have opted to use HTTP as a foundation of the technology.&lt;br /&gt;
&lt;br /&gt;
== reliable application logic in body ==&lt;br /&gt;
This includes technologies like [http://www.ibm.com/developerworks/library/ws-httprspec/ httpr] and [http://www.ibm.com/developerworks/library/specification/ws-rm/ ws-reliable].&lt;br /&gt;
&lt;br /&gt;
These tend to be thoroughly engineered protocol specifications which regrettably repeat the mistakes of the nearly defunct XMLRPC and the soon to join it SOAP -- namely, treating services as a function call. This is a reasonable approach, and is probably the most obvious to the engineers working on the problem. The most obvious path, which is followed in both of the examples, is to package a traditional message queue body into an HTTP body sent via POST. Treating web services as function calls severely limits the expressive nature of HTTP and should be avoided.&lt;br /&gt;
&lt;br /&gt;
Consumers of web services prefer REST APIs rather than function calls over HTTP. I believe this is because REST is inherently more comprehensible to consumers since all of the data is data the consumer requested. In one telling data point, Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface[http://www.oreillynet.com/pub/wlg/3005]. I believe ceding power to the consumer is the only path to make wide adoption possible. In doing so, we must drop the entire concept of burying data the consumer wants inside application data.&lt;br /&gt;
&lt;br /&gt;
== reliable delivery after setup ==&lt;br /&gt;
There appear to be a few proposals of this nature around the web and a shining example can be found in [http://www.dehora.net/doc/httplr/draft-httplr-01.html httplr].&lt;br /&gt;
&lt;br /&gt;
These are http reliability mechanisms which require a round trip to begin the reliable transfer and then follow through with some permutation of acknowledging the transfer. This setup can be cheap since the setup does not have the same reliability constraints as long as all clients correctly handle 404. Also, some of this overhead can be optimized away by batching the setup requests.&lt;br /&gt;
&lt;br /&gt;
However, a protocol which requires setup for all messaging will always be more expensive than other options.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44715</id>
		<title>Certified HTTP</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44715"/>
		<updated>2007-12-13T22:43:59Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Retry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;&amp;lt; Back to [[Certified HTTP Project]]&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
The basic goal of Certified HTTP (colloquially known as chttp) is to perform exactly-once messaging between two hosts.&lt;br /&gt;
&lt;br /&gt;
From a standard http client perspective, if the client reads a whole response, then it knows for certain the server handled the request. However, for all other failure modes, the client can&#039;t be sure if the server did, or did-not perform the request function. On the server side, the server can never know if the client ever got the answer or not. For some operations, we need the ability for the client to perform a data-altering operation and be insistent that it occur. In particular, if it isn&#039;t certain that it happened, then it must be able to try again safely.&lt;br /&gt;
&lt;br /&gt;
The bigger picture goal is to make a simple way to conduct reliable delivery and receipt such that general adoption by the wider community is possible. This means that we have to respect HTTP where we can to take advantage of existing tools and methodology and to never contradict common conventions in a REST world.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Join the [https://lists.secondlife.com/cgi-bin/mailman/listinfo/chttpdev mailing list].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Workflow =&lt;br /&gt;
&lt;br /&gt;
The workflow is a specification/pseudocode for what actions both ends of chttp communication need to take to fulfill the requirements.&lt;br /&gt;
&lt;br /&gt;
== Interaction Sequence ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a diagram that describes an everything-works certified http communication.&lt;br /&gt;
&lt;br /&gt;
[[Image:Interaction_sequence.png]]&lt;br /&gt;
&lt;br /&gt;
Of note are the failure points.  These are the effective crash locations of the participants (the failure points on the arrows represent communication failures).  Actions that intervene between two failure points should be deterministic and/or atomic enough that a crash occurring midway through them is functionally identical to a crash occurring at the immediately prior failure point.&lt;br /&gt;
&lt;br /&gt;
The [[Certified HTTP Failure Diagrams]] page (warning: &#039;&#039;&#039;very&#039;&#039;&#039; image-heavy) has a relatively-exhaustive exploration of the way a Certified HTTP implementation should behave in the face of failures.&lt;br /&gt;
&lt;br /&gt;
== Sending a Message ==&lt;br /&gt;
&lt;br /&gt;
The sending-side API looks very much like a normal HTTP method call:&lt;br /&gt;
  response = certified_http.put(url, body)&lt;br /&gt;
&lt;br /&gt;
What happens under the covers is:&lt;br /&gt;
# Generate a globally unique message ID for the message&lt;br /&gt;
# Store the outgoing request (headers and all), including the message id, in a durable store &amp;quot;outbox&amp;quot;, and waits for a response.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Retrieves the request from the outbox.&lt;br /&gt;
## Performs the HTTP request specified by the outbox request and waits for a response.&lt;br /&gt;
## If a response is not forthcoming, for whatever reason, the process retries after a certain period.&lt;br /&gt;
## If the server sends an error code that indicates that the reliable message will never complete (e.g. 501), or a long timeout expires indicating that an absurd amount of time has elapsed, the method throws an exception.&lt;br /&gt;
# Opens a transaction on the durable store&lt;br /&gt;
# Stores the incoming response in a durable inbox.&lt;br /&gt;
# &#039;Tombstones&#039; the message in the outbox, which essentially marks the message as having been received, so that if the application resumes again, it doesn&#039;t resend.&lt;br /&gt;
# Closes the transaction on the durable store&lt;br /&gt;
# If the response contains a header indicating a confirmation url on the recipient, performs an HTTP DELETE on the resource to ack the incoming message.&lt;br /&gt;
&lt;br /&gt;
There are no explicit semantics for the response body, like HTTP itself.  The content will vary depending on the application.&lt;br /&gt;
&lt;br /&gt;
== Receiving a Message ==&lt;br /&gt;
&lt;br /&gt;
The receiver sets up a node in the url hierarchy, just like a regular http node.  When an incoming request comes in, the receiver:&lt;br /&gt;
&lt;br /&gt;
# Stores the incoming request in a durable store &amp;quot;inbox&amp;quot;, if it doesn&#039;t already contain a message with the same ID.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Looks for responses in the outbox matching the incoming message id, and if it finds one, sends it as the response without invoking anything else.&lt;br /&gt;
## Opens a transaction on the database, locking the inbox request&lt;br /&gt;
## Calls the handler method on the receiving node:&lt;br /&gt;
### &amp;lt;code&amp;gt;def handle_put(body, txn):&amp;lt;br/&amp;gt;return &amp;quot;My Response&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
### The handler method can use the open transaction to perform actions in the database that are atomic with the receipt of the message.  Any non-idempotent operation must be done atomically in this way.&lt;br /&gt;
## Stores the return value of the handle method as an outgoing response in the outbox, without closing the transaction. &lt;br /&gt;
## Removes the incoming request from the inbox&lt;br /&gt;
## Closes the transaction&lt;br /&gt;
# Discovers a new item in the outbox, responds to the incoming http request with the response from the outbox, including a url that, if DELETEd, will remove the item from the outbox.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
We have the concept of a &amp;quot;long&amp;quot; time (LT).  The purpose of this time is to ensure that any clients will stop trying a particular request long before the server discards state associated with the request.  This is not a very theoretically &amp;quot;pure&amp;quot; concept, since it relies on all parties conforming to certain (reasonable) assumptions, but we believe that we get significant benefits (lack of explicit negotiation), at little risk of actually entering an incorrect state.   chttp is expected to generate a small amount of bookkeeping data for each message, and there needs to be a way to expire this data in a way that doesn&#039;t involve additional negotiation between servers and clients.  The server should keep data for LT, and clients should not retry messages that are older than LT/2 or similar, so that there is at least LT/2 for a Reliable Host to recover from errors, and LT/2 for clock skew.  LT therefore should be orders of magnitude longer than the longest downtime we expect to see in the system and the largest clock skew we expect to see.  Off the cuff, 30 days seems like a reasonable value for LT.&lt;br /&gt;
&lt;br /&gt;
* chttp is based on http, and can use any facility provided by http 1.1 where not otherwise contradicted.&lt;br /&gt;
** this includes the use of https, pipelining, chunked encoding, proxies, redirects, caches, and headers such as Accept, Accept-Encoding, Expect, and Content-Type.&lt;br /&gt;
** any normal http verb appropriate to context should be accepted, eg POST, PUT, GET, DELETE&lt;br /&gt;
** unless otherwise specified, the http feature set in use is orthogonal and effectively transparent to chttp&lt;br /&gt;
* in any complete chttp exchange the client and server can eventually agree on success or failure of delivery, though it is more important that no ill effects arise when they disagree&lt;br /&gt;
* any message will be effectively received once and only once or not at all&lt;br /&gt;
* the content of the http body must be opaque to chttp&lt;br /&gt;
* the URI of the original request must be opaque to chttp&lt;br /&gt;
* chttp enabled clients and servers can integrate with unreliable tools&lt;br /&gt;
** the chttp server can differentiate reliable requests and respond without reliability guarantees (i.e. act as a normal http server)&lt;br /&gt;
** chttp clients can differentiate reliable responses and handle unreliable servers (i.e. act as a normal http client)&lt;br /&gt;
* the client will persist the local time of sending&lt;br /&gt;
* if there is one the client must either have the persisted outgoing body or the exact same body can be regenerated on the fly&lt;br /&gt;
* the server will persist the local time of message receipt&lt;br /&gt;
* the server must persist the response body or have a mechanism to idempotently generate the same response to the same request&lt;br /&gt;
* all urls with a chttp server behind them are effectively idempotent for all uniquely identified messages&lt;br /&gt;
** the client can retry steadily over a period of LT/2 days&lt;br /&gt;
** the client and server are assumed to almost always be running&lt;br /&gt;
** over that window of opportunity, the same message will always get the same response&lt;br /&gt;
* all persisted data on a single host is ACID&lt;br /&gt;
&lt;br /&gt;
== requirements on top of http ==&lt;br /&gt;
* if the body of the request is non-zero length, the client MUST include a Content-Length header, unless prohibited by section 4.4 of [http://www.w3.org/Protocols/rfc2616/rfc2616.html RFC 2616]&lt;br /&gt;
** the server will look for \r\n\r\n and content length body to consider the request complete&lt;br /&gt;
** an incomplete request will result in 4XX status code&lt;br /&gt;
* if the body of the response is non-zero length, the server must include a Content-Length header&lt;br /&gt;
** the client will look for \r\n\r\n and content length body to consider the response complete&lt;br /&gt;
** the client will retry on an incomplete response&lt;br /&gt;
* Messages can not be terminated by closing the connection -- only positive expressions of message termination (such as Content-Length) can guarantee that a full message is received.&lt;br /&gt;
&lt;br /&gt;
== assumptions ==&lt;br /&gt;
&lt;br /&gt;
* The client and server will not have any significant time discontinuity, i.e., the clock difference between them should be less than LT/100.&lt;br /&gt;
* The client and server will not have clock drift more than LT/100 per day.&lt;br /&gt;
* Both parties exchanging messages are Reliable Hosts (defined below).&lt;br /&gt;
* Generating a globally unique message ID is inexpensive.&lt;br /&gt;
* It is possible to store a large amount of &#039;small&#039; data (such as [[UUID]]s, urls, and date/timestamps) for LT.  &amp;quot;Large&amp;quot; in this case means &amp;quot;as many items as the throughput of a host implies that you could create during LT&amp;quot;.  In other words, storing this small data will never be a resource problem.&lt;br /&gt;
* Any transaction or data handled by this system will become useless well before LT has elapsed.  &lt;br /&gt;
&lt;br /&gt;
; Reliable Host : A reliable host has the following properties:&lt;br /&gt;
* The host has a durable data store of finite size, which can store data in such a way that it is guaranteed to be recoverable even in the face of a certain number of hardware failures.&lt;br /&gt;
* The host will not be down forever.  Either a clone will be brought up on different hardware, or the machine itself will reappear within a day or so. &lt;br /&gt;
* The host can perform {{Wikipedia|ACID|w=n}} operations on the data it contains.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Requiring an opaque body and URI pretty much requires either negotiating an URL beforehand or adding new headers. Since the former was discarded earlier (reliable delivery after setup), we will focus on adding request and response headers.&lt;br /&gt;
&lt;br /&gt;
This is a suggested implementation:&lt;br /&gt;
# chttp enabled servers will behave idempotently with a unique message id on the request&lt;br /&gt;
# the server can request acknowledgment from the client if the request consumes server resources&lt;br /&gt;
&lt;br /&gt;
== Request ==&lt;br /&gt;
A client will start a reliable message by making an HTTP request to a url on a reliable http server. The url may be known in advance or returned as part of an earlier application protocol exchange.  The request must contain two headers on top of the headers required by HTTP/1.1: X-Message-Id and Date.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-ID ===&lt;br /&gt;
A globally unique id.  It must match the regular expression &amp;lt;code&amp;gt;^[A-Za-z0-9-_:]{30,100}$&amp;lt;/code&amp;gt;.  This header is required for all Certified HTTP interactions.&lt;br /&gt;
&lt;br /&gt;
The best practice for generating this id is to combine a client host identifier with a cryptographically secure uuid and a sequence number.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but a a different body has an undefined result.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but with a different header which implies a different response body, eg, the first request specifies &amp;quot;Accept: text/plain&amp;quot; and the second request specifies &amp;quot;Accept: text/html&amp;quot;, the response can be one of:&lt;br /&gt;
&lt;br /&gt;
* The original response.&lt;br /&gt;
* A 4xx indicating that the server has detected the incompatability&lt;br /&gt;
&lt;br /&gt;
It is preferable to return the original response rather than the 4xx, but some implementations may not be able to achieve that.&lt;br /&gt;
&lt;br /&gt;
=== Date ===&lt;br /&gt;
&lt;br /&gt;
The Date header, as specified in RFC2616.  Certified HTTP requires a date header on all requests, which differs somewhat from RFC2616.&lt;br /&gt;
&lt;br /&gt;
== Response ==&lt;br /&gt;
Generally, when the client gets the 2XX back from the server, the message has been delivered. If the server has a response body, then the client will need to acknowledge receipt of the entire body. If the entire body is not read, the client can safely resubmit the exact same request. The server will include a message url in the headers if the client specified a message id on request and the body requires persistence by the server.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-URL ===&lt;br /&gt;
This will be a unique url on the server for the client message id which the client will DELETE upon receipt of the entire response to the request. This will only exist if there is a non-null response body or the server is consuming significant resources to maintain that url. When the client performs the delete, the server can flush all persisted resources other than the fact that the message was sent at some point.&lt;br /&gt;
&lt;br /&gt;
== Status Codes ==&lt;br /&gt;
&lt;br /&gt;
The semantics of Certified HTTP are to retry until the message goes through.  HTTP status codes provide one way of determining whether the message made it or not;  we&#039;ve grouped these status codes into &#039;success&#039; or &#039;retry&#039;.   In many cases they can signify that the client is attempting to send an invalid message, an error in the application logic; these are labeled as &#039;fail&#039;.  There is a third class, where the status code may be ambiguous; e.g. 404, which is often emitted by temporarily-misconfigured webservers, but may also indicate that an incorrect url was chosen.&lt;br /&gt;
&lt;br /&gt;
=== Success ===&lt;br /&gt;
&lt;br /&gt;
These status codes, when received, give the client permission to do whatever cleanup it needs to do, and to return to caller, safe in the assumption that the message was delivered.&lt;br /&gt;
&lt;br /&gt;
* 200 OK&lt;br /&gt;
* 201 Created&lt;br /&gt;
* 203 Non-Authoritative Information&lt;br /&gt;
* 204 No Content&lt;br /&gt;
* 205 Reset Content&lt;br /&gt;
* 206 Partial Content&lt;br /&gt;
* 304 Not Modified&lt;br /&gt;
&lt;br /&gt;
=== Retry ===&lt;br /&gt;
&lt;br /&gt;
These status codes indicate a temporary failure or misconfiguration on the server side, and therefore the client should retry until it gets something different.  All the redirected/proxied messages carry the same message-id.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Retry codes&lt;br /&gt;
|-&lt;br /&gt;
! Status code&lt;br /&gt;
! Notes&lt;br /&gt;
! Implementation&lt;br /&gt;
|-&lt;br /&gt;
| 202 Accepted&lt;br /&gt;
| potentially delaying longer than normal&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 300 Multiple Choices&lt;br /&gt;
| follow redirect&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 301 Moved Permanently&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 302 Found&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 303 See Other&lt;br /&gt;
| retry, using GET&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 305 Use Proxy&lt;br /&gt;
| use proxy&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 307 Temporary Redirect&lt;br /&gt;
| follow redirect only if GET&lt;br /&gt;
| not correct (doesn&#039;t check for GET)&lt;br /&gt;
|-&lt;br /&gt;
| 408 Request Timeout&lt;br /&gt;
| retry with a new message-id and date&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 413 Request Entity Too Large&lt;br /&gt;
| if Retry-After header present&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 502 Bad Gateway&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 503 Service Unavailable&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 504 Gateway Timeout&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Fail ===&lt;br /&gt;
&lt;br /&gt;
If your application logic screws up and picks an improper content-type or messes up the url, then the Certified HTTP subsystem shouldn&#039;t be burdened with retrying forever for a message that will never be delivered.  If it receives these status codes, it will raise an exception to the caller and nuke the outgoing request.&lt;br /&gt;
&lt;br /&gt;
* 400 Bad Request&lt;br /&gt;
* 401 Unauthorized&lt;br /&gt;
* 402 Payment Required&lt;br /&gt;
* 403 Forbidden&lt;br /&gt;
* 410 Gone&lt;br /&gt;
* 411 Length Required&lt;br /&gt;
* 413 Request Entity Too Large (if no Retry-After header present)&lt;br /&gt;
* 414 Request-URI Too Long&lt;br /&gt;
* 415 Unsupported Media Type&lt;br /&gt;
* 416 Requested Range Not Satisfiable&lt;br /&gt;
* 417 Expectation Failed&lt;br /&gt;
* 501 Not Implemented&lt;br /&gt;
* 505 HTTP Version Not Supported&lt;br /&gt;
&lt;br /&gt;
=== Ambiguous ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s a little ambiguous what to do when the client gets one of these status codes, so we think that the application should decide.  There are a few ways to do that:&lt;br /&gt;
# The client raises an exception with a retry() method that can be caught by the application, and retried if the application determines that the exception represented a temporary failure.&lt;br /&gt;
# The application passes a list to the Certified HTTP subsystem that sorts these status codes into &#039;retry&#039; or &#039;fail&#039;.&lt;br /&gt;
# The subsystem uses a heuristic such as retrying for a short period of time then converting to a Fail if still not successful.&lt;br /&gt;
Here&#039;s the list of status codes:&lt;br /&gt;
&lt;br /&gt;
* 303 See Other (retry will use GET even if original used POST)&lt;br /&gt;
* 307 Temporary Redirect (only if POST)&lt;br /&gt;
* 404 Not Found&lt;br /&gt;
* 406 Not Acceptable&lt;br /&gt;
* 407 Proxy Authentication Required&lt;br /&gt;
* 409 Conflict&lt;br /&gt;
* 412 Precondition Failed&lt;br /&gt;
* 500 Internal Server Error&lt;br /&gt;
&lt;br /&gt;
= Related Technologies =&lt;br /&gt;
I believe that all competitors to this fall into one of three categories, specialized message queues, reliable logic tunneled through HTTP, and delivery over HTTP with setup charges.&lt;br /&gt;
&lt;br /&gt;
== traditional message queue technology ==&lt;br /&gt;
This includes products like [http://www-306.ibm.com/software/integration/wmq/ MQ], [http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx MSMQ], and [http://activemq.apache.org/ ActiveMQ].&lt;br /&gt;
&lt;br /&gt;
These technologies are useful, but provide a number of hurdles:&lt;br /&gt;
* No common standards.&lt;br /&gt;
* Integrates a new technology with unknown performance characteristics.&lt;br /&gt;
* Requires significant operational overhead.&lt;br /&gt;
&lt;br /&gt;
Because of this, we have opted to use HTTP as a foundation of the technology.&lt;br /&gt;
&lt;br /&gt;
== reliable application logic in body ==&lt;br /&gt;
This includes technologies like [http://www.ibm.com/developerworks/library/ws-httprspec/ httpr] and [http://www.ibm.com/developerworks/library/specification/ws-rm/ ws-reliable].&lt;br /&gt;
&lt;br /&gt;
These tend to be thoroughly engineered protocol specifications which regrettably repeat the mistakes of the nearly defunct XMLRPC and the soon to join it SOAP -- namely, treating services as a function call. This is a reasonable approach, and is probably the most obvious to the engineers working on the problem. The most obvious path, which is followed in both of the examples, is to package a traditional message queue body into an HTTP body sent via POST. Treating web services as function calls severely limits the expressive nature of HTTP and should be avoided.&lt;br /&gt;
&lt;br /&gt;
Consumers of web services prefer REST APIs rather than function calls over HTTP. I believe this is because REST is inherently more comprehensible to consumers since all of the data is data the consumer requested. In one telling data point, Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface[http://www.oreillynet.com/pub/wlg/3005]. I believe ceding power to the consumer is the only path to make wide adoption possible. In doing so, we must drop the entire concept of burying data the consumer wants inside application data.&lt;br /&gt;
&lt;br /&gt;
== reliable delivery after setup ==&lt;br /&gt;
There appear to be a few proposals of this nature around the web and a shining example can be found in [http://www.dehora.net/doc/httplr/draft-httplr-01.html httplr].&lt;br /&gt;
&lt;br /&gt;
These are http reliability mechanisms which require a round trip to begin the reliable transfer and then follow through with some permutation of acknowledging the transfer. This setup can be cheap since the setup does not have the same reliability constraints as long as all clients correctly handle 404. Also, some of this overhead can be optimized away by batching the setup requests.&lt;br /&gt;
&lt;br /&gt;
However, a protocol which requires setup for all messaging will always be more expensive than other options.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44714</id>
		<title>Certified HTTP</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44714"/>
		<updated>2007-12-13T22:41:34Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Retry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;&amp;lt; Back to [[Certified HTTP Project]]&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
The basic goal of Certified HTTP (colloquially known as chttp) is to perform exactly-once messaging between two hosts.&lt;br /&gt;
&lt;br /&gt;
From a standard http client perspective, if the client reads a whole response, then it knows for certain the server handled the request. However, for all other failure modes, the client can&#039;t be sure if the server did, or did-not perform the request function. On the server side, the server can never know if the client ever got the answer or not. For some operations, we need the ability for the client to perform a data-altering operation and be insistent that it occur. In particular, if it isn&#039;t certain that it happened, then it must be able to try again safely.&lt;br /&gt;
&lt;br /&gt;
The bigger picture goal is to make a simple way to conduct reliable delivery and receipt such that general adoption by the wider community is possible. This means that we have to respect HTTP where we can to take advantage of existing tools and methodology and to never contradict common conventions in a REST world.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Join the [https://lists.secondlife.com/cgi-bin/mailman/listinfo/chttpdev mailing list].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Workflow =&lt;br /&gt;
&lt;br /&gt;
The workflow is a specification/pseudocode for what actions both ends of chttp communication need to take to fulfill the requirements.&lt;br /&gt;
&lt;br /&gt;
== Interaction Sequence ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a diagram that describes an everything-works certified http communication.&lt;br /&gt;
&lt;br /&gt;
[[Image:Interaction_sequence.png]]&lt;br /&gt;
&lt;br /&gt;
Of note are the failure points.  These are the effective crash locations of the participants (the failure points on the arrows represent communication failures).  Actions that intervene between two failure points should be deterministic and/or atomic enough that a crash occurring midway through them is functionally identical to a crash occurring at the immediately prior failure point.&lt;br /&gt;
&lt;br /&gt;
The [[Certified HTTP Failure Diagrams]] page (warning: &#039;&#039;&#039;very&#039;&#039;&#039; image-heavy) has a relatively-exhaustive exploration of the way a Certified HTTP implementation should behave in the face of failures.&lt;br /&gt;
&lt;br /&gt;
== Sending a Message ==&lt;br /&gt;
&lt;br /&gt;
The sending-side API looks very much like a normal HTTP method call:&lt;br /&gt;
  response = certified_http.put(url, body)&lt;br /&gt;
&lt;br /&gt;
What happens under the covers is:&lt;br /&gt;
# Generate a globally unique message ID for the message&lt;br /&gt;
# Store the outgoing request (headers and all), including the message id, in a durable store &amp;quot;outbox&amp;quot;, and waits for a response.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Retrieves the request from the outbox.&lt;br /&gt;
## Performs the HTTP request specified by the outbox request and waits for a response.&lt;br /&gt;
## If a response is not forthcoming, for whatever reason, the process retries after a certain period.&lt;br /&gt;
## If the server sends an error code that indicates that the reliable message will never complete (e.g. 501), or a long timeout expires indicating that an absurd amount of time has elapsed, the method throws an exception.&lt;br /&gt;
# Opens a transaction on the durable store&lt;br /&gt;
# Stores the incoming response in a durable inbox.&lt;br /&gt;
# &#039;Tombstones&#039; the message in the outbox, which essentially marks the message as having been received, so that if the application resumes again, it doesn&#039;t resend.&lt;br /&gt;
# Closes the transaction on the durable store&lt;br /&gt;
# If the response contains a header indicating a confirmation url on the recipient, performs an HTTP DELETE on the resource to ack the incoming message.&lt;br /&gt;
&lt;br /&gt;
There are no explicit semantics for the response body, like HTTP itself.  The content will vary depending on the application.&lt;br /&gt;
&lt;br /&gt;
== Receiving a Message ==&lt;br /&gt;
&lt;br /&gt;
The receiver sets up a node in the url hierarchy, just like a regular http node.  When an incoming request comes in, the receiver:&lt;br /&gt;
&lt;br /&gt;
# Stores the incoming request in a durable store &amp;quot;inbox&amp;quot;, if it doesn&#039;t already contain a message with the same ID.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Looks for responses in the outbox matching the incoming message id, and if it finds one, sends it as the response without invoking anything else.&lt;br /&gt;
## Opens a transaction on the database, locking the inbox request&lt;br /&gt;
## Calls the handler method on the receiving node:&lt;br /&gt;
### &amp;lt;code&amp;gt;def handle_put(body, txn):&amp;lt;br/&amp;gt;return &amp;quot;My Response&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
### The handler method can use the open transaction to perform actions in the database that are atomic with the receipt of the message.  Any non-idempotent operation must be done atomically in this way.&lt;br /&gt;
## Stores the return value of the handle method as an outgoing response in the outbox, without closing the transaction. &lt;br /&gt;
## Removes the incoming request from the inbox&lt;br /&gt;
## Closes the transaction&lt;br /&gt;
# Discovers a new item in the outbox, responds to the incoming http request with the response from the outbox, including a url that, if DELETEd, will remove the item from the outbox.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
We have the concept of a &amp;quot;long&amp;quot; time (LT).  The purpose of this time is to ensure that any clients will stop trying a particular request long before the server discards state associated with the request.  This is not a very theoretically &amp;quot;pure&amp;quot; concept, since it relies on all parties conforming to certain (reasonable) assumptions, but we believe that we get significant benefits (lack of explicit negotiation), at little risk of actually entering an incorrect state.   chttp is expected to generate a small amount of bookkeeping data for each message, and there needs to be a way to expire this data in a way that doesn&#039;t involve additional negotiation between servers and clients.  The server should keep data for LT, and clients should not retry messages that are older than LT/2 or similar, so that there is at least LT/2 for a Reliable Host to recover from errors, and LT/2 for clock skew.  LT therefore should be orders of magnitude longer than the longest downtime we expect to see in the system and the largest clock skew we expect to see.  Off the cuff, 30 days seems like a reasonable value for LT.&lt;br /&gt;
&lt;br /&gt;
* chttp is based on http, and can use any facility provided by http 1.1 where not otherwise contradicted.&lt;br /&gt;
** this includes the use of https, pipelining, chunked encoding, proxies, redirects, caches, and headers such as Accept, Accept-Encoding, Expect, and Content-Type.&lt;br /&gt;
** any normal http verb appropriate to context should be accepted, eg POST, PUT, GET, DELETE&lt;br /&gt;
** unless otherwise specified, the http feature set in use is orthogonal and effectively transparent to chttp&lt;br /&gt;
* in any complete chttp exchange the client and server can eventually agree on success or failure of delivery, though it is more important that no ill effects arise when they disagree&lt;br /&gt;
* any message will be effectively received once and only once or not at all&lt;br /&gt;
* the content of the http body must be opaque to chttp&lt;br /&gt;
* the URI of the original request must be opaque to chttp&lt;br /&gt;
* chttp enabled clients and servers can integrate with unreliable tools&lt;br /&gt;
** the chttp server can differentiate reliable requests and respond without reliability guarantees (i.e. act as a normal http server)&lt;br /&gt;
** chttp clients can differentiate reliable responses and handle unreliable servers (i.e. act as a normal http client)&lt;br /&gt;
* the client will persist the local time of sending&lt;br /&gt;
* if there is one the client must either have the persisted outgoing body or the exact same body can be regenerated on the fly&lt;br /&gt;
* the server will persist the local time of message receipt&lt;br /&gt;
* the server must persist the response body or have a mechanism to idempotently generate the same response to the same request&lt;br /&gt;
* all urls with a chttp server behind them are effectively idempotent for all uniquely identified messages&lt;br /&gt;
** the client can retry steadily over a period of LT/2 days&lt;br /&gt;
** the client and server are assumed to almost always be running&lt;br /&gt;
** over that window of opportunity, the same message will always get the same response&lt;br /&gt;
* all persisted data on a single host is ACID&lt;br /&gt;
&lt;br /&gt;
== requirements on top of http ==&lt;br /&gt;
* if the body of the request is non-zero length, the client MUST include a Content-Length header, unless prohibited by section 4.4 of [http://www.w3.org/Protocols/rfc2616/rfc2616.html RFC 2616]&lt;br /&gt;
** the server will look for \r\n\r\n and content length body to consider the request complete&lt;br /&gt;
** an incomplete request will result in 4XX status code&lt;br /&gt;
* if the body of the response is non-zero length, the server must include a Content-Length header&lt;br /&gt;
** the client will look for \r\n\r\n and content length body to consider the response complete&lt;br /&gt;
** the client will retry on an incomplete response&lt;br /&gt;
* Messages can not be terminated by closing the connection -- only positive expressions of message termination (such as Content-Length) can guarantee that a full message is received.&lt;br /&gt;
&lt;br /&gt;
== assumptions ==&lt;br /&gt;
&lt;br /&gt;
* The client and server will not have any significant time discontinuity, i.e., the clock difference between them should be less than LT/100.&lt;br /&gt;
* The client and server will not have clock drift more than LT/100 per day.&lt;br /&gt;
* Both parties exchanging messages are Reliable Hosts (defined below).&lt;br /&gt;
* Generating a globally unique message ID is inexpensive.&lt;br /&gt;
* It is possible to store a large amount of &#039;small&#039; data (such as [[UUID]]s, urls, and date/timestamps) for LT.  &amp;quot;Large&amp;quot; in this case means &amp;quot;as many items as the throughput of a host implies that you could create during LT&amp;quot;.  In other words, storing this small data will never be a resource problem.&lt;br /&gt;
* Any transaction or data handled by this system will become useless well before LT has elapsed.  &lt;br /&gt;
&lt;br /&gt;
; Reliable Host : A reliable host has the following properties:&lt;br /&gt;
* The host has a durable data store of finite size, which can store data in such a way that it is guaranteed to be recoverable even in the face of a certain number of hardware failures.&lt;br /&gt;
* The host will not be down forever.  Either a clone will be brought up on different hardware, or the machine itself will reappear within a day or so. &lt;br /&gt;
* The host can perform {{Wikipedia|ACID|w=n}} operations on the data it contains.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Requiring an opaque body and URI pretty much requires either negotiating an URL beforehand or adding new headers. Since the former was discarded earlier (reliable delivery after setup), we will focus on adding request and response headers.&lt;br /&gt;
&lt;br /&gt;
This is a suggested implementation:&lt;br /&gt;
# chttp enabled servers will behave idempotently with a unique message id on the request&lt;br /&gt;
# the server can request acknowledgment from the client if the request consumes server resources&lt;br /&gt;
&lt;br /&gt;
== Request ==&lt;br /&gt;
A client will start a reliable message by making an HTTP request to a url on a reliable http server. The url may be known in advance or returned as part of an earlier application protocol exchange.  The request must contain two headers on top of the headers required by HTTP/1.1: X-Message-Id and Date.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-ID ===&lt;br /&gt;
A globally unique id.  It must match the regular expression &amp;lt;code&amp;gt;^[A-Za-z0-9-_:]{30,100}$&amp;lt;/code&amp;gt;.  This header is required for all Certified HTTP interactions.&lt;br /&gt;
&lt;br /&gt;
The best practice for generating this id is to combine a client host identifier with a cryptographically secure uuid and a sequence number.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but a a different body has an undefined result.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but with a different header which implies a different response body, eg, the first request specifies &amp;quot;Accept: text/plain&amp;quot; and the second request specifies &amp;quot;Accept: text/html&amp;quot;, the response can be one of:&lt;br /&gt;
&lt;br /&gt;
* The original response.&lt;br /&gt;
* A 4xx indicating that the server has detected the incompatability&lt;br /&gt;
&lt;br /&gt;
It is preferable to return the original response rather than the 4xx, but some implementations may not be able to achieve that.&lt;br /&gt;
&lt;br /&gt;
=== Date ===&lt;br /&gt;
&lt;br /&gt;
The Date header, as specified in RFC2616.  Certified HTTP requires a date header on all requests, which differs somewhat from RFC2616.&lt;br /&gt;
&lt;br /&gt;
== Response ==&lt;br /&gt;
Generally, when the client gets the 2XX back from the server, the message has been delivered. If the server has a response body, then the client will need to acknowledge receipt of the entire body. If the entire body is not read, the client can safely resubmit the exact same request. The server will include a message url in the headers if the client specified a message id on request and the body requires persistence by the server.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-URL ===&lt;br /&gt;
This will be a unique url on the server for the client message id which the client will DELETE upon receipt of the entire response to the request. This will only exist if there is a non-null response body or the server is consuming significant resources to maintain that url. When the client performs the delete, the server can flush all persisted resources other than the fact that the message was sent at some point.&lt;br /&gt;
&lt;br /&gt;
== Status Codes ==&lt;br /&gt;
&lt;br /&gt;
The semantics of Certified HTTP are to retry until the message goes through.  HTTP status codes provide one way of determining whether the message made it or not;  we&#039;ve grouped these status codes into &#039;success&#039; or &#039;retry&#039;.   In many cases they can signify that the client is attempting to send an invalid message, an error in the application logic; these are labeled as &#039;fail&#039;.  There is a third class, where the status code may be ambiguous; e.g. 404, which is often emitted by temporarily-misconfigured webservers, but may also indicate that an incorrect url was chosen.&lt;br /&gt;
&lt;br /&gt;
=== Success ===&lt;br /&gt;
&lt;br /&gt;
These status codes, when received, give the client permission to do whatever cleanup it needs to do, and to return to caller, safe in the assumption that the message was delivered.&lt;br /&gt;
&lt;br /&gt;
* 200 OK&lt;br /&gt;
* 201 Created&lt;br /&gt;
* 203 Non-Authoritative Information&lt;br /&gt;
* 204 No Content&lt;br /&gt;
* 205 Reset Content&lt;br /&gt;
* 206 Partial Content&lt;br /&gt;
* 304 Not Modified&lt;br /&gt;
&lt;br /&gt;
=== Retry ===&lt;br /&gt;
&lt;br /&gt;
These status codes indicate a temporary failure or misconfiguration on the server side, and therefore the client should retry until it gets something different.  All the redirected/proxied messages carry the same message-id.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|+ Retry codes&lt;br /&gt;
|-&lt;br /&gt;
! Status code&lt;br /&gt;
! Desired behaviour&lt;br /&gt;
! Implementation&lt;br /&gt;
|-&lt;br /&gt;
| 202 Accepted&lt;br /&gt;
| potentially delaying longer than normal&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 300 Multiple Choices&lt;br /&gt;
| follow redirect&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 301 Moved Permanently&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 302 Found&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 303 See Other&lt;br /&gt;
| retry, using GET&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 305 Use Proxy&lt;br /&gt;
| use proxy&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 307 Temporary Redirect&lt;br /&gt;
| follow redirect only if GET&lt;br /&gt;
| not correct (doesn&#039;t check for GET)&lt;br /&gt;
|-&lt;br /&gt;
| 408 Request Timeout&lt;br /&gt;
| retry with a new message-id and date&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 413 Request Entity Too Large&lt;br /&gt;
| if Retry-After header present&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 502 Bad Gateway&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 503 Service Unavailable&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 504 Gateway Timeout&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Fail ===&lt;br /&gt;
&lt;br /&gt;
If your application logic screws up and picks an improper content-type or messes up the url, then the Certified HTTP subsystem shouldn&#039;t be burdened with retrying forever for a message that will never be delivered.  If it receives these status codes, it will raise an exception to the caller and nuke the outgoing request.&lt;br /&gt;
&lt;br /&gt;
* 400 Bad Request&lt;br /&gt;
* 401 Unauthorized&lt;br /&gt;
* 402 Payment Required&lt;br /&gt;
* 403 Forbidden&lt;br /&gt;
* 410 Gone&lt;br /&gt;
* 411 Length Required&lt;br /&gt;
* 413 Request Entity Too Large (if no Retry-After header present)&lt;br /&gt;
* 414 Request-URI Too Long&lt;br /&gt;
* 415 Unsupported Media Type&lt;br /&gt;
* 416 Requested Range Not Satisfiable&lt;br /&gt;
* 417 Expectation Failed&lt;br /&gt;
* 501 Not Implemented&lt;br /&gt;
* 505 HTTP Version Not Supported&lt;br /&gt;
&lt;br /&gt;
=== Ambiguous ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s a little ambiguous what to do when the client gets one of these status codes, so we think that the application should decide.  There are a few ways to do that:&lt;br /&gt;
# The client raises an exception with a retry() method that can be caught by the application, and retried if the application determines that the exception represented a temporary failure.&lt;br /&gt;
# The application passes a list to the Certified HTTP subsystem that sorts these status codes into &#039;retry&#039; or &#039;fail&#039;.&lt;br /&gt;
# The subsystem uses a heuristic such as retrying for a short period of time then converting to a Fail if still not successful.&lt;br /&gt;
Here&#039;s the list of status codes:&lt;br /&gt;
&lt;br /&gt;
* 303 See Other (retry will use GET even if original used POST)&lt;br /&gt;
* 307 Temporary Redirect (only if POST)&lt;br /&gt;
* 404 Not Found&lt;br /&gt;
* 406 Not Acceptable&lt;br /&gt;
* 407 Proxy Authentication Required&lt;br /&gt;
* 409 Conflict&lt;br /&gt;
* 412 Precondition Failed&lt;br /&gt;
* 500 Internal Server Error&lt;br /&gt;
&lt;br /&gt;
= Related Technologies =&lt;br /&gt;
I believe that all competitors to this fall into one of three categories, specialized message queues, reliable logic tunneled through HTTP, and delivery over HTTP with setup charges.&lt;br /&gt;
&lt;br /&gt;
== traditional message queue technology ==&lt;br /&gt;
This includes products like [http://www-306.ibm.com/software/integration/wmq/ MQ], [http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx MSMQ], and [http://activemq.apache.org/ ActiveMQ].&lt;br /&gt;
&lt;br /&gt;
These technologies are useful, but provide a number of hurdles:&lt;br /&gt;
* No common standards.&lt;br /&gt;
* Integrates a new technology with unknown performance characteristics.&lt;br /&gt;
* Requires significant operational overhead.&lt;br /&gt;
&lt;br /&gt;
Because of this, we have opted to use HTTP as a foundation of the technology.&lt;br /&gt;
&lt;br /&gt;
== reliable application logic in body ==&lt;br /&gt;
This includes technologies like [http://www.ibm.com/developerworks/library/ws-httprspec/ httpr] and [http://www.ibm.com/developerworks/library/specification/ws-rm/ ws-reliable].&lt;br /&gt;
&lt;br /&gt;
These tend to be thoroughly engineered protocol specifications which regrettably repeat the mistakes of the nearly defunct XMLRPC and the soon to join it SOAP -- namely, treating services as a function call. This is a reasonable approach, and is probably the most obvious to the engineers working on the problem. The most obvious path, which is followed in both of the examples, is to package a traditional message queue body into an HTTP body sent via POST. Treating web services as function calls severely limits the expressive nature of HTTP and should be avoided.&lt;br /&gt;
&lt;br /&gt;
Consumers of web services prefer REST APIs rather than function calls over HTTP. I believe this is because REST is inherently more comprehensible to consumers since all of the data is data the consumer requested. In one telling data point, Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface[http://www.oreillynet.com/pub/wlg/3005]. I believe ceding power to the consumer is the only path to make wide adoption possible. In doing so, we must drop the entire concept of burying data the consumer wants inside application data.&lt;br /&gt;
&lt;br /&gt;
== reliable delivery after setup ==&lt;br /&gt;
There appear to be a few proposals of this nature around the web and a shining example can be found in [http://www.dehora.net/doc/httplr/draft-httplr-01.html httplr].&lt;br /&gt;
&lt;br /&gt;
These are http reliability mechanisms which require a round trip to begin the reliable transfer and then follow through with some permutation of acknowledging the transfer. This setup can be cheap since the setup does not have the same reliability constraints as long as all clients correctly handle 404. Also, some of this overhead can be optimized away by batching the setup requests.&lt;br /&gt;
&lt;br /&gt;
However, a protocol which requires setup for all messaging will always be more expensive than other options.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44713</id>
		<title>Certified HTTP</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44713"/>
		<updated>2007-12-13T22:40:42Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Retry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;&amp;lt; Back to [[Certified HTTP Project]]&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
The basic goal of Certified HTTP (colloquially known as chttp) is to perform exactly-once messaging between two hosts.&lt;br /&gt;
&lt;br /&gt;
From a standard http client perspective, if the client reads a whole response, then it knows for certain the server handled the request. However, for all other failure modes, the client can&#039;t be sure if the server did, or did-not perform the request function. On the server side, the server can never know if the client ever got the answer or not. For some operations, we need the ability for the client to perform a data-altering operation and be insistent that it occur. In particular, if it isn&#039;t certain that it happened, then it must be able to try again safely.&lt;br /&gt;
&lt;br /&gt;
The bigger picture goal is to make a simple way to conduct reliable delivery and receipt such that general adoption by the wider community is possible. This means that we have to respect HTTP where we can to take advantage of existing tools and methodology and to never contradict common conventions in a REST world.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Join the [https://lists.secondlife.com/cgi-bin/mailman/listinfo/chttpdev mailing list].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Workflow =&lt;br /&gt;
&lt;br /&gt;
The workflow is a specification/pseudocode for what actions both ends of chttp communication need to take to fulfill the requirements.&lt;br /&gt;
&lt;br /&gt;
== Interaction Sequence ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a diagram that describes an everything-works certified http communication.&lt;br /&gt;
&lt;br /&gt;
[[Image:Interaction_sequence.png]]&lt;br /&gt;
&lt;br /&gt;
Of note are the failure points.  These are the effective crash locations of the participants (the failure points on the arrows represent communication failures).  Actions that intervene between two failure points should be deterministic and/or atomic enough that a crash occurring midway through them is functionally identical to a crash occurring at the immediately prior failure point.&lt;br /&gt;
&lt;br /&gt;
The [[Certified HTTP Failure Diagrams]] page (warning: &#039;&#039;&#039;very&#039;&#039;&#039; image-heavy) has a relatively-exhaustive exploration of the way a Certified HTTP implementation should behave in the face of failures.&lt;br /&gt;
&lt;br /&gt;
== Sending a Message ==&lt;br /&gt;
&lt;br /&gt;
The sending-side API looks very much like a normal HTTP method call:&lt;br /&gt;
  response = certified_http.put(url, body)&lt;br /&gt;
&lt;br /&gt;
What happens under the covers is:&lt;br /&gt;
# Generate a globally unique message ID for the message&lt;br /&gt;
# Store the outgoing request (headers and all), including the message id, in a durable store &amp;quot;outbox&amp;quot;, and waits for a response.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Retrieves the request from the outbox.&lt;br /&gt;
## Performs the HTTP request specified by the outbox request and waits for a response.&lt;br /&gt;
## If a response is not forthcoming, for whatever reason, the process retries after a certain period.&lt;br /&gt;
## If the server sends an error code that indicates that the reliable message will never complete (e.g. 501), or a long timeout expires indicating that an absurd amount of time has elapsed, the method throws an exception.&lt;br /&gt;
# Opens a transaction on the durable store&lt;br /&gt;
# Stores the incoming response in a durable inbox.&lt;br /&gt;
# &#039;Tombstones&#039; the message in the outbox, which essentially marks the message as having been received, so that if the application resumes again, it doesn&#039;t resend.&lt;br /&gt;
# Closes the transaction on the durable store&lt;br /&gt;
# If the response contains a header indicating a confirmation url on the recipient, performs an HTTP DELETE on the resource to ack the incoming message.&lt;br /&gt;
&lt;br /&gt;
There are no explicit semantics for the response body, like HTTP itself.  The content will vary depending on the application.&lt;br /&gt;
&lt;br /&gt;
== Receiving a Message ==&lt;br /&gt;
&lt;br /&gt;
The receiver sets up a node in the url hierarchy, just like a regular http node.  When an incoming request comes in, the receiver:&lt;br /&gt;
&lt;br /&gt;
# Stores the incoming request in a durable store &amp;quot;inbox&amp;quot;, if it doesn&#039;t already contain a message with the same ID.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Looks for responses in the outbox matching the incoming message id, and if it finds one, sends it as the response without invoking anything else.&lt;br /&gt;
## Opens a transaction on the database, locking the inbox request&lt;br /&gt;
## Calls the handler method on the receiving node:&lt;br /&gt;
### &amp;lt;code&amp;gt;def handle_put(body, txn):&amp;lt;br/&amp;gt;return &amp;quot;My Response&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
### The handler method can use the open transaction to perform actions in the database that are atomic with the receipt of the message.  Any non-idempotent operation must be done atomically in this way.&lt;br /&gt;
## Stores the return value of the handle method as an outgoing response in the outbox, without closing the transaction. &lt;br /&gt;
## Removes the incoming request from the inbox&lt;br /&gt;
## Closes the transaction&lt;br /&gt;
# Discovers a new item in the outbox, responds to the incoming http request with the response from the outbox, including a url that, if DELETEd, will remove the item from the outbox.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
We have the concept of a &amp;quot;long&amp;quot; time (LT).  The purpose of this time is to ensure that any clients will stop trying a particular request long before the server discards state associated with the request.  This is not a very theoretically &amp;quot;pure&amp;quot; concept, since it relies on all parties conforming to certain (reasonable) assumptions, but we believe that we get significant benefits (lack of explicit negotiation), at little risk of actually entering an incorrect state.   chttp is expected to generate a small amount of bookkeeping data for each message, and there needs to be a way to expire this data in a way that doesn&#039;t involve additional negotiation between servers and clients.  The server should keep data for LT, and clients should not retry messages that are older than LT/2 or similar, so that there is at least LT/2 for a Reliable Host to recover from errors, and LT/2 for clock skew.  LT therefore should be orders of magnitude longer than the longest downtime we expect to see in the system and the largest clock skew we expect to see.  Off the cuff, 30 days seems like a reasonable value for LT.&lt;br /&gt;
&lt;br /&gt;
* chttp is based on http, and can use any facility provided by http 1.1 where not otherwise contradicted.&lt;br /&gt;
** this includes the use of https, pipelining, chunked encoding, proxies, redirects, caches, and headers such as Accept, Accept-Encoding, Expect, and Content-Type.&lt;br /&gt;
** any normal http verb appropriate to context should be accepted, eg POST, PUT, GET, DELETE&lt;br /&gt;
** unless otherwise specified, the http feature set in use is orthogonal and effectively transparent to chttp&lt;br /&gt;
* in any complete chttp exchange the client and server can eventually agree on success or failure of delivery, though it is more important that no ill effects arise when they disagree&lt;br /&gt;
* any message will be effectively received once and only once or not at all&lt;br /&gt;
* the content of the http body must be opaque to chttp&lt;br /&gt;
* the URI of the original request must be opaque to chttp&lt;br /&gt;
* chttp enabled clients and servers can integrate with unreliable tools&lt;br /&gt;
** the chttp server can differentiate reliable requests and respond without reliability guarantees (i.e. act as a normal http server)&lt;br /&gt;
** chttp clients can differentiate reliable responses and handle unreliable servers (i.e. act as a normal http client)&lt;br /&gt;
* the client will persist the local time of sending&lt;br /&gt;
* if there is one the client must either have the persisted outgoing body or the exact same body can be regenerated on the fly&lt;br /&gt;
* the server will persist the local time of message receipt&lt;br /&gt;
* the server must persist the response body or have a mechanism to idempotently generate the same response to the same request&lt;br /&gt;
* all urls with a chttp server behind them are effectively idempotent for all uniquely identified messages&lt;br /&gt;
** the client can retry steadily over a period of LT/2 days&lt;br /&gt;
** the client and server are assumed to almost always be running&lt;br /&gt;
** over that window of opportunity, the same message will always get the same response&lt;br /&gt;
* all persisted data on a single host is ACID&lt;br /&gt;
&lt;br /&gt;
== requirements on top of http ==&lt;br /&gt;
* if the body of the request is non-zero length, the client MUST include a Content-Length header, unless prohibited by section 4.4 of [http://www.w3.org/Protocols/rfc2616/rfc2616.html RFC 2616]&lt;br /&gt;
** the server will look for \r\n\r\n and content length body to consider the request complete&lt;br /&gt;
** an incomplete request will result in 4XX status code&lt;br /&gt;
* if the body of the response is non-zero length, the server must include a Content-Length header&lt;br /&gt;
** the client will look for \r\n\r\n and content length body to consider the response complete&lt;br /&gt;
** the client will retry on an incomplete response&lt;br /&gt;
* Messages can not be terminated by closing the connection -- only positive expressions of message termination (such as Content-Length) can guarantee that a full message is received.&lt;br /&gt;
&lt;br /&gt;
== assumptions ==&lt;br /&gt;
&lt;br /&gt;
* The client and server will not have any significant time discontinuity, i.e., the clock difference between them should be less than LT/100.&lt;br /&gt;
* The client and server will not have clock drift more than LT/100 per day.&lt;br /&gt;
* Both parties exchanging messages are Reliable Hosts (defined below).&lt;br /&gt;
* Generating a globally unique message ID is inexpensive.&lt;br /&gt;
* It is possible to store a large amount of &#039;small&#039; data (such as [[UUID]]s, urls, and date/timestamps) for LT.  &amp;quot;Large&amp;quot; in this case means &amp;quot;as many items as the throughput of a host implies that you could create during LT&amp;quot;.  In other words, storing this small data will never be a resource problem.&lt;br /&gt;
* Any transaction or data handled by this system will become useless well before LT has elapsed.  &lt;br /&gt;
&lt;br /&gt;
; Reliable Host : A reliable host has the following properties:&lt;br /&gt;
* The host has a durable data store of finite size, which can store data in such a way that it is guaranteed to be recoverable even in the face of a certain number of hardware failures.&lt;br /&gt;
* The host will not be down forever.  Either a clone will be brought up on different hardware, or the machine itself will reappear within a day or so. &lt;br /&gt;
* The host can perform {{Wikipedia|ACID|w=n}} operations on the data it contains.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Requiring an opaque body and URI pretty much requires either negotiating an URL beforehand or adding new headers. Since the former was discarded earlier (reliable delivery after setup), we will focus on adding request and response headers.&lt;br /&gt;
&lt;br /&gt;
This is a suggested implementation:&lt;br /&gt;
# chttp enabled servers will behave idempotently with a unique message id on the request&lt;br /&gt;
# the server can request acknowledgment from the client if the request consumes server resources&lt;br /&gt;
&lt;br /&gt;
== Request ==&lt;br /&gt;
A client will start a reliable message by making an HTTP request to a url on a reliable http server. The url may be known in advance or returned as part of an earlier application protocol exchange.  The request must contain two headers on top of the headers required by HTTP/1.1: X-Message-Id and Date.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-ID ===&lt;br /&gt;
A globally unique id.  It must match the regular expression &amp;lt;code&amp;gt;^[A-Za-z0-9-_:]{30,100}$&amp;lt;/code&amp;gt;.  This header is required for all Certified HTTP interactions.&lt;br /&gt;
&lt;br /&gt;
The best practice for generating this id is to combine a client host identifier with a cryptographically secure uuid and a sequence number.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but a a different body has an undefined result.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but with a different header which implies a different response body, eg, the first request specifies &amp;quot;Accept: text/plain&amp;quot; and the second request specifies &amp;quot;Accept: text/html&amp;quot;, the response can be one of:&lt;br /&gt;
&lt;br /&gt;
* The original response.&lt;br /&gt;
* A 4xx indicating that the server has detected the incompatability&lt;br /&gt;
&lt;br /&gt;
It is preferable to return the original response rather than the 4xx, but some implementations may not be able to achieve that.&lt;br /&gt;
&lt;br /&gt;
=== Date ===&lt;br /&gt;
&lt;br /&gt;
The Date header, as specified in RFC2616.  Certified HTTP requires a date header on all requests, which differs somewhat from RFC2616.&lt;br /&gt;
&lt;br /&gt;
== Response ==&lt;br /&gt;
Generally, when the client gets the 2XX back from the server, the message has been delivered. If the server has a response body, then the client will need to acknowledge receipt of the entire body. If the entire body is not read, the client can safely resubmit the exact same request. The server will include a message url in the headers if the client specified a message id on request and the body requires persistence by the server.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-URL ===&lt;br /&gt;
This will be a unique url on the server for the client message id which the client will DELETE upon receipt of the entire response to the request. This will only exist if there is a non-null response body or the server is consuming significant resources to maintain that url. When the client performs the delete, the server can flush all persisted resources other than the fact that the message was sent at some point.&lt;br /&gt;
&lt;br /&gt;
== Status Codes ==&lt;br /&gt;
&lt;br /&gt;
The semantics of Certified HTTP are to retry until the message goes through.  HTTP status codes provide one way of determining whether the message made it or not;  we&#039;ve grouped these status codes into &#039;success&#039; or &#039;retry&#039;.   In many cases they can signify that the client is attempting to send an invalid message, an error in the application logic; these are labeled as &#039;fail&#039;.  There is a third class, where the status code may be ambiguous; e.g. 404, which is often emitted by temporarily-misconfigured webservers, but may also indicate that an incorrect url was chosen.&lt;br /&gt;
&lt;br /&gt;
=== Success ===&lt;br /&gt;
&lt;br /&gt;
These status codes, when received, give the client permission to do whatever cleanup it needs to do, and to return to caller, safe in the assumption that the message was delivered.&lt;br /&gt;
&lt;br /&gt;
* 200 OK&lt;br /&gt;
* 201 Created&lt;br /&gt;
* 203 Non-Authoritative Information&lt;br /&gt;
* 204 No Content&lt;br /&gt;
* 205 Reset Content&lt;br /&gt;
* 206 Partial Content&lt;br /&gt;
* 304 Not Modified&lt;br /&gt;
&lt;br /&gt;
=== Retry ===&lt;br /&gt;
&lt;br /&gt;
These status codes indicate a temporary failure or misconfiguration on the server side, and therefore the client should retry until it gets something different.  All the redirected/proxied messages carry the same message-id.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|+ Retry codes&lt;br /&gt;
|-&lt;br /&gt;
! Status code&lt;br /&gt;
! Desired behaviour&lt;br /&gt;
! Implementation&lt;br /&gt;
|-&lt;br /&gt;
| 202 Accepted&lt;br /&gt;
| potentially delaying longer than normal&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 300 Multiple Choices&lt;br /&gt;
| follow redirect&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 301 Moved Permanently&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 302 Found&lt;br /&gt;
| follow redirect&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 303 See Other&lt;br /&gt;
| retry, using GET&lt;br /&gt;
| &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 305 Use Proxy&lt;br /&gt;
| use proxy&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|- 307 Temporary Redirect&lt;br /&gt;
| follow redirect only if GET&lt;br /&gt;
| not correct (doesn&#039;t check for GET)&lt;br /&gt;
|-&lt;br /&gt;
| 408 Request Timeout&lt;br /&gt;
| retry with a new message-id and date&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 413 Request Entity Too Large&lt;br /&gt;
| if Retry-After header present&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 502 Bad Gateway&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 503 Service Unavailable&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 504 Gateway Timeout&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Fail ===&lt;br /&gt;
&lt;br /&gt;
If your application logic screws up and picks an improper content-type or messes up the url, then the Certified HTTP subsystem shouldn&#039;t be burdened with retrying forever for a message that will never be delivered.  If it receives these status codes, it will raise an exception to the caller and nuke the outgoing request.&lt;br /&gt;
&lt;br /&gt;
* 400 Bad Request&lt;br /&gt;
* 401 Unauthorized&lt;br /&gt;
* 402 Payment Required&lt;br /&gt;
* 403 Forbidden&lt;br /&gt;
* 410 Gone&lt;br /&gt;
* 411 Length Required&lt;br /&gt;
* 413 Request Entity Too Large (if no Retry-After header present)&lt;br /&gt;
* 414 Request-URI Too Long&lt;br /&gt;
* 415 Unsupported Media Type&lt;br /&gt;
* 416 Requested Range Not Satisfiable&lt;br /&gt;
* 417 Expectation Failed&lt;br /&gt;
* 501 Not Implemented&lt;br /&gt;
* 505 HTTP Version Not Supported&lt;br /&gt;
&lt;br /&gt;
=== Ambiguous ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s a little ambiguous what to do when the client gets one of these status codes, so we think that the application should decide.  There are a few ways to do that:&lt;br /&gt;
# The client raises an exception with a retry() method that can be caught by the application, and retried if the application determines that the exception represented a temporary failure.&lt;br /&gt;
# The application passes a list to the Certified HTTP subsystem that sorts these status codes into &#039;retry&#039; or &#039;fail&#039;.&lt;br /&gt;
# The subsystem uses a heuristic such as retrying for a short period of time then converting to a Fail if still not successful.&lt;br /&gt;
Here&#039;s the list of status codes:&lt;br /&gt;
&lt;br /&gt;
* 303 See Other (retry will use GET even if original used POST)&lt;br /&gt;
* 307 Temporary Redirect (only if POST)&lt;br /&gt;
* 404 Not Found&lt;br /&gt;
* 406 Not Acceptable&lt;br /&gt;
* 407 Proxy Authentication Required&lt;br /&gt;
* 409 Conflict&lt;br /&gt;
* 412 Precondition Failed&lt;br /&gt;
* 500 Internal Server Error&lt;br /&gt;
&lt;br /&gt;
= Related Technologies =&lt;br /&gt;
I believe that all competitors to this fall into one of three categories, specialized message queues, reliable logic tunneled through HTTP, and delivery over HTTP with setup charges.&lt;br /&gt;
&lt;br /&gt;
== traditional message queue technology ==&lt;br /&gt;
This includes products like [http://www-306.ibm.com/software/integration/wmq/ MQ], [http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx MSMQ], and [http://activemq.apache.org/ ActiveMQ].&lt;br /&gt;
&lt;br /&gt;
These technologies are useful, but provide a number of hurdles:&lt;br /&gt;
* No common standards.&lt;br /&gt;
* Integrates a new technology with unknown performance characteristics.&lt;br /&gt;
* Requires significant operational overhead.&lt;br /&gt;
&lt;br /&gt;
Because of this, we have opted to use HTTP as a foundation of the technology.&lt;br /&gt;
&lt;br /&gt;
== reliable application logic in body ==&lt;br /&gt;
This includes technologies like [http://www.ibm.com/developerworks/library/ws-httprspec/ httpr] and [http://www.ibm.com/developerworks/library/specification/ws-rm/ ws-reliable].&lt;br /&gt;
&lt;br /&gt;
These tend to be thoroughly engineered protocol specifications which regrettably repeat the mistakes of the nearly defunct XMLRPC and the soon to join it SOAP -- namely, treating services as a function call. This is a reasonable approach, and is probably the most obvious to the engineers working on the problem. The most obvious path, which is followed in both of the examples, is to package a traditional message queue body into an HTTP body sent via POST. Treating web services as function calls severely limits the expressive nature of HTTP and should be avoided.&lt;br /&gt;
&lt;br /&gt;
Consumers of web services prefer REST APIs rather than function calls over HTTP. I believe this is because REST is inherently more comprehensible to consumers since all of the data is data the consumer requested. In one telling data point, Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface[http://www.oreillynet.com/pub/wlg/3005]. I believe ceding power to the consumer is the only path to make wide adoption possible. In doing so, we must drop the entire concept of burying data the consumer wants inside application data.&lt;br /&gt;
&lt;br /&gt;
== reliable delivery after setup ==&lt;br /&gt;
There appear to be a few proposals of this nature around the web and a shining example can be found in [http://www.dehora.net/doc/httplr/draft-httplr-01.html httplr].&lt;br /&gt;
&lt;br /&gt;
These are http reliability mechanisms which require a round trip to begin the reliable transfer and then follow through with some permutation of acknowledging the transfer. This setup can be cheap since the setup does not have the same reliability constraints as long as all clients correctly handle 404. Also, some of this overhead can be optimized away by batching the setup requests.&lt;br /&gt;
&lt;br /&gt;
However, a protocol which requires setup for all messaging will always be more expensive than other options.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44712</id>
		<title>Certified HTTP</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Certified_HTTP&amp;diff=44712"/>
		<updated>2007-12-13T22:23:42Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Retry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;&amp;lt; Back to [[Certified HTTP Project]]&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
The basic goal of Certified HTTP (colloquially known as chttp) is to perform exactly-once messaging between two hosts.&lt;br /&gt;
&lt;br /&gt;
From a standard http client perspective, if the client reads a whole response, then it knows for certain the server handled the request. However, for all other failure modes, the client can&#039;t be sure if the server did, or did-not perform the request function. On the server side, the server can never know if the client ever got the answer or not. For some operations, we need the ability for the client to perform a data-altering operation and be insistent that it occur. In particular, if it isn&#039;t certain that it happened, then it must be able to try again safely.&lt;br /&gt;
&lt;br /&gt;
The bigger picture goal is to make a simple way to conduct reliable delivery and receipt such that general adoption by the wider community is possible. This means that we have to respect HTTP where we can to take advantage of existing tools and methodology and to never contradict common conventions in a REST world.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Join the [https://lists.secondlife.com/cgi-bin/mailman/listinfo/chttpdev mailing list].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Workflow =&lt;br /&gt;
&lt;br /&gt;
The workflow is a specification/pseudocode for what actions both ends of chttp communication need to take to fulfill the requirements.&lt;br /&gt;
&lt;br /&gt;
== Interaction Sequence ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a diagram that describes an everything-works certified http communication.&lt;br /&gt;
&lt;br /&gt;
[[Image:Interaction_sequence.png]]&lt;br /&gt;
&lt;br /&gt;
Of note are the failure points.  These are the effective crash locations of the participants (the failure points on the arrows represent communication failures).  Actions that intervene between two failure points should be deterministic and/or atomic enough that a crash occurring midway through them is functionally identical to a crash occurring at the immediately prior failure point.&lt;br /&gt;
&lt;br /&gt;
The [[Certified HTTP Failure Diagrams]] page (warning: &#039;&#039;&#039;very&#039;&#039;&#039; image-heavy) has a relatively-exhaustive exploration of the way a Certified HTTP implementation should behave in the face of failures.&lt;br /&gt;
&lt;br /&gt;
== Sending a Message ==&lt;br /&gt;
&lt;br /&gt;
The sending-side API looks very much like a normal HTTP method call:&lt;br /&gt;
  response = certified_http.put(url, body)&lt;br /&gt;
&lt;br /&gt;
What happens under the covers is:&lt;br /&gt;
# Generate a globally unique message ID for the message&lt;br /&gt;
# Store the outgoing request (headers and all), including the message id, in a durable store &amp;quot;outbox&amp;quot;, and waits for a response.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Retrieves the request from the outbox.&lt;br /&gt;
## Performs the HTTP request specified by the outbox request and waits for a response.&lt;br /&gt;
## If a response is not forthcoming, for whatever reason, the process retries after a certain period.&lt;br /&gt;
## If the server sends an error code that indicates that the reliable message will never complete (e.g. 501), or a long timeout expires indicating that an absurd amount of time has elapsed, the method throws an exception.&lt;br /&gt;
# Opens a transaction on the durable store&lt;br /&gt;
# Stores the incoming response in a durable inbox.&lt;br /&gt;
# &#039;Tombstones&#039; the message in the outbox, which essentially marks the message as having been received, so that if the application resumes again, it doesn&#039;t resend.&lt;br /&gt;
# Closes the transaction on the durable store&lt;br /&gt;
# If the response contains a header indicating a confirmation url on the recipient, performs an HTTP DELETE on the resource to ack the incoming message.&lt;br /&gt;
&lt;br /&gt;
There are no explicit semantics for the response body, like HTTP itself.  The content will vary depending on the application.&lt;br /&gt;
&lt;br /&gt;
== Receiving a Message ==&lt;br /&gt;
&lt;br /&gt;
The receiver sets up a node in the url hierarchy, just like a regular http node.  When an incoming request comes in, the receiver:&lt;br /&gt;
&lt;br /&gt;
# Stores the incoming request in a durable store &amp;quot;inbox&amp;quot;, if it doesn&#039;t already contain a message with the same ID.&lt;br /&gt;
# A potentially asynchronous process performs the following steps:&lt;br /&gt;
## Looks for responses in the outbox matching the incoming message id, and if it finds one, sends it as the response without invoking anything else.&lt;br /&gt;
## Opens a transaction on the database, locking the inbox request&lt;br /&gt;
## Calls the handler method on the receiving node:&lt;br /&gt;
### &amp;lt;code&amp;gt;def handle_put(body, txn):&amp;lt;br/&amp;gt;return &amp;quot;My Response&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
### The handler method can use the open transaction to perform actions in the database that are atomic with the receipt of the message.  Any non-idempotent operation must be done atomically in this way.&lt;br /&gt;
## Stores the return value of the handle method as an outgoing response in the outbox, without closing the transaction. &lt;br /&gt;
## Removes the incoming request from the inbox&lt;br /&gt;
## Closes the transaction&lt;br /&gt;
# Discovers a new item in the outbox, responds to the incoming http request with the response from the outbox, including a url that, if DELETEd, will remove the item from the outbox.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
We have the concept of a &amp;quot;long&amp;quot; time (LT).  The purpose of this time is to ensure that any clients will stop trying a particular request long before the server discards state associated with the request.  This is not a very theoretically &amp;quot;pure&amp;quot; concept, since it relies on all parties conforming to certain (reasonable) assumptions, but we believe that we get significant benefits (lack of explicit negotiation), at little risk of actually entering an incorrect state.   chttp is expected to generate a small amount of bookkeeping data for each message, and there needs to be a way to expire this data in a way that doesn&#039;t involve additional negotiation between servers and clients.  The server should keep data for LT, and clients should not retry messages that are older than LT/2 or similar, so that there is at least LT/2 for a Reliable Host to recover from errors, and LT/2 for clock skew.  LT therefore should be orders of magnitude longer than the longest downtime we expect to see in the system and the largest clock skew we expect to see.  Off the cuff, 30 days seems like a reasonable value for LT.&lt;br /&gt;
&lt;br /&gt;
* chttp is based on http, and can use any facility provided by http 1.1 where not otherwise contradicted.&lt;br /&gt;
** this includes the use of https, pipelining, chunked encoding, proxies, redirects, caches, and headers such as Accept, Accept-Encoding, Expect, and Content-Type.&lt;br /&gt;
** any normal http verb appropriate to context should be accepted, eg POST, PUT, GET, DELETE&lt;br /&gt;
** unless otherwise specified, the http feature set in use is orthogonal and effectively transparent to chttp&lt;br /&gt;
* in any complete chttp exchange the client and server can eventually agree on success or failure of delivery, though it is more important that no ill effects arise when they disagree&lt;br /&gt;
* any message will be effectively received once and only once or not at all&lt;br /&gt;
* the content of the http body must be opaque to chttp&lt;br /&gt;
* the URI of the original request must be opaque to chttp&lt;br /&gt;
* chttp enabled clients and servers can integrate with unreliable tools&lt;br /&gt;
** the chttp server can differentiate reliable requests and respond without reliability guarantees (i.e. act as a normal http server)&lt;br /&gt;
** chttp clients can differentiate reliable responses and handle unreliable servers (i.e. act as a normal http client)&lt;br /&gt;
* the client will persist the local time of sending&lt;br /&gt;
* if there is one the client must either have the persisted outgoing body or the exact same body can be regenerated on the fly&lt;br /&gt;
* the server will persist the local time of message receipt&lt;br /&gt;
* the server must persist the response body or have a mechanism to idempotently generate the same response to the same request&lt;br /&gt;
* all urls with a chttp server behind them are effectively idempotent for all uniquely identified messages&lt;br /&gt;
** the client can retry steadily over a period of LT/2 days&lt;br /&gt;
** the client and server are assumed to almost always be running&lt;br /&gt;
** over that window of opportunity, the same message will always get the same response&lt;br /&gt;
* all persisted data on a single host is ACID&lt;br /&gt;
&lt;br /&gt;
== requirements on top of http ==&lt;br /&gt;
* if the body of the request is non-zero length, the client MUST include a Content-Length header, unless prohibited by section 4.4 of [http://www.w3.org/Protocols/rfc2616/rfc2616.html RFC 2616]&lt;br /&gt;
** the server will look for \r\n\r\n and content length body to consider the request complete&lt;br /&gt;
** an incomplete request will result in 4XX status code&lt;br /&gt;
* if the body of the response is non-zero length, the server must include a Content-Length header&lt;br /&gt;
** the client will look for \r\n\r\n and content length body to consider the response complete&lt;br /&gt;
** the client will retry on an incomplete response&lt;br /&gt;
* Messages can not be terminated by closing the connection -- only positive expressions of message termination (such as Content-Length) can guarantee that a full message is received.&lt;br /&gt;
&lt;br /&gt;
== assumptions ==&lt;br /&gt;
&lt;br /&gt;
* The client and server will not have any significant time discontinuity, i.e., the clock difference between them should be less than LT/100.&lt;br /&gt;
* The client and server will not have clock drift more than LT/100 per day.&lt;br /&gt;
* Both parties exchanging messages are Reliable Hosts (defined below).&lt;br /&gt;
* Generating a globally unique message ID is inexpensive.&lt;br /&gt;
* It is possible to store a large amount of &#039;small&#039; data (such as [[UUID]]s, urls, and date/timestamps) for LT.  &amp;quot;Large&amp;quot; in this case means &amp;quot;as many items as the throughput of a host implies that you could create during LT&amp;quot;.  In other words, storing this small data will never be a resource problem.&lt;br /&gt;
* Any transaction or data handled by this system will become useless well before LT has elapsed.  &lt;br /&gt;
&lt;br /&gt;
; Reliable Host : A reliable host has the following properties:&lt;br /&gt;
* The host has a durable data store of finite size, which can store data in such a way that it is guaranteed to be recoverable even in the face of a certain number of hardware failures.&lt;br /&gt;
* The host will not be down forever.  Either a clone will be brought up on different hardware, or the machine itself will reappear within a day or so. &lt;br /&gt;
* The host can perform {{Wikipedia|ACID|w=n}} operations on the data it contains.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Requiring an opaque body and URI pretty much requires either negotiating an URL beforehand or adding new headers. Since the former was discarded earlier (reliable delivery after setup), we will focus on adding request and response headers.&lt;br /&gt;
&lt;br /&gt;
This is a suggested implementation:&lt;br /&gt;
# chttp enabled servers will behave idempotently with a unique message id on the request&lt;br /&gt;
# the server can request acknowledgment from the client if the request consumes server resources&lt;br /&gt;
&lt;br /&gt;
== Request ==&lt;br /&gt;
A client will start a reliable message by making an HTTP request to a url on a reliable http server. The url may be known in advance or returned as part of an earlier application protocol exchange.  The request must contain two headers on top of the headers required by HTTP/1.1: X-Message-Id and Date.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-ID ===&lt;br /&gt;
A globally unique id.  It must match the regular expression &amp;lt;code&amp;gt;^[A-Za-z0-9-_:]{30,100}$&amp;lt;/code&amp;gt;.  This header is required for all Certified HTTP interactions.&lt;br /&gt;
&lt;br /&gt;
The best practice for generating this id is to combine a client host identifier with a cryptographically secure uuid and a sequence number.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but a a different body has an undefined result.&lt;br /&gt;
&lt;br /&gt;
Sending a message with the same message id but with a different header which implies a different response body, eg, the first request specifies &amp;quot;Accept: text/plain&amp;quot; and the second request specifies &amp;quot;Accept: text/html&amp;quot;, the response can be one of:&lt;br /&gt;
&lt;br /&gt;
* The original response.&lt;br /&gt;
* A 4xx indicating that the server has detected the incompatability&lt;br /&gt;
&lt;br /&gt;
It is preferable to return the original response rather than the 4xx, but some implementations may not be able to achieve that.&lt;br /&gt;
&lt;br /&gt;
=== Date ===&lt;br /&gt;
&lt;br /&gt;
The Date header, as specified in RFC2616.  Certified HTTP requires a date header on all requests, which differs somewhat from RFC2616.&lt;br /&gt;
&lt;br /&gt;
== Response ==&lt;br /&gt;
Generally, when the client gets the 2XX back from the server, the message has been delivered. If the server has a response body, then the client will need to acknowledge receipt of the entire body. If the entire body is not read, the client can safely resubmit the exact same request. The server will include a message url in the headers if the client specified a message id on request and the body requires persistence by the server.&lt;br /&gt;
&lt;br /&gt;
=== X-Message-URL ===&lt;br /&gt;
This will be a unique url on the server for the client message id which the client will DELETE upon receipt of the entire response to the request. This will only exist if there is a non-null response body or the server is consuming significant resources to maintain that url. When the client performs the delete, the server can flush all persisted resources other than the fact that the message was sent at some point.&lt;br /&gt;
&lt;br /&gt;
== Status Codes ==&lt;br /&gt;
&lt;br /&gt;
The semantics of Certified HTTP are to retry until the message goes through.  HTTP status codes provide one way of determining whether the message made it or not;  we&#039;ve grouped these status codes into &#039;success&#039; or &#039;retry&#039;.   In many cases they can signify that the client is attempting to send an invalid message, an error in the application logic; these are labeled as &#039;fail&#039;.  There is a third class, where the status code may be ambiguous; e.g. 404, which is often emitted by temporarily-misconfigured webservers, but may also indicate that an incorrect url was chosen.&lt;br /&gt;
&lt;br /&gt;
=== Success ===&lt;br /&gt;
&lt;br /&gt;
These status codes, when received, give the client permission to do whatever cleanup it needs to do, and to return to caller, safe in the assumption that the message was delivered.&lt;br /&gt;
&lt;br /&gt;
* 200 OK&lt;br /&gt;
* 201 Created&lt;br /&gt;
* 203 Non-Authoritative Information&lt;br /&gt;
* 204 No Content&lt;br /&gt;
* 205 Reset Content&lt;br /&gt;
* 206 Partial Content&lt;br /&gt;
* 304 Not Modified&lt;br /&gt;
&lt;br /&gt;
=== Retry ===&lt;br /&gt;
&lt;br /&gt;
These status codes indicate a temporary failure or misconfiguration on the server side, and therefore the client should retry until it gets something different.  All the redirected/proxied messages carry the same message-id.&lt;br /&gt;
&lt;br /&gt;
* 202 Accepted&lt;br /&gt;
** potentially delaying longer than normal&lt;br /&gt;
* 300 Multiple Choices&lt;br /&gt;
** follow redirect&lt;br /&gt;
* 301 Moved Permanently&lt;br /&gt;
** follow redirect&lt;br /&gt;
** &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
* 302 Found&lt;br /&gt;
** follow redirect&lt;br /&gt;
** &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
* 303 See Other&lt;br /&gt;
** retry, using GET&lt;br /&gt;
** &amp;lt;b&amp;gt;done&amp;lt;/b&amp;gt;&lt;br /&gt;
* 305 Use Proxy&lt;br /&gt;
** use proxy&lt;br /&gt;
* 307 Temporary Redirect&lt;br /&gt;
** follow redirect only if GET&lt;br /&gt;
** not correct (doesn&#039;t check for GET)&lt;br /&gt;
* 408 Request Timeout&lt;br /&gt;
** retry with a new message-id and date&lt;br /&gt;
* 413 Request Entity Too Large&lt;br /&gt;
** if Retry-After header present&lt;br /&gt;
* 502 Bad Gateway&lt;br /&gt;
* 503 Service Unavailable&lt;br /&gt;
* 504 Gateway Timeout&lt;br /&gt;
&lt;br /&gt;
=== Fail ===&lt;br /&gt;
&lt;br /&gt;
If your application logic screws up and picks an improper content-type or messes up the url, then the Certified HTTP subsystem shouldn&#039;t be burdened with retrying forever for a message that will never be delivered.  If it receives these status codes, it will raise an exception to the caller and nuke the outgoing request.&lt;br /&gt;
&lt;br /&gt;
* 400 Bad Request&lt;br /&gt;
* 401 Unauthorized&lt;br /&gt;
* 402 Payment Required&lt;br /&gt;
* 403 Forbidden&lt;br /&gt;
* 410 Gone&lt;br /&gt;
* 411 Length Required&lt;br /&gt;
* 413 Request Entity Too Large (if no Retry-After header present)&lt;br /&gt;
* 414 Request-URI Too Long&lt;br /&gt;
* 415 Unsupported Media Type&lt;br /&gt;
* 416 Requested Range Not Satisfiable&lt;br /&gt;
* 417 Expectation Failed&lt;br /&gt;
* 501 Not Implemented&lt;br /&gt;
* 505 HTTP Version Not Supported&lt;br /&gt;
&lt;br /&gt;
=== Ambiguous ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s a little ambiguous what to do when the client gets one of these status codes, so we think that the application should decide.  There are a few ways to do that:&lt;br /&gt;
# The client raises an exception with a retry() method that can be caught by the application, and retried if the application determines that the exception represented a temporary failure.&lt;br /&gt;
# The application passes a list to the Certified HTTP subsystem that sorts these status codes into &#039;retry&#039; or &#039;fail&#039;.&lt;br /&gt;
# The subsystem uses a heuristic such as retrying for a short period of time then converting to a Fail if still not successful.&lt;br /&gt;
Here&#039;s the list of status codes:&lt;br /&gt;
&lt;br /&gt;
* 303 See Other (retry will use GET even if original used POST)&lt;br /&gt;
* 307 Temporary Redirect (only if POST)&lt;br /&gt;
* 404 Not Found&lt;br /&gt;
* 406 Not Acceptable&lt;br /&gt;
* 407 Proxy Authentication Required&lt;br /&gt;
* 409 Conflict&lt;br /&gt;
* 412 Precondition Failed&lt;br /&gt;
* 500 Internal Server Error&lt;br /&gt;
&lt;br /&gt;
= Related Technologies =&lt;br /&gt;
I believe that all competitors to this fall into one of three categories, specialized message queues, reliable logic tunneled through HTTP, and delivery over HTTP with setup charges.&lt;br /&gt;
&lt;br /&gt;
== traditional message queue technology ==&lt;br /&gt;
This includes products like [http://www-306.ibm.com/software/integration/wmq/ MQ], [http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx MSMQ], and [http://activemq.apache.org/ ActiveMQ].&lt;br /&gt;
&lt;br /&gt;
These technologies are useful, but provide a number of hurdles:&lt;br /&gt;
* No common standards.&lt;br /&gt;
* Integrates a new technology with unknown performance characteristics.&lt;br /&gt;
* Requires significant operational overhead.&lt;br /&gt;
&lt;br /&gt;
Because of this, we have opted to use HTTP as a foundation of the technology.&lt;br /&gt;
&lt;br /&gt;
== reliable application logic in body ==&lt;br /&gt;
This includes technologies like [http://www.ibm.com/developerworks/library/ws-httprspec/ httpr] and [http://www.ibm.com/developerworks/library/specification/ws-rm/ ws-reliable].&lt;br /&gt;
&lt;br /&gt;
These tend to be thoroughly engineered protocol specifications which regrettably repeat the mistakes of the nearly defunct XMLRPC and the soon to join it SOAP -- namely, treating services as a function call. This is a reasonable approach, and is probably the most obvious to the engineers working on the problem. The most obvious path, which is followed in both of the examples, is to package a traditional message queue body into an HTTP body sent via POST. Treating web services as function calls severely limits the expressive nature of HTTP and should be avoided.&lt;br /&gt;
&lt;br /&gt;
Consumers of web services prefer REST APIs rather than function calls over HTTP. I believe this is because REST is inherently more comprehensible to consumers since all of the data is data the consumer requested. In one telling data point, Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface[http://www.oreillynet.com/pub/wlg/3005]. I believe ceding power to the consumer is the only path to make wide adoption possible. In doing so, we must drop the entire concept of burying data the consumer wants inside application data.&lt;br /&gt;
&lt;br /&gt;
== reliable delivery after setup ==&lt;br /&gt;
There appear to be a few proposals of this nature around the web and a shining example can be found in [http://www.dehora.net/doc/httplr/draft-httplr-01.html httplr].&lt;br /&gt;
&lt;br /&gt;
These are http reliability mechanisms which require a round trip to begin the reliable transfer and then follow through with some permutation of acknowledging the transfer. This setup can be cheap since the setup does not have the same reliability constraints as long as all clients correctly handle 404. Also, some of this overhead can be optimized away by batching the setup requests.&lt;br /&gt;
&lt;br /&gt;
However, a protocol which requires setup for all messaging will always be more expensive than other options.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44240</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44240"/>
		<updated>2007-12-11T00:18:01Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: /* Linux and Mac OS X */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.  &amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; This branch does not yet exist.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linux and Mac OS X ==&lt;br /&gt;
&lt;br /&gt;
Fetch the tree:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a Makefile for use by [http://www.gnu.org/software/make/ GNU Make], this is what &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will generate by default.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd mybuild; cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, you have to explicitly tell &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; to do that.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd mybuild; cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Windows ==&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44239</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44239"/>
		<updated>2007-12-11T00:16:20Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.  &amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; This branch does not yet exist.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linux and Mac OS X ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Windows ==&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
== What to expect ==&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44238</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44238"/>
		<updated>2007-12-11T00:15:09Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
To get started, check out a copy of the cmake branch from here.  &amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; This branch does not yet exist.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Linux and Mac OS X ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
=== What to expect ===&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; actually start a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
= Prebuilt libraries vs. standalone builds =&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44233</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44233"/>
		<updated>2007-12-10T23:30:04Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing? ==&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are some downsides to CMake? ==&lt;br /&gt;
&lt;br /&gt;
Please note: none of the following caveats is really serious.&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The tool has some peculiar inconsistencies: some variables and actions are inherited across files, and others are not.  There&#039;s no regularity to these, so you have to bump into them one by one.&lt;br /&gt;
&lt;br /&gt;
The documentation is weak.  It&#039;s mostly organised as reference documentation that assumes that you already know how to use CMake.  This is a much bigger problem for new projects than ones that have already bit the bullet.  We&#039;ve already worked through the early &amp;quot;WTF?&amp;quot; stages.  It&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch with no prior experience.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch.  &amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; This does not yet exist!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; run a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
== Prebuilt libraries vs. standalone builds ==&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44232</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44232"/>
		<updated>2007-12-10T23:23:37Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch.  &amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; This does not yet exist!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; run a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
== Prebuilt libraries vs. standalone builds ==&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of platform, compiler, IDE, and libraries, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44231</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44231"/>
		<updated>2007-12-10T23:22:40Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What&#039;s this about? =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch.  &amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; This does not yet exist!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; run a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
== Prebuilt libraries vs. standalone builds ==&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
= Patching guidelines =&lt;br /&gt;
&lt;br /&gt;
We welcome your patches!  We can&#039;t test on every permutation of systems, so if you have problems that you can fix, please contribute your fixes and we&#039;ll do our best to ensure that you only have to fix problems once.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44230</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44230"/>
		<updated>2007-12-10T23:20:25Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
CMake instructs your build system in how to rebuild its input files when it detects changes to CMake&#039;s configuration files.  This means that you only need to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once.  After that, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or your IDE should keep the CMake files and its own project files in sync for you.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Performing a build with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; run a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;br /&gt;
&lt;br /&gt;
In principle, your build should run to completion.  If you run into any problems, please report them.  Better yet, if you can fix them and supply patches, we&#039;d be thrilled!&lt;br /&gt;
&lt;br /&gt;
== Prebuilt libraries vs. standalone builds ==&lt;br /&gt;
&lt;br /&gt;
While many users will want to use the prebuilt libraries that we provide, we&#039;re also interested in making life as easy as possible for packagers who want to use their platform&#039;s native libraries.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt;, you should see a &amp;lt;code&amp;gt;STANDALONE&amp;lt;/code&amp;gt; option that determines whether the build will use your system&#039;s libraries or our prepackaged ones.  Flipping this to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; should be all you need to do to perform a packager-friendly build.&lt;br /&gt;
&lt;br /&gt;
For standalone builds, we&#039;d really like to beef up the checks for system libraries so that for example &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; will fail if a required library (such as OpenJPEG) isn&#039;t installed.  We welcome all patches that help out with this.&lt;br /&gt;
&lt;br /&gt;
== Patching guidelines ==&lt;br /&gt;
&lt;br /&gt;
If you&#039;re sending patches in, please follow a few simple guidelines:&lt;br /&gt;
* Use regular context diffs.&lt;br /&gt;
* Follow the existing coding style in the CMake files.  I don&#039;t like code shouting at me, so prefer lowercase letters.&lt;br /&gt;
* One logical change per patch.&lt;br /&gt;
* Use spaces for indentation, not tabs.&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to try an experiment with the development process.  Instead of creating JIRA issues, please send your patches to &amp;lt;code&amp;gt;bos at lindenlab dot com&amp;lt;/code&amp;gt;, and CC &amp;lt;code&amp;gt;sldev&amp;lt;/code&amp;gt;.  Inline patches are preferred over attachments, unless your email client trashes white space (as many do).&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44229</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44229"/>
		<updated>2007-12-10T23:02:16Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Experimenting with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into your build directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.  If you want to generate a makefile for use by [http://www.gnu.org/software/make/ GNU Make], the defaults will work.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you&#039;re on a Mac and want to use XCode, use this command instead.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake -G XCode ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does &amp;lt;i&amp;gt;not&amp;lt;/i&amp;gt; run a build.  It just generates the makefiles, project files, or whatever that you&#039;ll need.  After you&#039;re done, you&#039;ll have a top-level makefile or project file in your build directory.  Run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; or load it into your IDE, and away you go!&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44228</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44228"/>
		<updated>2007-12-10T22:58:51Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Experimenting with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
These are Linux/Mac instructions.  The Windows instructions are presumably similar, except you wave your mouse around instead of running commands.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into that directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44227</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44227"/>
		<updated>2007-12-10T22:57:12Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Experimenting with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create a build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mybuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go into that directory, and run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ccmake&amp;lt;/code&amp;gt; in there, pointing it at the parent directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44226</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44226"/>
		<updated>2007-12-10T22:55:52Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;br /&gt;
&lt;br /&gt;
== Why change what we&#039;re doing?&lt;br /&gt;
&lt;br /&gt;
Our current build system is unsatisfactory in several respects.&lt;br /&gt;
&lt;br /&gt;
Within Linden Lab, we use different tools on each platform: [http://www.scons.org/ scons] on Linux, Visual Studio 2003 on Windows, and XCode on OS X.&lt;br /&gt;
* Any time we add or rename a source file, updating the various build instructions is painful.&lt;br /&gt;
* We can&#039;t easily stay up to date with newer tools, such as Visual Studio 2005 or 2008.&lt;br /&gt;
* Merging changes to the project files used by XCode and Visual Studio is a nightmare.&lt;br /&gt;
&lt;br /&gt;
== What does CMake buy us? ==&lt;br /&gt;
&lt;br /&gt;
CMake has the advantage of generating per-platform build files for us.  On Linux, it will generate Makefiles and KDevelop project files.  On OS X, it will generate Makefiles and XCode project files.  On Windows, it will generate Makefiles (for nmake) and Visual Studio project files.&lt;br /&gt;
&lt;br /&gt;
All of the &amp;quot;smarts&amp;quot; stay in the CMake files, so there&#039;s just one authoritative source of build knowledge.  This means that people can use the development environment they prefer without having to worry so much about breaking other people&#039;s builds.  Because CMake files are plain text, merging is easy, as is maintaining experimental patches.&lt;br /&gt;
&lt;br /&gt;
== What are the disadvantages of CMake? ==&lt;br /&gt;
&lt;br /&gt;
The CMake configuration language is weird and ugly.&lt;br /&gt;
&lt;br /&gt;
The documentation is poor.  This is a much bigger problem for new projects than ones that already have CMake in place.  We&#039;ve already survived the early &amp;quot;WTF?&amp;quot; stages; it&#039;s much easier to hack on existing CMake files than it is to create new ones from scratch.&lt;br /&gt;
&lt;br /&gt;
= Experimenting with CMake =&lt;br /&gt;
&lt;br /&gt;
First of all, you&#039;ll need to [http://www.cmake.org/HTML/Download.html download CMake], and install it.  On Linux distros, it&#039;s usually available as a native package.  On Windows and OS X, just use the prebuilt binaries.&lt;br /&gt;
&lt;br /&gt;
Check out a copy of the viewer cmake branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn co http://svn.secondlife.com/svn/linden/branches/cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44223</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44223"/>
		<updated>2007-12-10T22:07:41Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Building the viewer using CMake =&lt;br /&gt;
&lt;br /&gt;
We&#039;re experimenting with the possibility of switching to [http://www.cmake.org/ CMake] for building the Second Life viewer.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44222</id>
		<title>CMake</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=CMake&amp;diff=44222"/>
		<updated>2007-12-10T22:06:31Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: New page: == Building the viewer using CMake ==&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Building the viewer using CMake ==&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Profiling_and_Optimization&amp;diff=24414</id>
		<title>Profiling and Optimization</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Profiling_and_Optimization&amp;diff=24414"/>
		<updated>2007-06-25T17:29:25Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Open Source Participate Box}}&lt;br /&gt;
&lt;br /&gt;
First, this article assumes that you&#039;re working with an existing and essentially complete piece of code or product that you want to optimize.  However, if you are working on performance critical code (rendering code falls into this category, for example), you will have wanted to start thinking about performance long before you reach this stage.  Premature &#039;&#039;&#039;micro&#039;&#039;&#039;-optimization is evil, but algorithmic optimization should always be in the back of your mind.&lt;br /&gt;
&lt;br /&gt;
Basic guidelines:&lt;br /&gt;
* ALWAYS profile before and while performing optimizations.  There are ALWAYS surprises, and performance bottlenecks are often not where you expect them to be - especially if there are other people writing code besides you.  Plus, a good profiler will help you figure out exactly what your problem is - whether it&#039;s memory access, CPU.&lt;br /&gt;
* Iterate frequently.  Don&#039;t do one profile, write a week&#039;s worth of code, then write another profile.  As you change the code, the bottlenecks will change.  Don&#039;t spend a lot of time optimizing one piece of code down to zero when cutting it in half makes something else the bottleneck.&lt;br /&gt;
&lt;br /&gt;
= Profiling =&lt;br /&gt;
* Choosing a test case:&lt;br /&gt;
** If possible, have a reproducible test case in your production environment.&lt;br /&gt;
** A good test case may not be steady-state.  It may be better for your test case to reproduce the production environment than have it be repeatable.&lt;br /&gt;
** If you are performing micro-optimizations that you can&#039;t reproduce, generate a good synthetic test case that heavily exercises what you&#039;re working on, and optimize that.&lt;br /&gt;
&lt;br /&gt;
* Choosing the profiler:&lt;br /&gt;
** If a profiler is slowing down your application, it is probably distorting your results.  This is usually because the profiler is adding/running significant amounts of instrumentation which is doing a lot of work.  In addition, in network and graphics applications, significant performance degradation can significantly impact things such as the amount of network traffic recieved and the amount of time spent blocking waiting for the GPU.&lt;br /&gt;
** For the above reason, I generally prefer time-based sampling profilers over instrumented call-graph profilers.  The one disadvantage of most time-based profilers is that they don&#039;t generally have call-chain information (they only keep track of the function where CPU time was spent, not where it was called from) - although at least one profiler (Shark on OSX) is capable of doing this without performance degradation).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A list of profilers that we&#039;ve used at Linden:&lt;br /&gt;
* Shark (Mac) - my preferred profiler right now.  Sampling profiler, but it still manages to have call chain information.  Great UI.  Unfortunately, can&#039;t use it for everything, as it&#039;s Mac only, and graphics stuff is very different on the Mac vs. PC.&lt;br /&gt;
* oprofile (linux) - another sampling profiler.  Has some third party UIs, call chain information via &amp;lt;code&amp;gt;--callgraph=&amp;lt;i&amp;gt;N&amp;lt;/i&amp;gt;&amp;lt;/code&amp;gt;.  Fairly easy to use on Linux.&lt;br /&gt;
* VTune (Windows) - sampling and call graph profiler.  The UI is terrible - but there aren&#039;t many other sampling profilers available on Windows.&lt;br /&gt;
* GlowCode (Windows) - instrumented call-graph profiler, but a lot faster than typical - so it runs in near real time.  If you want call chain information on Windows, this may be the way to go.&lt;br /&gt;
&lt;br /&gt;
= Optimization =&lt;br /&gt;
* Obviously, always optimize based on the results of a profile.&lt;br /&gt;
* Always try to do algorithmic and architecture-based optimizations before code optimizations.&lt;br /&gt;
* Memory and cache considerations are often MUCH more important than instruction count.  This is a relatively recent phenomenon.  On some architectures, you can run dozens of instructions or more in the amount of time that it takes to fetch data from main memory.  Thus, when optimizing, you may want to think more about how your algorithms access data than the number of instructions that they use.&lt;br /&gt;
* Don&#039;t write assembly unless you absolutely have to.  It&#039;s not easy to make cross-platform, and unless you are REALLY good, compilers are often better than you are.  If you need to, restructure the C/C++ code to make it more clear to the compiler what you are attempting to do.&lt;br /&gt;
* On the other hand, understand assembly if you&#039;re doing micro-optimizations.  Profilers will tell you what line your problem is on according to the symbol database, but that line can expand out into hundreds of instructions, only one of which is the problem.  Understanding assembly will let you know if that instruction is the divide, or actually the memory access fetching the value to be divided.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Profiling_and_Optimization&amp;diff=24413</id>
		<title>Profiling and Optimization</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Profiling_and_Optimization&amp;diff=24413"/>
		<updated>2007-06-25T17:28:59Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Open Source Participate Box}}&lt;br /&gt;
&lt;br /&gt;
First, this article assumes that you&#039;re working with an existing and essentially complete piece of code or product that you want to optimize.  However, if you are working on performance critical code (rendering code falls into this category, for example), you will have wanted to start thinking about performance long before you reach this stage.  Premature &#039;&#039;&#039;micro&#039;&#039;&#039;-optimization is evil, but algorithmic optimization should always be in the back of your mind.&lt;br /&gt;
&lt;br /&gt;
Basic guidelines:&lt;br /&gt;
* ALWAYS profile before and while performing optimizations.  There are ALWAYS surprises, and performance bottlenecks are often not where you expect them to be - especially if there are other people writing code besides you.  Plus, a good profiler will help you figure out exactly what your problem is - whether it&#039;s memory access, CPU.&lt;br /&gt;
* Iterate frequently.  Don&#039;t do one profile, write a week&#039;s worth of code, then write another profile.  As you change the code, the bottlenecks will change.  Don&#039;t spend a lot of time optimizing one piece of code down to zero when cutting it in half makes something else the bottleneck.&lt;br /&gt;
&lt;br /&gt;
= Profiling =&lt;br /&gt;
* Choosing a test case:&lt;br /&gt;
** If possible, have a reproducible test case in your production environment.&lt;br /&gt;
** A good test case may not be steady-state.  It may be better for your test case to reproduce the production environment than have it be repeatable.&lt;br /&gt;
** If you are performing micro-optimizations that you can&#039;t reproduce, generate a good synthetic test case that heavily exercises what you&#039;re working on, and optimize that.&lt;br /&gt;
&lt;br /&gt;
* Choosing the profiler:&lt;br /&gt;
** If a profiler is slowing down your application, it is probably distorting your results.  This is usually because the profiler is adding/running significant amounts of instrumentation which is doing a lot of work.  In addition, in network and graphics applications, significant performance degradation can significantly impact things such as the amount of network traffic recieved and the amount of time spent blocking waiting for the GPU.&lt;br /&gt;
** For the above reason, I generally prefer time-based sampling profilers over instrumented call-graph profilers.  The one disadvantage of most time-based profilers is that they don&#039;t generally have call-chain information (they only keep track of the function where CPU time was spent, not where it was called from) - although at least one profiler (Shark on OSX) is capable of doing this without performance degradation).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A list of profilers that we&#039;ve used at Linden:&lt;br /&gt;
* Shark (Mac) - my preferred profiler right now.  Sampling profiler, but it still manages to have call chain information.  Great UI.  Unfortunately, can&#039;t use it for everything, as it&#039;s Mac only, and graphics stuff is very different on the Mac vs. PC.&lt;br /&gt;
* oprofile (linux) - another sampling profiler.  Has some third party UIs, call chain information via &amp;lt;code&amp;gt;--callgraph=&amp;lt;i&amp;gt;N&amp;lt;/i&amp;gt;&amp;lt;/code&amp;gt;.  However, very easy to use on Linux.&lt;br /&gt;
* VTune (Windows) - sampling and call graph profiler.  The UI is terrible - but there aren&#039;t many other sampling profilers available on Windows.&lt;br /&gt;
* GlowCode (Windows) - instrumented call-graph profiler, but a lot faster than typical - so it runs in near real time.  If you want call chain information on Windows, this may be the way to go.&lt;br /&gt;
&lt;br /&gt;
= Optimization =&lt;br /&gt;
* Obviously, always optimize based on the results of a profile.&lt;br /&gt;
* Always try to do algorithmic and architecture-based optimizations before code optimizations.&lt;br /&gt;
* Memory and cache considerations are often MUCH more important than instruction count.  This is a relatively recent phenomenon.  On some architectures, you can run dozens of instructions or more in the amount of time that it takes to fetch data from main memory.  Thus, when optimizing, you may want to think more about how your algorithms access data than the number of instructions that they use.&lt;br /&gt;
* Don&#039;t write assembly unless you absolutely have to.  It&#039;s not easy to make cross-platform, and unless you are REALLY good, compilers are often better than you are.  If you need to, restructure the C/C++ code to make it more clear to the compiler what you are attempting to do.&lt;br /&gt;
* On the other hand, understand assembly if you&#039;re doing micro-optimizations.  Profilers will tell you what line your problem is on according to the symbol database, but that line can expand out into hundreds of instructions, only one of which is the problem.  Understanding assembly will let you know if that instruction is the divide, or actually the memory access fetching the value to be divided.&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23118</id>
		<title>Preparing Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23118"/>
		<updated>2007-06-11T22:55:58Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OSWikiContribBox}}&lt;br /&gt;
&lt;br /&gt;
If you have a piece of source code (be it a fix, new feature, or optimization of existing code) submit the patches in a way that makes it easy for the Lindens to incorporate them into the source code.&lt;br /&gt;
&lt;br /&gt;
== Good Patch Practise ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
The best way to think about patches is that the people who are reviewing and applying your patches are the bottleneck in the system.  If you can make it easier for us to understand and apply patches without lots of cleanup, we can spend more time reviewing and incorporating your work.&lt;br /&gt;
&lt;br /&gt;
===Before You Start===&lt;br /&gt;
&lt;br /&gt;
Check [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker] to see if the issue has been submitted and its status.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re going to write a patch, don&#039;t forget to sign and send in the [[Project:Contribution_Agreement|contribution agreement]].  The sooner you do that, the sooner we can accept your patch.&lt;br /&gt;
&lt;br /&gt;
=== Coding Standard ===&lt;br /&gt;
&lt;br /&gt;
Please read and follow the coding standard: [[Coding_standard|Second Life coding standard]]&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Please do not add issue numbers or your name to patches.  We have to remove these by hand.  Also, please be careful in how you add comments.  Bracketing a patch with comments like &amp;quot;// PATCH START&amp;quot; and &amp;quot;// PATCH END&amp;quot; does not add any information, and adds to the manual cleanup we have to do.&lt;br /&gt;
&lt;br /&gt;
If you want to make sure you get credited, then&lt;br /&gt;
add yourself to doc/contributions.txt as part of the patch.  That makes&lt;br /&gt;
it easier for people to see the exact nature of the changes you&#039;ve added.&lt;br /&gt;
&lt;br /&gt;
In short, just add to the patch what is expected to appear in the final source.&lt;br /&gt;
&lt;br /&gt;
=== One Patch for one Issue ===&lt;br /&gt;
&lt;br /&gt;
Each patch should do exactly one thing.  If you have three different bugs to fix, please submit three different patches.  When you fold unrelated hunks into a single patch, we have to try to figure out which part of the patch applies to which bug, and split it out by hand, sometimes into several patches.  Combo patches are particularly time consuming, and the manual splitting up makes it very easy to lose pieces of patches altogether.&lt;br /&gt;
&lt;br /&gt;
=== Less is more ===&lt;br /&gt;
&lt;br /&gt;
Smaller patches are easier to review and therefore more likely to be integrated quickly. The longer it takes for a patch to be incorporated, the higher the likelihood that the underlying code will change enough for the patch to fail. Please do not include formatting or other clean-up changes as that makes it harder to review and more likely to fail.&lt;br /&gt;
&lt;br /&gt;
== Creating a Patch ==&lt;br /&gt;
&lt;br /&gt;
Patches should be submitted in unified diff format.  This format is similar to simple diffs, but with more detailed information, and it can be automatically integrated into the source.  You can generate a unified diff by calling &#039;&#039;diff -u &amp;lt;original file&amp;gt; &amp;lt;new file&amp;gt;&#039;&#039; (under Windows you will find the diff command as part of the CygWin project in C:\CYGWIN\BIN).&lt;br /&gt;
&lt;br /&gt;
The easiest way to generate a clean patch is to keep two copies of the source tree.  Leave one completely unmodified, and make all of your changes in the second.  Then use &amp;quot;diff -urN&amp;quot; to generate the patch.  You can use the --exclude option to omit unwanted files.  For example:&lt;br /&gt;
&lt;br /&gt;
 diff -urN --exclude=&amp;quot;*.o&amp;quot; my_untouched_tree my_modified_tree&lt;br /&gt;
&lt;br /&gt;
Please submit a single plain text uncompressed patch file that affects all of the files you need to modify.  This is far easier to review than a collection of tiny one-file patches.  Also bad for reviewability are a compressed patch, or a tarball or zip containing one or more patches.&lt;br /&gt;
&lt;br /&gt;
For reference, here&#039;s what a unified diff looks like.&lt;br /&gt;
&lt;br /&gt;
 --- linden-untouched/indra/newview/viewer.cpp    2007-05-14 16:47:26.000000000 +0200&lt;br /&gt;
 +++ linden/indra/newview/viewer.cpp 2007-05-22 08:49:50.484375000 +0200&lt;br /&gt;
 @@ -6302,7 +6326,7 @@&lt;br /&gt;
 &lt;br /&gt;
     llinfos &amp;lt;&amp;lt; &amp;quot;Cleaning Up&amp;quot; &amp;lt;&amp;lt; llendflush;&lt;br /&gt;
 &lt;br /&gt;
 -   LLKeyframeMotion::flushKeyframeCache();&lt;br /&gt;
 +   LLKeyframeMotion::flushKeyframeCache(TRUE); &lt;br /&gt;
 &lt;br /&gt;
     // Must clean up texture references before viewer window is destroyed.&lt;br /&gt;
     LLHUDObject::cleanupHUDObjects();&lt;br /&gt;
 @@ -6562,6 +6586,8 @@&lt;br /&gt;
     delete gVFS;&lt;br /&gt;
     gVFS = NULL;&lt;br /&gt;
 &lt;br /&gt;
 +   LLCurl::cleanup(); &lt;br /&gt;
 +&lt;br /&gt;
     // This will eventually be done in LLApp&lt;br /&gt;
     LLCommon::cleanupClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch for Peer Review ==&lt;br /&gt;
&lt;br /&gt;
Especially with larger or sensitive patches it is a good idea to first submit the patch for peer review on the [[Developer_communication_tools|mailing list]].  This way fellow developers can review the patch, uncover possible bugs, comment on undesired interactions or generally share ideas with you.&lt;br /&gt;
&lt;br /&gt;
Just subscribe to the mailing list, then write an email to the list with your &#039;&#039;.patch&#039;&#039; file attached and with a description of what it does in the text or also as an attachment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch on JIRA ==&lt;br /&gt;
&lt;br /&gt;
Finally, when you think the patch is ready for the Lindens, submit the patch on the [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker]. Create a new issue or attach the patch to an existing entry as appropriate. Attach the &#039;&#039;.patch&#039;&#039; file itself as a file attachment and make sure that the check mark for &#039;&#039;Patch attached&#039;&#039; is set (you can do that when creating the issue or by choosing Edit for an existing one).&lt;br /&gt;
&lt;br /&gt;
Also, offer a description of the patch (the why and what) as a separate file and/or as a description or comment with the issue.&lt;br /&gt;
&lt;br /&gt;
Before you do that however, just have a look at existing patches through the &#039;&#039;Issues with patches attached&#039;&#039; filter on the JIRA main page to get a general idea how it is done.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23117</id>
		<title>Preparing Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23117"/>
		<updated>2007-06-11T22:54:50Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OSWikiContribBox}}&lt;br /&gt;
&lt;br /&gt;
If you have a piece of source code (be it a fix, new feature, or optimization of existing code) submit the patches in a way that makes it easy for the Lindens to incorporate them into the source code.&lt;br /&gt;
&lt;br /&gt;
== Good Patch Practise ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
The best way to think about patches is that the people who are reviewing and applying your patches are the bottleneck in the system.  If you can make it easier for us to understand and apply patches without lots of cleanup, we can spend more time reviewing and incorporating your work.&lt;br /&gt;
&lt;br /&gt;
===Before You Start===&lt;br /&gt;
&lt;br /&gt;
Check [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker] to see if the issue has been submitted and its status.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re going to write a patch, don&#039;t forget to sign and send in the [[Project:Contribution_Agreement|contribution agreement]].  The sooner you do that, the sooner we can accept your patch.&lt;br /&gt;
&lt;br /&gt;
=== Coding Standard ===&lt;br /&gt;
&lt;br /&gt;
Please read and follow the coding standard: [[Coding_standard|Second Life coding standard]]&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Please do not add issue numbers or your name to patches.  We have to remove these by hand.  Also, please be careful in how you add comments.  Bracketing a patch with comments like &amp;quot;// PATCH START&amp;quot; and &amp;quot;// PATCH END&amp;quot; does not add any information, and adds to the manual cleanup we have to do.&lt;br /&gt;
&lt;br /&gt;
If you want to make sure you get credited, then&lt;br /&gt;
add yourself to doc/contributions.txt as part of the patch.  That makes&lt;br /&gt;
it easier for people to see the exact nature of the changes you&#039;ve added.&lt;br /&gt;
&lt;br /&gt;
In short, just add to the patch what is expected to appear in the final source.&lt;br /&gt;
&lt;br /&gt;
=== One Patch for one Issue ===&lt;br /&gt;
&lt;br /&gt;
Each patch should do exactly one thing.  If you have three different bugs to fix, please submit three different patches.  When you fold unrelated hunks into a single patch, we have to try to figure out which part of the patch applies to which bug, and split it out by hand, sometimes into several patches.  Combo patches are particularly time consuming, and the manual splitting up makes it very easy to lose pieces of patches altogether.&lt;br /&gt;
&lt;br /&gt;
=== Less is more ===&lt;br /&gt;
&lt;br /&gt;
Smaller patches are easier to review and therefore more likely to be integrated quickly. The longer it takes for a patch to be incorporated, the higher the likelihood that the underlying code will change enough for the patch to fail. Please do not include formatting or other clean-up changes as that makes it harder to review and more likely to fail.&lt;br /&gt;
&lt;br /&gt;
== Creating a Patch ==&lt;br /&gt;
&lt;br /&gt;
Patches should be submitted in unified diff format.  This format is similar to simple diffs, but with more detailed information, and it can be automatically integrated into the source.  You can generate a unified diff by calling &#039;&#039;diff -u &amp;lt;original file&amp;gt; &amp;lt;new file&amp;gt;&#039;&#039; (under Windows you will find the diff command as part of the CygWin project in C:\CYGWIN\BIN).&lt;br /&gt;
&lt;br /&gt;
The easiest way to generate a clean patch is to keep two copies of the source tree.  Leave one completely unmodified, and make all of your changes in the second.  Then use &amp;quot;diff -urN&amp;quot; to generate the patch.  You can use the --exclude option to omit unwanted files.  For example:&lt;br /&gt;
&lt;br /&gt;
 diff -urN --exclude=&amp;quot;*.o&amp;quot; my_untouched_tree my_modified_tree&lt;br /&gt;
&lt;br /&gt;
Please submit a single plain text uncompressed patch file that affects all of the files you need to modify.  This is far easier to review than a collection of tiny one-file patches.  Also bad for reviewability are a compressed patch, or a tarball or zip containing one or more patches.&lt;br /&gt;
&lt;br /&gt;
The patch command for a change viewer.cpp would then be something like &#039;&#039;diff -u --strip-trailing-cr linden/indra/newview/viewer_orig.cpp linden/indra/newview/viewer.cpp &amp;gt;viewer.patch&#039;&#039; and would create output file named &#039;&#039;viewer.patch&#039;&#039; like this:&lt;br /&gt;
&lt;br /&gt;
 --- linden/indra/newview/viewer_orig.cpp    2007-05-14 16:47:26.000000000 +0200&lt;br /&gt;
 +++ linden/indra/newview/viewer.cpp 2007-05-22 08:49:50.484375000 +0200&lt;br /&gt;
 @@ -6302,7 +6326,7 @@&lt;br /&gt;
 &lt;br /&gt;
     llinfos &amp;lt;&amp;lt; &amp;quot;Cleaning Up&amp;quot; &amp;lt;&amp;lt; llendflush;&lt;br /&gt;
 &lt;br /&gt;
 -   LLKeyframeMotion::flushKeyframeCache();&lt;br /&gt;
 +   LLKeyframeMotion::flushKeyframeCache(TRUE); &lt;br /&gt;
 &lt;br /&gt;
     // Must clean up texture references before viewer window is destroyed.&lt;br /&gt;
     LLHUDObject::cleanupHUDObjects();&lt;br /&gt;
 @@ -6562,6 +6586,8 @@&lt;br /&gt;
     delete gVFS;&lt;br /&gt;
     gVFS = NULL;&lt;br /&gt;
 &lt;br /&gt;
 +   LLCurl::cleanup(); &lt;br /&gt;
 +&lt;br /&gt;
     // This will eventually be done in LLApp&lt;br /&gt;
     LLCommon::cleanupClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch for Peer Review ==&lt;br /&gt;
&lt;br /&gt;
Especially with larger or sensitive patches it is a good idea to first submit the patch for peer review on the [[Developer_communication_tools|mailing list]].  This way fellow developers can review the patch, uncover possible bugs, comment on undesired interactions or generally share ideas with you.&lt;br /&gt;
&lt;br /&gt;
Just subscribe to the mailing list, then write an email to the list with your &#039;&#039;.patch&#039;&#039; file attached and with a description of what it does in the text or also as an attachment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch on JIRA ==&lt;br /&gt;
&lt;br /&gt;
Finally, when you think the patch is ready for the Lindens, submit the patch on the [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker]. Create a new issue or attach the patch to an existing entry as appropriate. Attach the &#039;&#039;.patch&#039;&#039; file itself as a file attachment and make sure that the check mark for &#039;&#039;Patch attached&#039;&#039; is set (you can do that when creating the issue or by choosing Edit for an existing one).&lt;br /&gt;
&lt;br /&gt;
Also, offer a description of the patch (the why and what) as a separate file and/or as a description or comment with the issue.&lt;br /&gt;
&lt;br /&gt;
Before you do that however, just have a look at existing patches through the &#039;&#039;Issues with patches attached&#039;&#039; filter on the JIRA main page to get a general idea how it is done.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23116</id>
		<title>Preparing Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23116"/>
		<updated>2007-06-11T22:46:07Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OSWikiContribBox}}&lt;br /&gt;
&lt;br /&gt;
If you have a piece of source code (be it a fix, new feature, or optimization of existing code) submit the patches in a way that makes it easy for the Lindens to incorporate them into the source code.&lt;br /&gt;
&lt;br /&gt;
== Good Patch Practise ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
The best way to think about patches is that the people who are reviewing and applying your patches are the bottleneck in the system.  If you can make it easier for us to understand and apply patches without lots of cleanup, we can spend more time reviewing and incorporating your work.&lt;br /&gt;
&lt;br /&gt;
===Before You Start===&lt;br /&gt;
&lt;br /&gt;
Check [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker] to see if the issue has been submitted and its status.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re going to write a patch, don&#039;t forget to sign and send in the [[Project:Contribution_Agreement|contribution agreement]].  The sooner you do that, the sooner we can accept your patch.&lt;br /&gt;
&lt;br /&gt;
=== Coding Standard ===&lt;br /&gt;
&lt;br /&gt;
Please read and follow the coding standard: [[Coding_standard|Second Life coding standard]]&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Please do not add issue numbers or your name to patches.  We have to remove these by hand.  Also, please be careful in how you add comments.  Bracketing a patch with comments like &amp;quot;// PATCH START&amp;quot; and &amp;quot;// PATCH END&amp;quot; does not add any information, and adds to the manual cleanup we have to do.&lt;br /&gt;
&lt;br /&gt;
If you want to make sure you get credited, then&lt;br /&gt;
add yourself to doc/contributions.txt as part of the patch.  That makes&lt;br /&gt;
it easier for people to see the exact nature of the changes you&#039;ve added.&lt;br /&gt;
&lt;br /&gt;
In short, just add to the patch what is expected to appear in the final source.&lt;br /&gt;
&lt;br /&gt;
=== One Patch for one Issue ===&lt;br /&gt;
&lt;br /&gt;
Each patch should do exactly one thing.  If you have three different bugs to fix, please submit three different patches.  When you fold unrelated hunks into a single patch, we have to try to figure out which part of the patch applies to which bug, and split it out by hand, sometimes into several patches.  Combo patches are particularly time consuming, and the manual splitting up makes it very easy to lose pieces of patches altogether.&lt;br /&gt;
&lt;br /&gt;
=== Less is more ===&lt;br /&gt;
&lt;br /&gt;
Smaller patches are easier to review and therefore more likely to be integrated quickly. The longer it takes for a patch to be incorporated, the higher the likelihood that the underlying code will change enough for the patch to fail. Please do not include formatting or other clean-up changes as that makes it harder to review and more likely to fail.&lt;br /&gt;
&lt;br /&gt;
== Creating a Patch ==&lt;br /&gt;
&lt;br /&gt;
Patches should be submitted in Unidiff-Format.  This format is simlar to simple diffs but with more detailed information and can be automatically integrated into the source.  It is generated by calling &#039;&#039;diff -u &amp;lt;original file&amp;gt; &amp;lt;new file&amp;gt;&#039;&#039; (under Windows you will find the diff command as part of the CygWin project in C:\CYGWIN\BIN).&lt;br /&gt;
&lt;br /&gt;
With the file names it is best to rename the original file to something like &#039;&#039;viewer_orig.cpp&#039;&#039; have the new file the same name as in the Second Life project and redirect the output to a file that ends with &#039;&#039;.patch&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The patch command for a change viewer.cpp would then be something like &#039;&#039;diff -u --strip-trailing-cr linden/indra/newview/viewer_orig.cpp linden/indra/newview/viewer.cpp &amp;gt;viewer.patch&#039;&#039; and would create output file named &#039;&#039;viewer.patch&#039;&#039; like this:&lt;br /&gt;
&lt;br /&gt;
 --- linden/indra/newview/viewer_orig.cpp    2007-05-14 16:47:26.000000000 +0200&lt;br /&gt;
 +++ linden/indra/newview/viewer.cpp 2007-05-22 08:49:50.484375000 +0200&lt;br /&gt;
 @@ -6302,7 +6326,7 @@&lt;br /&gt;
 &lt;br /&gt;
     llinfos &amp;lt;&amp;lt; &amp;quot;Cleaning Up&amp;quot; &amp;lt;&amp;lt; llendflush;&lt;br /&gt;
 &lt;br /&gt;
 -   LLKeyframeMotion::flushKeyframeCache();&lt;br /&gt;
 +   LLKeyframeMotion::flushKeyframeCache(TRUE); &lt;br /&gt;
 &lt;br /&gt;
     // Must clean up texture references before viewer window is destroyed.&lt;br /&gt;
     LLHUDObject::cleanupHUDObjects();&lt;br /&gt;
 @@ -6562,6 +6586,8 @@&lt;br /&gt;
     delete gVFS;&lt;br /&gt;
     gVFS = NULL;&lt;br /&gt;
 &lt;br /&gt;
 +   LLCurl::cleanup(); &lt;br /&gt;
 +&lt;br /&gt;
     // This will eventually be done in LLApp&lt;br /&gt;
     LLCommon::cleanupClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch for Peer Review ==&lt;br /&gt;
&lt;br /&gt;
Especially with larger or sensitive patches it is a good idea to first submit the patch for peer review on the [[Developer_communication_tools|mailing list]].  This way fellow developers can review the patch, uncover possible bugs, comment on undesired interactions or generally share ideas with you.&lt;br /&gt;
&lt;br /&gt;
Just subscribe to the mailing list, then write an email to the list with your &#039;&#039;.patch&#039;&#039; file attached and with a description of what it does in the text or also as an attachment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch on JIRA ==&lt;br /&gt;
&lt;br /&gt;
Finally, when you think the patch is ready for the Lindens, submit the patch on the [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker]. Create a new issue or attach the patch to an existing entry as appropriate. Attach the &#039;&#039;.patch&#039;&#039; file itself as a file attachment and make sure that the check mark for &#039;&#039;Patch attached&#039;&#039; is set (you can do that when creating the issue or by choosing Edit for an existing one).&lt;br /&gt;
&lt;br /&gt;
Also, offer a description of the patch (the why and what) as a separate file and/or as a description or comment with the issue.&lt;br /&gt;
&lt;br /&gt;
Before you do that however, just have a look at existing patches through the &#039;&#039;Issues with patches attached&#039;&#039; filter on the JIRA main page to get a general idea how it is done.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23115</id>
		<title>Preparing Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Preparing_Code&amp;diff=23115"/>
		<updated>2007-06-11T22:45:20Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OSWikiContribBox}}&lt;br /&gt;
&lt;br /&gt;
If you have a piece of source code (be it a fix, new feature, or optimization of existing code) submit the patches in a way that makes it easy for the Lindens to incorporate them into the source code.&lt;br /&gt;
&lt;br /&gt;
== Good Patch Practise ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
The best way to think about patches is that the people who are reviewing and applying your patches are the bottleneck in the system.  If you can make it easier for us to understand and apply patches without lots of cleanup, we can spend more time reviewing and incorporating your work.&lt;br /&gt;
&lt;br /&gt;
===Before You Start===&lt;br /&gt;
&lt;br /&gt;
Check [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker] to see if the issue has been submitted and its status.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re going to write a patch, don&#039;t forget to sign and send in the [Project:Contribution_Agreement contribution agreement].  The sooner you do that, the sooner we can accept your patch.&lt;br /&gt;
&lt;br /&gt;
=== Coding Standard ===&lt;br /&gt;
&lt;br /&gt;
Please read and follow the coding standard: [[Coding_standard|Second Life coding standard]]&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Please do not add issue numbers or your name to patches.  We have to remove these by hand.  Also, please be careful in how you add comments.  Bracketing a patch with comments like &amp;quot;// PATCH START&amp;quot; and &amp;quot;// PATCH END&amp;quot; does not add any information, and adds to the manual cleanup we have to do.&lt;br /&gt;
&lt;br /&gt;
If you want to make sure you get credited, then&lt;br /&gt;
add yourself to doc/contributions.txt as part of the patch.  That makes&lt;br /&gt;
it easier for people to see the exact nature of the changes you&#039;ve added.&lt;br /&gt;
&lt;br /&gt;
In short, just add to the patch what is expected to appear in the final source.&lt;br /&gt;
&lt;br /&gt;
=== One Patch for one Issue ===&lt;br /&gt;
&lt;br /&gt;
Each patch should do exactly one thing.  If you have three different bugs to fix, please submit three different patches.  When you fold unrelated hunks into a single patch, we have to try to figure out which part of the patch applies to which bug, and split it out by hand, sometimes into several patches.  Combo patches are particularly time consuming, and the manual splitting up makes it very easy to lose pieces of patches altogether.&lt;br /&gt;
&lt;br /&gt;
=== Less is more ===&lt;br /&gt;
&lt;br /&gt;
Smaller patches are easier to review and therefore more likely to be integrated quickly. The longer it takes for a patch to be incorporated, the higher the likelihood that the underlying code will change enough for the patch to fail. Please do not include formatting or other clean-up changes as that makes it harder to review and more likely to fail.&lt;br /&gt;
&lt;br /&gt;
== Creating a Patch ==&lt;br /&gt;
&lt;br /&gt;
Patches should be submitted in Unidiff-Format.  This format is simlar to simple diffs but with more detailed information and can be automatically integrated into the source.  It is generated by calling &#039;&#039;diff -u &amp;lt;original file&amp;gt; &amp;lt;new file&amp;gt;&#039;&#039; (under Windows you will find the diff command as part of the CygWin project in C:\CYGWIN\BIN).&lt;br /&gt;
&lt;br /&gt;
With the file names it is best to rename the original file to something like &#039;&#039;viewer_orig.cpp&#039;&#039; have the new file the same name as in the Second Life project and redirect the output to a file that ends with &#039;&#039;.patch&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The patch command for a change viewer.cpp would then be something like &#039;&#039;diff -u --strip-trailing-cr linden/indra/newview/viewer_orig.cpp linden/indra/newview/viewer.cpp &amp;gt;viewer.patch&#039;&#039; and would create output file named &#039;&#039;viewer.patch&#039;&#039; like this:&lt;br /&gt;
&lt;br /&gt;
 --- linden/indra/newview/viewer_orig.cpp    2007-05-14 16:47:26.000000000 +0200&lt;br /&gt;
 +++ linden/indra/newview/viewer.cpp 2007-05-22 08:49:50.484375000 +0200&lt;br /&gt;
 @@ -6302,7 +6326,7 @@&lt;br /&gt;
 &lt;br /&gt;
     llinfos &amp;lt;&amp;lt; &amp;quot;Cleaning Up&amp;quot; &amp;lt;&amp;lt; llendflush;&lt;br /&gt;
 &lt;br /&gt;
 -   LLKeyframeMotion::flushKeyframeCache();&lt;br /&gt;
 +   LLKeyframeMotion::flushKeyframeCache(TRUE); &lt;br /&gt;
 &lt;br /&gt;
     // Must clean up texture references before viewer window is destroyed.&lt;br /&gt;
     LLHUDObject::cleanupHUDObjects();&lt;br /&gt;
 @@ -6562,6 +6586,8 @@&lt;br /&gt;
     delete gVFS;&lt;br /&gt;
     gVFS = NULL;&lt;br /&gt;
 &lt;br /&gt;
 +   LLCurl::cleanup(); &lt;br /&gt;
 +&lt;br /&gt;
     // This will eventually be done in LLApp&lt;br /&gt;
     LLCommon::cleanupClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch for Peer Review ==&lt;br /&gt;
&lt;br /&gt;
Especially with larger or sensitive patches it is a good idea to first submit the patch for peer review on the [[Developer_communication_tools|mailing list]].  This way fellow developers can review the patch, uncover possible bugs, comment on undesired interactions or generally share ideas with you.&lt;br /&gt;
&lt;br /&gt;
Just subscribe to the mailing list, then write an email to the list with your &#039;&#039;.patch&#039;&#039; file attached and with a description of what it does in the text or also as an attachment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Submitting the Patch on JIRA ==&lt;br /&gt;
&lt;br /&gt;
Finally, when you think the patch is ready for the Lindens, submit the patch on the [https://jira.secondlife.com/secure/Dashboard.jspa| JIRA Bug Tracker]. Create a new issue or attach the patch to an existing entry as appropriate. Attach the &#039;&#039;.patch&#039;&#039; file itself as a file attachment and make sure that the check mark for &#039;&#039;Patch attached&#039;&#039; is set (you can do that when creating the issue or by choosing Edit for an existing one).&lt;br /&gt;
&lt;br /&gt;
Also, offer a description of the patch (the why and what) as a separate file and/or as a description or comment with the issue.&lt;br /&gt;
&lt;br /&gt;
Before you do that however, just have a look at existing patches through the &#039;&#039;Issues with patches attached&#039;&#039; filter on the JIRA main page to get a general idea how it is done.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Third_Party_Libraries&amp;diff=23114</id>
		<title>Third Party Libraries</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Third_Party_Libraries&amp;diff=23114"/>
		<updated>2007-06-11T22:23:21Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: Add libpng&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{OSWikiLearnBox}}&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
    |- style=&amp;quot;background:#ffdead;&amp;quot;&lt;br /&gt;
    !Library !! Version !! Description !! GPL-Compatible?  || Covered under [http://secondlife.com/developers/opensource/flossexception FLOSS exception]?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Apache --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://apr.apache.org/ Apache Portable Runtime ] || 1.2.8&lt;br /&gt;
|A set of C functions which provide a portable and consistent interface into operating system - or simply widely useful - functionality. We primarily use it for threading and socket i/o. This is actually three packages, apr, apr-util and apr-iconv.&lt;br /&gt;
|| No, Apache 2.0 license&lt;br /&gt;
|| Yes&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Boost --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.boost.org/ Boost] || 1.32.0&lt;br /&gt;
|A set of portable C++ libraries which provide a wide set of functionality. Used primarily for tokenization.&lt;br /&gt;
|| Yes, BSDish&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- c-ares--&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://daniel.haxx.se/projects/c-ares/ c-ares] || 1.3.2&lt;br /&gt;
|Performs DNS requests and name resolves asynchronously. Used with libcurl to keep all HTTP operations async.&lt;br /&gt;
|| Yes, BSDish&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- cg --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://developer.nvidia.com/page/cg_main.html CG] || ??&lt;br /&gt;
|cg controls some visual effects. - NOT USED BY THE NORMAL CLIENT.&lt;br /&gt;
|| No, permissive license but forbids reverse engineering.&lt;br /&gt;
|| No&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ELFIO --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://sourceforge.net/projects/elfio/ ELFIO] || 1.0.3&lt;br /&gt;
|Enhanced stacktrace information on the Linux client.&lt;br /&gt;
|| Yes, LGPL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Expat --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://expat.sourceforge.net/ Expat] || 1.95.8&lt;br /&gt;
|XML parser.&lt;br /&gt;
|| Yes, MIT&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- FMOD --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.fmod.org FMOD] ||  3.75&lt;br /&gt;
|Audio engine and mp3 stream decoder&lt;br /&gt;
|| No, proprietary&lt;br /&gt;
|| No&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- FreeType --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.freetype.org/ FreeType] || 2.1.5&lt;br /&gt;
|Font engine.&lt;br /&gt;
|| Yes, dual licensed BSD/Advertising + GPL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Glib --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.gtk.org/ Glib] || 2.0.7&lt;br /&gt;
|??&lt;br /&gt;
|| Yes, LGPL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- GTK+ --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.gtk.org/ GTK+] || 2.0.9&lt;br /&gt;
|&#039;Native&#039; UI components on the Linux client.&lt;br /&gt;
|| Yes, LGPL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- jpeglib --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.ijg.org/ jpeglib] || 6b&lt;br /&gt;
|JPEG decoder library.&lt;br /&gt;
|| Yes, BSD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- KDU --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.kakadusoftware.com/ KDU] || 5.2.1&lt;br /&gt;
|Kakadu (KDU) JPEG-2000 decoder library.&lt;br /&gt;
|| No, Proprietary&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- libcurl--&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://curl.haxx.se/libcurl/ libcurl] || 7.16.0&lt;br /&gt;
|Handles moving data across the net in many different protocols. Used to GET/POST/PUT/DELETE web resources.&lt;br /&gt;
|| Yes, MIT&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- libpng--&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.libpng.org/pub/png/libpng.html libpng] || 1.2.18&lt;br /&gt;
|PNG image library.&lt;br /&gt;
|| [http://www.libpng.org/pub/png/src/libpng-LICENSE.txt BSD-like]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- libuuid --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
!libuuid ||  ??&lt;br /&gt;
|Generates UUIDs under Linux. Originally a part of the ext2fs filesystem. Also see lluuid.cpp for all platforms.&lt;br /&gt;
|| Yes, LGPL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- llMozLib --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://ubrowser.com/llmozlib.php llMozLib] || 1.8.0.9&lt;br /&gt;
|llMozLib handles rendering HTML in the viewer via an embedded Gecko ([http://www.mozilla.org/developer/ Mozilla]) engine.&lt;br /&gt;
|| Yes, MPL/GPL/LGPL Tri-license&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- MESA --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.mesa3d.org/ Mesa] ||  6.2.1&lt;br /&gt;
|Provides the required OpenGL headers under Linux.&lt;br /&gt;
|| Yes&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Ogg --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://xiph.org/ogg/ OGG] || 1.0.3&lt;br /&gt;
|Audio control.&lt;br /&gt;
|| Yes, BSDish&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- OpenGL --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.opengl.org/ OpenGL] || GLX&lt;br /&gt;
| 3D Graphics rendering engine.&lt;br /&gt;
|| No (see [http://www.xfree86.org/4.4.0/LICENSE3.html XFree86 License FAQ])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- OpenJPEG --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.openjpeg.org/ OpenJPEG] || 1.0&lt;br /&gt;
|An open-source JPEG-2000 library; a slower alternative to Kadaku. Used in the open source release&lt;br /&gt;
|| Yes, however one must beware of patents.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- openssl --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.openssl.org/ OpenSSL] || 0.9.7c&lt;br /&gt;
|Provides encryption for sensitive actions such as user login&lt;br /&gt;
|| No, advertising clauses.&lt;br /&gt;
|| Yes&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- quicktime --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://developer.apple.com/quicktime/ Quicktime] || 7.13&lt;br /&gt;
|Used to play in-world video clips on a prim.&lt;br /&gt;
|| No, Proprietary&lt;br /&gt;
|| No&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- SDL --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.libsdl.org/index.php SDL] || 1.2.7&lt;br /&gt;
|The Simple DirectMedia Layer libraries are used for handling input and basic window/GL setup on the Linux client.&lt;br /&gt;
|| Yes&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Smartheap --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.microquill.com/smartheap/index.html Smartheap] || ??&lt;br /&gt;
|Memory allocation (Windows only malloc() replacement)&lt;br /&gt;
|| No, Proprietary, but entirely optional (easy to comment out)&lt;br /&gt;
|| No&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TUT --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://tut-framework.sourceforge.net/ TUT] || 2006-06-22&lt;br /&gt;
|Unit test framework based on the use of c++ meta template programming. Used to test LL libraries.&lt;br /&gt;
|| Yes, BSD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Vorbis --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://xiph.org/vorbis/ Vorbis] || 1.1.2&lt;br /&gt;
|Audio control.&lt;br /&gt;
|| Yes&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- xmlrpc-epi --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://xmlrpc-epi.sourceforge.net/ xmlrpc-epi] || 0.51&lt;br /&gt;
|Controls the XML-RPC protocol.&lt;br /&gt;
|| Yes, BSD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- zlib --&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
![http://www.zlib.net/ zlib] || 1.2.1&lt;br /&gt;
|zlib is a lossless data-compression library which is used for a variety of network i/o and file compression.&lt;br /&gt;
|| Yes, MIT-like&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Build_the_Viewer_on_Linux&amp;diff=22107</id>
		<title>Build the Viewer on Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Build_the_Viewer_on_Linux&amp;diff=22107"/>
		<updated>2007-05-30T19:09:21Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: Add notes for building on Fedora&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{CompileNav}}&lt;br /&gt;
&lt;br /&gt;
The following are instructions for building the Second Life viewer on linux. This process has been used on [http://www.debian.org/ debian] and debian based systems like [http://www.ubuntu.com/ ubuntu], and also on [http://www.fedoraproject.org/ Fedora]. For other platforms, see [[Get source and compile]].&lt;br /&gt;
&lt;br /&gt;
== Installing the required dependencies ==&lt;br /&gt;
&lt;br /&gt;
The Second Life Viewer has a number of compile/link dependencies on external libraries which need to be put in place first - to help you, the source download page contains a link to a &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package which you unpack over the source tree to fill most of the dependencies (and thus avoid most of the fiddly work described on this page).  The Second Life Viewer is not a trivial build, and experience with building large software packages will help you greatly - but don&#039;t be daunted, it should be simple once the dependencies are in the right place the first time.&lt;br /&gt;
&lt;br /&gt;
Paths and package names given here are based on Ubuntu 6.06 and may vary according to your Linux distribution.&lt;br /&gt;
&lt;br /&gt;
*If you download the art and libs to the top folder, where the &amp;lt;i&amp;gt;linden&amp;lt;/i&amp;gt; folder is after getting the veiwer source code, the following commands should unpack everything to the right spot. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 unzip slviewer-artwork-&amp;lt;version&amp;gt;.zip&lt;br /&gt;
 tar xvfz slviewer-linux-libs-&amp;lt;version&amp;gt;.tar.gz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{vital-info|How to compile [[Source_archive#2007-Feb-20|FL-1.13.3.58185]] and [[Source_archive#2007-Feb-24|FL-1.13.3.58390]] &#039;&#039;&#039;with&#039;&#039;&#039; llmozlib (see [[Talk:Compiling_the_viewer_%28Linux%29#llmozlib|discussion]])}}&lt;br /&gt;
&lt;br /&gt;
* You will need the &amp;lt;b&amp;gt;SCons&amp;lt;/b&amp;gt; build tool [package: scons]&lt;br /&gt;
* You should use the &amp;lt;b&amp;gt;GCC 3.4&amp;lt;/b&amp;gt; C/C++ compiler [debian/ubuntu: g++-3.4, fedora: compat-gcc-34-c++]; other GCC versions are not well-tested; GCC 4.x will NOT currently build the viewer without some code adjustments.&lt;br /&gt;
&lt;br /&gt;
* fetch and unpack &amp;lt;b&amp;gt;FMOD 3.75&amp;lt;/b&amp;gt; &amp;lt;http://www.fmod.org/&amp;gt;&lt;br /&gt;
** FMOD provides audio output, but (although &#039;free&#039; in some senses) is not itself open-source.  &amp;lt;b&amp;gt;If&amp;lt;/b&amp;gt; you wish to avoid FMOD, thus disabling audio, you may make these changes:&lt;br /&gt;
*** Remove the reference to &#039;&amp;lt;b&amp;gt;fmod-3.75&amp;lt;/b&amp;gt;&#039; in indra/SConstruct&lt;br /&gt;
*** Replace &#039;&amp;lt;b&amp;gt;-DLL_SDL=1&amp;lt;/b&amp;gt;&#039; with &#039;&amp;lt;b&amp;gt;-DLL_SDL=1 -DLL_FMOD=0&amp;lt;/b&amp;gt;&#039; in indra/SConstruct&lt;br /&gt;
*** Comment-out the libfmod line in indra/newview/viewer_manifest.py&lt;br /&gt;
&lt;br /&gt;
**If you want to use FMOD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget http://www.fmod.org/files/fmodapi375linux.tar.gz&lt;br /&gt;
 tar -xzvf fmodapi375linux.tar.gz&lt;br /&gt;
 cd fmodapi375linux/&lt;br /&gt;
 cp api/inc/* ../linden/libraries/i686-linux/include/&lt;br /&gt;
 cp api/libfmod-3.75.so ../linden/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You will need the &amp;lt;b&amp;gt;Curl&amp;lt;/b&amp;gt; library [debian/ubuntu: libcurl-dev, fedora: curl-devel] - at least version 7.15.4 is recommended, 7.16.x is ideal.&lt;br /&gt;
** If you are compiling your own version of &amp;lt;b&amp;gt;Curl&amp;lt;/b&amp;gt;, then you should consider configuring it to use the &amp;lt;b&amp;gt;c-ares&amp;lt;/b&amp;gt; library so that DNS lookups will be asynchronous.&lt;br /&gt;
&lt;br /&gt;
* You will need some development headers for OpenGL and X11: gl.h, glext.h, glu.h, Xlib.h, and Xutil.h [debian/ubuntu: mesa-common-dev, libglu1-mesa-dev, libx11-dev, fedora: mesa-libGL-devel, mesa-libGLU-devel, libX11-devel]&lt;br /&gt;
&lt;br /&gt;
* You will need &amp;lt;b&amp;gt;GTK 2.x development headers&amp;lt;/b&amp;gt; [debian/ubuntu: libgtk2.0-dev, fedora: gtk2-devel]&lt;br /&gt;
&lt;br /&gt;
* You will need &amp;lt;b&amp;gt;yacc&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;lex&amp;lt;/b&amp;gt; [suggest packages: bison, flex]&lt;br /&gt;
&lt;br /&gt;
* You may &amp;lt;b&amp;gt;either&amp;lt;/b&amp;gt; use our easy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle of pre-built libraries and headers unpacked into the Second Life Viewer source tree, &amp;lt;b&amp;gt;or&amp;lt;/b&amp;gt; (for example if you are porting to a new architecture or wish to make a package tailored to your Linux distribution&#039;s own libraries) you will have to install the following additional dependencies:&lt;br /&gt;
** &amp;lt;b&amp;gt;boost&amp;lt;/b&amp;gt; [debian/ubuntu: libboost-dev, fedora: boost-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;boost-regex&amp;lt;/b&amp;gt; [debian/ubuntu: libboost-regex-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;apr-1&amp;lt;/b&amp;gt; [debian/ubuntu: libapr1.0-dev, fedora: apr-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;aprutil-1&amp;lt;/b&amp;gt; [debian/ubuntu: libaprutil1.0-dev, fedora: apr-util-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;xmlrpc-epi 0.51&amp;lt;/b&amp;gt; &amp;lt;http://xmlrpc-epi.sourceforge.net/&amp;gt;&lt;br /&gt;
*** note: not xmlrpc-c (xmlrpc-c has a library and headers with the same name but is not compatible)&lt;br /&gt;
*** Apply patches from the instructions in [[patch xmlrpc-epi]].&lt;br /&gt;
** &amp;lt;b&amp;gt;jpeglib&amp;lt;/b&amp;gt; [debian/ubuntu: libjpeg62-dev, fedora: libjpeg-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;SDL&amp;lt;/b&amp;gt; [libsdl1.2-dev, fedora: SDL-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;Google perftools 0.91 or greater&amp;lt;/b&amp;gt; [debian/ubuntu: google-perftools-dev, fedora: google-perftools-devel]&lt;br /&gt;
** &amp;lt;b&amp;gt;Vorbis&amp;lt;/b&amp;gt; [debian/ubuntu: libvorbis-dev, fedora: libvorbis-devel]&lt;br /&gt;
** build &amp;lt;b&amp;gt;ELFIO&amp;lt;/b&amp;gt; &amp;lt;http://sourceforge.net/projects/elfio/&amp;gt;&lt;br /&gt;
*** This wants to build a static library by default.  Afterwards, to create a dynamic libelfio.so: &amp;lt;code&amp;gt;cd ELFIO &amp;amp;&amp;amp; g++-3.4 -shared *.o -o libelfio.so&amp;lt;/code&amp;gt;&lt;br /&gt;
** build &amp;lt;b&amp;gt;OpenJPEG&amp;lt;/b&amp;gt; &amp;lt;http://www.openjpeg.org/&amp;gt;&lt;br /&gt;
*** note: OpenJPEG 1.1.1 or greater is required which has the macro OPJ_PATH_LEN, if the header has MAX_PATH, then upgrade or it will crash with a divide by zero error as the structures would be two different sizes.&lt;br /&gt;
*** 02-26-2007, another set of patches is required to Second Life to make it usable, that is fix a crash, make it look good, and speed it up.  See https://jira.secondlife.com:443/browse/VWR-123&lt;br /&gt;
** &amp;lt;b&amp;gt;expat&amp;lt;/b&amp;gt; [debian/ubuntu: libexpat1-dev, fedora: expat-devel]&lt;br /&gt;
&lt;br /&gt;
=== Copy headers and libraries into the source tree ===&lt;br /&gt;
&lt;br /&gt;
Here is a guide to the sequence of shell commands needed to copy the required headers and libraries into the Second Life Viewer source tree for building.  Actual paths to system headers may vary according to Linux distribution.&lt;br /&gt;
* ${SLSRC} refers to the top-level directory of the Second Life Viewer source tree.&lt;br /&gt;
* ${FMOD} refers to the top-level directory into which you unpacked FMOD 3.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp ${FMOD}/api/inc/* ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp ${FMOD}/api/libfmod-3.75.so ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You only need to copy the following if you&#039;re not using the handy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp -a /usr/include/atk-1.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/include/gtk-2.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/lib/gtk-2.0/include/* ${SLSRC}/libraries/i686-linux/include/gtk-2.0/&lt;br /&gt;
 cp -a /usr/include/glib-2.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/lib/glib-2.0/include/* ${SLSRC}/libraries/i686-linux/include/glib-2.0/&lt;br /&gt;
 cp -a /usr/include/pango-1.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
&lt;br /&gt;
if your GTK is fairly recent and thus needs Cairo:&lt;br /&gt;
 cp -a /usr/include/cairo/* ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Fix Shell Scripts ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This has been fixed in [http://blog.secondlife.com/2007/05/04/preview-of-second-life-116-on-the-beta-test-grid-sculpties/ 1.16.0]. Looks it was fixed in 1.15.0.2 too&#039;&#039;--[[User:Signore Iredell|Signore Iredell]] 14:56, 6 May 2007 (PDT)&lt;br /&gt;
&lt;br /&gt;
Some systems don&#039;t use bash for /bin/sh.  Ubuntu is one example.  If this is the case on your system, you must do the following, since these scripts are actually bash scripts, but call /bin/sh.&lt;br /&gt;
&lt;br /&gt;
Edit the first line of these scripts, changing &#039;&#039;#!/bin/sh&#039;&#039; to &#039;&#039;#!/bin/bash&#039;&#039;&lt;br /&gt;
* linden/indra/newview/linux_tools/launch_url.sh&lt;br /&gt;
* linden/indra/newview/linux_tools/wrapper.sh&lt;br /&gt;
* linden/libraries/include/boost/pool/detail/pool_construct_simple.sh&lt;br /&gt;
* linden/libraries/include/boost/pool/detail/pool_construct.sh&lt;br /&gt;
* linden/libraries/i686-linux/include/apr-1/arch/unix/apr_arch_threadproc.h&lt;br /&gt;
** &#039;&#039;(it&#039;s at line 47 - 1.15.0.2 release)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Disable llMozLib ===&lt;br /&gt;
&lt;br /&gt;
Add MOZLIB=no to your Scons build command when compiling the source.&lt;br /&gt;
&lt;br /&gt;
=== Libs ===&lt;br /&gt;
&lt;br /&gt;
If you are using our easy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle then you can skip the rest of this section, &amp;lt;b&amp;gt;otherwise&amp;lt;/b&amp;gt; you will also need to perform the following:&lt;br /&gt;
* ${OPENJPEG} refers to the top-level directory of your completed OpenJPEG build.&lt;br /&gt;
* ${ELFIO} refers to the top-level directory of your completed ELFIO build.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp -a /usr/include/apr-1.0/ ${SLSRC}/libraries/i686-linux/include/apr-1&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/expat&lt;br /&gt;
 cp -a /usr/include/expat*.h ${SLSRC}/libraries/i686-linux/include/expat/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/zlib&lt;br /&gt;
 cp -a /usr/include/zlib*.h ${SLSRC}/libraries/i686-linux/include/zlib/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/openjpeg&lt;br /&gt;
 cp ${OPENJPEG}/libopenjpeg/openjpeg.h ${SLSRC}/libraries/i686-linux/include/openjpeg/&lt;br /&gt;
 cp ${OPENJPEG}/libopenjpeg.a ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/ELFIO&lt;br /&gt;
 cp ${ELFIO}/ELFIO/*.h ${SLSRC}/libraries/i686-linux/include/ELFIO/&lt;br /&gt;
 cp ${ELFIO}/ELFIO/libelfio.so ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/jpeglib&lt;br /&gt;
 cp -a /usr/include/j*.h ${SLSRC}/libraries/i686-linux/include/jpeglib/&lt;br /&gt;
 touch ${SLSRC}/libraries/i686-linux/include/jpeglib/jinclude.h&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/llfreetype2&lt;br /&gt;
 cp -a /usr/include/freetype2/freetype/ ${SLSRC}/libraries/i686-linux/include/llfreetype2/&lt;br /&gt;
 cp -a /usr/include/ft2build.h ${SLSRC}/libraries/i686-linux/include/llfreetype2/freetype/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi&lt;br /&gt;
 cp -a /usr/include/xmlrpc*.h ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compiling ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd indra&lt;br /&gt;
 $ scons DISTCC=no BTARGET=client BUILD=release MOZLIB=no&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Expect a build time of a couple of hours.  The resulting unstripped Second Life Viewer binary is &amp;lt;b&amp;gt;newview/secondlife-i686-bin&amp;lt;/b&amp;gt;. Note that temporary object code is compiled into &amp;lt;b&amp;gt;/tmp/$USER&amp;lt;/b&amp;gt; by default (where $USER is your username) - this can be changed by prefixing the &amp;lt;b&amp;gt;scons&amp;lt;/b&amp;gt; command above with &amp;lt;b&amp;gt;TEMP_BUILD_DIR=&amp;quot;&amp;lt;i&amp;gt;[full directory path]&amp;lt;/i&amp;gt;&amp;quot;&amp;lt;/b&amp;gt;. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ TEMP_BUILD_DIR=&amp;quot;/home/fred/secondlife/temp-build&amp;quot; scons DISTCC=no BTARGET=client BUILD=release&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To build a release that has all of the shaders and optimizations enabled and resembles the official shipped Linux alpha client, use BUILD=releasefordownload&lt;br /&gt;
&lt;br /&gt;
Be sure to read the [[Common compilation problems]] page if you have problems - we&#039;ll try to keep the page up to date with known problems and solutions.&lt;br /&gt;
&lt;br /&gt;
== Testing and packaging the client ==&lt;br /&gt;
&lt;br /&gt;
=== Testing the result from inside the tree ===&lt;br /&gt;
&lt;br /&gt;
You may find it simpler and less error-prone to follow the instructions in the &#039;Packaging the client&#039; section below to run the client under the same conditions as an end-user would.  Otherwise:&lt;br /&gt;
&lt;br /&gt;
* Preparing to run &#039;in-tree&#039;&lt;br /&gt;
** &amp;lt;i&amp;gt;ensure that you have indra/newview/app_settings/static_*.db2&amp;lt;/i&amp;gt; - if not, you&#039;ll find it in the &#039;slviewer-artwork&#039; download (a zip file).&lt;br /&gt;
** now, from the indra directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cp ../scripts/messages/message_template.msg newview/app_settings/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running it: The LD_LIBRARY_PATH stuff ensures that the binary looks for its libraries in the right places.  From the indra directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ( cd newview &amp;amp;&amp;amp; LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** For version &#039;&#039;&#039;20070117a&#039;&#039;&#039; the binary name seems to have changed to &#039;&#039;&#039;secondlife-i686-bin-globalsyms&#039;&#039;&#039;, so the command would be (&amp;lt;i&amp;gt;Tofu Linden says - this was an oversight after a build process change, and future releases will generate a &#039;&#039;&#039;secondlife-i686&#039;&#039;&#039; again, whereupon this instruction can be removed. :)&amp;lt;/i&amp;gt;)&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ( cd newview &amp;amp;&amp;amp; LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin-globalsyms )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Augh!!  The client seems REALLY slow!! ====&lt;br /&gt;
&lt;br /&gt;
By default, the open-source Second Life Viewer uses the open-source OpenJPEG library to decode the (many) JPEG-2000 texture images it receives from the servers.  Unfortunately this isn&#039;t quite of comparable speed to the proprietary third-party library which the Linden Lab viewer builds have traditionally used, for which we are not permitted to redistribute the source.&lt;br /&gt;
&lt;br /&gt;
However, the &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package includes two pre-built libraries which facilitate the use of this smoother image decoding method: &amp;lt;b&amp;gt;libkdu_v42R.so&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;libllkdu.so&amp;lt;/b&amp;gt;.  These are provided for your testing; again, we are not permitted to grant you the right to re-distribute these libraries to downstream users, but the viewer will still work (albeit slower) without them.&lt;br /&gt;
&lt;br /&gt;
To &amp;lt;b&amp;gt;use these faster image-decoding libraries&amp;lt;/b&amp;gt;, they simply need to be put into the right places relative to the viewer runtime directory - nothing needs to be reconfigured or recompiled.  If you&#039;re running the client from the source tree, the following will make the KDU libraries available:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp &amp;quot;$SLSRC/libraries/i686-linux/lib_release_client/libllkdu.so&amp;quot; &amp;quot;$SLSRC/indra/newview/libllkdu.so&amp;quot;&lt;br /&gt;
 mkdir &amp;quot;$SLSRC/indra/lib&amp;quot;&lt;br /&gt;
 cp &amp;quot;$SLSRC/libraries/i686-linux/lib_release_client/libkdu_v42R.so&amp;quot; &amp;quot;$SLSRC/indra/lib/libkdu_v42R.so&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt; contains some commented-out entries describing where these libraries belong; if you uncomment the two lines corresponding to libllkdu and libkdu then they will be automatically copied into the right place in the runtime directory when you follow the &#039;Packaging the client&#039; instructions below.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;Unable to initialize communications&amp;quot; ====&lt;br /&gt;
&lt;br /&gt;
If the viewer just displays the error message &amp;quot; Unable to initialize communications&amp;quot; and exits, it can&#039;t find message_template.msg. You did remember to copy it over, right?&lt;br /&gt;
&lt;br /&gt;
=== Packaging the client ===&lt;br /&gt;
&lt;br /&gt;
If you substitute &#039;BUILD=release&#039; with &#039;&amp;lt;b&amp;gt;BUILD=releasefordownload&amp;lt;/b&amp;gt;&#039; in the &#039;Compiling&#039; section above, then packaging the resulting code, libraries, data and documentation into a tarball for the end-user will be done automatically as the final stage of the build process; the pristine end-user client distribution has been assembled into the directory &amp;lt;b&amp;gt;indra/newview/SecondLife_i686_1_X_Y_Z/&amp;lt;/b&amp;gt; and has also been tarred into &amp;lt;b&amp;gt;indra/newview/SecondLife_i686_1_X_Y_Z.tar.bz2&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file which controls what (and where) files go into the end-user runtime viewer directory is &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Packaging errors ====&lt;br /&gt;
&lt;br /&gt;
The final packaging step may fail with errors about the manifest if you are not using the &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle; in this case, if you still wish to end up with an end-user viewer package incorporating your own libraries, you can edit the manifest file found at &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Automated libraries and headers adjustments, compilation and packaging ====&lt;br /&gt;
&lt;br /&gt;
Here is a bash script that could save you a lot of time... It basically does all what is described above, and more, and entitles you to compile a SL client very easily:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# make-SL v1.00 (c)2007 Henri Beauchamp. Released under GPL license v2:&lt;br /&gt;
# http://www.gnu.org/licenses/gpl.txt&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
######## THIS IS QUICK&#039;N DIRTY ALPHA SOFTWARE. USE AT YOUR OWN RISKS ! ########&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# This bash script is aimed at easying up the build process of a SL client.&lt;br /&gt;
# It does not cover building it with custom/system openjpeg, elfio or fmodapi&lt;br /&gt;
# (we use the provided libraries).&lt;br /&gt;
# You may enable or disable the use of your system&#039;s library by editing&lt;br /&gt;
# the USE_SYSTEM_* variable (&amp;quot;yes&amp;quot; --&amp;gt; use the system library, &amp;quot;no&amp;quot; --&amp;gt; use&lt;br /&gt;
# LL&#039;s provided ones).&lt;br /&gt;
# The script also takes care of updating properly the viewer_manifest.py script&lt;br /&gt;
# accordingly, so that you (should) end up with a properly packaged client.&lt;br /&gt;
&lt;br /&gt;
# To use this script, simply make it executable (chmod +x make-SL) and&lt;br /&gt;
# put it into /usr/local/bin (or any other directory in your PATH).&lt;br /&gt;
# Then, download the slviewer-src-*.tar.gz, slviewer-linux-libs-*.tar.gz,&lt;br /&gt;
# slviewer-artwork-*.zip and fmodapi*.tar.gz archives, and finally, invoke&lt;br /&gt;
# make-SL as follow:&lt;br /&gt;
#   make-SL path_to_archives  (example: make-SL ~/downloads)&lt;br /&gt;
# or simply:&lt;br /&gt;
#   make-SL&lt;br /&gt;
# when invoking from the directory where the archives are.&lt;br /&gt;
# The sources will be installed into the PATH_TO_SOURCES directory,&lt;br /&gt;
# and the client will be built into the TEMP_BUILD_DIR directory.&lt;br /&gt;
# If you want to retry a compilation after fixing something manually and&lt;br /&gt;
# don&#039;t want make-SL to start all over again, overwriting everything,&lt;br /&gt;
# you may invoke it with the --retry option, like this:&lt;br /&gt;
#   make-SL --retry&lt;br /&gt;
# This script has been tested by the author, on a (very customized)&lt;br /&gt;
# Mandrake 10.2 distro.&lt;br /&gt;
&lt;br /&gt;
# Where the sources of the client will be held (defaults to &amp;quot;linden&amp;quot;):&lt;br /&gt;
PATH_TO_SOURCES=&amp;quot;/usr/src/SL&amp;quot;&lt;br /&gt;
# Where to build the client:&lt;br /&gt;
export TEMP_BUILD_DIR=&amp;quot;$HOME/secondlife&amp;quot;&lt;br /&gt;
&lt;br /&gt;
USE_SYSTEM_GTK=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_SDL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_SSL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_DB4=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_OGG=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_APR=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_ZLIB=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_UUID=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_CURL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_EXPAT=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_VORBIS=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_XMLRPC=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_JPEGLIB=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_FREETYPE2=&amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# You may add tune flags here, to optimize the code for your processor.&lt;br /&gt;
# Example, for an Athlon XP:&lt;br /&gt;
# TUNE_FLAGS=&amp;quot;-march=athlon-xp -mtune=athlon-xp&amp;quot;&lt;br /&gt;
TUNE_FLAGS=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Whether to build with the browser login screen or not:&lt;br /&gt;
WITH_MOZILLA=&amp;quot;no&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function update_manifest() {&lt;br /&gt;
    grep -v $1 $PATH_TO_SOURCES/indra/newview/viewer_manifest.py &amp;gt;$TEMP_BUILD_DIR/viewer_manifest.py&lt;br /&gt;
    mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function compile() {&lt;br /&gt;
    cd $PATH_TO_SOURCES/indra&lt;br /&gt;
    echo &amp;quot;Compiling the client into $TEMP_BUILD_DIR...&amp;quot;&lt;br /&gt;
    scons DISTCC=no BTARGET=client BUILD=releasefordownload MOZLIB=$WITH_MOZILLA&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$TEMP_BUILD_DIR&amp;quot; == &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    export TEMP_BUILD_DIR=/tmp/$USER/SL&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Check to see if we simply want to retry a compilation:&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; == &amp;quot;--retry&amp;quot; ] ; then&lt;br /&gt;
    compile&lt;br /&gt;
    exit $?&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Make sure we don&#039;t unpack over an old source tree:&lt;br /&gt;
if [ -d linden ] ; then&lt;br /&gt;
    rm -rf linden/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -d $PATH_TO_SOURCES ] &amp;amp;&amp;amp; [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    rm -rf $PATH_TO_SOURCES/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Use the parameter (if any) as the path to the archives:&lt;br /&gt;
&lt;br /&gt;
PATH_TO_ARCHIVES=&amp;quot;.&amp;quot;&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
    if [ -d $1 ] ; then&lt;br /&gt;
        PATH_TO_ARCHIVES=$1&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s first unpack everything:&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-src !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-linux-libs !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-artwork-*.zip ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-artwork !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/fmodapi*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need fmodapi !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
echo &amp;quot;Extracting the files from the archives...&amp;quot;&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz&lt;br /&gt;
unzip $PATH_TO_ARCHIVES/slviewer-artwork-*.zip &amp;gt;/dev/null&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/fmodapi*.tar.gz&lt;br /&gt;
&lt;br /&gt;
# fmodapi:&lt;br /&gt;
echo &amp;quot;Copying fmodapi files...&amp;quot;&lt;br /&gt;
cp -a fmodapi*/api/inc/* linden/libraries/i686-linux/include/&lt;br /&gt;
cp fmodapi*/api/libfmod-*.so linden/libraries/i686-linux/lib_release_client/&lt;br /&gt;
rm -rf fmodapi*/&lt;br /&gt;
&lt;br /&gt;
# Move the sources to where we want to hold them:&lt;br /&gt;
if [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;linden&amp;quot; ] &amp;amp;&amp;amp; [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Moving the sources to $PATH_TO_SOURCES...&amp;quot;&lt;br /&gt;
    mv -f linden $PATH_TO_SOURCES&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s own the files:&lt;br /&gt;
chown -R $USER: $PATH_TO_SOURCES/&lt;br /&gt;
&lt;br /&gt;
# Make a clean build:&lt;br /&gt;
if [ -d $TEMP_BUILD_DIR ] ; then&lt;br /&gt;
    rm -rf $TEMP_BUILD_DIR/&lt;br /&gt;
fi&lt;br /&gt;
mkdir -p $TEMP_BUILD_DIR&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system GTK+ if available:&lt;br /&gt;
if [ -d /usr/include/atk-1.0 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_GTK&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system GTK+...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux/include&lt;br /&gt;
    rm -rf atk-1.0/ gtk-2.0/ glib-2.0/ pango-1.0/&lt;br /&gt;
    rm -f ../lib_release_client/libgtk*&lt;br /&gt;
    cp -a /usr/include/atk-1.0 .&lt;br /&gt;
    cp -a /usr/include/gtk-2.0 .&lt;br /&gt;
    cp -a /usr/lib/gtk-2.0/include/* gtk-2.0/&lt;br /&gt;
    cp -a /usr/include/glib-2.0 .&lt;br /&gt;
    cp -a /usr/lib/glib-2.0/include/* glib-2.0/&lt;br /&gt;
    cp -a /usr/include/pango-1.0 .&lt;br /&gt;
    if [ -d /usr/include/cairo ] ; then&lt;br /&gt;
        cp -a /usr/include/cairo/* .&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system freetype2 if available:&lt;br /&gt;
if [ -f /usr/include/ft2build.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_FREETYPE2&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system freetype2...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/freetype/ i686-linux/include/llfreetype2/*&lt;br /&gt;
    rm -f include/ft2build.h i686-linux/lib_release_client/libfreetype.a&lt;br /&gt;
    cp -a /usr/include/freetype2/freetype/ i686-linux/include/llfreetype2/&lt;br /&gt;
    cp -a /usr/include/ft2build.h i686-linux/include/llfreetype2/freetype/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system zlib if available:&lt;br /&gt;
if [ -f /usr/include/zlib.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_ZLIB&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system zlib...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/zlib/&lt;br /&gt;
    mkdir -p i686-linux/include/zlib&lt;br /&gt;
    cp -a /usr/include/zlib*.h i686-linux/include/zlib/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system jpeglib if available:&lt;br /&gt;
if [ -f /usr/include/jpeglib.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_JPEGLIB&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system jpeglib...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/jpeglib/ i686-linux/lib_release_client/libjpeg.a&lt;br /&gt;
    mkdir -p i686-linux/include/jpeglib&lt;br /&gt;
    cp -a /usr/include/j*.h i686-linux/include/jpeglib/&lt;br /&gt;
    touch i686-linux/include/jpeglib/jinclude.h&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system xmlrpc-epi if available:&lt;br /&gt;
if [ -f /usr/include/xmlrpc.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_XMLRPC&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system xmlrpc-epi...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/xmlrpc-epi/ i686-linux/lib_release_client/libxmlrpc.a&lt;br /&gt;
    mkdir -p i686-linux/include/xmlrpc-epi&lt;br /&gt;
    cp -a /usr/include/xmlrpc*.h i686-linux/include/xmlrpc-epi/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system ogg if available:&lt;br /&gt;
if [ -f /usr/include/ogg/ogg.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_OGG&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system ogg...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/ogg/ i686-linux/lib_release_client/libogg*&lt;br /&gt;
    update_manifest libogg&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system vorbis if available:&lt;br /&gt;
if [ -f /usr/include/vorbis/vorbisenc.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_VORBIS&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system vorbis...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/vorbis/ i686-linux/lib_release_client/libvorbis*&lt;br /&gt;
    update_manifest libvorbis&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system SDL if available:&lt;br /&gt;
if [ -f /usr/include/SDL/SDL.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_SDL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system SDL...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux&lt;br /&gt;
    rm -rf include/SDL/ lib_release_client/libSDL*&lt;br /&gt;
    update_manifest libSDL&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system openssl if available:&lt;br /&gt;
if [ -f /usr/lib/libssl.so.0.9.7 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_SSL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system openssl...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client&lt;br /&gt;
    rm -f libssl.* libcrypto.*&lt;br /&gt;
    update_manifest libssl&lt;br /&gt;
    update_manifest libcrypto&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system apr if available:&lt;br /&gt;
if [ -f /usr/include/apr*/apr.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_APR&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system apr...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux&lt;br /&gt;
    rm -rf include/apr-1/*&lt;br /&gt;
    rm -f lib_release_client/libapr*&lt;br /&gt;
    cp -a /usr/include/apr*/* include/apr-1/&lt;br /&gt;
    update_manifest libapr&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system expat if available:&lt;br /&gt;
if [ -f /usr/include/expat.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_EXPAT&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system expat...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/expat/&lt;br /&gt;
    rm -f i686-linux/lib_release_client/libexpat*&lt;br /&gt;
    mkdir -p i686-linux/include/expat&lt;br /&gt;
    cp -a /usr/include/expat*.h i686-linux/include/expat/&lt;br /&gt;
    update_manifest libexpat&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system curl if available:&lt;br /&gt;
if [ -f /usr/include/curl/curl.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_CURL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system curl...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/curl/&lt;br /&gt;
    rm -f i686-linux/lib_release_client/libcurl.*&lt;br /&gt;
    update_manifest libcurl&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system db4 if available:&lt;br /&gt;
if [ -f /usr/lib/libdb-4.2.so ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_DB4&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system db4...&amp;quot;&lt;br /&gt;
    rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libdb*.so&lt;br /&gt;
    update_manifest libdb&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system uuid if available:&lt;br /&gt;
if [ -f /lib/libuuid.so.1 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_UUID&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system libuuid...&amp;quot;&lt;br /&gt;
    rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libuuid.*&lt;br /&gt;
    update_manifest libuuid&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Update the manifest file and enable libkdu packaging. I&#039;m too lazy to use&lt;br /&gt;
# awk or perl, here, but that&#039;s indeed what should be done...&lt;br /&gt;
# The following (very dirty) code may break at some point, depending on what&lt;br /&gt;
# LL will put in comments in the manifest file...&lt;br /&gt;
# First, remove the lines with libstdc++.so.6 and the crash logger:&lt;br /&gt;
update_manifest libstdc&lt;br /&gt;
update_manifest crash_logger&lt;br /&gt;
# Now, any line with a &#039;#&#039; followed with several spaces _should_ be dealing&lt;br /&gt;
# with the libkdu stuff... So, we simply remove the &#039;#&amp;quot;...&lt;br /&gt;
sed -e &amp;quot;s/#   /   /&amp;quot; $PATH_TO_SOURCES/indra/newview/viewer_manifest.py &amp;gt;$TEMP_BUILD_DIR/viewer_manifest.py&lt;br /&gt;
mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py&lt;br /&gt;
&lt;br /&gt;
# Add tune flags, if any:&lt;br /&gt;
if [ &amp;quot;$TUNE_FLAGS&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    sed -e &amp;quot;s/-O2/-O2 $TUNE_FLAGS/&amp;quot; $PATH_TO_SOURCES/indra/SConstruct &amp;gt;$TEMP_BUILD_DIR/SConstruct&lt;br /&gt;
    mv -f $TEMP_BUILD_DIR/SConstruct $PATH_TO_SOURCES/indra/SConstruct&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
compile&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FreeBSD ==&lt;br /&gt;
&lt;br /&gt;
A list of patches is given for [[Compiling the viewer (FreeBSD)]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Build_the_Viewer_on_Linux&amp;diff=21623</id>
		<title>Build the Viewer on Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Build_the_Viewer_on_Linux&amp;diff=21623"/>
		<updated>2007-05-25T16:50:14Z</updated>

		<summary type="html">&lt;p&gt;Sardonyx Linden: Mention Google perftools&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{CompileNav}}&lt;br /&gt;
&lt;br /&gt;
The following are instructions for building the Second Life viewer on linux. This process has only been used on [http://www.debian.org/ debian] and debian based systems like [http://www.ubuntu.com/ ubuntu]. For other platforms, see [[Get source and compile]].&lt;br /&gt;
&lt;br /&gt;
== Installing the required dependencies ==&lt;br /&gt;
&lt;br /&gt;
The Second Life Viewer has a number of compile/link dependencies on external libraries which need to be put in place first - to help you, the source download page contains a link to a &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package which you unpack over the source tree to fill most of the dependencies (and thus avoid most of the fiddly work described on this page).  The Second Life Viewer is not a trivial build, and experience with building large software packages will help you greatly - but don&#039;t be daunted, it should be simple once the dependencies are in the right place the first time.&lt;br /&gt;
&lt;br /&gt;
Paths and package names given here are based on Ubuntu 6.06 and may vary according to your Linux distribution.&lt;br /&gt;
&lt;br /&gt;
*If you download the art and libs to the top folder, where the &amp;lt;i&amp;gt;linden&amp;lt;/i&amp;gt; folder is after getting the veiwer source code, the following commands should unpack everything to the right spot. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 unzip slviewer-artwork-&amp;lt;version&amp;gt;.zip&lt;br /&gt;
 tar xvfz slviewer-linux-libs-&amp;lt;version&amp;gt;.tar.gz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{vital-info|How to compile [[Source_archive#2007-Feb-20|FL-1.13.3.58185]] and [[Source_archive#2007-Feb-24|FL-1.13.3.58390]] &#039;&#039;&#039;with&#039;&#039;&#039; llmozlib (see [[Talk:Compiling_the_viewer_%28Linux%29#llmozlib|discussion]])}}&lt;br /&gt;
&lt;br /&gt;
* You will need the &amp;lt;b&amp;gt;SCons&amp;lt;/b&amp;gt; build tool [package: scons]&lt;br /&gt;
* You should use the &amp;lt;b&amp;gt;GCC 3.4&amp;lt;/b&amp;gt; C/C++ compiler [package: g++-3.4]; other GCC versions are not well-tested; GCC 4.x will NOT currently build the viewer without some code adjustments.&lt;br /&gt;
&lt;br /&gt;
* fetch and unpack &amp;lt;b&amp;gt;FMOD 3.75&amp;lt;/b&amp;gt; &amp;lt;http://www.fmod.org/&amp;gt;&lt;br /&gt;
** FMOD provides audio output, but (although &#039;free&#039; in some senses) is not itself open-source.  &amp;lt;b&amp;gt;If&amp;lt;/b&amp;gt; you wish to avoid FMOD, thus disabling audio, you may make these changes:&lt;br /&gt;
*** Remove the reference to &#039;&amp;lt;b&amp;gt;fmod-3.75&amp;lt;/b&amp;gt;&#039; in indra/SConstruct&lt;br /&gt;
*** Replace &#039;&amp;lt;b&amp;gt;-DLL_SDL=1&amp;lt;/b&amp;gt;&#039; with &#039;&amp;lt;b&amp;gt;-DLL_SDL=1 -DLL_FMOD=0&amp;lt;/b&amp;gt;&#039; in indra/SConstruct&lt;br /&gt;
*** Comment-out the libfmod line in indra/newview/viewer_manifest.py&lt;br /&gt;
&lt;br /&gt;
**If you want to use FMOD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget http://www.fmod.org/files/fmodapi375linux.tar.gz&lt;br /&gt;
 tar -xzvf fmodapi375linux.tar.gz&lt;br /&gt;
 cd fmodapi375linux/&lt;br /&gt;
 cp api/inc/* ../linden/libraries/i686-linux/include/&lt;br /&gt;
 cp api/libfmod-3.75.so ../linden/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You will need the &amp;lt;b&amp;gt;Curl&amp;lt;/b&amp;gt; library [package: libcurl-dev] - at least version 7.15.4 is recommended, 7.16.x is ideal.&lt;br /&gt;
** If you are compiling your own version of &amp;lt;b&amp;gt;Curl&amp;lt;/b&amp;gt;, then you should consider configuring it to use the &amp;lt;b&amp;gt;c-ares&amp;lt;/b&amp;gt; library so that DNS lookups will be asynchronous.&lt;br /&gt;
&lt;br /&gt;
* You will need some development headers for OpenGL and X11: gl.h, glext.h, glu.h, Xlib.h, and Xutil.h [packages: mesa-common-dev, libglu1-mesa-dev, libx11-dev]&lt;br /&gt;
&lt;br /&gt;
* You will need &amp;lt;b&amp;gt;GTK 2.x development headers&amp;lt;/b&amp;gt; [libgtk2.0-dev]&lt;br /&gt;
&lt;br /&gt;
* You will need &amp;lt;b&amp;gt;yacc&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;lex&amp;lt;/b&amp;gt; [suggest packages: bison, flex]&lt;br /&gt;
&lt;br /&gt;
* You may &amp;lt;b&amp;gt;either&amp;lt;/b&amp;gt; use our easy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle of pre-built libraries and headers unpacked into the Second Life Viewer source tree, &amp;lt;b&amp;gt;or&amp;lt;/b&amp;gt; (for example if you are porting to a new architecture or wish to make a package tailored to your Linux distribution&#039;s own libraries) you will have to install the following additional dependencies:&lt;br /&gt;
** &amp;lt;b&amp;gt;boost&amp;lt;/b&amp;gt; [libboost-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;boost-regex&amp;lt;/b&amp;gt; [libboost-regex-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;apr-1&amp;lt;/b&amp;gt; [libapr1.0-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;aprutil-1&amp;lt;/b&amp;gt; [libaprutil1.0-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;xmlrpc-epi 0.51&amp;lt;/b&amp;gt; &amp;lt;http://xmlrpc-epi.sourceforge.net/&amp;gt;&lt;br /&gt;
*** note: not xmlrpc-c (xmlrpc-c has a library and headers with the same name but is not compatible)&lt;br /&gt;
*** Apply patches from the instructions in [[patch xmlrpc-epi]].&lt;br /&gt;
** &amp;lt;b&amp;gt;jpeglib&amp;lt;/b&amp;gt; [libjpeg62-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;SDL&amp;lt;/b&amp;gt; [libsdl1.2-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;Google perftools 0.91 or greater&amp;lt;/b&amp;gt; [google-perftools-dev]&lt;br /&gt;
** &amp;lt;b&amp;gt;Vorbis&amp;lt;/b&amp;gt; [libvorbis-dev]&lt;br /&gt;
** build &amp;lt;b&amp;gt;ELFIO&amp;lt;/b&amp;gt; &amp;lt;http://sourceforge.net/projects/elfio/&amp;gt;&lt;br /&gt;
*** This wants to build a static library by default.  Afterwards, to create a dynamic libelfio.so: &amp;lt;code&amp;gt;cd ELFIO &amp;amp;&amp;amp; g++-3.4 -shared *.o -o libelfio.so&amp;lt;/code&amp;gt;&lt;br /&gt;
** build &amp;lt;b&amp;gt;OpenJPEG&amp;lt;/b&amp;gt; &amp;lt;http://www.openjpeg.org/&amp;gt;&lt;br /&gt;
*** note: OpenJPEG 1.1.1 or greater is required which has the macro OPJ_PATH_LEN, if the header has MAX_PATH, then upgrade or it will crash with a divide by zero error as the structures would be two different sizes.&lt;br /&gt;
*** 02-26-2007, another set of patches is required to Second Life to make it usable, that is fix a crash, make it look good, and speed it up.  See https://jira.secondlife.com:443/browse/VWR-123&lt;br /&gt;
** &amp;lt;b&amp;gt;expat&amp;lt;/b&amp;gt; [libexpat1-dev]&lt;br /&gt;
&lt;br /&gt;
=== Copy headers and libraries into the source tree ===&lt;br /&gt;
&lt;br /&gt;
Here is a guide to the sequence of shell commands needed to copy the required headers and libraries into the Second Life Viewer source tree for building.  Actual paths to system headers may vary according to Linux distribution.&lt;br /&gt;
* ${SLSRC} refers to the top-level directory of the Second Life Viewer source tree.&lt;br /&gt;
* ${FMOD} refers to the top-level directory into which you unpacked FMOD 3.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp ${FMOD}/api/inc/* ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp ${FMOD}/api/libfmod-3.75.so ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You only need to copy the following if you&#039;re not using the handy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp -a /usr/include/atk-1.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/include/gtk-2.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/lib/gtk-2.0/include/* ${SLSRC}/libraries/i686-linux/include/gtk-2.0/&lt;br /&gt;
 cp -a /usr/include/glib-2.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
 cp -a /usr/lib/glib-2.0/include/* ${SLSRC}/libraries/i686-linux/include/glib-2.0/&lt;br /&gt;
 cp -a /usr/include/pango-1.0 ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
&lt;br /&gt;
if your GTK is fairly recent and thus needs Cairo:&lt;br /&gt;
 cp -a /usr/include/cairo/* ${SLSRC}/libraries/i686-linux/include/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Fix Shell Scripts ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This has been fixed in [http://blog.secondlife.com/2007/05/04/preview-of-second-life-116-on-the-beta-test-grid-sculpties/ 1.16.0]. Looks it was fixed in 1.15.0.2 too&#039;&#039;--[[User:Signore Iredell|Signore Iredell]] 14:56, 6 May 2007 (PDT)&lt;br /&gt;
&lt;br /&gt;
Some systems don&#039;t use bash for /bin/sh.  Ubuntu is one example.  If this is the case on your system, you must do the following, since these scripts are actually bash scripts, but call /bin/sh.&lt;br /&gt;
&lt;br /&gt;
Edit the first line of these scripts, changing &#039;&#039;#!/bin/sh&#039;&#039; to &#039;&#039;#!/bin/bash&#039;&#039;&lt;br /&gt;
* linden/indra/newview/linux_tools/launch_url.sh&lt;br /&gt;
* linden/indra/newview/linux_tools/wrapper.sh&lt;br /&gt;
* linden/libraries/include/boost/pool/detail/pool_construct_simple.sh&lt;br /&gt;
* linden/libraries/include/boost/pool/detail/pool_construct.sh&lt;br /&gt;
* linden/libraries/i686-linux/include/apr-1/arch/unix/apr_arch_threadproc.h&lt;br /&gt;
** &#039;&#039;(it&#039;s at line 47 - 1.15.0.2 release)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Disable llMozLib ===&lt;br /&gt;
&lt;br /&gt;
Add MOZLIB=no to your Scons build command when compiling the source.&lt;br /&gt;
&lt;br /&gt;
=== Libs ===&lt;br /&gt;
&lt;br /&gt;
If you are using our easy &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle then you can skip the rest of this section, &amp;lt;b&amp;gt;otherwise&amp;lt;/b&amp;gt; you will also need to perform the following:&lt;br /&gt;
* ${OPENJPEG} refers to the top-level directory of your completed OpenJPEG build.&lt;br /&gt;
* ${ELFIO} refers to the top-level directory of your completed ELFIO build.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp -a /usr/include/apr-1.0/ ${SLSRC}/libraries/i686-linux/include/apr-1&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/expat&lt;br /&gt;
 cp -a /usr/include/expat*.h ${SLSRC}/libraries/i686-linux/include/expat/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/zlib&lt;br /&gt;
 cp -a /usr/include/zlib*.h ${SLSRC}/libraries/i686-linux/include/zlib/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/openjpeg&lt;br /&gt;
 cp ${OPENJPEG}/libopenjpeg/openjpeg.h ${SLSRC}/libraries/i686-linux/include/openjpeg/&lt;br /&gt;
 cp ${OPENJPEG}/libopenjpeg.a ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/ELFIO&lt;br /&gt;
 cp ${ELFIO}/ELFIO/*.h ${SLSRC}/libraries/i686-linux/include/ELFIO/&lt;br /&gt;
 cp ${ELFIO}/ELFIO/libelfio.so ${SLSRC}/libraries/i686-linux/lib_release_client/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/jpeglib&lt;br /&gt;
 cp -a /usr/include/j*.h ${SLSRC}/libraries/i686-linux/include/jpeglib/&lt;br /&gt;
 touch ${SLSRC}/libraries/i686-linux/include/jpeglib/jinclude.h&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/llfreetype2&lt;br /&gt;
 cp -a /usr/include/freetype2/freetype/ ${SLSRC}/libraries/i686-linux/include/llfreetype2/&lt;br /&gt;
 cp -a /usr/include/ft2build.h ${SLSRC}/libraries/i686-linux/include/llfreetype2/freetype/&lt;br /&gt;
&lt;br /&gt;
 mkdir ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi&lt;br /&gt;
 cp -a /usr/include/xmlrpc*.h ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compiling ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd indra&lt;br /&gt;
 $ scons DISTCC=no BTARGET=client BUILD=release MOZLIB=no&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Expect a build time of a couple of hours.  The resulting unstripped Second Life Viewer binary is &amp;lt;b&amp;gt;newview/secondlife-i686-bin&amp;lt;/b&amp;gt;. Note that temporary object code is compiled into &amp;lt;b&amp;gt;/tmp/$USER&amp;lt;/b&amp;gt; by default (where $USER is your username) - this can be changed by prefixing the &amp;lt;b&amp;gt;scons&amp;lt;/b&amp;gt; command above with &amp;lt;b&amp;gt;TEMP_BUILD_DIR=&amp;quot;&amp;lt;i&amp;gt;[full directory path]&amp;lt;/i&amp;gt;&amp;quot;&amp;lt;/b&amp;gt;. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ TEMP_BUILD_DIR=&amp;quot;/home/fred/secondlife/temp-build&amp;quot; scons DISTCC=no BTARGET=client BUILD=release&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To build a release that has all of the shaders and optimizations enabled and resembles the official shipped Linux alpha client, use BUILD=releasefordownload&lt;br /&gt;
&lt;br /&gt;
Be sure to read the [[Common compilation problems]] page if you have problems - we&#039;ll try to keep the page up to date with known problems and solutions.&lt;br /&gt;
&lt;br /&gt;
== Testing and packaging the client ==&lt;br /&gt;
&lt;br /&gt;
=== Testing the result from inside the tree ===&lt;br /&gt;
&lt;br /&gt;
You may find it simpler and less error-prone to follow the instructions in the &#039;Packaging the client&#039; section below to run the client under the same conditions as an end-user would.  Otherwise:&lt;br /&gt;
&lt;br /&gt;
* Preparing to run &#039;in-tree&#039;&lt;br /&gt;
** &amp;lt;i&amp;gt;ensure that you have indra/newview/app_settings/static_*.db2&amp;lt;/i&amp;gt; - if not, you&#039;ll find it in the &#039;slviewer-artwork&#039; download (a zip file).&lt;br /&gt;
** now, from the indra directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cp ../scripts/messages/message_template.msg newview/app_settings/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running it: The LD_LIBRARY_PATH stuff ensures that the binary looks for its libraries in the right places.  From the indra directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ( cd newview &amp;amp;&amp;amp; LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** For version &#039;&#039;&#039;20070117a&#039;&#039;&#039; the binary name seems to have changed to &#039;&#039;&#039;secondlife-i686-bin-globalsyms&#039;&#039;&#039;, so the command would be (&amp;lt;i&amp;gt;Tofu Linden says - this was an oversight after a build process change, and future releases will generate a &#039;&#039;&#039;secondlife-i686&#039;&#039;&#039; again, whereupon this instruction can be removed. :)&amp;lt;/i&amp;gt;)&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ( cd newview &amp;amp;&amp;amp; LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin-globalsyms )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Augh!!  The client seems REALLY slow!! ====&lt;br /&gt;
&lt;br /&gt;
By default, the open-source Second Life Viewer uses the open-source OpenJPEG library to decode the (many) JPEG-2000 texture images it receives from the servers.  Unfortunately this isn&#039;t quite of comparable speed to the proprietary third-party library which the Linden Lab viewer builds have traditionally used, for which we are not permitted to redistribute the source.&lt;br /&gt;
&lt;br /&gt;
However, the &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; package includes two pre-built libraries which facilitate the use of this smoother image decoding method: &amp;lt;b&amp;gt;libkdu_v42R.so&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;libllkdu.so&amp;lt;/b&amp;gt;.  These are provided for your testing; again, we are not permitted to grant you the right to re-distribute these libraries to downstream users, but the viewer will still work (albeit slower) without them.&lt;br /&gt;
&lt;br /&gt;
To &amp;lt;b&amp;gt;use these faster image-decoding libraries&amp;lt;/b&amp;gt;, they simply need to be put into the right places relative to the viewer runtime directory - nothing needs to be reconfigured or recompiled.  If you&#039;re running the client from the source tree, the following will make the KDU libraries available:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cp &amp;quot;$SLSRC/libraries/i686-linux/lib_release_client/libllkdu.so&amp;quot; &amp;quot;$SLSRC/indra/newview/libllkdu.so&amp;quot;&lt;br /&gt;
 mkdir &amp;quot;$SLSRC/indra/lib&amp;quot;&lt;br /&gt;
 cp &amp;quot;$SLSRC/libraries/i686-linux/lib_release_client/libkdu_v42R.so&amp;quot; &amp;quot;$SLSRC/indra/lib/libkdu_v42R.so&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt; contains some commented-out entries describing where these libraries belong; if you uncomment the two lines corresponding to libllkdu and libkdu then they will be automatically copied into the right place in the runtime directory when you follow the &#039;Packaging the client&#039; instructions below.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;Unable to initialize communications&amp;quot; ====&lt;br /&gt;
&lt;br /&gt;
If the viewer just displays the error message &amp;quot; Unable to initialize communications&amp;quot; and exits, it can&#039;t find message_template.msg. You did remember to copy it over, right?&lt;br /&gt;
&lt;br /&gt;
=== Packaging the client ===&lt;br /&gt;
&lt;br /&gt;
If you substitute &#039;BUILD=release&#039; with &#039;&amp;lt;b&amp;gt;BUILD=releasefordownload&amp;lt;/b&amp;gt;&#039; in the &#039;Compiling&#039; section above, then packaging the resulting code, libraries, data and documentation into a tarball for the end-user will be done automatically as the final stage of the build process; the pristine end-user client distribution has been assembled into the directory &amp;lt;b&amp;gt;indra/newview/SecondLife_i686_1_X_Y_Z/&amp;lt;/b&amp;gt; and has also been tarred into &amp;lt;b&amp;gt;indra/newview/SecondLife_i686_1_X_Y_Z.tar.bz2&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file which controls what (and where) files go into the end-user runtime viewer directory is &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Packaging errors ====&lt;br /&gt;
&lt;br /&gt;
The final packaging step may fail with errors about the manifest if you are not using the &amp;lt;i&amp;gt;slviewer-linux-libs&amp;lt;/i&amp;gt; bundle; in this case, if you still wish to end up with an end-user viewer package incorporating your own libraries, you can edit the manifest file found at &amp;lt;b&amp;gt;indra/newview/viewer_manifest.py&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Automated libraries and headers adjustments, compilation and packaging ====&lt;br /&gt;
&lt;br /&gt;
Here is a bash script that could save you a lot of time... It basically does all what is described above, and more, and entitles you to compile a SL client very easily:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# make-SL v1.00 (c)2007 Henri Beauchamp. Released under GPL license v2:&lt;br /&gt;
# http://www.gnu.org/licenses/gpl.txt&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
######## THIS IS QUICK&#039;N DIRTY ALPHA SOFTWARE. USE AT YOUR OWN RISKS ! ########&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# This bash script is aimed at easying up the build process of a SL client.&lt;br /&gt;
# It does not cover building it with custom/system openjpeg, elfio or fmodapi&lt;br /&gt;
# (we use the provided libraries).&lt;br /&gt;
# You may enable or disable the use of your system&#039;s library by editing&lt;br /&gt;
# the USE_SYSTEM_* variable (&amp;quot;yes&amp;quot; --&amp;gt; use the system library, &amp;quot;no&amp;quot; --&amp;gt; use&lt;br /&gt;
# LL&#039;s provided ones).&lt;br /&gt;
# The script also takes care of updating properly the viewer_manifest.py script&lt;br /&gt;
# accordingly, so that you (should) end up with a properly packaged client.&lt;br /&gt;
&lt;br /&gt;
# To use this script, simply make it executable (chmod +x make-SL) and&lt;br /&gt;
# put it into /usr/local/bin (or any other directory in your PATH).&lt;br /&gt;
# Then, download the slviewer-src-*.tar.gz, slviewer-linux-libs-*.tar.gz,&lt;br /&gt;
# slviewer-artwork-*.zip and fmodapi*.tar.gz archives, and finally, invoke&lt;br /&gt;
# make-SL as follow:&lt;br /&gt;
#   make-SL path_to_archives  (example: make-SL ~/downloads)&lt;br /&gt;
# or simply:&lt;br /&gt;
#   make-SL&lt;br /&gt;
# when invoking from the directory where the archives are.&lt;br /&gt;
# The sources will be installed into the PATH_TO_SOURCES directory,&lt;br /&gt;
# and the client will be built into the TEMP_BUILD_DIR directory.&lt;br /&gt;
# If you want to retry a compilation after fixing something manually and&lt;br /&gt;
# don&#039;t want make-SL to start all over again, overwriting everything,&lt;br /&gt;
# you may invoke it with the --retry option, like this:&lt;br /&gt;
#   make-SL --retry&lt;br /&gt;
# This script has been tested by the author, on a (very customized)&lt;br /&gt;
# Mandrake 10.2 distro.&lt;br /&gt;
&lt;br /&gt;
# Where the sources of the client will be held (defaults to &amp;quot;linden&amp;quot;):&lt;br /&gt;
PATH_TO_SOURCES=&amp;quot;/usr/src/SL&amp;quot;&lt;br /&gt;
# Where to build the client:&lt;br /&gt;
export TEMP_BUILD_DIR=&amp;quot;$HOME/secondlife&amp;quot;&lt;br /&gt;
&lt;br /&gt;
USE_SYSTEM_GTK=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_SDL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_SSL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_DB4=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_OGG=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_APR=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_ZLIB=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_UUID=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_CURL=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_EXPAT=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_VORBIS=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_XMLRPC=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_JPEGLIB=&amp;quot;yes&amp;quot;&lt;br /&gt;
USE_SYSTEM_FREETYPE2=&amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# You may add tune flags here, to optimize the code for your processor.&lt;br /&gt;
# Example, for an Athlon XP:&lt;br /&gt;
# TUNE_FLAGS=&amp;quot;-march=athlon-xp -mtune=athlon-xp&amp;quot;&lt;br /&gt;
TUNE_FLAGS=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Whether to build with the browser login screen or not:&lt;br /&gt;
WITH_MOZILLA=&amp;quot;no&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function update_manifest() {&lt;br /&gt;
    grep -v $1 $PATH_TO_SOURCES/indra/newview/viewer_manifest.py &amp;gt;$TEMP_BUILD_DIR/viewer_manifest.py&lt;br /&gt;
    mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function compile() {&lt;br /&gt;
    cd $PATH_TO_SOURCES/indra&lt;br /&gt;
    echo &amp;quot;Compiling the client into $TEMP_BUILD_DIR...&amp;quot;&lt;br /&gt;
    scons DISTCC=no BTARGET=client BUILD=releasefordownload MOZLIB=$WITH_MOZILLA&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$TEMP_BUILD_DIR&amp;quot; == &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    export TEMP_BUILD_DIR=/tmp/$USER/SL&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Check to see if we simply want to retry a compilation:&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; == &amp;quot;--retry&amp;quot; ] ; then&lt;br /&gt;
    compile&lt;br /&gt;
    exit $?&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Make sure we don&#039;t unpack over an old source tree:&lt;br /&gt;
if [ -d linden ] ; then&lt;br /&gt;
    rm -rf linden/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -d $PATH_TO_SOURCES ] &amp;amp;&amp;amp; [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    rm -rf $PATH_TO_SOURCES/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Use the parameter (if any) as the path to the archives:&lt;br /&gt;
&lt;br /&gt;
PATH_TO_ARCHIVES=&amp;quot;.&amp;quot;&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
    if [ -d $1 ] ; then&lt;br /&gt;
        PATH_TO_ARCHIVES=$1&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s first unpack everything:&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-src !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-linux-libs !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/slviewer-artwork-*.zip ] ; then&lt;br /&gt;
    echo &amp;quot;You need slviewer-artwork !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
if ! [ -f $PATH_TO_ARCHIVES/fmodapi*.tar.gz ] ; then&lt;br /&gt;
    echo &amp;quot;You need fmodapi !&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
echo &amp;quot;Extracting the files from the archives...&amp;quot;&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz&lt;br /&gt;
unzip $PATH_TO_ARCHIVES/slviewer-artwork-*.zip &amp;gt;/dev/null&lt;br /&gt;
tar xzf $PATH_TO_ARCHIVES/fmodapi*.tar.gz&lt;br /&gt;
&lt;br /&gt;
# fmodapi:&lt;br /&gt;
echo &amp;quot;Copying fmodapi files...&amp;quot;&lt;br /&gt;
cp -a fmodapi*/api/inc/* linden/libraries/i686-linux/include/&lt;br /&gt;
cp fmodapi*/api/libfmod-*.so linden/libraries/i686-linux/lib_release_client/&lt;br /&gt;
rm -rf fmodapi*/&lt;br /&gt;
&lt;br /&gt;
# Move the sources to where we want to hold them:&lt;br /&gt;
if [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;linden&amp;quot; ] &amp;amp;&amp;amp; [ &amp;quot;$PATH_TO_SOURCES&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Moving the sources to $PATH_TO_SOURCES...&amp;quot;&lt;br /&gt;
    mv -f linden $PATH_TO_SOURCES&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s own the files:&lt;br /&gt;
chown -R $USER: $PATH_TO_SOURCES/&lt;br /&gt;
&lt;br /&gt;
# Make a clean build:&lt;br /&gt;
if [ -d $TEMP_BUILD_DIR ] ; then&lt;br /&gt;
    rm -rf $TEMP_BUILD_DIR/&lt;br /&gt;
fi&lt;br /&gt;
mkdir -p $TEMP_BUILD_DIR&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system GTK+ if available:&lt;br /&gt;
if [ -d /usr/include/atk-1.0 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_GTK&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system GTK+...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux/include&lt;br /&gt;
    rm -rf atk-1.0/ gtk-2.0/ glib-2.0/ pango-1.0/&lt;br /&gt;
    rm -f ../lib_release_client/libgtk*&lt;br /&gt;
    cp -a /usr/include/atk-1.0 .&lt;br /&gt;
    cp -a /usr/include/gtk-2.0 .&lt;br /&gt;
    cp -a /usr/lib/gtk-2.0/include/* gtk-2.0/&lt;br /&gt;
    cp -a /usr/include/glib-2.0 .&lt;br /&gt;
    cp -a /usr/lib/glib-2.0/include/* glib-2.0/&lt;br /&gt;
    cp -a /usr/include/pango-1.0 .&lt;br /&gt;
    if [ -d /usr/include/cairo ] ; then&lt;br /&gt;
        cp -a /usr/include/cairo/* .&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system freetype2 if available:&lt;br /&gt;
if [ -f /usr/include/ft2build.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_FREETYPE2&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system freetype2...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/freetype/ i686-linux/include/llfreetype2/*&lt;br /&gt;
    rm -f include/ft2build.h i686-linux/lib_release_client/libfreetype.a&lt;br /&gt;
    cp -a /usr/include/freetype2/freetype/ i686-linux/include/llfreetype2/&lt;br /&gt;
    cp -a /usr/include/ft2build.h i686-linux/include/llfreetype2/freetype/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system zlib if available:&lt;br /&gt;
if [ -f /usr/include/zlib.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_ZLIB&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system zlib...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/zlib/&lt;br /&gt;
    mkdir -p i686-linux/include/zlib&lt;br /&gt;
    cp -a /usr/include/zlib*.h i686-linux/include/zlib/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system jpeglib if available:&lt;br /&gt;
if [ -f /usr/include/jpeglib.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_JPEGLIB&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system jpeglib...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/jpeglib/ i686-linux/lib_release_client/libjpeg.a&lt;br /&gt;
    mkdir -p i686-linux/include/jpeglib&lt;br /&gt;
    cp -a /usr/include/j*.h i686-linux/include/jpeglib/&lt;br /&gt;
    touch i686-linux/include/jpeglib/jinclude.h&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system xmlrpc-epi if available:&lt;br /&gt;
if [ -f /usr/include/xmlrpc.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_XMLRPC&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system xmlrpc-epi...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/xmlrpc-epi/ i686-linux/lib_release_client/libxmlrpc.a&lt;br /&gt;
    mkdir -p i686-linux/include/xmlrpc-epi&lt;br /&gt;
    cp -a /usr/include/xmlrpc*.h i686-linux/include/xmlrpc-epi/&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system ogg if available:&lt;br /&gt;
if [ -f /usr/include/ogg/ogg.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_OGG&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system ogg...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/ogg/ i686-linux/lib_release_client/libogg*&lt;br /&gt;
    update_manifest libogg&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system vorbis if available:&lt;br /&gt;
if [ -f /usr/include/vorbis/vorbisenc.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_VORBIS&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system vorbis...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/vorbis/ i686-linux/lib_release_client/libvorbis*&lt;br /&gt;
    update_manifest libvorbis&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system SDL if available:&lt;br /&gt;
if [ -f /usr/include/SDL/SDL.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_SDL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system SDL...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux&lt;br /&gt;
    rm -rf include/SDL/ lib_release_client/libSDL*&lt;br /&gt;
    update_manifest libSDL&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system openssl if available:&lt;br /&gt;
if [ -f /usr/lib/libssl.so.0.9.7 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_SSL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system openssl...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client&lt;br /&gt;
    rm -f libssl.* libcrypto.*&lt;br /&gt;
    update_manifest libssl&lt;br /&gt;
    update_manifest libcrypto&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system apr if available:&lt;br /&gt;
if [ -f /usr/include/apr*/apr.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_APR&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system apr...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries/i686-linux&lt;br /&gt;
    rm -rf include/apr-1/*&lt;br /&gt;
    rm -f lib_release_client/libapr*&lt;br /&gt;
    cp -a /usr/include/apr*/* include/apr-1/&lt;br /&gt;
    update_manifest libapr&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system expat if available:&lt;br /&gt;
if [ -f /usr/include/expat.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_EXPAT&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system expat...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/expat/&lt;br /&gt;
    rm -f i686-linux/lib_release_client/libexpat*&lt;br /&gt;
    mkdir -p i686-linux/include/expat&lt;br /&gt;
    cp -a /usr/include/expat*.h i686-linux/include/expat/&lt;br /&gt;
    update_manifest libexpat&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system curl if available:&lt;br /&gt;
if [ -f /usr/include/curl/curl.h ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_CURL&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system curl...&amp;quot;&lt;br /&gt;
    cd $PATH_TO_SOURCES/libraries&lt;br /&gt;
    rm -rf include/curl/&lt;br /&gt;
    rm -f i686-linux/lib_release_client/libcurl.*&lt;br /&gt;
    update_manifest libcurl&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system db4 if available:&lt;br /&gt;
if [ -f /usr/lib/libdb-4.2.so ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_DB4&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system db4...&amp;quot;&lt;br /&gt;
    rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libdb*.so&lt;br /&gt;
    update_manifest libdb&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Let&#039;s use the system uuid if available:&lt;br /&gt;
if [ -f /lib/libuuid.so.1 ] &amp;amp;&amp;amp; [ &amp;quot;$USE_SYSTEM_UUID&amp;quot; == &amp;quot;yes&amp;quot; ] ; then&lt;br /&gt;
    echo &amp;quot;Using the system libuuid...&amp;quot;&lt;br /&gt;
    rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libuuid.*&lt;br /&gt;
    update_manifest libuuid&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Update the manifest file and enable libkdu packaging. I&#039;m too lazy to use&lt;br /&gt;
# awk or perl, here, but that&#039;s indeed what should be done...&lt;br /&gt;
# The following (very dirty) code may break at some point, depending on what&lt;br /&gt;
# LL will put in comments in the manifest file...&lt;br /&gt;
# First, remove the lines with libstdc++.so.6 and the crash logger:&lt;br /&gt;
update_manifest libstdc&lt;br /&gt;
update_manifest crash_logger&lt;br /&gt;
# Now, any line with a &#039;#&#039; followed with several spaces _should_ be dealing&lt;br /&gt;
# with the libkdu stuff... So, we simply remove the &#039;#&amp;quot;...&lt;br /&gt;
sed -e &amp;quot;s/#   /   /&amp;quot; $PATH_TO_SOURCES/indra/newview/viewer_manifest.py &amp;gt;$TEMP_BUILD_DIR/viewer_manifest.py&lt;br /&gt;
mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py&lt;br /&gt;
&lt;br /&gt;
# Add tune flags, if any:&lt;br /&gt;
if [ &amp;quot;$TUNE_FLAGS&amp;quot; != &amp;quot;&amp;quot; ] ; then&lt;br /&gt;
    sed -e &amp;quot;s/-O2/-O2 $TUNE_FLAGS/&amp;quot; $PATH_TO_SOURCES/indra/SConstruct &amp;gt;$TEMP_BUILD_DIR/SConstruct&lt;br /&gt;
    mv -f $TEMP_BUILD_DIR/SConstruct $PATH_TO_SOURCES/indra/SConstruct&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
compile&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FreeBSD ==&lt;br /&gt;
&lt;br /&gt;
A list of patches is given for [[Compiling the viewer (FreeBSD)]].&lt;/div&gt;</summary>
		<author><name>Sardonyx Linden</name></author>
	</entry>
</feed>