diff --git a/rust_src/crates/git/src/lib.rs b/rust_src/crates/git/src/lib.rs index 85ae87e4cfc..0f62ad2ed2a 100755 --- a/rust_src/crates/git/src/lib.rs +++ b/rust_src/crates/git/src/lib.rs @@ -9,4 +9,4 @@ extern crate lisp_util; mod repository; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/git/src/repository.rs b/rust_src/crates/git/src/repository.rs index 372ea747164..c2ea2abad88 100644 --- a/rust_src/crates/git/src/repository.rs +++ b/rust_src/crates/git/src/repository.rs @@ -16,7 +16,4 @@ pub fn git_init(path: LispStringRef) -> LispStringRef { } } -include!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/out/repository_exports.rs" -)); +include!(concat!(env!("OUT_DIR"), "/repository_exports.rs")); diff --git a/rust_src/crates/js/src/lib.rs b/rust_src/crates/js/src/lib.rs index 1dd3ceb0c1a..175a9c714da 100755 --- a/rust_src/crates/js/src/lib.rs +++ b/rust_src/crates/js/src/lib.rs @@ -15,4 +15,4 @@ mod javascript; mod subcommands; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/lsp_json/src/lib.rs b/rust_src/crates/lsp_json/src/lib.rs index 0df139db451..0d3dbf1e8e9 100755 --- a/rust_src/crates/lsp_json/src/lib.rs +++ b/rust_src/crates/lsp_json/src/lib.rs @@ -13,4 +13,4 @@ extern crate lisp_util; pub mod parsing; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/lsp_json/src/parsing.rs b/rust_src/crates/lsp_json/src/parsing.rs index 77fe30063b9..d73e4386468 100644 --- a/rust_src/crates/lsp_json/src/parsing.rs +++ b/rust_src/crates/lsp_json/src/parsing.rs @@ -683,7 +683,4 @@ fn init_syms() { def_lisp_sym!(Qarray, "array"); } -include!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/out/parsing_exports.rs" -)); +include!(concat!(env!("OUT_DIR"), "/parsing_exports.rs")); diff --git a/rust_src/crates/ng_async/src/lib.rs b/rust_src/crates/ng_async/src/lib.rs index 08292a29d55..7da0bba8cb0 100755 --- a/rust_src/crates/ng_async/src/lib.rs +++ b/rust_src/crates/ng_async/src/lib.rs @@ -10,4 +10,4 @@ extern crate lisp_util; pub mod ng_async; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/ng_async/src/ng_async.rs b/rust_src/crates/ng_async/src/ng_async.rs index cf6db0aab93..c010b369ebd 100644 --- a/rust_src/crates/ng_async/src/ng_async.rs +++ b/rust_src/crates/ng_async/src/ng_async.rs @@ -500,7 +500,4 @@ fn init_syms() { def_lisp_sym!(QCoutchannel, "outchannel"); } -include!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/out/ng_async_exports.rs" -)); +include!(concat!(env!("OUT_DIR"), "/ng_async_exports.rs")); diff --git a/rust_src/crates/ng_module/src/lib.rs b/rust_src/crates/ng_module/src/lib.rs index a3d1207e862..ffca336fd3c 100755 --- a/rust_src/crates/ng_module/src/lib.rs +++ b/rust_src/crates/ng_module/src/lib.rs @@ -7,4 +7,4 @@ extern crate lisp_util; mod ng_module; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/ng_module/src/ng_module.rs b/rust_src/crates/ng_module/src/ng_module.rs index f5a93b6f004..13e61cc2bdd 100644 --- a/rust_src/crates/ng_module/src/ng_module.rs +++ b/rust_src/crates/ng_module/src/ng_module.rs @@ -74,7 +74,4 @@ unsafe extern "C" fn ng_module_access_current_buffer_contents( *after_gap_size = z_byte - gpt_byte; } -include!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/out/ng_module_exports.rs" -)); +include!(concat!(env!("OUT_DIR"), "/ng_module_exports.rs")); diff --git a/rust_src/crates/webrender/src/lib.rs b/rust_src/crates/webrender/src/lib.rs index 2b5e9471d4b..74c4e1e423e 100644 --- a/rust_src/crates/webrender/src/lib.rs +++ b/rust_src/crates/webrender/src/lib.rs @@ -68,4 +68,4 @@ pub use crate::platform::macos; pub use crate::wrterm::{tip_frame, wr_display_list}; #[cfg(not(test))] -include!(concat!(env!("CARGO_MANIFEST_DIR"), "/out/c_exports.rs")); +include!(concat!(env!("OUT_DIR"), "/c_exports.rs")); diff --git a/rust_src/crates/webrender/src/wrterm.rs b/rust_src/crates/webrender/src/wrterm.rs index 491c502539d..6b5eb2cbfd1 100644 --- a/rust_src/crates/webrender/src/wrterm.rs +++ b/rust_src/crates/webrender/src/wrterm.rs @@ -1009,7 +1009,4 @@ pub extern "C" fn syms_of_wrterm() { syms_of_wrfont(); } -include!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/out/wrterm_exports.rs" -)); +include!(concat!(env!("OUT_DIR"), "/wrterm_exports.rs")); diff --git a/rust_src/ng-bindgen/lib.rs b/rust_src/ng-bindgen/lib.rs index 7ae411f9ec4..c2b0759eb9c 100644 --- a/rust_src/ng-bindgen/lib.rs +++ b/rust_src/ng-bindgen/lib.rs @@ -495,8 +495,9 @@ fn build_ignored_crates(path: &PathBuf) -> bool { pub fn generate_crate_exports(path: &PathBuf) -> Result<(), BuildError> { let modules = find_crate_modules(&path.join("src"))?; - let _ = fs::create_dir(path.join("out")); - let mut out_file = File::create(path.join("out").join("c_exports.rs"))?; + let out_path: PathBuf = [&env_var("OUT_DIR")].iter().collect(); + let mut out_file = File::create(out_path.join("c_exports.rs"))?; + generate_crate_c_export_file(&out_file, &modules)?; let crate_name = get_crate_name(path); @@ -506,7 +507,7 @@ pub fn generate_crate_exports(path: &PathBuf) -> Result<(), BuildError> { crate_name )?; - write_lisp_fns(&path.join("out"), &out_file, &modules)?; + write_lisp_fns(&out_path, &out_file, &modules)?; write!(out_file, "}}\n")?; @@ -516,7 +517,7 @@ pub fn generate_crate_exports(path: &PathBuf) -> Result<(), BuildError> { fn get_crate_name(path: &PathBuf) -> String { let manifest = Manifest::from_path(path.join("Cargo.toml")).unwrap(); match manifest.package { - Some(package) => package.name, + Some(package) => package.name.replace('-', "_"), None => path_as_str(path.file_name()).to_string(), } } diff --git a/src/Makefile.in b/src/Makefile.in index c3844d1a397..239f1d6b10a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -737,12 +737,6 @@ gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES) globals.h: gl-stamp; @true rust_srcdir=$(top_srcdir)/rust_src -RUSTFLAGS_FILE=$(top_srcdir)/target/.rustflags -$(RUSTFLAGS_FILE) : FORCE - mkdir -p $(dir $@) - echo "$(CARGO_FLAGS) $(RUSTFLAGS)" > $@.tmp - diff -q $@ $@.tmp || cp $@.tmp $@ - rm -f $@.tmp HEADERS=$(wildcard $(srcdir)/*.h) @@ -755,12 +749,9 @@ LIBEMACSNG_CARGO_FILES = $(sort $(shell find ${rust_srcdir} -type f \ -name 'Cargo.*' -o -name "build.rs")) $(LIBEMACSNG_ARCHIVE) $(LIBEMACSNG_DEP-INFO): FORCE - touch $@ - CARGO_BUILD_DEP_INFO_BASEDIR=$(realpath $(top_srcdir)) \ RUSTFLAGS="$(RUSTFLAGS)" \ EMACS_CFLAGS="$(EMACS_CFLAGS)" \ $(CARGO_BUILD) $(CARGO_FLAGS) --manifest-path $(cargo_manifest) - sed -i~ 's/rust_src\//..\/rust_src\//g' $(LIBEMACSNG_DEP-INFO) clippy: RUSTFLAGS="$(RUSTFLAGS)" \ @@ -800,7 +791,7 @@ endif ## existence when setting Vinstallation_directory (FIXME?). ## This goes on to affect various things, and the emacs binary fails ## to start if Vinstallation_directory has the wrong value. -temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEMACSNG_ARCHIVE) $(RUSTFLAGS_FILE) $(LIBEGNU_ARCHIVE) $(EMACSRES) \ +temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEMACSNG_ARCHIVE) $(LIBEGNU_ARCHIVE) $(EMACSRES) \ $(charsets) $(charscript) ${emoji-zwj} $(MAKE_PDUMPER_FINGERPRINT) ifeq ($(HAVE_BE_APP),yes) $(AM_V_CXXLD)$(CXX) -o $@.tmp \