Git fork

Makefile: allow "bin-wrappers/" directory to exist

The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.

Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
95bcd6f0 3f145a4f

+52 -44
-1
.gitignore
··· 12 12 /GIT-TEST-SUITES 13 13 /GIT-USER-AGENT 14 14 /GIT-VERSION-FILE 15 - /bin-wrappers/ 16 15 /git 17 16 /git-add 18 17 /git-am
+1 -1
Documentation/CodingGuidelines
··· 583 583 Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or 584 584 run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to 585 585 use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" 586 - ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) 586 + ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.) 587 587 588 588 - The primary data structure that a subsystem 'S' deals with is called 589 589 `struct S`. Functions that operate on `struct S` are named
+3 -3
Makefile
··· 3202 3202 3203 3203 all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) 3204 3204 3205 - bin-wrappers/%: wrap-for-bin.sh 3206 - $(call mkdir_p_parent_template) 3205 + $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh 3207 3206 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 3208 3207 -e 's|@BUILD_DIR@|$(shell pwd)|' \ 3209 3208 -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ ··· 3700 3699 $(RM) $(SP_OBJ) 3701 3700 $(RM) $(HCC) 3702 3701 $(RM) version-def.h 3703 - $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json 3702 + $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json 3703 + $(RM) $(test_bindir_programs) 3704 3704 $(RM) -r po/build/ 3705 3705 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* 3706 3706 $(RM) -r .dist-tmp-dir .doc-tmp-dir
+9
bin-wrappers/.gitignore
··· 1 + /git 2 + /git-cvsserver 3 + /git-receive-pack 4 + /git-shell 5 + /git-upload-archive 6 + /git-upload-pack 7 + /scalar 8 + /test-fake-ssh 9 + /test-tool
+36
bin-wrappers/wrap-for-bin.sh
··· 1 + #!/bin/sh 2 + 3 + # wrap-for-bin.sh: Template for git executable wrapper scripts 4 + # to run test suite against sandbox, but with only bindir-installed 5 + # executables in PATH. The Makefile copies this into various 6 + # files in bin-wrappers, substituting 7 + # @BUILD_DIR@ and @PROG@. 8 + 9 + GIT_EXEC_PATH='@BUILD_DIR@' 10 + if test -n "$NO_SET_GIT_TEMPLATE_DIR" 11 + then 12 + unset GIT_TEMPLATE_DIR 13 + else 14 + GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' 15 + export GIT_TEMPLATE_DIR 16 + fi 17 + GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" 18 + GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' 19 + PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" 20 + 21 + export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR 22 + 23 + case "$GIT_DEBUGGER" in 24 + '') 25 + exec "${GIT_EXEC_PATH}/@PROG@" "$@" 26 + ;; 27 + 1) 28 + unset GIT_DEBUGGER 29 + exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@" 30 + ;; 31 + *) 32 + GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" 33 + unset GIT_DEBUGGER 34 + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@" 35 + ;; 36 + esac
+3 -3
contrib/buildsystems/CMakeLists.txt
··· 1095 1095 1096 1096 1097 1097 foreach(script ${wrapper_scripts}) 1098 - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) 1098 + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) 1099 1099 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") 1100 1100 string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") 1101 1101 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) 1102 1102 endforeach() 1103 1103 1104 1104 foreach(script ${wrapper_test_scripts}) 1105 - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) 1105 + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) 1106 1106 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") 1107 1107 string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") 1108 1108 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) 1109 1109 endforeach() 1110 1110 1111 - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) 1111 + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) 1112 1112 string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") 1113 1113 string(REPLACE "@PROG@" "git-cvsserver" content "${content}") 1114 1114 file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
-36
wrap-for-bin.sh
··· 1 - #!/bin/sh 2 - 3 - # wrap-for-bin.sh: Template for git executable wrapper scripts 4 - # to run test suite against sandbox, but with only bindir-installed 5 - # executables in PATH. The Makefile copies this into various 6 - # files in bin-wrappers, substituting 7 - # @BUILD_DIR@ and @PROG@. 8 - 9 - GIT_EXEC_PATH='@BUILD_DIR@' 10 - if test -n "$NO_SET_GIT_TEMPLATE_DIR" 11 - then 12 - unset GIT_TEMPLATE_DIR 13 - else 14 - GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' 15 - export GIT_TEMPLATE_DIR 16 - fi 17 - GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" 18 - GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' 19 - PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" 20 - 21 - export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR 22 - 23 - case "$GIT_DEBUGGER" in 24 - '') 25 - exec "${GIT_EXEC_PATH}/@PROG@" "$@" 26 - ;; 27 - 1) 28 - unset GIT_DEBUGGER 29 - exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@" 30 - ;; 31 - *) 32 - GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" 33 - unset GIT_DEBUGGER 34 - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@" 35 - ;; 36 - esac