30 lines
1.2 KiB
Rust
30 lines
1.2 KiB
Rust
// Copyright (C) 2026 Elias Wendland <eliaswendland@pm.me>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, version 3 exclusively.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
use std::process::Command;
|
|
|
|
fn main() {
|
|
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_owned());
|
|
let version = Command::new(rustc)
|
|
.arg("--version")
|
|
.output()
|
|
.ok()
|
|
.filter(|output| output.status.success())
|
|
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_owned())
|
|
.unwrap_or_else(|| "unknown".to_owned());
|
|
let target = std::env::var("TARGET").unwrap_or_else(|_| "unknown".to_owned());
|
|
println!("cargo:rustc-env=CONVERTIS_RUSTC_VERSION={version}");
|
|
println!("cargo:rustc-env=CONVERTIS_TARGET={target}");
|
|
}
|