window 下编译LibreOffice源码

最权威的社区链接:https://wiki.documentfoundation.org/Development/BuildingOnWindows

也许英文好的人直接看wiki上的说明就能很容易的编译并搭建好LibreOffice。

编译过程中遇到任何问题,欢迎加qq群:174768656

一、下载并安装Cygwin

链接:http://www.cygwin.com/ win7(32位)安装setup-x86.exe, win7(64位) setup-x86_64.exe

二、使用Cygwin搭建Linux环境

打开Windows 命令行,运行以下命令

win7(32位):

setup-x86.exe -P autoconf -P automake -P bison -P cabextract -P doxygen -P flex -P gcc-g++ -P git -P gnupg -P gperf -P make -P mintty -P nasm -P openssh -P openssl -P patch -P perl -P python -P python3 -P pkg-config -P rsync -P unzip -P vim -P wget -P zip -P
perl_vendor

win7(64位):

setup-x86_64.exe -P autoconf -P automake -P bison -P cabextract -P doxygen -P flex -P gcc-g++ -P git -P gnupg -P gperf -P make -P mintty -P nasm -P openssh -P openssl -P patch -P perl -P python -P python3 -P pkg-config -P
rsync -P unzip -P vim -P wget -P zip -P perl-Archive-Zip

三、安装Windows编译所需要的工具

1)JDK 安装 下载链接:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2)Visual Studio安装

LibreOffice 4.4版本需要Visual Studio 2012以上版本,LibreOffice5.0需要Visual Studio 2013以上版本。

最好安装的是Visual Studio 2013,2015有的特性不支持。

3)GUN make 下载链接:http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe

下载完make-85047eb-msvc.exe并将其命名为make,放在Cygwin安装目录的/opt/lo/bin路径下(我的完整路径:D:cygwinoptloinmake)。

4)apache-ant-1.9.4,下载链接:https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.5-bin.tar.bz2

junit-4.10.jar,下载链接:http://downloads.sourceforge.net/project/junit/junit/4.10/junit-4.10.jar

并将其放在相应目录下(ant解压后放,junit则不需要解压,我的完整路径:D:LibreOfficeComplieapache-ant-1.9.4 ,D:LibreOfficeComplieJunitjunit-4.10.jar)

5)使用git下载LibreOffice源码 git命令:git clone git://gerrit.libreoffice.org/core libo-core

(LibreOffice完整路径:D:LibreOfficeComplie4.3.3.2)

四、编译LibreOffice

1)在LibreOffice源码同级目录下建立一个build目录,存放编译产生文件(D:LibreOfficeComplieuild)

2)运行Cygwin,进入上一步新建的build目录,运行以下命令


../4.3.3.2/autogen.sh 

--with-external-tar=/cygdrive/d/LibreOfficeComplie/lo-externalsrc 

--with-junit=/cygdrive/d/LibreOfficeComplie/Junit/junit-4.10.jar 

--with-ant-home=/cygdrive/d/LibreOfficeComplie/apache-ant-1.9.4 

--with-visual-studio=2013 

--with-windows-sdk=7.1A 

--enable-pch 

--enable-debug 

--disable-ccache 

--disable-activex 

--disable-atl 

--disable-odk

3)配置成功后会出现以下信息

这里写图片描述

然后就是运行/opt/lo/bin make进行LibreOffice的编译。。。接下来是个漫长的等待。

五、编译LibreOffice成功之后,生成Visual Studio 2012项目,这样才能方面编辑源码。

首先需要更改LibreOffice源码目录下的Makefile.gbuild

改成你相对应的目录。

然后打开Cygwin,进入build目录(D:LibreOfficeComplieuild)运行以下命令。

/opt/lo/bin/make -npf ../core/Makefile.gbuild | D:/LibreOfficeComplie/core/bin/gbuild-to-ide –ide vs2013

这样就生成了Virsual Studio 2013项目工程文件。

转载:
http://www.chongchonggou.com/g_648604482.html
更多参考资料:
http://www.cnblogs.com/linTracy/p/5167635.html
http://blog.csdn.net/wu554513392/article/details/44834455

原文地址:https://www.cnblogs.com/jinxiang1224/p/8468160.html