取得原始碼
下載 Godot 原始碼
在 進入 SCons 建置系統 並編譯 Godot 之前,必須先下載 Godot 原始碼。
原始碼可於 GitHub 取得。雖然可以手動從網站下載,但一般建議使用 git 版本控制系統來下載。
如果你是為了貢獻或送出 Pull Request 而編譯,請依照 Pull Request 工作流程 的說明。
如果你還不熟悉 git ,網路上有許多 教學 可供參考。
一般來說,你需要安裝 git 及/或某個圖形化用戶端。
接下來,若要取得最新開發版 Godot 原始碼(不穩定的 master 分支),可以使用 git clone。
如果你使用的是 git 指令列用戶端,可以在終端機中輸入以下指令:
git clone https://github.com/godotengine/godot.git
# You can add the --depth 1 argument to omit the commit history (shallow clone).
# A shallow clone is faster, but not all Git operations (like blame) will work.
若要取得穩定版本,請前往 Release 頁面 並點擊你想要的版本,然後從該頁面下載並解壓縮原始碼。
使用 git 時, 也可以在 --branch (或 -b) 參數後指定分支或標籤來複製穩定版本:
# Clone the continuously maintained stable branch (`4.5` as of writing).
git clone https://github.com/godotengine/godot.git -b 4.5
# Clone the `4.5-stable` tag. This is a fixed revision that will never change.
git clone https://github.com/godotengine/godot.git -b 4.5-stable
# After cloning, optionally go to a specific commit.
# This can be used to access the source code at a specific point in time,
# e.g. for development snapshots, betas and release candidates.
cd godot
git checkout f4af8201bac157b9d47e336203d3e8a8ef729de2
維護分支 用於各小版本的後續修補與維護。
你可以從 GitHub 上的 godotengine/godot-builds 下載每個正式版與預覽版的原始碼(.tar.xz 格式)。這類壓縮檔不含版本控制資訊,但下載檔案較小。
下載好 Godot 原始碼後,你可以 繼續編譯 Godot。