Makefile: extract script to massage Shell scripts
Same as in the preceding commits, extract a script that allows us to unify how we massage shell scripts. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ccfba9e0c4
commit
eb98cb835c
@ -838,18 +838,23 @@ set(git_shell_scripts
|
||||
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
|
||||
|
||||
foreach(script ${git_shell_scripts})
|
||||
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
|
||||
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
|
||||
string(REPLACE "@DIFF@" "diff" content "${content}")
|
||||
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
|
||||
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
|
||||
string(REPLACE "@NO_CURL@" "" content "${content}")
|
||||
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
|
||||
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
|
||||
string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
|
||||
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
|
||||
if ("${script}" IN_LIST git_sh_scripts)
|
||||
string(REPLACE ".sh" "" shell_gen_path "${script}")
|
||||
else()
|
||||
set(shell_gen_path "${script}")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
|
||||
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
|
||||
"${CMAKE_SOURCE_DIR}/${script}.sh"
|
||||
"${CMAKE_BINARY_DIR}/${shell_gen_path}"
|
||||
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
|
||||
"${CMAKE_SOURCE_DIR}/${script}.sh"
|
||||
VERBATIM)
|
||||
list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
|
||||
endforeach()
|
||||
add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
|
||||
|
||||
#perl scripts
|
||||
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
|
||||
@ -1183,6 +1188,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
|
||||
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
|
||||
string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
|
||||
if(USE_VCPKG)
|
||||
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user