Skip to content

fix(build_opt): add double quotes to allow space in path #1759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions system/extras/prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ if [ ! -f "$BUILD_PATH/sketch" ]; then
fi

# Create empty build.opt if build_opt.h does not exists in the original sketch dir
# Then add or append -fmacro-prefix-map option to change __FILE__ absolute path of
# the board platform folder to a relative path by using '.'.
# (i.e. the folder containing boards.txt)
if [ ! -f "$BUILD_SOURCE_PATH/build_opt.h" ]; then
touch "$BUILD_PATH/sketch/build.opt"
printf '-fmacro-prefix-map="%s"=.' "${BOARD_PLATFORM_PATH//\\/\\\\}" > "$BUILD_PATH/sketch/build.opt"
else
# Else copy the build_opt.h as build.opt
# Workaround to the header file preprocessing done by arduino-cli
# See https://github.com/arduino/arduino-cli/issues/1338
cp "$BUILD_SOURCE_PATH/build_opt.h" "$BUILD_PATH/sketch/build.opt"
printf '\n-fmacro-prefix-map="%s"=.' "${BOARD_PLATFORM_PATH//\\/\\\\}" >> "$BUILD_PATH/sketch/build.opt"
fi

# Append -fmacro-prefix-map option to change __FILE__ absolute path of the board
# platform folder to a relative path by using '.'.
# (i.e. the folder containing boards.txt)
printf '\n-fmacro-prefix-map=%s=.' "${BOARD_PLATFORM_PATH//\\/\\\\}" >> "$BUILD_PATH/sketch/build.opt"

# Force include of SrcWrapper library
echo "#include <SrcWrapper.h>" > "$BUILD_PATH/sketch/SrcWrapper.cpp"