Skip to content

Commit 6162582

Browse files
committed
fix(build_opt): add double quotes to allow space in path
and avoid to append same line at each build. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 7318ac0 commit 6162582

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

system/extras/prebuild.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ if [ ! -f "$BUILD_PATH/sketch" ]; then
1010
fi
1111

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

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

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy