summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 14:24:45 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-06 23:52:10 +0100
commiteb98cb835c9faf4d675411b3314b7fc9820ab179 (patch)
tree04b36969512057ae949a105964ddf135e43986cc /contrib
parentMakefile: use "generate-perl.sh" to massage Perl library (diff)
downloadgit-eb98cb835c9faf4d675411b3314b7fc9820ab179.tar.xz
git-eb98cb835c9faf4d675411b3314b7fc9820ab179.zip
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>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/buildsystems/CMakeLists.txt31
1 files changed, 20 insertions, 11 deletions
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 52b479e2e5..defdd958bb 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -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()