Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit a53cd1c

Browse files
bors[bot]Glauber Costa
andauthored
Merge #334
334: allow building from source tarball r=MarinPostma a=glommer vergen by default will try to enable git, which means the build will fail if compiling from a source tarball. Tools like homebrew have a preference towards building from the git tarball, so let's enable that. Co-authored-by: Glauber Costa <[email protected]>
2 parents 2c9c320 + ff81238 commit a53cd1c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sqld/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ use prost_build::Config;
33
fn main() -> Result<(), Box<dyn std::error::Error>> {
44
let mut config = vergen::Config::default();
55
*config.build_mut().kind_mut() = vergen::TimestampKind::All;
6-
vergen::vergen(config)?;
6+
// when building from source, git is not available
7+
if vergen::vergen(config.clone()).is_err() {
8+
*config.git_mut().enabled_mut() = false;
9+
vergen::vergen(config)?;
10+
}
711

812
let mut config = Config::new();
913
config.bytes([".wal_log"]);

sqld/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ impl Cli {
135135
eprintln!("Welcome to sqld!");
136136
eprintln!();
137137
eprintln!("version: {}", env!("VERGEN_BUILD_SEMVER"));
138-
eprintln!("commit SHA: {}", env!("VERGEN_GIT_SHA"));
138+
if let Some(git_sha) = option_env!("VERGEN_GIT_SHA") {
139+
eprintln!("commit SHA: {}", git_sha);
140+
}
139141
eprintln!("build date: {}", env!("VERGEN_BUILD_DATE"));
140142
eprintln!();
141143
eprintln!("This software is in BETA version.");

0 commit comments

Comments
 (0)