|
|
| (317 intermediate revisions by 48 users not shown) |
| Line 1: |
Line 1: |
| | {{Multi-lang}} |
| {{CompileNav}} | | {{CompileNav}} |
| | {{TOC}} |
|
| |
|
| 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]].
| | ==Step 0. Review BUILD.LINUX.md== |
| | There is a [https://github.com/secondlife/viewer/blob/develop-linux/doc/BUILD.LINUX.md BUILD.LINUX.md] markdown file in the active '''develop-linux''' branch (see '''Step 2''') which will eventually become the primary documentation for building the SL viewer on Linux. In the meantime the instructions below may also be helpful. |
|
| |
|
| {{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]] '''with''' llmozlib (see [[Talk:Compiling_the_viewer_%28Linux%29#llmozlib|discussion]])}}
| | ==Step 1. Install Requirements== |
|
| |
|
| = Building the client =
| | * Python 3.7+ |
| To build the Second Life Viewer you will first need to install the required tools and libraries.
| | * [https://git-scm.com/downloads Git] |
| The following sections online steps to build the client from source. To simplify building,
| | * [https://cmake.org/download/ CMake] 3.20+ (need to be able to handle <code>--config</code> option) |
| Linden labs has been nice enough to prepackage some of the libraries and bundled them up in an
| | * Native packages and tools (this list may be incomplete, please update as new dependencies are discovered): |
| additional tar file.
| | libfontconfig-dev libglib2.0-dev libglvnd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libosmesa6-dev libvlc-dev libwayland-dev libx11-dev ninja-build python3-venv |
| | * [[Autobuild]] (probably best installed in a [https://docs.python.org/3/library/venv.html virtual environment]) |
|
| |
|
| And while The Second Life Viewer is not a trivial build, and experience with building large
| | ===Intermediate Check=== |
| software packages will help you greatly - but don't be daunted, it should be simple once the
| |
| dependencies are in the right place the first time.
| |
|
| |
|
| The tasks are:
| | Confirm things are installed properly so far by typing the following in a terminal: |
| # Install required tools.
| | cmake --version |
| # Unpack source and art tree's from Linden Labs.
| | python3 --version |
| # Install libraries not shiped by Linden Labs.
| | git --version |
| # Unpack or install the other required libraries and headers.
| | autobuild --version |
| # Compile.
| |
| <br />
| |
| <br />
| |
| == Required tools ==
| |
| There are a number of tools that need to be installed first.
| |
|
| |
|
| * <b>SCons</b> build tool [package: scons]
| | If everything reported sensible values and not "Command not found" errors, then you are in good shape! |
| * <b>GCC 3.4</b> 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.
| |
| * <b>yacc</b> [suggest packages: bison]
| |
| * <b>lex</b> [suggest packages: flex]
| |
| <br />
| |
| <br />
| |
| == Unpack the source tree ==
| |
|
| |
|
| Choose a location and unpack the source tree and the art work. They will be extracted into a
| | ==Step 2. Checkout Code== |
| directory call <b>linden</b>.
| |
|
| |
|
| <code>
| | ===Viewer=== |
| % tar -xf slviewer-src-<version>.tar.gz
| |
| % unzip slviewer-artwork-<version>.zip
| |
| </code>
| |
| <br />
| |
| <br />
| |
| == Installing the required libraries (that Linden labs can not or does not provide)== | |
| === FMOD (audio) ===
| |
| * FMOD provides audio output, but (although 'free' in some senses) is not itself open-source. <b>If</b> you wish to avoid FMOD, thus disabling audio, you may make these changes:
| |
| ** Comment-out the libfmod line in indra/newview/viewer_manifest.py
| |
| ** Add FMOD=no to your Scons build command when compiling the source.
| |
| * If you want to use FMOD, fetch and unpack <b>FMOD 3.75</b> <http://www.fmod.org/>
| |
| <code>
| |
| % wget http://www.fmod.org/files/fmodapi375linux.tar.gz
| |
| % tar -xzvf fmodapi375linux.tar.gz
| |
| % cd fmodapi375linux/
| |
| % cp api/inc/* ../linden/libraries/i686-linux/include/
| |
| % cp api/libfmod-3.75.so ../linden/libraries/i686-linux/lib_release_client/
| |
| </code>
| |
| <br />
| |
| === google-perftools (memory checking) ===
| |
| * <b>google-perftools</b> library for the tcmalloc and stacktrace libraries.
| |
| **[fedora: google-perftools-devel.i386]
| |
| **[debian/ubuntu: google-perftools-dev]
| |
| <br />
| |
| <br />
| |
| == Installing the required dependencies (prepackaged by Linden labs)==
| |
|
| |
|
| The Second Life Viewer has a number of compile/link dependencies on external libraries which
| | Open a terminal and checkout the viewer source code: |
| are needed - to help you, the source download page contains a link to a <i>slviewer-linux-libs</i> 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).
| | git clone https://github.com/secondlife/viewer.git |
|
| |
|
| If you download the libs to the top folder, where the <i>linden</i> folder is after getting and extracting the viewer source code tarball, the following command should unpack everything to the right spot.
| | Until it is merged into the '''develop''' branch you need to checkout '''develop-linux''': |
| | cd viewer |
| | git checkout develop-linux |
|
| |
|
| <code>
| | ===Build Variables=== |
| tar xvfz slviewer-linux-libs-<version>.tar.gz
| |
| </code>
| |
| <br />
| |
| === Doing yourself === | |
| If you are porting to a new architecture or wish to make a package tailored to your Linux distribution's own libraries. You will have to install the following additional dependencies
| |
| listed below. Paths and package names given here are based on Ubuntu 6.06 and may vary
| |
| according to your Linux distribution.
| |
|
| |
|
| ==== List of libraries ====
| | See [[Building the Viewer with Autobuild#Select Build Variables]] |
| * <b>apr-1</b> [debian/ubuntu: libapr1.0-dev, fedora: apr-devel]
| |
|
| |
|
| * <b>aprutil-1</b> [debian/ubuntu: libaprutil1.0-dev, fedora: apr-util-devel]
| | ==Step 3. Configure== |
|
| |
|
| * <b>boost</b> [debian/ubuntu: libboost-dev, fedora: boost-devel]
| | Be sure you have the following environment variables set before continuing: |
|
| |
|
| * <b>boost-regex</b> [debian/ubuntu: libboost-regex-dev]
| | AUTOBUILD_ADDRSIZE=64 |
| | AUTOBUILD_VARIABLES_FILE=<path to autobuild viewer variables> |
|
| |
|
| * <b>curl</b> library at least version 7.15.4 is recommended, 7.16.x is ideal.
| | Configuring and building with '''autobuild''' works the same on all platforms. Full instructions may be found at [[Build_Viewer_With_Autobuild]]. |
| ** [debian/ubuntu: libcurl-dev]
| |
| ** fedora: curl-devel]
| |
| ** If you are compiling your own version of <b>Curl</b>, then you should consider configuring it to use the <b>c-ares</b> library so that DNS lookups will be asynchronous.
| |
|
| |
|
| * <b>ELFIO</b> <http://sourceforge.net/projects/elfio/>
| | autobuild configure -c RelWithDebInfoOS |
| ** This wants to build a static library by default. Afterwards, to create a dynamic libelfio.so
| |
| <code>
| |
| % cd ELFIO && g++-3.4 -shared *.o -o libelfio.so
| |
| </code>
| |
|
| |
|
| * <b>expat</b> [debian/ubuntu: libexpat1-dev, fedora: expat-devel]
| | ==Step 4. Build== |
|
| |
|
| * <b>GTK 2.x</b> development headers
| | autobuild build |
| ** [debian/ubuntu: libgtk2.0-dev
| |
| ** [fedora: gtk2-devel]
| |
|
| |
|
| * <b>jpeglib</b>
| | ===Running your newly built viewer=== |
| **[debian/ubuntu: libjpeg62-dev]
| |
| **[fedora: libjpeg-devel]
| |
|
| |
|
| * <b>OpenGL</b> development headers: gl.h, glext.h, glu.h
| | ==Step 5. Run== |
| **[debian/ubuntu: mesa-common-dev, libglu1-mesa-dev]
| |
| **[fedora: mesa-libGL-devel, mesa-libGLU-devel]
| |
|
| |
|
| * <b>OpenJPEG</b> <http://www.openjpeg.org/>
| | To launch the '''viewer''' you built, from your source tree root directory, run: |
| ** 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.
| |
| *** ''what does this mean?''
| |
| ** 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
| |
| *** ''VWR-123 has been fixed: should this note be removed?''
| |
|
| |
|
| * <b>SDL</b> [libsdl1.2-dev, fedora: SDL-devel]
| | build-linux-x86_64/newview/packaged/secondlife |
|
| |
|
| * <b>Vorbis</b> [debian/ubuntu: libvorbis-dev, fedora: libvorbis-devel]
| | ==Step 6. Optional== |
|
| |
|
| * <b>X11</b> development headers: Xlib.h, and Xutil.h
| | ===Running Unit Tests=== |
| **[debian/ubuntu: libx11-dev]
| |
| **[fedora: libX11-devel]
| |
|
| |
|
| * <b>xmlrpc-epi 0.51</b> <http://xmlrpc-epi.sourceforge.net/>
| | TODO: provide instructions for running unit tests. |
| ** note: not xmlrpc-c (xmlrpc-c has a library and headers with the same name but is not compatible)
| |
| ** Apply patches from the instructions in [[patch xmlrpc-epi]]
| |
| *** ''does this still work?''
| |
| ** See also:
| |
| *** http://www.haxxed.com/rpms/secondlife/xmlrpc-epi-0.51-gcc4.1.patch
| |
| *** http://www.haxxed.com/rpms/secondlife/xmlrpc-epi-0.51-use-system-expat.patch
| |
| *** http://www.haxxed.com/rpms/secondlife/xmlrpc-epi-0.51-rename.patch
| |
| *** You have to regenerate autotools after applying the patch:
| |
| ****libtoolize -c -f
| |
| ****aclocal
| |
| ****automake -c -a -f
| |
| ****autoconf
| |
| *** The first patch fixes compiling on gcc 4. The second patch causes it to compile against the system expat, the one xmlrpc-epi is broken and will not work. The last patch renames the library from xmlrpc to xmlrpc-epi, otherwise it conflicts with xmlrpc-c - which means the viewer then needs to be patched to link against xmlrpc-epi and not xmlrpc. These are the patches in my Fedora package. On linux, I recommend these patches in favor of the Linden ones, as they seem to be windows oriented. (And they actually work)
| |
| <br />
| |
| <br />
| |
|
| |
|
| ==== Copy headers and libraries into the source tree ==== | | ===Optional: Installing Proprietary Libraries=== |
|
| |
|
| 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.
| | Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the 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't ask, Lindens already did, and can't get permission. So you do have to get them yourself.) |
| * ${SLSRC} refers to the top-level directory of the Second Life Viewer source tree.
| |
|
| |
|
| You only need to copy the following if you're not using the handy <i>slviewer-linux-libs</i> package:
| | TODO: provide instructions for building proprietary libraries. |
| cp -a /usr/include/atk-1.0 ${SLSRC}/libraries/i686-linux/include/
| |
| cp -a /usr/include/gtk-2.0 ${SLSRC}/libraries/i686-linux/include/
| |
| cp -a /usr/lib/gtk-2.0/include/* ${SLSRC}/libraries/i686-linux/include/gtk-2.0/
| |
| cp -a /usr/include/glib-2.0 ${SLSRC}/libraries/i686-linux/include/
| |
| cp -a /usr/lib/glib-2.0/include/* ${SLSRC}/libraries/i686-linux/include/glib-2.0/
| |
| cp -a /usr/include/pango-1.0 ${SLSRC}/libraries/i686-linux/include/
| |
|
| |
|
| if your GTK is fairly recent and thus needs Cairo:
| | ==Handling Problems== |
| cp -a /usr/include/cairo/* ${SLSRC}/libraries/i686-linux/include/
| |
| <br />
| |
|
| |
|
| ==== Libs ====
| | If you encounter errors or run into problems following the instructions above, please first check whether someone else already had the same issue. A solution might be known already. |
|
| |
|
| If you are using our easy <i>slviewer-linux-libs</i> bundle then you can skip the rest of this section, <b>otherwise</b> you will also need to perform the following:
| | You may find the solution in any of these resources: |
| * ${OPENJPEG} refers to the top-level directory of your completed OpenJPEG build. | | * [[{{TALKPAGENAME}}|This talk page]] (Report useful experiences there) |
| * ${ELFIO} refers to the top-level directory of your completed ELFIO build. | | * [[#Common_Issues.2FBugs.2FGlitches_And_Solutions|Issue list below]] (If new issues, please add it to talk page above instead of there) |
| <code>
| | * [[Talk:Microsoft_Windows_Builds|Old talk page]] |
| cp -a /usr/include/apr-1.0/ ${SLSRC}/libraries/i686-linux/include/apr-1
| | * [[Common compilation problems]] (Rather old) |
| | * [[Issue tracker]] |
|
| |
|
| mkdir ${SLSRC}/libraries/i686-linux/include/expat
| | * Fix it: [[Modifying CMake Files]] and please, submit a patch! |
| cp -a /usr/include/expat*.h ${SLSRC}/libraries/i686-linux/include/expat/
| |
|
| |
|
| mkdir ${SLSRC}/libraries/i686-linux/include/zlib
| | ===Getting Help=== |
| cp -a /usr/include/zlib*.h ${SLSRC}/libraries/i686-linux/include/zlib/
| |
|
| |
|
| mkdir ${SLSRC}/libraries/i686-linux/include/openjpeg
| | Even when no description of your problem has been written down yet, someone might know about it, so get in touch with the community to get help. |
| cp ${OPENJPEG}/libopenjpeg/openjpeg.h ${SLSRC}/libraries/i686-linux/include/openjpeg/
| |
| cp ${OPENJPEG}/libopenjpeg.a ${SLSRC}/libraries/i686-linux/lib_release_client/
| |
|
| |
|
| mkdir ${SLSRC}/libraries/i686-linux/include/ELFIO
| | * Subscribe to [[OpenSource-Dev|OpenSource-Dev Mailing List]] ([https://lists.secondlife.com/cgi-bin/mailman/listinfo/opensource-dev subscribe]) and post your question there. |
| cp ${ELFIO}/ELFIO/*.h ${SLSRC}/libraries/i686-linux/include/ELFIO/
| |
| cp ${ELFIO}/ELFIO/libelfio.so ${SLSRC}/libraries/i686-linux/lib_release_client/
| |
|
| |
|
| mkdir ${SLSRC}/libraries/i686-linux/include/jpeglib
| | ---- |
| cp -a /usr/include/j*.h ${SLSRC}/libraries/i686-linux/include/jpeglib/
| | [[Category:Compiling viewer]] |
| touch ${SLSRC}/libraries/i686-linux/include/jpeglib/jinclude.h
| |
| | |
| mkdir ${SLSRC}/libraries/i686-linux/include/llfreetype2
| |
| cp -a /usr/include/freetype2/freetype/ ${SLSRC}/libraries/i686-linux/include/llfreetype2/
| |
| cp -a /usr/include/ft2build.h ${SLSRC}/libraries/i686-linux/include/llfreetype2/freetype/
| |
| | |
| mkdir ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi
| |
| cp -a /usr/include/xmlrpc*.h ${SLSRC}/libraries/i686-linux/include/xmlrpc-epi/
| |
| </code>
| |
| <br />
| |
| <br />
| |
| | |
| | |
| == Compiling ==
| |
| === Build Types ===
| |
| The ''BUILD'' parameter specifies the build type. For normal usage, use '''release'''. If you plan to work on the source, choose '''releasenoopt''' or '''debug''', as these versions are unoptimized and much easier to debug.
| |
| | |
| * '''release''': Optimized build for release.
| |
| * '''releasenoopt''': Unoptimized build.
| |
| * '''debug''': Debug build with assertions.
| |
| * '''releasefordownload''': Optimized build for release, will create a .tar.gz with the files for distribution.
| |
| <br />
| |
| === Building ===
| |
| === Disable llMozLib ===
| |
| Add MOZLIB=no to your Scons build command when compiling the source.
| |
| <br />
| |
| <code>
| |
| $ cd indra
| |
| $ scons DISTCC=no BTARGET=client BUILD=release MOZLIB=no
| |
| </code>
| |
| Expect a build time of a couple of hours. The resulting unstripped Second Life Viewer binary is <b>newview/secondlife-i686-bin</b>. Note that temporary object code is compiled into <b>/tmp/$USER</b> by default (where $USER is your username) - this can be changed by prefixing the <b>scons</b> command above with <b>TEMP_BUILD_DIR="<i>[full directory path]</i>"</b>. For example:
| |
| | |
| <code>
| |
| $ TEMP_BUILD_DIR="/home/fred/secondlife/temp-build" scons DISTCC=no BTARGET=client BUILD=release
| |
| </code>
| |
| | |
| To build a release that has all of the shaders and optimizations enabled and resembles the official shipped Linux alpha client, use BUILD=releasefordownload
| |
| | |
| Be sure to read the [[Common compilation problems]] page if you have problems - we'll try to keep the page up to date with known problems and solutions.
| |
| <br />
| |
| <br />
| |
| == Testing and packaging the client ==
| |
| | |
| === Testing the result from inside the tree ===
| |
| | |
| You may find it simpler and less error-prone to follow the instructions in the [[Compiling_the_viewer_%28Linux%29#Packaging_the_client|Packaging the client]] section below to run the client under the same conditions as an end-user would. Otherwise:
| |
| | |
| * Preparing to run 'in-tree'
| |
| ** <i>ensure that you have indra/newview/app_settings/static_*.db2</i> - if not, you'll find it in the 'slviewer-artwork' download (a zip file).
| |
| ** now, from the indra directory:
| |
| <code>
| |
| $ cp ../scripts/messages/message_template.msg newview/app_settings/
| |
| </code>
| |
| | |
| * Running it: The LD_LIBRARY_PATH stuff ensures that the binary looks for its libraries in the right places. From the indra directory:
| |
| <code>
| |
| $ ( cd newview && LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib ./secondlife-i686-bin )
| |
| </code>
| |
| | |
| ** For version '''20070117a''' the binary name seems to have changed to '''secondlife-i686-bin-globalsyms''', so the command would be (<i>Tofu Linden says - this was an oversight after a build process change, and future releases will generate a '''secondlife-i686''' again, whereupon this instruction can be removed. :)</i>)
| |
| <code>
| |
| $ ( cd newview && LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib ./secondlife-i686-bin-globalsyms )
| |
| </code>
| |
| <br />
| |
| ==== Augh!! The client seems REALLY slow!! ====
| |
| | |
| 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'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.
| |
| | |
| However, the <i>slviewer-linux-libs</i> package includes two pre-built libraries which facilitate the use of this smoother image decoding method: <b>libkdu_v42R.so</b> and <b>libllkdu.so</b>. 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.
| |
| | |
| To <b>use these faster image-decoding libraries</b>, 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're running the client from the source tree, the following will make the KDU libraries available:
| |
| <code>
| |
| cp "$SLSRC/libraries/i686-linux/lib_release_client/libllkdu.so" "$SLSRC/indra/newview/libllkdu.so"
| |
| mkdir "$SLSRC/indra/lib"
| |
| cp "$SLSRC/libraries/i686-linux/lib_release_client/libkdu_v42R.so" "$SLSRC/indra/lib/libkdu_v42R.so"
| |
| </code>
| |
| | |
| The file <b>indra/newview/viewer_manifest.py</b> 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 'Packaging the client' instructions below.
| |
| | |
| | |
| === Packaging the client ===
| |
| | |
| If you substitute 'BUILD=release' with '<b>BUILD=releasefordownload</b>' in the 'Compiling' 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 <b>indra/newview/SecondLife_i686_1_X_Y_Z/</b> and has also been tarred into <b>indra/newview/SecondLife_i686_1_X_Y_Z.tar.bz2</b>
| |
| | |
| The file which controls what (and where) files go into the end-user runtime viewer directory is <b>indra/newview/viewer_manifest.py</b>
| |
| | |
| | |
| ==== Automated libraries and headers adjustments, compilation and packaging ====
| |
| | |
| 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:
| |
| | |
| <code>
| |
| <pre>
| |
| <nowiki>
| |
| #!/bin/bash
| |
| | |
| # make-SL v1.21 (c)2007 Henri Beauchamp. Released under GPL license v2:
| |
| # http://www.gnu.org/licenses/gpl.txt
| |
| | |
| ###############################################################################
| |
| ######## THIS IS QUICK'N DIRTY ALPHA SOFTWARE. USE AT YOUR OWN RISKS ! ########
| |
| ###############################################################################
| |
| | |
| # This bash script is aimed at easying up the build process of a SL client.
| |
| # It does not cover building it with custom/system openjpeg, elfio or fmodapi
| |
| # (we use the provided libraries).
| |
| # You may enable or disable the use of your system's library by editing
| |
| # the USE_SYSTEM_* variable ("yes" --> use the system library, "no" --> use
| |
| # LL's provided ones).
| |
| # The script also takes care of updating properly the viewer_manifest.py script
| |
| # accordingly, so that you (should) end up with a properly packaged client.
| |
| | |
| # To use this script, simply make it executable (chmod +x make-SL) and
| |
| # put it into /usr/local/bin (or any other directory in your PATH).
| |
| # Then, download the slviewer-src-*.tar.gz, slviewer-linux-libs-*.tar.gz,
| |
| # slviewer-artwork-*.zip and fmodapi*.tar.gz archives, and finally, invoke
| |
| # make-SL as follow:
| |
| # make-SL path_to_archives (example: make-SL ~/downloads)
| |
| # or simply:
| |
| # make-SL
| |
| # when invoking from the directory where the archives are.
| |
| # The sources will be installed into the PATH_TO_SOURCES directory,
| |
| # and the client will be built into the TEMP_BUILD_DIR directory.
| |
| # If you want to retry a compilation after fixing something manually and
| |
| # don't want make-SL to start all over again, overwriting everything,
| |
| # you may invoke it with the --retry option, like this:
| |
| # make-SL --retry
| |
| # This script has been tested by the author, on a (very customized)
| |
| # Mandrake 10.2 distro. Tested with SL v1.17 sources.
| |
| | |
| # Where the sources of the client will be held (defaults to "./linden"):
| |
| PATH_TO_SOURCES="/usr/src/SL"
| |
| # Where to build the client:
| |
| export TEMP_BUILD_DIR="$HOME/secondlife"
| |
| | |
| USE_SYSTEM_GTK="yes"
| |
| USE_SYSTEM_SDL="yes"
| |
| USE_SYSTEM_SSL="yes"
| |
| # Beware: libdb4 makes use of libapr... so you should keep USE_SYSTEM_APR
| |
| # and USE_SYSTEM_DB4 in sync.
| |
| USE_SYSTEM_APR="no"
| |
| USE_SYSTEM_DB4="no"
| |
| USE_SYSTEM_OGG="yes"
| |
| USE_SYSTEM_ZLIB="yes"
| |
| USE_SYSTEM_UUID="yes"
| |
| USE_SYSTEM_CURL="no"
| |
| USE_SYSTEM_EXPAT="no"
| |
| USE_SYSTEM_VORBIS="yes"
| |
| USE_SYSTEM_XMLRPC="yes"
| |
| USE_SYSTEM_JPEGLIB="yes"
| |
| USE_SYSTEM_FREETYPE2="yes"
| |
| USE_SYSTEM_PERFTOOLS="yes"
| |
| | |
| # You may add tune flags here, to optimize the code for your processor.
| |
| # Example, for an Athlon XP:
| |
| # TUNE_FLAGS="-march=athlon-xp -mtune=athlon-xp"
| |
| TUNE_FLAGS="-march=athlon-xp -mtune=athlon-xp"
| |
| | |
| # Whether to build with the browser login screen or not:
| |
| WITH_MOZILLA="yes"
| |
| | |
| function update_manifest() {
| |
| grep -v $1 $PATH_TO_SOURCES/indra/newview/viewer_manifest.py >$TEMP_BUILD_DIR/viewer_manifest.py
| |
| mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py
| |
| chmod +x $PATH_TO_SOURCES/indra/newview/viewer_manifest.py
| |
| }
| |
| | |
| function compile() {
| |
| cd $PATH_TO_SOURCES/indra
| |
| echo "Compiling the client into $TEMP_BUILD_DIR..."
| |
| scons DISTCC=no BTARGET=client BUILD=releasefordownload MOZLIB=$WITH_MOZILLA
| |
| }
| |
| | |
| if [ "$TEMP_BUILD_DIR" == "" ] ; then
| |
| export TEMP_BUILD_DIR=/tmp/$USER/SL
| |
| fi
| |
| | |
| # Check to see if we simply want to retry a compilation:
| |
| if [ "$1" == "--retry" ] ; then
| |
| compile
| |
| exit $?
| |
| fi
| |
| | |
| # Make sure we don't unpack over an old source tree:
| |
| if [ -d linden ] ; then
| |
| rm -rf linden/
| |
| fi
| |
| | |
| if [ -d $PATH_TO_SOURCES ] && [ "$PATH_TO_SOURCES" != "" ] && [ "$PATH_TO_SOURCES" != "/" ] && [ "$PATH_TO_SOURCES" != "." ] && [ "$PATH_TO_SOURCES" != ".." ] && [ "$PATH_TO_SOURCES" != "$HOME" ] ; then
| |
| rm -rf $PATH_TO_SOURCES/
| |
| fi
| |
| | |
| # Use the parameter (if any) as the path to the archives:
| |
| | |
| PATH_TO_ARCHIVES="."
| |
| if [ "$1" != "" ]; then
| |
| if [ -d $1 ] ; then
| |
| PATH_TO_ARCHIVES=$1
| |
| fi
| |
| fi
| |
| | |
| # Let's first unpack everything:
| |
| if ! [ -f $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz ] ; then
| |
| echo "You need slviewer-src !"
| |
| exit 1
| |
| fi
| |
| if ! [ -f $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz ] ; then
| |
| echo "You need slviewer-linux-libs !"
| |
| exit 1
| |
| fi
| |
| if ! [ -f $PATH_TO_ARCHIVES/slviewer-artwork-*.zip ] ; then
| |
| echo "You need slviewer-artwork !"
| |
| exit 1
| |
| fi
| |
| if ! [ -f $PATH_TO_ARCHIVES/fmodapi*.tar.gz ] ; then
| |
| echo "You need fmodapi !"
| |
| exit 1
| |
| fi
| |
| echo "Extracting the files from the archives..."
| |
| tar xzf $PATH_TO_ARCHIVES/slviewer-src-*.tar.gz
| |
| tar xzf $PATH_TO_ARCHIVES/slviewer-linux-libs-*.tar.gz
| |
| unzip $PATH_TO_ARCHIVES/slviewer-artwork-*.zip >/dev/null
| |
| tar xzf $PATH_TO_ARCHIVES/fmodapi*.tar.gz
| |
| | |
| # fmodapi:
| |
| echo "Copying fmodapi files..."
| |
| cp -a fmodapi*/api/inc/* linden/libraries/i686-linux/include/
| |
| cp fmodapi*/api/libfmod-*.so linden/libraries/i686-linux/lib_release_client/
| |
| rm -rf fmodapi*/
| |
| | |
| # Move the sources to where we want to hold them:
| |
| if [ "$PATH_TO_SOURCES" != "linden" ] && [ "$PATH_TO_SOURCES" != "" ] ; then
| |
| echo "Moving the sources to $PATH_TO_SOURCES..."
| |
| mv -f linden $PATH_TO_SOURCES
| |
| fi
| |
| | |
| # Let's own the files:
| |
| chown -R $USER: $PATH_TO_SOURCES/
| |
| | |
| # Make a clean build:
| |
| if [ -d $TEMP_BUILD_DIR ] && [ "$TEMP_BUILD_DIR" != "" ] && [ "$TEMP_BUILD_DIR" != "/" ] && [ "$TEMP_BUILD_DIR" != "." ] && [ "$TEMP_BUILD_DIR" != ".." ] && [ "$TEMP_BUILD_DIR" != "$HOME" ] ; then
| |
| rm -rf $TEMP_BUILD_DIR/
| |
| fi
| |
| mkdir -p $TEMP_BUILD_DIR
| |
| | |
| # Let's use the system GTK+ if available:
| |
| if [ -d /usr/include/atk-1.0 ] && [ "$USE_SYSTEM_GTK" == "yes" ] ; then
| |
| echo "Using the system GTK+..."
| |
| cd $PATH_TO_SOURCES/libraries/i686-linux/include
| |
| rm -rf atk-1.0/ gtk-2.0/ glib-2.0/ pango-1.0/
| |
| rm -f ../lib_release_client/libgtk*
| |
| cp -a /usr/include/atk-1.0 .
| |
| cp -a /usr/include/gtk-2.0 .
| |
| cp -a /usr/lib/gtk-2.0/include/* gtk-2.0/
| |
| cp -a /usr/include/glib-2.0 .
| |
| cp -a /usr/lib/glib-2.0/include/* glib-2.0/
| |
| cp -a /usr/include/pango-1.0 .
| |
| if [ -d /usr/include/cairo ] ; then
| |
| cp -a /usr/include/cairo/* .
| |
| fi
| |
| fi
| |
| | |
| # Let's use the system freetype2 if available:
| |
| if [ -f /usr/include/ft2build.h ] && [ "$USE_SYSTEM_FREETYPE2" == "yes" ] ; then
| |
| echo "Using the system freetype2..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/freetype/ i686-linux/include/llfreetype2/*
| |
| rm -f include/ft2build.h i686-linux/lib_release_client/libfreetype.a
| |
| cp -a /usr/include/freetype2/freetype/ i686-linux/include/llfreetype2/
| |
| cp -a /usr/include/ft2build.h i686-linux/include/llfreetype2/freetype/
| |
| fi
| |
| | |
| # Let's use the system zlib if available:
| |
| if [ -f /usr/include/zlib.h ] && [ "$USE_SYSTEM_ZLIB" == "yes" ] ; then
| |
| echo "Using the system zlib..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/zlib/
| |
| mkdir -p i686-linux/include/zlib
| |
| cp -a /usr/include/zlib*.h i686-linux/include/zlib/
| |
| fi
| |
| | |
| # Let's use the system jpeglib if available:
| |
| if [ -f /usr/include/jpeglib.h ] && [ "$USE_SYSTEM_JPEGLIB" == "yes" ] ; then
| |
| echo "Using the system jpeglib..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/jpeglib/ i686-linux/lib_release_client/libjpeg.a
| |
| mkdir -p i686-linux/include/jpeglib
| |
| cp -a /usr/include/j*.h i686-linux/include/jpeglib/
| |
| touch i686-linux/include/jpeglib/jinclude.h
| |
| fi
| |
| | |
| # Let's use the system xmlrpc-epi if available:
| |
| if [ -f /usr/include/xmlrpc.h ] && [ "$USE_SYSTEM_XMLRPC" == "yes" ] ; then
| |
| echo "Using the system xmlrpc-epi..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/xmlrpc-epi/ i686-linux/lib_release_client/libxmlrpc.a
| |
| mkdir -p i686-linux/include/xmlrpc-epi
| |
| cp -a /usr/include/xmlrpc*.h i686-linux/include/xmlrpc-epi/
| |
| fi
| |
| | |
| # Let's use the system ogg if available:
| |
| if [ -f /usr/include/ogg/ogg.h ] && [ "$USE_SYSTEM_OGG" == "yes" ] ; then
| |
| echo "Using the system ogg..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/ogg/ i686-linux/lib_release_client/libogg*
| |
| update_manifest libogg
| |
| fi
| |
| | |
| # Let's use the system vorbis if available:
| |
| if [ -f /usr/include/vorbis/vorbisenc.h ] && [ "$USE_SYSTEM_VORBIS" == "yes" ] ; then
| |
| echo "Using the system vorbis..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/vorbis/ i686-linux/lib_release_client/libvorbis*
| |
| update_manifest libvorbis
| |
| fi
| |
| | |
| # Let's use the system SDL if available:
| |
| if [ -f /usr/include/SDL/SDL.h ] && [ "$USE_SYSTEM_SDL" == "yes" ] ; then
| |
| echo "Using the system SDL..."
| |
| cd $PATH_TO_SOURCES/libraries/i686-linux
| |
| rm -rf include/SDL/ lib_release_client/libSDL*
| |
| update_manifest libSDL
| |
| fi
| |
| | |
| # Let's use the system openssl if available:
| |
| if [ -f /usr/lib/libssl.so.0.9.7 ] && [ "$USE_SYSTEM_SSL" == "yes" ] ; then
| |
| echo "Using the system openssl..."
| |
| cd $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client
| |
| rm -f libssl.* libcrypto.*
| |
| update_manifest libssl
| |
| update_manifest libcrypto
| |
| fi
| |
| | |
| # Let's use the system apr if available:
| |
| if [ -f /usr/include/apr*/apr.h ] && [ "$USE_SYSTEM_APR" == "yes" ] ; then
| |
| echo "Using the system apr..."
| |
| cd $PATH_TO_SOURCES/libraries/i686-linux
| |
| rm -rf include/apr-1/*
| |
| rm -f lib_release_client/libapr*
| |
| cp -a /usr/include/apr*/* include/apr-1/
| |
| update_manifest libapr
| |
| fi
| |
| | |
| # Let's use the system expat if available:
| |
| if [ -f /usr/include/expat.h ] && [ "$USE_SYSTEM_EXPAT" == "yes" ] ; then
| |
| echo "Using the system expat..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/expat/
| |
| rm -f i686-linux/lib_release_client/libexpat*
| |
| mkdir -p i686-linux/include/expat
| |
| cp -a /usr/include/expat*.h i686-linux/include/expat/
| |
| update_manifest libexpat
| |
| fi
| |
| | |
| # Let's use the system curl if available:
| |
| if [ -f /usr/include/curl/curl.h ] && [ "$USE_SYSTEM_CURL" == "yes" ] ; then
| |
| echo "Using the system curl..."
| |
| cd $PATH_TO_SOURCES/libraries
| |
| rm -rf include/curl/
| |
| rm -f i686-linux/lib_release_client/libcurl.*
| |
| update_manifest libcurl
| |
| fi
| |
| | |
| # Let's use the system db4 if available:
| |
| if [ -f /usr/lib/libdb-4.2.so ] && [ "$USE_SYSTEM_DB4" == "yes" ] ; then
| |
| echo "Using the system db4..."
| |
| rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libdb*.so
| |
| update_manifest libdb
| |
| fi
| |
| | |
| # Let's use the system uuid if available:
| |
| if [ -f /lib/libuuid.so.1 ] && [ "$USE_SYSTEM_UUID" == "yes" ] ; then
| |
| echo "Using the system libuuid..."
| |
| rm -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libuuid.*
| |
| update_manifest libuuid
| |
| fi
| |
| | |
| if grep tcmalloc $PATH_TO_SOURCES/indra/SConstruct &>/dev/null ; then
| |
| if [ -f /usr/include/google/malloc_hook.h ] && [ "$USE_SYSTEM_PERFTOOLS" == "yes" ] ; then
| |
| echo "Using the system google-perftools..."
| |
| cd $PATH_TO_SOURCES/libraries/i686-linux
| |
| rm -f lib_release_client/libtcmalloc.* lib_release_client/libstacktrace.*
| |
| rm -rf include/google/
| |
| cp -a /usr/lib/libstacktrace.* /usr/lib/libtcmalloc.so* lib_release_client/
| |
| cp -a /usr/include/google include/
| |
| update_manifest tcmalloc
| |
| update_manifest stacktrace
| |
| else
| |
| # Remove the google-perftools stuff if not present in the libraries package
| |
| # (problem seen in SL v1.17):
| |
| if ! [ -f $PATH_TO_SOURCES/libraries/i686-linux/lib_release_client/libtcmalloc.so* ] ; then
| |
| update_manifest tcmalloc
| |
| update_manifest stacktrace
| |
| # The following lines remove the
| |
| # "external_libs += ['tcmalloc', 'stacktrace']"
| |
| # line from SConstruct... and many other lines which renders SConstruct
| |
| # unusable to build anything else than the client... this is a quick'n
| |
| # dirty patch. :-P
| |
| grep -v tcmalloc $PATH_TO_SOURCES/indra/SConstruct >$TEMP_BUILD_DIR/SConstruct
| |
| mv -f $TEMP_BUILD_DIR/SConstruct $PATH_TO_SOURCES/indra/SConstruct
| |
| fi
| |
| fi
| |
| fi
| |
| | |
| # Update the manifest file and enable libkdu packaging. I'm too lazy to use
| |
| # awk or perl, here, but that's indeed what should be done...
| |
| # The following (very dirty) code may break at some point, depending on what
| |
| # LL will put in comments in the manifest file...
| |
| # First, remove the lines with libstdc++.so.6 and the crash logger:
| |
| update_manifest libstdc
| |
| update_manifest crash_logger
| |
| # Now, any line with a '#' followed with several spaces _should_ be dealing
| |
| # with the libkdu stuff... So, we simply remove the '#"...
| |
| sed -e "s/# them/# them/" $PATH_TO_SOURCES/indra/newview/viewer_manifest.py >$TEMP_BUILD_DIR/viewer_manifest.py
| |
| sed -e "s/# / /" $TEMP_BUILD_DIR/viewer_manifest.py >$PATH_TO_SOURCES/indra/newview/viewer_manifest.py
| |
| #mv -f $TEMP_BUILD_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py
| |
| chmod +x $PATH_TO_SOURCES/indra/newview/viewer_manifest.py
| |
| | |
| # Missing file... at least in v1.17.
| |
| touch $PATH_TO_SOURCES/indra/newview/secondlife-i686.supp
| |
| | |
| # Add tune flags, if any:
| |
| if [ "$TUNE_FLAGS" != "" ] ; then
| |
| sed -e "s/-O2/-O2 $TUNE_FLAGS/" $PATH_TO_SOURCES/indra/SConstruct >$TEMP_BUILD_DIR/SConstruct
| |
| mv -f $TEMP_BUILD_DIR/SConstruct $PATH_TO_SOURCES/indra/SConstruct
| |
| fi
| |
| | |
| compile
| |
| </nowiki>
| |
| </pre>
| |
| </code>
| |
| <br />
| |
| <br />
| |
| | |
| == FreeBSD ==
| |
| | |
| A list of patches is given for [[Compiling the viewer (FreeBSD)]].
| |