Difference between revisions of "Linux Build Environment"

From Catznip
Jump to navigation Jump to search
(Autobuild configure & build)
(Catznip Source)
Line 119: Line 119:
 
Fetch the source from our [http://hg.catznip.com/ bitbucket] repository. This may take some time ...
 
Fetch the source from our [http://hg.catznip.com/ bitbucket] repository. This may take some time ...
 
<code>
 
<code>
(squeeze)$ hg clone http://hg.catznip.com/catznip-{{CurrentVersion}}
+
(squeeze)$ hg clone http://hg.catznip.com/Catznip-R9
 
</code>
 
</code>
  
 
<code>
 
<code>
(squeeze)$ cd ~/SecondLife-Dev/catznip-{{CurrentVersion}}
+
(squeeze)$ cd ~/SecondLife-Dev/Catznip-R9
 
</code>
 
</code>
  
Line 130: Line 130:
 
(squeeze)$ hg update tip
 
(squeeze)$ hg update tip
 
</pre>
 
</pre>
 
  
 
==Compiling the Viewer==
 
==Compiling the Viewer==

Revision as of 23:37, 23 May 2014

The following instructions have been tested on both Ubuntu and Linux Mint, you will need at least 1 GB of free disk space on your root partition for the build environment, and 5 GB in your home folder for the source code and compilation results, and at least 4GB of memory. We do not recommend you do this on removable / usb based storage.

Setting up the environment is relatively straight forward, compiling can take several hours depending on hardware.

Commands starting with a $ are to be run on the host, commands starting with (squeeze)$ are to be run inside the schroot. Don't type the $ or (squeeze)$.


Schroot

This guided uses a schroot to provide a static build environment that is separate from your running install, a Linux inside a Linux. Once set up this can be easily backed up and copied between machines.

Install schroot and debootstrap.

$ sudo apt-get install schroot debootstrap

Configure the schroot. Edit '/etc/schroot/schroot.conf' so it looks like the following, making sure to change YOUR_USER_NAME...

[squeeze]
description=Debian Squeeze
type=directory
directory=/schroot/squeeze
users=YOUR_USER_NAME
groups=sbuild
root-groups=root
personality=linux32

Make some folders..

$ sudo mkdir /schroot
$ sudo mkdir /schroot/squeeze


Debian Squeeze

We build using Debian Squeeze, for fewer headaches you should too. There are other distributions you could use in your schroot, good luck!

$ sudo debootstrap  --arch i386 squeeze /schroot/squeeze http://ftp.de.debian.org/debian

Enter the new schroot..

$ sudo schroot -c squeeze -u root

If you have done everything right to this point your prompt will change to look something like the following, ignore any 'failed to change directory' warnings.

(squeeze)root@tetsuo:/home/trinity#

Install a load of things needed to build the viewer. Yes, that is one single huge command.

(squeeze)# apt-get install sudo cmake bison flex python g++ make bzip2 \
ccache libc6-dev libstdc++6 libx11-dev libxrender-dev \
libgl1-mesa-dev libglu1-mesa-dev zlib1g-dev libssl-dev libogg-dev \
libpng12-dev libdbus-glib-1-dev libgtk2.0-dev libxml2-dev wget mercurial 

We're done here. Exit the schroot.

(squeeze)# exit


Setting up

When you switch into a schroot the host OS home folder is fully accessible, for simplicity that's where we're going to viewer source.

$ cd
$ mkdir ./SecondLife-Dev

Enter the schroot and fetch some source code (you could just as easily do this with tools installed on the host OS).

$ cd ~/SecondLife-Dev
$ schroot -c squeeze

If you have done everything correct you should be presented with something like the following.

(squeeze)trinity@tetsuo:~/SecondLife-Dev$

Autobuild

Fetch Linden Lab's autobuild..

(squeeze)$ hg clone http://hg.secondlife.com/autobuild

build
destination directory: autobuild
requesting all changes
adding changesets
adding manifests
adding file changes
added 557 changesets with 1105 changes to 98 files
updating to branch default
67 files updated, 0 files merged, 0 files removed, 0 files unresolved

CMAKE

The version of cmake that ships with debian squeeze is 2.8.2, for now we need 2.8.11.2

(squeeze)$ mkdir ~/SecondLife-Dev/cmake
(squeeze)$ cd ~/SecondLife-Dev/cmake

Download cmake 2.8.11.2

(squeeze)$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2-Linux-i386.sh

Install.. tap space to get though the licence and then enter Y followed by N.

(squeeze)$ /bin/sh cmake-2.8.11.2-Linux-i386.sh

Catznip Source

We do not release source code for a viewer until we have released it to the public.

(squeeze)$ cd ~/SecondLife-Dev

Fetch the source from our bitbucket repository. This may take some time ... (squeeze)$ hg clone http://hg.catznip.com/Catznip-R9

(squeeze)$ cd ~/SecondLife-Dev/Catznip-R9

Update the tip (if you were to build without doing this you will get the base Linden viewer).

(squeeze)$ hg update tip

Compiling the Viewer

Enter the Schroot (if you aren't already from the steps above).

$ cd ~/SecondLife-Dev
$ schroot -c squeeze

Add cmake to the PATH

This could be set up automatically, but for the purposes of this guide you need to enter this every time you enter the schroot to build the viewer.

(squeeze)$ export PATH=~/SecondLife-Dev/cmake/bin:$PATH
(squeeze)$ cmake -version

cmake version 2.8.11.2

Autobuild configure & build

Change to the source directory.. (squeeze)$ cd ~/SecondLife-Dev/catznip-R12.2

Run autobuild, setting the viewer channel to Catznip Homebrew will get you the homebrew branding, logos and start up screen when you're done (for R9 or later).

(squeeze)$ ../autobuild/bin/autobuild configure -c ReleaseOS -- -DFMODEX:BOOL=OFF \
-DVIEWER_CHANNEL="\"Catznip Homebrew\"" -DGCC_DISABLE_FATAL_WARNINGS:BOOL=ON \
-DLL_TESTS:BOOL=OFF

There are a number of compilation options you are free to explore but they are beyond the scope of this document.

Compile the viewer .. depending on hardware this could take a significant amount of time (over an hour on an i5).

(squeeze)$ ../autobuild/bin/autobuild build -c ReleaseOS --verbose

The build and all working files will be placed inside ~/SecondLife-Dev/catznip-R12.2/build-linux-i686. This folder should be removed if you wish to run configure again or to save disk space on older source trees.

Running the Viewer

The completed viewer will be placed in ~/SecondLife-Dev/catznip-R12.2/build-linux-i686/newview and can be run in place without needing to install.

Exit from the schroot (or open a new terminal).

(squeeze)$ exit

Change to the directory ... $ cd ~/SecondLife-Dev/catznip-R12.2/build-linux-i686/newview/packaged

.. and run. No installation or messing about required, menu entries will be created.

$ ./catznip

The viewer will have it's own configuration file ~/.catznip/user_settings/settings_homebrew.xml


Deep Notes

That's it, you have set up a build environment and built the viewer.

These instructions do not cover creating the FMOD / FMODEX packages so there will be no streaming audio. Instructions on how to create these packages yourself may follow ....

We are bound by the terms of the havok sub licence and as such can not provide libraries or instructions on how to build havok into the viewer. Mesh upload will not function and the pathfinding nav mesh will not be visible. Configuration options to explore include -DCMAKE_CXX_FLAGS:STRING="\" ..... \"" and -DCMAKE_EXE_LINKER_FLAGS:STRING="\" .... \"".

To compile any changes you make to the source, you only have to run ../autobuild/bin/autobuild build -c ReleaseOS --verbose as detailed above.

If run out of the build folder the viewer XUI files will be loaded from ~/SecondLife-Dev/catznip-R12.2/indra/newview/skins/default/ rather than those in location you're running the viewer from. Editing XUI files while running is a good source of crashes, so is messing up the XUI.