最權威的社區鏈接:https://wiki.documentfoundation.org/Development/BuildingOnWindows
也許英文好的人直接看wiki上的說明就能很容易的編譯並搭建好LibreOffice。
編譯過程中遇到任何問題,歡迎加qq羣:174768656
一、下載Cygwin
鏈接:http://www.cygwin.com/ win(32位)下載 setup-x86.exe, win(64位)下載 setup-x86_64.exe
二、使用Cygwin搭建環境
打開Windows 命令行,切換到cygwin下載目錄,運行以下命令:
win(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
win(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以上版本,LibreOffice 5.0需要Visual Studio 2013以上版本。LibreOffice 5.4需要Visual Studio 2015以上版本。LibreOffice 6.2需要Visual Studio 2017以上版本。
最新版的代碼需要Visual Studio 2017以上版本。
3)GUN make 下載鏈接:http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
下載完make-85047eb-msvc.exe並將其命名爲make,放在Cygwin安裝目錄的/opt/lo/bin\路徑下(我的完整路徑:D:\cygwin\opt\lo\bin\make)。
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:\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完整路徑:D:\LibreOfficeComplie\5.3.3.2)
四、編譯LibreOffice
1)在LibreOffice源碼同級目錄下建立一個build目錄,存放編譯產生文件(D:\LibreOfficeComplie\build)
2)運行Cygwin,進入上一步新建的build目錄,運行以下命令
../5.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=2015 \
--with-windows-sdk=7.1A \
--enable-pch \
--enable-debug \
--disable-ccache \
--disable-activex \
--disable-atl \
--disable-odk
3)配置成功後會出現以下信息
然後就是運行/opt/lo/bin make進行LibreOffice的編譯。接下來是個漫長的等待。
五、終端輸入./instir/program/soffice便可以啓動LibreOffice了
六、使用visual studio調試LibreOffice。
此圖是點擊write 字符對話框OK按鈕時的斷點。