Difference between revisions of "Zh/Documentation/Building Guide/Building on Windows"
(Created page with "{{Documentation/Building Guide TOC |ShowNextPage=none |ShowPrevPage=none }} {{DISPLAYTITLE:Building on Windows}} Category:Windows Category:Build System __TOC__ = Ov...") |
((保存点)) |
||
Line 1: | Line 1: | ||
− | {{Documentation/ | + | {{Documentation/建制指导 TOC |
|ShowNextPage=none | |ShowNextPage=none | ||
|ShowPrevPage=none | |ShowPrevPage=none | ||
}} | }} | ||
− | {{DISPLAYTITLE: | + | {{DISPLAYTITLE:Windows环境下的建制}} |
[[Category:Windows]] | [[Category:Windows]] | ||
[[Category:Build System]] | [[Category:Build System]] | ||
Line 10: | Line 10: | ||
__TOC__ | __TOC__ | ||
− | = | + | = 概述= |
− | {{Template:Documentation/Windows| | + | {{Template:Documentation/Windows| 这个文档解释了怎么在Windows系统下建立一个OpenOffice.org的源代码.}} |
− | + | 为了能够建制 OpenOffice.org我们需要Cygwin这个工具 , 这是一个模拟一个完整的Unix命令环境的 Windows 程序.为了能够使用它,你需要熟悉命令行, 当然,并不需要你相当了解Unix 内核. | |
− | {{Template:Documentation/Tip| | + | {{Template:Documentation/Tip|如果你从未使用过Unix shell命令, 你可以访问这个网页 [http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/index.html TLDP内核介绍].}} |
− | {{Template:Documentation/Note|<code>$SRC_ROOT</code> | + | {{Template:Documentation/Note|<code>$SRC_ROOT</code> 将表示 OpenOffice.org源代码资源存储所在路径.}} |
− | {{Template:Documentation/Tip| | + | {{Template:Documentation/Tip|当您建制时建议您检测发布说明来获得与以前发布的版本的一些改变.}} |
= Requirements= | = Requirements= |
Revision as of 13:46, 17 February 2013
Template:Documentation/建制指导 TOC
Contents
概述
Template:Documentation/Windows
为了能够建制 OpenOffice.org我们需要Cygwin这个工具 , 这是一个模拟一个完整的Unix命令环境的 Windows 程序.为了能够使用它,你需要熟悉命令行, 当然,并不需要你相当了解Unix 内核.
Template:Documentation/Note Template:Documentation/Tip
Requirements
hardware requirements
- 1 or more reasonable fast CPUs (x-way CPU recommended)
- 1 GB RAM (2 GB recommended)
- 10 GB free disk space (20 GB when debugging)
software requirements
- Windows XP/Vista/7
The following table is placed here, so you can come back to it easily, when you want to use a link. The items are explained below. Here's the list of files to download (with links) and the locations in the source tree where you must put them:
Where to get | Place in/Use configure switch |
---|---|
Cygwin: Cygwin ToolKit with(dll version 1.5.10)or later | (default) |
C/C++ Compiler: free: Visual C++ 2008 Express Compiler(basic install, no optional required) offical: Visual C++ 2008 Professional | --with-cl-home= |
Java: JDK 1.6 for DEV300 milestones >= m37 and all OOo310 versions (older milestones will fail in the hsqldb module) | --with-jdk-home= |
Windows SDK for Windows Server 2008[1] | |
GDI+ Redistributable (Genuine Windows Validation required) | main/external/gdiplus |
dbghelp.dll[2]
Can also be found in the Visual Studio C++ 2008 Express installation. |
main/external/dbghelp |
Apache Ant (version 1.6.5 or later) | --with-ant-home= |
Mozilla binary distribution (WNTMSCIruntime.zip,WNTMSCIlib.zip,WNTMSCIinc.zip)
Needed as prebuilts for module moz (SeaMonkey) as the current used SeaMonkey version 1.1.4 does not support a build with Visual Studio C++ 2008 compiler. |
main/moz/zipped |
msvcr71.dll and msvcp71.dll for Mozilla libraries (Search for them in the Web or on your PC. These files should be named as all lower case. Sometimes when downloaded they are upper case and this will cause 'file not found' errors towards the end of the build)) | main/external/msvcp71 |
msvcp80.dll and msvcr80.dll for Mozilla libraries (found in c:\WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd/msvc) | main/external/msvcp80 |
optional: Nullsoft Scriptable Install System (NSIS)[3] | |
optional: Microsoft DirectX SDK[4] | --with-directx-home= |
Legacy requirements that do not apply for Apache OpenOffice:
Where to get | Place in |
---|---|
not needed anymore for Apache OpenOffice |
|
not needed anymore for Apache OpenOffice |
|
not needed anymore for Apache OpenOffice |
|
not needed anymore for Apache OpenOffice . These merge modules are available in VS08 Express Edition and VS08 Professional Edtion. All *.msm files are located at c:\Program Files\Common Files\Merge Module. |
|
adding required files to the build tree
Installation and Preparation of Build Tools
setting up cygwin
Go to http://www.cygwin.com/ and download and install the current version.
Make sure that the PATH variable in your cygwin shell does not contain any blanks and quotes, otherwise configure will not work |
required additional packages
Cygwin consists of some basic and a lot of optional packages. As building OOo needs some of these optional packages you have to select them in the installer. Here's a complete list of the needed packages:
- Category Archive:
- unzip
- zip
- Category Devel :
- autoconf
- bison
- flex
- gcc-g++
- gperf
- make
- openssl-devel (only needed for perl modules for CWS tooling, see below)
- mercurial (or cvs for 2.x-3.0, or subversion for 3.1 codeline)
- readline
- Category Libs
- openssl
- Category Net
- openssh
- Category Perl
- perl
- Category Shells
- mintty
- Category Utils
- patch
- gnupg
- Category Web
- wget
breaking links to executables
Within the Cygwin Toolkit, some executables might be symlinks: awk.exe and gunzip.exe, tar.exe (in older releases only). This can lead to a break of the build later, and the symlinks should be replaced by copies of the command they link to.
To check this, execute:
ls -l /bin/awk.exe
whether e.g. awk.exe is a symlink. In version 1.5.24-2 awk.exe is a link to gawk.exe. The shell will show this by putting out “awk.exe -> gawk.exe”. In this case gawk.exe must be copied to awk.exe by executing:
cd /bin rm awk.exe cp gawk.exe awk.exe
In case you overlook something here or you have a newer Cygwin version with additional symlinks not mentioned here it's not a problem. You will get a helpful error message about an existing link in the configuration step (configure) later. The message will tell you which link you have to remove and you can do it following the advice given above for the awk.exe/gawk.exe pair.
installing additional perl modules in cygwin
As explained some perl modules must be installed with CPAN. The necessary command in the cygwin shell is
perl -MCPAN -e shell
If this command is executed the first time CPAN will ask for configuration. Choose autoconfiguration.
At the end the CPAN shell appeared and is ready to accept commands for installations. Each module is installed by typing install $MODULENAME
. The modules that must be installed are:
- Archive::Zip
- LWP::UserAgent
not needed anymore for Apache OpenOffice
- XML::Parser (though it seems that this is already installed; doesn't hurt to do it)
- URI
- Crypt::SSLeay
- SOAP::Lite
CPAN will detect if a selected module depends on other modules and it will offer to download them also. As explained please just confirm this.
Full Builds
configure
Finally the configure
tool is used to create the environment. It checks that all software, hardware, and system requirements for the build are satisfied, and creates configuration files called winenv.set (for tcsh) and winenv.set.sh (for bash) that are used to set all necessary build environment variables. Before running configure, make sure that all needed programs are in the system path or start configure with the appropriate command line switches. If configure detects a problem it will stop and give you a useful hint how to fix it.
For building OOo from the Mercurial repository:
You will find the configure
script in $SRC_ROOT
. The resulting configuration files are created there too.
For building OOo from the Apache svn repository:
call autoconf
in $SRC_ROOT
. This will create the configure step. Repeat that and the configure step after each change in configure.in (either by yourself or anyone else).And every time you make changes to the configure.in
script, the script will remind you to run autoconf
again.
autoconf
sample configure calls
You can get short explanations for all parameters by using ./configure --help.
minimum (requires the most prerequisites) - pathes of course are machine dependent:
./configure --disable-build-mozilla --with-mozilla-build="/cygdrive/d/OOo/mozilla-build-1.3" \ --with-cl-home="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC" \ --with-mspdb-path="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/Common7/IDE" \ --with-frame-home="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1" \ --with-psdk-home="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1" \ --with-midl-path="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1/Bin" \ --with-asm-home="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/Bin" \ --with-csc-path="/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v3.5" \ --with-jdk-home="/cygdrive/c/j2sdk1.5.0.06" \ --with-directx-home="/cygdrive/d/OOo/DirectXSDK" \ --with-ant-home=/ant \
some further settings that might help to get rid of some prerequisites that not every developer needs (but be aware, this will also remove some parts from the final build result):
--disable-mozilla \ --disable-activex \ --disable-directx \ --disable-atl \ --without-junit \ --disable-binfilter \ --disable-odk \
for all builds on code lines older than OOo330 or older than milestone m77 on the DEV300 code line:
--with-use-shell=bash
some other settings worth considering:
--enable-pch \ --enable-werror \ --enable-dbgutil \
in case you want to have several workspaces on your hard disk, it might be a good idea to share external source tarballs:
--with-external-tar=d:/OOo/ext_sources \
configure settings tips
Template:Documentation/Note
Template:Documentation/Tip
Template:Documentation/Tip
{{Template:Documentation/Caution|If you run into problems compiling on an "Express Edition" (such as Cannot open include files: 'atlbase.h': No such files or directory), check your settings in winenv.set.sh for DISABLE_ATL
, DISABLE_ACTIVEX
: all have to be set TRUE
. Visual Studio Express compilers do not contain everything needed to build the OOo ActiveX control, OLE automation and native Windows OLE support, so either disable support for them via --disable-atl --disable-activex
or add them via the WDK.
Template:Documentation/Tip
Template:Documentation/Tip
Template:Documentation/Tip
Template:Documentation/Tip
Template:Documentation/Tip
bootstrap
After running configure you must create the dmake make utility that is needed for the build of OpenOffice.org. This done from the SRC_ROOT directory by calling
./bootstrap
setting the enviroment
When the configure script has been run successfully a file winenv.Set.sh
was created[7]. Do this:
source winenv.Set.sh
to set up the enviroment for the build.
starting the build
Build the software by typing the following in $SRC_ROOT
[8]:
dmake
The building procedure will take at least an hour (on a 3 GHz Quad-Core with 8GB RAM).
There are some special things in the way how OOo builds its modules. Every module has an “output” folder (with some subfolders for the different kinds of generated output) that is created the first time a build is done in the module. The name of this folder is “wntmsci10.pro” for builds with MSVC++2003, “wntmsci11.pro” for builds with MSVC++2005 and "wntmsci12.pro" for builds with MSVC++2008 (for the meaning of the "pro" extension see below). After a successful build of a module some of the generated files are copied to the output folder of the “solver” module by executing a tool called “deliver” (this is automatically called by build --all for each of the modules). Other modules will take these “delivered” files (header files, libraries etc.) to resolve their dependencies. The content of the solver module will also be used to pack the installation sets in the final step.
Partial Builds
There are two ways to do partial builds:
- compatible
- incompatible
Only do compatible partial builds if you know exactly what you are doing. Template:Documentation/Note
rebuilding from a module (incompatible build)
If you decide to change a module in an incompatible way, you will need to rebuild all modules depending on it (directly or indirectly):
cd $SRC_ROOT/instsetoo_native build --from $INCOMPATIPLEMODULE --prepare build --from $INCOMPATIBLEMODULE
rebuilding a module (compatible build)
To rebuild a module you can delete all output directories with, rebuild and redeliver into the solver with:
cd $MODULE build --from $MODULE --prepare build && deliver
A simple build
in $SRC_ROOT/instsetoo_native
will recreate the installation sets, provided all other modules have already been build.[9]
Building a Module with Debug Information
To rebuild a module with debug information and additional assertions and checks, run:
cd $MODULE build --from $MODULE --prepare # removes old output trees and solver build debug=true --from $MODULE
Drop the newly created binaries into an existing installation. Building an installation set with them will not help, as binaries are stripped on packing by default.
Finding the Installation Sets
After a successful build you will find the OOo installation set in
instsetoo_native/wntmscixx.pro/OpenOffice/msi/Install/en-US
“instsetoo_native” is the module that packs the installation set.
Tips And Tricks
ccache
For Windows: download from here, do the following:
export CCACHE_DIR="some/place/with/space" ccache -M 2G -F 10000 export CCACHE_CPP2=TRUE export CXX="guw.pl ccache cl" # export USE_PCH= if you experience trouble with precompiled headers
dependencies
nodep
If you set the environment variable nodep
to TRUE
, then dependendy information files are not created - the build finishes faster.
But only enable that on a clean build. Once you have built OOo and then made modifications, unset the variable again to be on the safe side. |
NO_HIDS
Similar to the nodep
variable, this one prevents the generation of HIDs (Help IDs) that are mainly used for automated testing - if you only want to build OOo, you don't need those.
parallel builds
If you have a multiprocessor machine or similar, you can run a parallel build. There are two levels of parallelism - one operating on makefile (directory) level, the other one on the global level. The two levels of parallelism result from the two-step build procedure in the OOo build environment. The build script runs through all the directories it reads from the build.lst files in all modules and calls dmake for every directory.
parallelism on the global level
For parallelism on the global level, you have to run build from $SRC_ROOT>/instsetoo_native
with the -P<number>
switch, for example:
build -P2
This takes build how many dmake processes it is allowd to start in parallel.
parallelism on the directory level
export MAXPROCESS=<numer or processes>
This tells dmake how many targets it is allowed to build in parallel. When you don't use build.pl but build a single directory (single makefile), you can achieve the same with
dmake -P2
combining both levels
If you want to have parallelism on both levels, you can call
build -P2 -- -P2
"--" is a special build.pl parameter that passes every further parameters to the dmake processes it starts.
Recommendation
Experience tells that using the doubled number of cores in your machine is a good choice, using more threads does not make a big difference, except if the combined option is chosen. So even on single core machines using two threads will speed up the build considerably.
create prebuilt mozilla
For the mozilla-components you have the choice to either build from mozilla sources, to use precompiled packages or to use system-mozilla (the one installed on your buildsystem, not everything might work, depending on the version you got installed). You can easily create your own version of the prepacked binaries if you wish to do so (either because you cannot use the official ones because of mismatch of compiler version used to build them/other technical reasons or because you want to use stuff you didn't build yourself). To do so:
- build the
moz
module from the mozilla sources - use
--enable-build-mozilla
when running configure and put the mozilla-source tarball tomoz/download
- in
moz
rundmake zip
to create the zip files - you'll find the zips in
{platform}.pro/zipped
Copy them to a location of your liking.
Now instead of using --enable-build-mozilla
, use --disable-build-mozilla
and copy the zips you created or downloaded to moz/zipped
and these will be used when compiling.
This will greatly reduce build-time (you save the time that would otherwise be spent on compiling mozilla).
See Also
- ↑ Template:Documentation/Note
- ↑ Template:Documentation/Note
- ↑ Template:Documentation/Note
It used to be that newer version of NSIS broke the build (see Issue 85657 ), but it seems that it now works for NSIS up to 2.3.7. - ↑ Template:Documentation/Note
Current (as of 2008/01) versions of the DirectX9 SDK and Windows Platform SDK do not fit to each other. To be able to build with DirextX enabled, you need to patch one file in the Platform SDK. See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID2743771 for details. - ↑ Template:Documentation/Note
- ↑ Template:Documentation/Note
- ↑ Template:Documentation/Note
- ↑ Template:Documentation/Note
- ↑
Content on this page is licensed under the Public Documentation License (PDL). |