See Also: * [BuildingQtOnLinux Building the Qt Port on Linux] * [BuildingQtOnWindows Building the Qt Port on Windows] These instructions assume you are building on an OSX system with Mac Ports installed. == Install the qt4-mac (4.7.1) port == {{{ sudo port install qt4-mac +debug export QTDIR=/opt/local }}} == Checkout the Code == You'll need to check out WebKit from SVN or QtWebKit from Git {{{ svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit # WebKit SVN Trunk }}} '''OR''' {{{ git clone git://gitorious.org/webkit/webkit.git # Git mirror }}} == Build WebKit == First follow the instructions [QtWebKitContrib there to get the sources]. The Qt port is part of the WebKit source tree, so you don't need anything extra. If you are planning to build with video enabled, you must install `qt-mobility` as a pre-requisite. It's available in MacPorts, but can also be built from source if you need an up-to-date version: {{{ git clone http://git.gitorious.org/qt-mobility/qt-mobility.git git checkout 1.1 ./configure make sudo make install }}} Finally, set the QTDIR environment variable to Qt 4.x's installation path and make sure Qt 4.x's qmake is the first qmake in your PATH (typically by running `export PATH=$QTDIR/bin:$PATH`). If your qmake binary has a different name, e.g. when using Debian, use the --qmake= option to specify the name. If you also build other ports on the same machine, make sure to zap the build directories (WebKitBuild/) first. You can also override the build directory with the WEBKITOUTPUTDIR environment variable. Build WebKit and the Qt test browser with {{{ WebKit/Tools/Scripts/build-webkit --qt }}} `build-webkit` (see above) also supports special variable for specifying the OBJDIR directory, as well as some configure and build arguments {{{ WEBKITOUTPUTDIR=`pwd`/qtbuild WebKit/Tools/Scripts/build-webkit --qt --makeargs="-j20 -s" --no-video --debug }}} If there is a problem with include file, try to pass more arguments to the build-webkit script, e.g. (all in one line) {{{ INCLUDEPATH+=/Library/Frameworks/QtCore.framework/Versions/4/Headers INCLUDEPATH+=/Library/Frameworks/QtGui.framework/Versions/4/Headers INCLUDEPATH+=/Library/Frameworks/QtNetwork.framework/Versions/4/Headers INCLUDEPATH+=/Library/Frameworks/QtXmlPatterns.framework/Versions/4/Headers }}} If the build fails with this error message: {{{ Undefined symbols: "WebCore::CSSParser::lex()", referenced from: WebCore::CSSParser::lex(void*)in libwebcored.a(CSSParser.o) }}} chances are you are using MacPorts flex, which spews warnings about "the character range … is ambiguous in a case insensitive scanner" and doesn’t generate any output. Make sure {{{/usr/bin/flex}}} is used, perhaps by putting {{{/usr/bin}}} on your path before MacPorts’ {{{/opt/local}}}. === Finish Up and Run === Rerunning the build should recompile CSSParser.cpp and link correctly. {{{ ${WEBKITSRCDIR}/Tools/Scripts/build-webkit --qt --qmake=qmake-4.5 --makeargs="-j2" -spec macx-g++ --no-video --debug }}} Finally start the demo Qt browser: {{{ ${WEBKITSRCDIR}/Tools/Scripts/run-launcher --qt --debug # After this, check the dock and you'll see an icon for a Qt console app ... }}}