OpenOffice 编译日志

来源:互联网 发布:浙江省网络监管服务网 编辑:程序博客网 时间:2024/06/05 14:22

OpenOffice 编译日志


 学习开源软件,第一件事就是将源码下载下来,编译一下试试。

本篇记录了编译apache-openoffice-4.1.0-r1589052-src的经历。

安装VS2008+SP1 


1、平台准备

1.1安装Cygwin

网址:http://www.cygwin.com/

下载安装程序,然后安装。我是将其直接安装在D:\cygwin。利用Cygwin的安装程序安装相应的额外的包:

  • Perl

  • Zip

  • Unzip

  • Gperf

  • Autoconf

  • Rsync

  • gcc4-g++

  • bison

  • flex

  • patch

  • make

  • wget

1.2 awk处理

awkgawk的拷贝来替代,双击打开“Cygwin Terminal”,运行如下命令:

rm /usr/bin/awk

mv /usr/bin/gawk.exe /usr/bin/awk.exe

说明:事实上在usr目录中,并没有子目录bin/usr/bin/cygwin/bin的一个映射。可以输入mount查看。

1.3安装JDK

注意,源码不支持JDK8,所以安装的JDK7

   安装后可以在cmd中输入“java -version”测试。

1.4安装ant

网址:http://ant.apache.org/bindownload.cgi

下载二进制包,解压放在分区的根目录下,注意其不支持目录中有空格。

如,我是安装在:D:\apache-ant-1.9.4
1.5安装Microsoft Windows SDK

在安装vs2008时已自带有sdk,故略去此步骤。

见目录:C:\Program Files\Microsoft SDKs\Windows\v6.0A

1.6可选项:安装Install DirectX SDK(在幻灯片时,提供硬件支持)

下载网址:http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=6812

Download and run DXSDK_Jun10.exe

1.7可选项:Install NSIS installer (用于创建安装包)

下载网址:http://nsis.sourceforge.net


2源码获取和编译准备

2.1获取源码

apache,使用svn或直接下载source bar

本人是直接下载源码包apache-openoffice-4.1.0-r1589052-src,然后解压缩到D:\aoo-4.1.0。编译需要约15G的空间。

2.2 Cygwin的使用

关于Cygwin的使用,可以参阅相关的文档。

快捷键“ctrl+L”可以清屏。或者安装包ncurse,使用命令“clear”清屏。

2.3切换目录

输入命令(注,下述说到命令时,是指在cygwin shell中输入)

SourceMain='d:\aoo-4.1.0\main'

cd $SourceMain

2.4 dbghelp.dll(可选项)

可选项:获取dbghelp.dll(在后续配置为--enable-dbguti时,需要用到)

dbghelp.dllMS Visual Studio的组件,在其安装目录下:

D:\Program Files\Microsoft Visual Studio9.0\Common7\IDE\dbghelp.dll

将其copySourceMain/main/external/dbghelp

或使用如下命令:

cp /cygdrive/d/Program\ Files\/Microsoft\ Visual\ Studio\9.0/Common7/IDE/dbghelp.dll $SourceMain/external/dbghelp

2.5获取Visual C++ Redistributable Packages

下载相应visual studio的可再分发包,该可再分发包用于制作openoffice安装包,而不需要安装visual studio

vcredist_x86.exe and vcredist_x64.exe拷贝到目录:

main/external/vcredist

2.6获得GDI+ redistributable

网址:http://www.microsoft.com/en-us/download/details.aspx?id=18909

下载WindowsXP-KB975337-x86-ENU.exe

运行,解压之,获得gdiplus.dll,将其拷贝到目录:

main\external\gdiplus

2.7获得msvcr100.dl

在目录C:\WINDOWS\system32中,可以拷贝到目录:

Main\ external\msvcp100

或使用如下命令:

cp /cygdrive/c/Windows/System32/msvcr100.dll$SourceMain/external/msvcp100


3编译

3.1确认工作目录

确认当前工作目录是在:D:\aoo-4.1.0\main

若不是,则输入命令:cd $SourceMain

3.2 autoconf

运行autoconf以创建配置脚本

autoconf

3.3 configure

SDK_PATH="/cygdrive/c/ProgramFiles/Microsoft SDKs/Windows/v6.0A"

./configure \

   --with-frame-home="$SDK_PATH" \

   --with-psdk-home="$SDK_PATH" \

   --with-midl-path="$SDK_PATH/bin" \

   --with-jdk-home="C:\Program Files\Java\jdk1.7.0_60"\

   --with-directx-home=" C:\Program Files\Microsoft DirectX SDK (June2010)" \

   --with-ant-home="/cygdrive/d/apache-ant-1.9.4"\

   --with-dmake-url="http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.tar.bz2"\

   --with-epm-url="http://www.msweet.org/files/project2/epm-3.7-source.tar.gz"\

   --enable-pch \

   --disable-atl \

   --disable-activex \

   --disable-binfilter \

   --without-junit\

   --with-lang="en-US zh-CN"

使用“--with-lang”来指定语言包。

目录extra中为本地化语言文件。

支持的本地化语言包见文件:solenv/inc/langlist.mk

如果需要编译为debug,则添加:--enable-debug

运行完毕后,将显示提示符,如果出错,则根据提示做相应修改:

Configure completed

Run ./bootstrap in D:/aoo-4.1.0/main toprovide build tools and get third-party packages

此时,在main目录中,会生成一个文件:bootstrap

3.4修改external_deps.lst

main\external_deps.lst文件缺少STLPORT包的定义。

打开main\external_deps.lst,在其中添加:

if (SYSTEM_STLPORT!= YES)

   MD5 = a8341363e44d9d06a60e03215b38ddde

   name = STLport-5.2.1.tar.bz2

   URL1 = $(OOO_EXTRAS)$(MD5)-$(name)

3.5运行./bootstrap

运行./bootstrap,以下载一些额外的包,以完成配置,同时编译build工具。

./bootstrap

当显示如下字符,表示成功:

dmakesuccessfully built and copied to D:/aoo-4.1.0/main/solenv/wntmsci12.pro/bin/dmake.exe


bundlingof dictionaries is disabled.

3.6修改环境变量

  • 打开“mian\winenv.set.sh

  • 找到定义SOLARINC的行。

  • 在其下新增一行内容为:

    SOLARINC=$SOLARINC+" -I$SRC_ROOT/comphelper/inc/-I$DIRECTXSDK_LIB/../../Include"

  • 保存

3.7导入环境变量

source ./winenv.set.sh

3.6编译

cd instsetoo_native/ 

build --all

3.7安装

编译后的安装文件目录:

$SourceMain/instsetoo_native/wntmsci12.pro/OpenOffice/msi/install/en-US


4编译单个模块

在全部编译后,如果修改了某个模块的源代码,可以只编译单个模块及相关的模块,语句如下:

cd main/instsetoo_native/

build --from <incompatible-module>--prepare

build --from <incompatible-module>

以包odk为例:

build --from odk --prepare

build --from odk


注:在win8系统中,会遇到文件夹和文件权限限制,导致编译出错,运行如下脚本,修改work_path,以管理员权限运行。

@echo off
set work_path=E:\aoo-4.1.0\main
D:
cd %work_path%
for /R %%s in (.,*) do (
echo y|CACLS %%s /G everyone:F
echo  %%s
)
pause


5 运行“./bootstrap”, 往往会下载第三方包失败,原因就不多说了。
将 ext_sources.rar 中预下载的包解压,放置于 aoo-4.1.0\ ext_sources 目录中,再次运行
“./bootstrap”即可。
如果开启字典功能,该包中已含有 dict-en.oxt 和 en_use.oxt,其它语言种类的包则需
要自行下载。

http://download.csdn.net/detail/waji2000/7597203

http://download.csdn.net/detail/waji2000/7597209

http://download.csdn.net/detail/waji2000/7597213

http://download.csdn.net/detail/waji2000/7597237




0 0
原创粉丝点击