Difference between revisions of "LLQtWebKit Mac OSX Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '<<< [https://wiki.secondlife.com/wiki/LLQtWebKit Back to LLQtWebKit main page] == Introduction == These are instructions for building the Qt/WebKit library (LLQtWebKit) on Mac O...')
 
Line 1: Line 1:
<<< [https://wiki.secondlife.com/wiki/LLQtWebKit Back to LLQtWebKit main page]
== Introduction ==
== Introduction ==
These are instructions for building the Qt/WebKit library (LLQtWebKit) on Mac OS X as well as the test applications (testGL, uBrowser, QtTestApp). They have been tested using XCode 3.1.2 on Mac OS X 10.5.8.
These are instructions for building the Qt/WebKit library (LLQtWebKit) on Mac OS X as well as the test applications (testGL and uBrowser). They have been tested using XCode 3.2.1 on Mac OS X 10.6.2.


== Set up ==
== Set up ==
Line 12: Line 10:
* A zip file of the source code will be downloaded
* A zip file of the source code will be downloaded
* Extract the files in the zip into <code>~/llqtwebkit</code> (this should create the directory <code>~/llqtwebkit/llqtwebkit</code>
* Extract the files in the zip into <code>~/llqtwebkit</code> (this should create the directory <code>~/llqtwebkit/llqtwebkit</code>
* Do not build anything yet - some of the files that were just downloaded will be used to modify the Qt source code


== Build the open source version of Qt 4.5.2 using XCode ==
== Build the open source version of Qt using XCode ==
=== Downloading and patching the Qt source ===
=== Acquire the Qt 4.6 source with our patches ===
* Download the Qt 4.5.2 source from ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.2.tar.gz (Approximately 125MB)
* Our clone of Qt is available here: http://gitorious.org/+lindenqt/qt/lindenqt
* Download the source by clicking on the "lindenqt" branch under "Branches" and then using the "download as tar.gz" link on the right hand side of the page
** Alternately, if you prefer you can clone the repository with git using the "clone" link on the page -- details of this are left as an exercise to the reader
* Extract the tarball into <code>~/llqtwebkit</code>
* Extract the tarball into <code>~/llqtwebkit</code>
* This may take some as the archive contains a lot of files
* This may take some as the archive contains a lot of files
* You should now have a directory <code>~/llqtwebkit/qt-all-opensource-src-4.5.2</code>
* You should now have a directory <code>~/llqtwebkit/qt-lindenqt</code>
* Review the file <code>~/llqtwebkit/llqtwebkit/qt_patches/merged_into_qt</code> to determine which patches need to be applied. Some patches are no longer needed with Qt 4.5.2.
* Open a terminal window and cd to <code>~/llqtwebkit/qt-lindenqt </code> directory  
* Open a terminal window and cd to <code>~/llqtwebkit/qt-all-opensource-src-4.5.2</code> directory  
* run the following commands (we'll use the QTDIR variable in later steps)
* run the following commands (we'll use the QTDIR variable in later steps)
  export QTDIR=`pwd`
  export QTDIR=`pwd`
  export PATH=$PATH:$QTDIR/bin
  export PATH=$PATH:$QTDIR/bin
* For each <code>.patch</code> file, run the following command:
patch -p1 < ../llqtwebkit/qt_patches/$PATCH_NAME
* where <code>$PATCH_NAME</code> is the filename of the patch file


=== Configure Qt ===
=== Configure Qt ===
* In the terminal window, make sure you're still in the directory <code>~/llqtwebkit/qt-all-opensource-src-4.5.2</code>
* In the terminal window, make sure you're still in the directory <code>~/llqtwebkit/qt-lindenqt </code>
* Run the following command:
* Run the following command:
  ./configure -no-framework -fast -no-qt3support -prefix $PWD -static -release -no-xmlpatterns -no-phonon -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk/
  ./configure -platform macx-g++40 -no-framework -fast -no-qt3support -prefix $PWD -static -release -no-xmlpatterns -no-phonon -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk/ -nomake examples -nomake demos -nomake docs -nomake translations
* When you are asked if you want to use the Commercial or Open Source version type <code>o</code> to select Open Source and press <enter>
* When you are asked if you want to use the Commercial or Open Source version type <code>o</code> to select Open Source and press <enter>
* When the license agreement appears, if you agree type <code>yes</code> <enter>
* When the license agreement appears, if you agree type <code>yes</code> <enter>
Line 38: Line 33:


=== Build Qt ===
=== Build Qt ===
* In the terminal window, make sure you're still in the directory <code>~/llqtwebkit/qt-all-opensource-src-4.5.2</code>  
* In the terminal window, make sure you're still in the directory <code>~/llqtwebkit/qt-lindenqt </code>  
* Run this command:
* Run this command:
  make
  make
Line 44: Line 39:
  make -j4
  make -j4
* This takes a little over an hour on a 4-core Mac Pro.
* This takes a little over an hour on a 4-core Mac Pro.
* After building Qt the built libraries will be in <code>~/llqtwebkit/qt-all-opensource-src-4.5.2/lib</code>
* After building Qt the built libraries will be in <code>~/llqtwebkit/qt-lindenqt/lib</code>
* For some reason, this doesn't build one of the libraries we need.  I also had to do the following:
* For me, the full build fails with "duplicate symbol _sqlite3_status", but at that point it has already built most of what we need. 
* The one additional piece we need is the JavaScriptCore library in WebkitTo build that do the following:
  cd $QTDIR/src/3rdparty/webkit/JavaScriptCore
  cd $QTDIR/src/3rdparty/webkit/JavaScriptCore
  make
  make
Line 51: Line 47:
== Build LLQtWebKit ==
== Build LLQtWebKit ==
* In the terminal window, change to the directory <code>~/llqtwebkit/llqtwebkit</code>
* In the terminal window, change to the directory <code>~/llqtwebkit/llqtwebkit</code>
* Create a symlink to QTDIR in this directory (this allows the xcode project to find it easily):
* Create a symlink to QTDIR in this directory (this allows the Xcode project to find it easily):
  ln -s $QTDIR QTDIR
  ln -s $QTDIR QTDIR
* Open the <code>llqtwebkit.xcodeproj</code> project with Xcode
* Open the <code>llqtwebkit.xcodeproj</code> project with Xcode
* Build the "Release" configuration of the "llqtwebkit" target
* Build the "Release" configuration of the "llqtwebkit" target
* Now LLQtWebKit is built and can be used in the Second Life viewer.
* The output of the build is <code>~/llqtwebkit/llqtwebkit/build/Release/libllqtwebkit.dylib</code>
** to build the Second Life viewer, this library needs to be copied to <code>{VIEWERSRC}/libraries/universal-darwin/lib_release/</code> and llqtwebkit.h needs to go in <code>{VIEWERSRC}/libraries/include/</code>
 
== Optional: build testgl ==
testgl is a simple example that uses the OpenGL GLUT toolkit to open a window, and renders web pages to an OpenGL texture using llqtwebkit.
* First, build the llqtwebkit library as described above
* In Terminal, go into the <code>tests/testgl/</code> directory
* Create a symlink to your built version of the llqtwebkit library:
ln -s ../../build/Release/libllqtwebkit.dylib
* run the following commands:
qmake
make
* this should create a 'testgl' binary, which you can run from the terminal window like so:
./testgl
 
== Optional: build ubrowser ==
ubrowser is a more complex example that uses the GLUI toolkit to render web pages to OpenGL textures and apply them to various 3d models.
* First, build the llqtwebkit library as described above
* Open the Xcode project at <code>tests/ubrowser/ubrowser.xcodeproj</code>
* Build and run using the Xcode UI

Revision as of 15:45, 12 March 2010

Introduction

These are instructions for building the Qt/WebKit library (LLQtWebKit) on Mac OS X as well as the test applications (testGL and uBrowser). They have been tested using XCode 3.2.1 on Mac OS X 10.6.2.

Set up

Create a directory you'll use for the build. This can be anywhere you like, but for the purposes of the example I'll use ~/llqtwebkit.

Acquire LLQtWebKit source code

  • In a Web browser, navigate to http://hg.secondlife.com/llqtwebkit/
  • Select "get source->zip" from menu
  • A zip file of the source code will be downloaded
  • Extract the files in the zip into ~/llqtwebkit (this should create the directory ~/llqtwebkit/llqtwebkit

Build the open source version of Qt using XCode

Acquire the Qt 4.6 source with our patches

  • Our clone of Qt is available here: http://gitorious.org/+lindenqt/qt/lindenqt
  • Download the source by clicking on the "lindenqt" branch under "Branches" and then using the "download as tar.gz" link on the right hand side of the page
    • Alternately, if you prefer you can clone the repository with git using the "clone" link on the page -- details of this are left as an exercise to the reader
  • Extract the tarball into ~/llqtwebkit
  • This may take some as the archive contains a lot of files
  • You should now have a directory ~/llqtwebkit/qt-lindenqt
  • Open a terminal window and cd to ~/llqtwebkit/qt-lindenqt directory
  • run the following commands (we'll use the QTDIR variable in later steps)
export QTDIR=`pwd`
export PATH=$PATH:$QTDIR/bin

Configure Qt

  • In the terminal window, make sure you're still in the directory ~/llqtwebkit/qt-lindenqt
  • Run the following command:
./configure -platform macx-g++40 -no-framework -fast -no-qt3support -prefix $PWD -static -release -no-xmlpatterns -no-phonon -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk/ -nomake examples -nomake demos -nomake docs -nomake translations
  • When you are asked if you want to use the Commercial or Open Source version type o to select Open Source and press <enter>
  • When the license agreement appears, if you agree type yes <enter>
  • This operation takes around 10-15 minutes on a typical development system

Build Qt

  • In the terminal window, make sure you're still in the directory ~/llqtwebkit/qt-lindenqt
  • Run this command:
make
  • If you're on a multicore machine, you can speed up the build substantially by using the '-j' argument to make, which will cause it to build files in parallel. For example, on a 4-core system, I use:
make -j4
  • This takes a little over an hour on a 4-core Mac Pro.
  • After building Qt the built libraries will be in ~/llqtwebkit/qt-lindenqt/lib
  • For me, the full build fails with "duplicate symbol _sqlite3_status", but at that point it has already built most of what we need.
  • The one additional piece we need is the JavaScriptCore library in Webkit. To build that do the following:
cd $QTDIR/src/3rdparty/webkit/JavaScriptCore
make

Build LLQtWebKit

  • In the terminal window, change to the directory ~/llqtwebkit/llqtwebkit
  • Create a symlink to QTDIR in this directory (this allows the Xcode project to find it easily):
ln -s $QTDIR QTDIR
  • Open the llqtwebkit.xcodeproj project with Xcode
  • Build the "Release" configuration of the "llqtwebkit" target
  • The output of the build is ~/llqtwebkit/llqtwebkit/build/Release/libllqtwebkit.dylib
    • to build the Second Life viewer, this library needs to be copied to {VIEWERSRC}/libraries/universal-darwin/lib_release/ and llqtwebkit.h needs to go in {VIEWERSRC}/libraries/include/

Optional: build testgl

testgl is a simple example that uses the OpenGL GLUT toolkit to open a window, and renders web pages to an OpenGL texture using llqtwebkit.

  • First, build the llqtwebkit library as described above
  • In Terminal, go into the tests/testgl/ directory
  • Create a symlink to your built version of the llqtwebkit library:
ln -s ../../build/Release/libllqtwebkit.dylib
  • run the following commands:
qmake
make
  • this should create a 'testgl' binary, which you can run from the terminal window like so:
./testgl

Optional: build ubrowser

ubrowser is a more complex example that uses the GLUI toolkit to render web pages to OpenGL textures and apply them to various 3d models.

  • First, build the llqtwebkit library as described above
  • Open the Xcode project at tests/ubrowser/ubrowser.xcodeproj
  • Build and run using the Xcode UI