Makefile: write absolute program path into bin-wrappers

Write the absolute program path into our bin-wrappers. This allows us to simplify the Meson build instructions we are about to introduce a bit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Dec 6, 2024 at 14:24 UTC d2407bb8dc4bd7f0fb508e69d7ae49d0dfbf3b8b
3 files changed +7 -7
Makefile
+1 -1
@@ -3205,7 +3205,7 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
3205 $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
3206 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
3207 -e 's|@BUILD_DIR@|$(shell pwd)|' \
3208 - -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
3208 + -e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
3209 chmod +x $@
3210
3211 # GNU make supports exporting all variables by "export" without parameters.
bin-wrappers/wrap-for-bin.sh
+3 -3
@@ -22,15 +22,15 @@ export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
22
23 case "$GIT_DEBUGGER" in
24 '')
25 - exec "${GIT_EXEC_PATH}/@PROG@" "$@"
25 + exec "@PROG@" "$@"
26 ;;
27 1)
28 unset GIT_DEBUGGER
29 - exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
29 + exec gdb --args "@PROG@" "$@"
30 ;;
31 *)
32 GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
33 unset GIT_DEBUGGER
34 - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
34 + exec ${GIT_DEBUGGER_ARGS} "@PROG@" "$@"
35 ;;
36 esac
contrib/buildsystems/CMakeLists.txt
+3 -3
@@ -1097,20 +1097,20 @@ set(wrapper_test_scripts
1097 foreach(script ${wrapper_scripts})
1098 file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1099 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1100 - string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
1100 + string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/${script}${EXE_EXTENSION}" content "${content}")
1101 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
1102 endforeach()
1103
1104 foreach(script ${wrapper_test_scripts})
1105 file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1106 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1107 - string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
1107 + string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/t/helper/${script}${EXE_EXTENSION}" content "${content}")
1108 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
1109 endforeach()
1110
1111 file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1112 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1113 -string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
1113 +string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/git-cvsserver" content "${content}")
1114 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
1115
1116 #options for configuring test options