LibreOffice源码编译以及生成VS项目

也许英文好的人直接看wiki上的说明就能很容易的编译并搭建好LibreOffice。
一、下载并安装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编译所需要的工具
2)Visual Studio安装
    LibreOffice 4.4版本需要Visual Studio 2012以上版本,LibreOffice5.0需要Visual Studio 2013以上版本。
    我编译的LibreOffice版本是4.3.3.2,所以我安装的是Visual Studio 2012.
      下载完make-85047eb-msvc.exe并将其命名为make,放在Cygwin安装目录的\opt\lo\bin\路径下(我的完整路径:D:\cygwin\opt\lo\bin\make)。
     并将其放在相应目录下(我的完整路径:D:\LibreOfficeComplie\apache-ant-1.9.4 ,D:\LibreOfficeComplie\Junit\junit-4.10.jar)
5)使用git下载LibreOffice源码 git命令:git clone git://gerrit.libreoffice.org/core libo-core
   (我的LibreOffice版本为4.3.3.2,LibreOffice主版本号已经是5.0以上了,LibreOffice完整路径:D:\LibreOfficeComplie\4.3.3.2)
 
四、编译LibreOffice
1)在LibreOffice源码同级目录下建立一个build目录,存放编译产生文件(D:\LibreOfficeComplie\build)
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=2012 \
--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:\LibreOfficeComplie\build)运行以下命令。
/opt/lo/bin/make -npf ../4.3.3.2/Makefile.gbuild | D:/LibreOfficeComplie/4.3.3.2/bin/gbuild-to-ide --ide vs2012
这样就生成了Virsual Studio 2012项目工程文件。
 
六、接下来开始你的LibreOffice源码之旅吧。
posted @ 2016-01-28 22:16  MTracy  阅读(6044)  评论(1编辑  收藏  举报