imputnet/helium-windows

GitHub: imputnet/helium-windows

Helium 浏览器的 Windows 构建与打包项目,提供去 Google 化的 Chromium 隐私浏览方案。

Stars: 766 | Forks: 29

# helium-windows [Helium](https://github.com/imputnet/helium) 的 Windows 打包项目。 ## 许可证 所有代码、补丁、导入代码或补丁的修改部分,以及 Helium 中独有的且未从其他仓库导入的任何其他内容,均采用 GPL-3.0 许可。参见 [LICENSE](LICENSE)。 从其他项目导入的任何内容均保留其原始许可(例如,从 ungoogled-chromium 导入的任何原始未修改代码仍根据其 [BSD 3-Clause 许可](LICENSE.ungoogled_chromium)授权)。 ## 构建 #### 设置 Visual Studio [遵循官方 Windows 构建说明中的“Visual Studio”部分](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/windows_build_instructions.md#visual-studio)。 * 务必通读整个章节,并安装/配置所有必需的组件。 * 如果您的 Visual Studio 安装在非默认目录中,则需要设置一些环境变量以将工具链指向您的安装路径。(摘自 [Electron 说明](https://electronjs.org/docs/development/build-instructions-windows)) * `vs2019_install = DRIVE:\path\to\Microsoft Visual Studio\2019\Community`(将 `2019` 和 `Community` 替换为您安装的版本) * `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10` * `GYP_MSVS_VERSION = 2019`(将 2019 替换为您安装版本的年份) #### 其他构建要求 **重要提示**:目前,必须解除 `MAX_PATH` 路径长度限制(默认为 260 个字符),以便我们的 Python 构建脚本正常运行。在 Windows 10(v1607 或更高版本)中,可以使用 Python 3.6 或更高版本的官方安装程序解除此限制(您将在安装结束时看到一个按钮来执行此操作)。对于较旧的 Windows 版本,请参阅 [Issue #345](https://github.com/ungoogled-software/ungoogled-chromium/issues/345) 了解其他方法。 1. 设置以下项: * 7-Zip * Python 3.8 或更高版本 * 可以使用 WinGet 或 Microsoft Store 安装。 * 如果您不打算使用 Microsoft Store 版本的 Python: * 安装前勾选“Add python.exe to PATH”。 * 在 Python 安装程序结束时,点击按钮以解除 `MAX_PATH` 长度限制。 * 在 `Settings > Apps > Advanced app settings > App execution aliases` 中禁用 `python3.exe` 和 `python.exe` 别名。它们通常被称为“App Installer”。请参阅 [stackoverflow.com 上的此问题](https://stackoverflow.com/questions/57485491/python-python3-executes-in-command-prompt-but-does-not-run-correctly) 以了解原因。 * 确保您的 Python 目录中有一个名为“python3.exe”的 Python 副本,或者一个指向 Python 可执行文件的符号链接。 * 版本为 0.22.0 的 `httplib2` 模块。可以使用 `pip install httplib2==0.22.0` 安装。 * 务必解除 `MAX_PATH` 长度限制,可以通过点击 Python 安装程序末尾的按钮,或者通过[遵循这些说明](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#:~:text=Enable,Later)来实现。 * Git(用于获取所有必需的 ungoogled-chromium 脚本) * 在安装过程中,确保选中“Git from the command line and also from 3rd-party software”。这通常是推荐的选项。 ### 构建 在 `Developer Command Prompt for VS`(以管理员身份)中运行: ``` git clone --recurse-submodules https://github.com/imputnet/helium-windows.git cd helium-windows # 将 TAG_OR_BRANCH_HERE 替换为 tag 或 branch 名称 git checkout --recurse-submodules TAG_OR_BRANCH_HERE python3 build.py python3 package.py ``` 将在 `build` 下创建一个 zip 压缩包和一个安装程序。 **注意**:如果构建失败,您必须在重新运行构建之前采取额外的步骤: * 如果在下载 Chromium 源代码期间(即在 `build.py` 期间)构建失败,可以通过删除 `build\download_cache` 并重新运行构建说明来修复。 * 如果在 `build.py` 期间的任何其他时间点构建失败,可以通过删除 `build` 下除 `build\download_cache` 以外的所有内容并重新运行构建说明来修复。这将清除构建使用的所有代码以及构建生成的任何文件。 删除大量文件的一种有效方法是使用 `Remove-Item PATH -Recurse -Force`。但请注意,通过该命令删除的文件将永久丢失。 ## 开发者信息 ### 首次设置 1. [设置 MSYS2](http://www.msys2.org/) 2. 在“MSYS2 MSYS”shell 中运行以下内容: ``` pacman -S quilt python3 vim tar # 默认情况下,less、quilt edit 等似乎没有 vi 命令。 ln -s /usr/bin/vim /usr/bin/vi ``` ### 更新补丁和修剪列表 1. 启动 `Developer Command Prompt for VS` 和 `MSYS2 MSYS` shell 并导航到源文件夹 1. `Developer Command Prompt for VS` * `cd c:\path\to\repo\helium-windows` 2. `MSYS2 MSYS` * `cd /path/to/repo/helium-windows` * 您可以使用 Git Bash 确定此 repo 的路径 * 或者,您可以通过 `//` 自行查找 2. 克隆源代码 **`Developer Command Prompt for VS`** * `python3 helium-chromium\utils\clone.py -o build\src` 3. 检查 rust 版本更改(见下文) 4. 更新修剪列表 **`Developer Command Prompt for VS`** * `python3 helium-chromium\devutils\update_lists.py -t build\src --domain-regex helium-chromium\domain_regex.list` 5. 更新补丁 **`MSYS2 MSYS`** 1. 设置补丁和 shell 以更新补丁 * `./devutils/update_patches.sh merge` * `source devutils/set_quilt_vars.sh` 2. 进入源代码树 * `cd build/src` 3. 使用 quilt 刷新补丁。有关更多详细信息,请参阅 ungoogled-chromium 的 [docs/developing.md](https://github.com/ungoogled-software/ungoogled-chromium/blob/master/docs/developing.md#updating-patches) 部分“Updating patches” 4. 返回 repo 根目录 * `cd ../..` 5. 移除 helium-chromium 引入的所有补丁 * `./devutils/update_patches.sh unmerge` 6. 对 series 文件的一致性进行健全性检查 * `./devutils/check_patch_files.sh` 6. 使用 Git 添加更改并提交 ### 更新依赖项 **注意:**对于所有步骤,请相应地更新 `downloads.ini`。 1. 查看 [LLVM GitHub](https://github.com/llvm/llvm-project/releases/) 以获取最新版本的 LLVM。 1. 下载 `LLVM-*-win64.exe` 文件。 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 2. 检查文件 `build/src/third_party/devtools-frontend/src/DEPS` 中的 esbuild 版本,并在 [esbuild GitHub](https://github.com/evanw/esbuild/releases) 中找到与其最接近的版本。 * 例如:`version:3@0.24.0.chromium.2` 应为 `0.24.0` 3. 检查文件 `build/src/third_party/devtools-frontend/src/DEPS` 中的 ninja 版本,并在 [ninja GitHub](https://github.com/ninja-build/ninja/releases/) 中找到与其最接近的版本。 1. 下载 `ninja-win.zip` 文件。 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 4. 查看 [Git GitHub](https://github.com/git-for-windows/git/releases/) 以获取最新版本的 Git。 1. 获取 `PortableGit--64-bit.7z.exe` 的 SHA-256 校验和。 5. 检查 `third_party/microsoft_dxheaders` 中 `src` 子模块的提交哈希更改(例如,使用 GitHub `https://github.com/chromium/chromium/tree//third_party/microsoft_dxheaders`)。 1. 将 `version` 替换为 `helium-chromium/chromium_version.txt` 中的 Chromium 版本。 6. 检查 `third_party/node/update_node_binaries` 中的 node 版本更改(例如,使用 GitHub `https://github.com/chromium/chromium/tree//third_party/node/update_node_binaries`)。 1. 从 [NodeJS 网站](https://nodejs.org/en/download) 下载“Standalone Binary”版本。 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 7. 检查 windows rust crate 的版本更改(`third_party/rust/windows_x86_64_msvc/`)。 1. 下载 rust crate zip 文件。 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 3. 相应地更新 `patches/ungoogled-chromium/windows/windows-fix-building-with-rust.patch`。 ### 更新 rust 1. 检查构建根目录下 `tools/rust/update_rust.py` 文件中的 `RUST_REVISION` 常量。 * 例如:Revision 可能是 `f7b43542838f0a4a6cfdb17fbeadf45002042a77` 2. 从 Rust GitHub 页面获取 nightly rust 构建的日期:`https://github.com/rust-lang/rust/commit/f7b43542838f0a4a6cfdb17fbeadf45002042a77` 1. 将 `RUST_REVISION` 替换为获取的值 2. 相应地调整 `downloads.ini` * 例如:上述 revision 对应于 nightly 构建日期 `2025-03-14`(`YYYY-mm-dd`) 3. 从以下地址下载 nightly rust 构建:`https://static.rust-lang.org/dist//rust-nightly-x86_64-pc-windows-msvc.tar.gz` 1. 将 `build-date` 替换为获取的值 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 3. 解压归档 4. 执行 `rustc\bin\rustc.exe -V` 以获取 rust 版本字符串 5. 相应地调整 `patches\ungoogled-chromium\windows\windows-fix-building-with-rust.patch` 4. 从以下地址下载 nightly rust 构建:`https://static.rust-lang.org/dist//rust-nightly-i686-pc-windows-msvc.tar.gz` 1. 将 `build-date` 替换为获取的值 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。 5. 从以下地址下载 nightly rust 构建:`https://static.rust-lang.org/dist//rust-nightly-aarch64-pc-windows-msvc.tar.gz` 1. 将 `build-date` 替换为获取的值 2. 在 **`MSYS2 MSYS`** 中使用 `sha512sum` 获取 SHA-512 校验和。
标签:C++, Chromium, GPL-3.0, Helium, Python, Visual Studio, 互联网, 去谷歌化, 可视化界面, 安全浏览, 数据包嗅探, 数据擦除, 无后门, 沙箱逃逸, 浏览器, 知识库安全, 系统工具, 网络安全, 网络安全审计, 网络安全研究, 网络浏览, 软件构建, 逆向工具, 隐私保护, 隐私增强