Skip to content

Commit

Permalink
use relative path for rust_crate_sources
Browse files Browse the repository at this point in the history
  • Loading branch information
declantsien committed Apr 10, 2024
1 parent 4e76024 commit c598fdb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/codegen/bin/print_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ use codegen::packages_source;
use codegen::with_enabled_crates_all;
use codegen::BuildError;
use std::io::Write;
use std::path::PathBuf;

/// First we have to generate the include file for the main crate which
/// will be stored in OUT_DIR. It only contains the rust_init_syms
/// that runs the crates *_init_syms functions.
pub fn generate_source_list(packages: Vec<&Package>) -> Result<(), BuildError> {
let abs_top_srcdir = std::env::var("ABS_TOP_SRCDIR")
.map(|dir| PathBuf::from(dir))
.ok();
for file in packages_source(packages) {
let file = match abs_top_srcdir {
Some(ref base) => {
let path = file.as_path().strip_prefix(base).unwrap().to_path_buf();
PathBuf::from("..").join(path)
}
None => file,
};
write!(std::io::stdout(), "{} ", file.display())?;
}
Ok(())
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ HEADERS=$(wildcard $(srcdir)/*.h)

$(RUST_CRATES_SOURCES_FILE) : FORCE
cd ../crates/emacsng && \
ABS_TOP_SRCDIR=$(abs_top_srcdir) \
cargo run -p codegen --bin print-source $(CARGO_FEATURES) > $$OLDPWD/$@

$(LIBEMACSNG_ARCHIVE) : FORCE
Expand Down

0 comments on commit c598fdb

Please sign in to comment.