cmake: Drop dependency on sed for translate target

This commit is contained in:
Daniel Pfeifer
2025-08-15 18:37:11 +02:00
parent d5054beca5
commit 05255d5d1e
2 changed files with 7 additions and 16 deletions

View File

@@ -8,7 +8,6 @@ set(input_variables
LCONVERT_EXECUTABLE
LUPDATE_EXECUTABLE
PYTHON_EXECUTABLE
SED_EXECUTABLE
XGETTEXT_EXECUTABLE
)
@@ -73,13 +72,11 @@ execute_process(
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(
COMMAND ${SED_EXECUTABLE}
-i.old
-e "s|source-language=\"en\" target-language=\"en\"|source-language=\"en\"|"
-e "/<target xml:space=\"preserve\"><\\/target>/d"
${PROJECT_SOURCE_DIR}/src/qt/locale/bitcoin_en.xlf
COMMAND_ERROR_IS_FATAL ANY
file(READ "${PROJECT_SOURCE_DIR}/src/qt/locale/bitcoin_en.xlf" bitcoin_en)
string(REPLACE "source-language=\"en\" target-language=\"en\""
"source-language=\"en\"" bitcoin_en "${bitcoin_en}"
)
file(REMOVE "${PROJECT_SOURCE_DIR}/src/qt/locale/bitcoin_en.xlf.old")
string(REGEX REPLACE " *<target xml:space=\"preserve\"></target>\n"
"" bitcoin_en "${bitcoin_en}"
)
file(WRITE "${PROJECT_SOURCE_DIR}/src/qt/locale/bitcoin_en.xlf" "${bitcoin_en}")

View File

@@ -290,15 +290,10 @@ if(BUILD_GUI_TESTS)
endif()
find_program(XGETTEXT_EXECUTABLE xgettext)
find_program(SED_EXECUTABLE sed)
if(NOT XGETTEXT_EXECUTABLE)
add_custom_target(translate
COMMAND ${CMAKE_COMMAND} -E echo "Error: GNU gettext-tools not found"
)
elseif(NOT SED_EXECUTABLE)
add_custom_target(translate
COMMAND ${CMAKE_COMMAND} -E echo "Error: GNU sed not found"
)
else()
add_custom_target(translate COMMAND ${CMAKE_COMMAND}
-D "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}"
@@ -306,7 +301,6 @@ else()
-D "LCONVERT_EXECUTABLE=$<TARGET_FILE:Qt6::lconvert>"
-D "LUPDATE_EXECUTABLE=$<TARGET_FILE:Qt6::lupdate>"
-D "PYTHON_EXECUTABLE=$<TARGET_FILE:Python3::Interpreter>"
-D "SED_EXECUTABLE=${SED_EXECUTABLE}"
-D "XGETTEXT_EXECUTABLE=${XGETTEXT_EXECUTABLE}"
-P ${PROJECT_SOURCE_DIR}/share/qt/translate.cmake
)