From 335d0e52a4a31fddca0f5d3220598bde95ca06f1 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 28 May 2019 10:25:39 +0200 Subject: [PATCH] Ports: Replace run_command use in bash with a run_replace_in_file helper This way, we don't (in the ports themselves) depend on perl as a public interface, which means if we ever have to, we can port to something else easier. --- Ports/.port_include.sh | 4 ++++ Ports/bash/bash.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index e516cce05a..1a5de96130 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -40,6 +40,10 @@ function run_fetch_git() { fi } +function run_replace_in_file() { + run_command perl -p -i -e "$1" $2 +} + function run_patch() { echo "+ Applying patch $1" run_command patch "$2" < "$1" diff --git a/Ports/bash/bash.sh b/Ports/bash/bash.sh index 5cafa2344c..61bc2ad269 100755 --- a/Ports/bash/bash.sh +++ b/Ports/bash/bash.sh @@ -18,8 +18,8 @@ function configure() { } function build() { # Avoid some broken cross compile tests... - run_command perl -p -i -e "s/define GETCWD_BROKEN 1/undef GETCWD_BROKEN/" config.h - run_command perl -p -i -e "s/define CAN_REDEFINE_GETENV 1/undef CAN_REDEFINE_GETENV/" config.h + run_replace_in_file "s/define GETCWD_BROKEN 1/undef GETCWD_BROKEN/" config.h + run_replace_in_file "s/define CAN_REDEFINE_GETENV 1/undef CAN_REDEFINE_GETENV/" config.h run_make } function install() {