mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
teach build.rs to init submodules if needed
Forgetting to update the submodules is a commonly reported build issue with an obscure error message: ``` CMake Error: The source directory "/home/USER/wezterm/target/debug/build/freetype-430fe24cb64c561c/out/zlib-src/zlib" does not appear to contain CMakeLists.txt. ``` this teaches the build.rs machinery to run the submodule update if it looks like it is needed.
This commit is contained in:
parent
d0f2204bdd
commit
61b27c8089
2
.github/workflows/package_posix.yml
vendored
2
.github/workflows/package_posix.yml
vendored
@ -20,8 +20,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Update submodules
|
||||
run: git submodule update --init
|
||||
- name: Install System Deps
|
||||
run: sudo ./get-deps
|
||||
- name: Install Rust
|
||||
|
2
.github/workflows/package_win.yml
vendored
2
.github/workflows/package_win.yml
vendored
@ -20,8 +20,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Update submodules
|
||||
run: git submodule update --init
|
||||
- name: Install Rust
|
||||
shell: cmd
|
||||
run: |
|
||||
|
2
.github/workflows/posix.yml
vendored
2
.github/workflows/posix.yml
vendored
@ -18,8 +18,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Update submodules
|
||||
run: git submodule update --init
|
||||
- name: Install System Deps
|
||||
run: sudo ./get-deps
|
||||
- name: Install Rust
|
||||
|
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@ -18,8 +18,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Update submodules
|
||||
run: git submodule update --init
|
||||
- name: Install Rust
|
||||
shell: cmd
|
||||
run: |
|
||||
|
18
deps/freetype/build.rs
vendored
18
deps/freetype/build.rs
vendored
@ -4,6 +4,10 @@ use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn zlib() {
|
||||
if !Path::new("zlib/.git").exists() {
|
||||
git_submodule_update();
|
||||
}
|
||||
|
||||
// The out-of-source build for zlib unfortunately modifies some of
|
||||
// the sources, leaving the repo with a dirty status. Let's take
|
||||
// a copy of the sources so that we don't trigger this.
|
||||
@ -49,6 +53,10 @@ fn libpath(p: &Path, name: &str) -> PathBuf {
|
||||
}
|
||||
|
||||
fn libpng() {
|
||||
if !Path::new("libpng/.git").exists() {
|
||||
git_submodule_update();
|
||||
}
|
||||
|
||||
let mut config = Config::new("libpng");
|
||||
let dst = config.profile("Release").build();
|
||||
emit_libdirs(&dst);
|
||||
@ -60,6 +68,10 @@ fn libpng() {
|
||||
}
|
||||
|
||||
fn freetype() {
|
||||
if !Path::new("freetype2/.git").exists() {
|
||||
git_submodule_update();
|
||||
}
|
||||
|
||||
let mut config = Config::new("freetype2");
|
||||
let dst = config
|
||||
.define("FT_WITH_PNG", "ON")
|
||||
@ -73,6 +85,12 @@ fn freetype() {
|
||||
println!("cargo:lib={}", libpath(&dst, "freetype").display());
|
||||
}
|
||||
|
||||
fn git_submodule_update() {
|
||||
let _ = std::process::Command::new("git")
|
||||
.args(&["submodule", "update", "--init"])
|
||||
.status();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
zlib();
|
||||
libpng();
|
||||
|
10
deps/harfbuzz/build.rs
vendored
10
deps/harfbuzz/build.rs
vendored
@ -3,6 +3,10 @@ use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
fn harfbuzz() {
|
||||
if !Path::new("harfbuzz/.git").exists() {
|
||||
git_submodule_update();
|
||||
}
|
||||
|
||||
let mut config = Config::new("harfbuzz");
|
||||
for (key, value) in std::env::vars() {
|
||||
println!("{}: {}", key, value);
|
||||
@ -44,6 +48,12 @@ fn emit_libdirs(p: &Path) {
|
||||
}
|
||||
}
|
||||
|
||||
fn git_submodule_update() {
|
||||
let _ = std::process::Command::new("git")
|
||||
.args(&["submodule", "update", "--init"])
|
||||
.status();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
harfbuzz();
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user