Skip to content

Commit

Permalink
Stop using "which", which is not available on Amazon Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyash committed Dec 3, 2021
1 parent 7f6eb33 commit d4c28ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ add_custom_command(
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/syntax.auto.h
COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/syntax.include | ${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/make-syntax-auto.sh >${CMAKE_CURRENT_BINARY_DIR}/syntax.auto.h
COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/syntax.include | ${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/make-syntax-auto.sh ${SED} >${CMAKE_CURRENT_BINARY_DIR}/syntax.auto.h
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/syntax.include
)
add_custom_command(
Expand All @@ -84,7 +84,7 @@ add_custom_command(
add_custom_command(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/stdlib.ngs.h
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/bin2c.sh lib/stdlib.ngs >${CMAKE_CURRENT_BINARY_DIR}/stdlib.ngs.h
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/bin2c.sh ${SED} lib/stdlib.ngs >${CMAKE_CURRENT_BINARY_DIR}/stdlib.ngs.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/stdlib.ngs
)

Expand Down
9 changes: 2 additions & 7 deletions build-scripts/bin2c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

set -e

SED=sed

# gsed - MacOS, sed - all the rest
if which gsed >/dev/null;then
SED=gsed
fi
SED=$1

if ! $SED --version >/dev/null 2>/dev/null;then
echo "Failed to assert GNU sed: failed running sed --version" >&2
Expand All @@ -22,7 +17,7 @@ if ! $SED --version | grep -iq 'GNU sed';then
exit 2
fi

file_name=$1
file_name=$2
var_name=$(tr /. __ <<eof
$file_name
eof
Expand Down
7 changes: 1 addition & 6 deletions build-scripts/make-syntax-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

set -eu

SED=sed

# gsed - MacOS, sed - all the rest
if which gsed >/dev/null;then
SED=gsed
fi
SED=$1

if ! $SED --version >/dev/null 2>/dev/null;then
echo "Failed to assert GNU sed: failed running sed --version" >&2
Expand Down

0 comments on commit d4c28ec

Please sign in to comment.