您的位置:首页 > 编程语言 > Qt开发

[Webkit]QtWebkit开发环境配置及编译方法-Windows32bit

2014-06-06 09:58 501 查看

Dependencies

FirstofallyouneedaversionofQtforWindows.IfyouareanOpenSourcedeveloperthenyoucandownloadtheOpenSourceEditionofQtforWindowsfromtheNokiaWebsite:http://qt.nokia.com/downloads;针对Windows32位的版本为Qt5.0.1forWindows32-bit(VS2010,481MB)

NotethatyouneedtoenableICUsupportintheQtbuild(alsoseehttp://doc-snapshot.qt-project.org/5.0/requirements-win.html)

MakesurethatQtisconfiguredwith-opensslifyouwantHTTPSsupportinQtWebKit.Youwillneedthenon-lightversionofWin32OpenSSLlibraries.

InstallActiveStatePerl

InstallPython2.x(andaddtheinstallationlocationtoyourPATH)

ThefollowingexternalGNUtoolsareneededfromtheGnuWin32Project:

Bison

GPerf

Grep

Flex

LibIconv(neededforbison)

Make(notnecessaryifyouwanttobuildusingMSVC)

InstallRuby

Pleaseinstallthesetoolsinapathwithoutspaces(i.e.notin"C:\ProgramFiles")

MakesuretheGnuWin32packagesareinyourPATHaswellasPerlandPython.Youalsoneedtohave%QTDIR%setandhave%QTDIR%\bininyourPATH.
IfyouhaveCygwin'sbindirectoryinyourpath,makesurethatitcomesafterActiveStatePerlandGnuWin32.YoumighthavetoremoveitcompletelyfromyourPATHifyouhaveproblemswithslashesandbackslasheswhilebuildingusingMinGW.mingw32-makeandGnuWin32'smakewillusesh.exetoruncommandsiftheyfinditinthePATH.

BuildingQtWebKit

OpenaQtCommandPromptfromtheStartMenu.

AlternativelyyoucanuseaMSVCorMinGWcommandlineenvironmentthatmatchestheversionofQtyoudownloadedandmakesureqmakeisaccessibleinPATH.
NotethatbuildinginsideCygwinorMSYSiscurrentlynotsupported.PleaseuseaWindowscommandprompt.

ChdirintotheWebKitsourcetree

RunperlTools\Scripts\build-webkit--qt--release

Wait:)

TrytorunWebKitBuild\Release\bin\QtTestBrowser.exe

NotesaboutbuildingQtWebKitwiththeQt/WindowsOpenSourceEdition

Ifyouwanttocompileusingmultiplecores:

OnMinGWyoucantrysetMAKE_COMMAND=mingw32-make-j%NUMBER_OF_PROCESSORS%.
IfthisdonotworkyoumighthavetoCtrl-Cbuild-webkit'sexecution,gointheWebKitBuild\Release\directoryandrun:
mingw32-make-CJavaScriptCore-fMakefile.Release-j%NUMBER_OF_PROCESSORS%&&mingw32-make-CWebCore-fMakefile.Release-j%NUMBER_OF_PROCESSORS%&&mingw32-make


OnMSVCusetheCLenvironmentvariablealongwiththe/MPswitch:
setCL=/MP


Ifyouhaven'tsetupyourPATHalreadytoincludetheGnuWin32packagesthenyoumaywanttoexecutethefollowingcommand:setPATH=C:\GnuWin32\bin;C:\Perl\bin;%PATH%ProvidedthattheGnuWin32packagesareinstalledinC:\GnuWin32\binandPerlinC:\Perl\bin.

IfyougetbuilderrorsinJavaScriptCore\bindings\NP_jsobject.cpporsimilarthenpleasemakesurethattheMicrosoftPlatformSDKisNOTinyour%INCLUDE%pathbecauseitconflictswithyourMingWheaders.

Ifyougetbuilderrorsaftermakefilegeneration("Makefile:178:*Multipletargetpatterns.Stop.")thenyou'reprobablystillusingtheCygwinversionofmake.TryremovingCygwinfromyour%PATH%forthetimebeing(it'snotcurrentlysupported,asmentionedabove).

A'WorksForMe'Step-by-StepGuidetobuildingQtWebKitonWindowsusingmingw-w64/w32

Thepatchinbugreporthttps://bugs.webkit.org/show_bug.cgi?id=38747maynotyethavebeenappliedtoQtgit,applymanuallyifnecessary

UntilQt4.7isreleased,usethegitversionofQt4.7:http://qt.gitorious.org/qt/qt/trees/4.7

Getamingw-w64buildwithmingw32-make:

I'massumingyou'rerunningWindowsx64,asyouwillbetestingthebuild:)

Twooptions:

drangon:http://mingw-w64-dgn.googlecode.com/filesDownloadthemingw-w64-bin-x86_64-<date>packageDownloadthemake-w64-bin-x86_64-<date>packageExtractthembothtoC:\mingw64sothatmingw32-make.exeandg++.exearepresentintheC:\mingw64\binfolder

sezero:http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20BuildsDownloadanyofthemingw-w64-x86_64-mingw_<date>packages.Theexp/new/oldsuffixesarenotimportanthereExtractthepackagetoC:\mingw64sothatg++.exeispresentinC:\mingw64\binRenameincludedgmake.exetomingw32-make.exe

Setupyourenvironment:

QtsourcesareinC:\Qtsothatconfigure.exeispresentinthatdirectory

perlisinstalled:http://strawberryperl.com/(installershouldaddperl.exetoPATH)

opencmd.exe

runfollowingcommands:
setPATH=C:\mingw64\bin;C:\Qt\bin;%PATH%
setQTDIR=C:\Qt
cdC:\Qt
configure-qt-style-windowsxp-qt-style-windowsvista-phonon
mingw32-make


Everythingshouldhavebuilt.Havefun!

Remarks:mingw-w64/w32alsoprovidesatoolchaintargetting32-bitwindows.Sezeroprovidesbuilds:http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/TheproceduretocompileQtisexactlythesame,onlythathemingw64foldernameshouldbemingw32.

A'WorksForMe'Step-by-StepGuidetoBuildingQtWebKitonWindowsusingMinGW

ThethementionedGnuWin32tools

DownloadQTSDK(andQTCreator)andDownloadActivePerl

OpenforexampleaQtCommandPromptfromtheStartMenu.ClickStart->ProgramFiles->Qt->QTCommandPrompt.Infact,youreallydoneedtouseQtCommandPromptforthisratherthanthenormalwindowscommandprompt.

MakesuretheGnuWin32packagesareinyourPATHaswellasPerl(setPATH=C:\programfiles\gnuwin32\bin;C:\Perl\site\bin;%PATH%.

Youalsoneedtohave%QTDIR%setandhave%QTDIR%\bininyourPATH.

TrimyourPATHdownasmuchaspossible.RemoveGitandMingwfromyourPATHifyouhavetheminstalled,theirpresencecancauseoddbuildfailures.Forexample,thePATHthatworksformeis:
setPath=c:\GnuWin32\bin;c:\Qt\2009.01\qt\bin;c:\Qt\2009.01\bin;C:\Perl\bin;C:\Windows\system32;c:\Qt\2009.01\mingw\bin;C:\Perl\site\bin;C:\Windows


Notethatc:\Qt\2009.01\qtabovewillvarydependingontheQTSDKthatyoudownloaded.Youshouldmodifyitappropriately.

DownloadWebKitfromsvn(makesureyou'veleftthelocationofyoursvnclientinyour%PATH%above):
$svncheckouthttp://svn.webkit.org/repository/webkit/trunk%HOME%\WebKit
$cd%HOME%/WebKit


ChangeintotheWebKitsourcetree:cdc:\location\of\webkit

Forsomereason,thebuildcommandwasunabletocreatetheWebKitBuild\ReleasefoldersbyitselfonmyPC.IhadtodomkdirWebKitBuildandmkdirWebKitBuild\Releasebeforebuilding.

Youmayneedtodoamkdirc:\tmp.TheWebKitbuildreliesontheexistenceofc:\tmpwhenbuildinginWindows.

Buildthepatchedwebkit(releasemode):$perlTools\Scripts\build-webkit--qt--release

Thewebkitbuildtakesforever,youcanshortenitusingthebuild-webkit's--no-svgor--minimalflags:
$perlTools\Scripts\build-webkit--qt--release--no-svg
$perlTools\Scripts\build-webkit--qt--release--minimal


SpeedupGitonWindows

GittendstoberatherslowforrepositorieswithahugeamountoffilesonWindows.Onewaytodealwiththatistouseasparse-checkout,to"ignore"certainfiles.TheLayoutTestsdirectoryiscertainlyagoodcandidate,ifyoucurrentlydonotneedthesefiles.Asparse-checkoutusesaconfigfile(.git/info/sparse-checkout)todetermineifafileshouldbecheckedoutornot.Filesmentionedintheconfigfilewillbepartofthecheckout.Filesnotmentionedintheconfigfilewillbeignored.Thereisalsoasyntaxtoinvertthislogic,butitiscurrentlynotworkingwellwithdirectories.

Createa.git/info/sparse-checkoutfilethatwillignoretheLayoutTestsdirectory:
/*
!LayoutTests


Enablesparse-checkout:
gitconfigcore.sparsecheckouttrue


RemovetheLayoutTestsdirectoryifitisalreadythere:
rmdir/sLayoutTests


Updatethegittreecache:
gitread-tree-m-uHEAD


Checkwhichfileshavebeenexcluded:
gitls-files-v|grep^S


参考编译方法:


1.Qt官网下载最新版本:http://qt-project.org/downloads

2.将下载的压缩包解压(例如,路径为:F:/QtWebKit),配置相关环境变量:

-----创建两个变量名,分别为QTDIR(值为F:/QtWebKit/qt-windows-open.....),QMAKESPEC(值为win32-msvc20XX;这里的XX,根据VS的版本决定,本人用的是2010,所以为win32-msvc2010)

3.编译源代码

-----打开VS软件,进入VisualStudioTools中,运行命令行,锁定到qt的源码目录下,运行命令:configure.exe-webkit

-----编译过程中会出现GPL授权相关提示,yes即可,第一步会生成qmake

-----然后运行nmake命令,编译完即成功编译

4.编译应用程序,同上,一次执行qmake和nmake命令,会在debug目录下生成可执行文件

5.qt安装环境里包含webkit源代码,而且自带一个简单的Browser项目

6.将Browser工程设为启动项目,然后编译即可。


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: