public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Ezekiel Newren via GitGitGadget" <gitgitgadget@gmail•com>
To: git@vger•kernel.org
Cc: Ezekiel Newren <ezekielnewren@gmail•com>,
	Ezekiel Newren <ezekielnewren@gmail•com>
Subject: [PATCH 13/13] rust/build-rust.sh: update dir_git_root variable instantiation
Date: Thu, 27 Nov 2025 01:10:35 +0000	[thread overview]
Message-ID: <0f797a238c3c102814a3402caca2539a518ecb74.1764205835.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2110.git.git.1764205835.gitgitgadget@gmail.com>

From: Ezekiel Newren <ezekielnewren@gmail•com>

Signed-off-by: Ezekiel Newren <ezekielnewren@gmail•com>
---
 Makefile            |  6 ++++--
 meson.build         |  1 +
 rust/build-crate.sh | 15 ++++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 6da9db7d83..848db03227 100644
--- a/Makefile
+++ b/Makefile
@@ -931,6 +931,8 @@ EXTLIBS =
 
 GIT_BUILD_DIR := $(CURDIR)
 export GIT_BUILD_DIR
+MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+export MAKEFILE_DIR
 
 RUST_CRATES := gitcore
 .PHONY: rust-compile rust-clean
@@ -949,7 +951,7 @@ RUST_LIBS := $(foreach c,$(RUST_CRATES),$(GIT_BUILD_DIR)/lib$(c).a)
 rust-compile:
 	@for c in $(RUST_CRATES); do \
 		echo "Building $$c..."; \
-		./rust/build-crate.sh $(GIT_BUILD_DIR) $(RUST_BUILD_MODE) $$c || exit $$?; \
+		./rust/build-crate.sh $(MAKEFILE_DIR) $(GIT_BUILD_DIR) $(RUST_BUILD_MODE) $$c || exit $$?; \
 	done
 
 rust-clean:
@@ -958,7 +960,7 @@ rust-clean:
 
 $(GIT_BUILD_DIR)/lib%.a:
 	echo $(RUST_LIBS)
-	./rust/build-crate.sh $(GIT_BUILD_DIR) $(RUST_BUILD_MODE) $*
+	./rust/build-crate.sh $(MAKEFILE_DIR) $(GIT_BUILD_DIR) $(RUST_BUILD_MODE) $*
 
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
diff --git a/meson.build b/meson.build
index 94ec5e4ac0..3154cd684a 100644
--- a/meson.build
+++ b/meson.build
@@ -305,6 +305,7 @@ if with_rust
       build_always_stale: true,
       command: [
         meson.project_source_root() / 'rust' / 'build-crate.sh',
+        meson.project_source_root(),
         meson.current_build_dir(), rust_build_profile, crate,
       ],
       install: false,
diff --git a/rust/build-crate.sh b/rust/build-crate.sh
index b3debf70e5..50f5b0058c 100755
--- a/rust/build-crate.sh
+++ b/rust/build-crate.sh
@@ -3,10 +3,12 @@
 rustc -vV || exit $?
 cargo --version || exit $?
 
-dir_git_root=${0%/*}
-dir_build=$1
-rust_build_profile=$2
-crate=$3
+dir_git_root=$1
+cd $dir_git_root || exit $?
+dir_git_root=$PWD
+dir_build=$2
+rust_build_profile=$3
+crate=$4
 
 if [ "$dir_git_root" = "" ]; then
   echo "did not specify the directory for the root of git"
@@ -38,9 +40,12 @@ libfile="lib${crate}.a"
 if rustc -vV | grep windows-msvc; then
   libfile="${crate}.lib"
   PATH="$(echo $PATH | tr ':' '\n' | grep -Ev "^(/mingw64/bin|/usr/bin)$" | paste -sd: -):/mingw64/bin:/usr/bin"
+  echo "PATH=$PATH"
 fi
 
-CARGO_TARGET_DIR=$dir_git_root/.build/rust/$crate
+echo "libfile=$libfile"
+
+CARGO_TARGET_DIR=$dir_build/.build/rust/$crate
 export CARGO_TARGET_DIR
 
 cargo clean && pwd && USE_LINKING="false" cargo build -p $crate $rust_args
-- 
gitgitgadget

      parent reply	other threads:[~2025-11-27  1:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27  1:10 [PATCH 00/13] RFC: Convert to Cargo workspace Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 01/13] make: undo Patrick's changes concerning Rust Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 02/13] meson: " Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 03/13] cargo: convert from a crate to a workspace Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 04/13] build: build Rust with Makefile and Meson Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 05/13] .gitignore: ignore /generated/ Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 06/13] cargo: create crate generate-headers Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 07/13] cargo: create crate link-with-c Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 08/13] rust/gitcore: link with c Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 09/13] varint.h: unsigned char -> uint8_t Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 10/13] make: delete files in generated/ Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 11/13] github-workflows: unify with rust parameters in make and meson Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` [PATCH 12/13] github workflows: install Rust Ezekiel Newren via GitGitGadget
2025-11-27  1:10 ` Ezekiel Newren via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f797a238c3c102814a3402caca2539a518ecb74.1764205835.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail$(echo .)com \
    --cc=ezekielnewren@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox