From 360616d153cc99b3d369c8dcc2ad141dfa3bf849 Mon Sep 17 00:00:00 2001 From: ynqa Date: Thu, 14 Nov 2024 01:03:15 +0900 Subject: [PATCH] revert modification --- j9-sys/Cargo.toml | 1 + j9-sys/build.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/j9-sys/Cargo.toml b/j9-sys/Cargo.toml index bb88e45..2c95959 100644 --- a/j9-sys/Cargo.toml +++ b/j9-sys/Cargo.toml @@ -14,4 +14,5 @@ readme = "README.md" anyhow = "1.0.80" autotools = "0.2.6" bindgen = "0.69.4" +filetime = "0.2.25" walkdir = "2.5.0" diff --git a/j9-sys/build.rs b/j9-sys/build.rs index f3475dc..b44c3a2 100644 --- a/j9-sys/build.rs +++ b/j9-sys/build.rs @@ -5,8 +5,11 @@ use std::{ env, path::{Path, PathBuf}, process::Command, + time::SystemTime, }; +use filetime::FileTime; + fn check_installed(name: &str) -> anyhow::Result<()> { let check = Command::new(name).arg("--version").output(); @@ -38,6 +41,15 @@ fn main() -> anyhow::Result<()> { let out_dir = env::var("OUT_DIR").map(PathBuf::from)?; let src_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("jq"); + // Modify the timestamp of the lexer.c and parser.c files to circumvent an error that goes something like: + // 1. cc1: fatal error: src/lexer.c: No such file or directory compilation terminated. + // 2. error: src/parser.c: No such file or directory + let now = FileTime::from(SystemTime::now()); + let lexer_src = src_dir.join("src/lexer.c"); + let parser_src = src_dir.join("src/parser.c"); + filetime::set_file_mtime(&lexer_src, now)?; + filetime::set_file_mtime(&parser_src, now)?; + // See https://github.com/jqlang/jq/tree/jq-1.7.1?#instructions autotools::Config::new(&src_dir) .reconf("-i")