2008/11/21

buildout with MinGW

在 Plone 下載網頁,看得到 Windows 版本的 builout installer 了。
與傳統 Windows installer 不同的地方,主要是目錄架構改變了,這倒容易習慣,但使用 buildout 時,經常會用到 C 編譯器環境,則需要花些工夫準備。
MinGW 為例,先下載 Automated MinGW Installer 安裝,例如裝在 C:\MinGW 目錄,到 C:\MinGW\libexec\gcc\mingw32\3.4.5 目錄把 cc1.exe 和 collect2.exe 複製到 C:\MinGW\bin 目錄,下載 libpython24.a 放到 C:\MinGW\lib 目錄,再把 C:\MinGW\bin 加到系統環境變數 PATH 裡。
在 shell 裡執行 gcc --version 測試是否成功。
接著要通知 Python 的 distutils 已可以使用 MinGW,以 Plone 安裝在 C:\Plone3 目錄為例,要到 C:\Plone3\python\Lib\distutiles 目錄裡建立 distutils.cfg 檔案,內容是

[build]
compiler=mingw32

我有遇到 "missing structmember.h" 之類的訊息,處理方法是,下載 Python 原始碼檔案,複製 Include 目錄到 C:\Plone3\python\Include 目錄。
如果想要 Plone 以 Windows service 方式執行,可以先用 bin\instance install 指令,日後就可以直接使用 bin\instance start 或 stop 來啟動或關閉。
如果 Windows 使用防火牆,用 bin/instance fg 啟動後,系統會提示是否要打開 port。
其他更多的設定細節,可以參考 Using buildout on Windows 文件。

No comments: