Skip to content

Commit e8771be

Browse files
authored
Rename the RV32 toolchain on release to fit paths in GCC limit (espressif#8750)
Some include paths in the RV32 toolchain on Windows end up too long for GCCs 200 char limit and compilation fails. While a fix is provided upstream, we workaround this issue by shortening the tool name and version, thus saving 26 chars of the path.
1 parent d2d7bc4 commit e8771be

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/scripts/on-release.sh

+20-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ echo "Cleaning up folders ..."
191191
find "$PKG_DIR" -name '*.DS_Store' -exec rm -f {} \;
192192
find "$PKG_DIR" -name '*.git*' -type f -delete
193193

194+
##
195+
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
196+
##
197+
RVTC_NAME="riscv32-esp-elf-gcc"
198+
RVTC_NEW_NAME="esp-rv32"
199+
194200
# Replace tools locations in platform.txt
195201
echo "Generating platform.txt..."
196202
cat "$GITHUB_WORKSPACE/platform.txt" | \
@@ -200,7 +206,7 @@ sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-es
200206
sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
201207
sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
202208
sed 's/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
203-
sed 's/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc.path\}/g' | \
209+
sed "s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\\/tools\\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
204210
sed 's/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
205211
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
206212
sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
@@ -302,6 +308,19 @@ cat "$PACKAGE_JSON_TEMPLATE" | jq "$libs_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PR
302308
# Overwrite the template location with the newly edited one
303309
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME.json"
304310

311+
##
312+
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
313+
##
314+
RVTC_VERSION=`cat $PACKAGE_JSON_TEMPLATE | jq -r ".packages[0].platforms[0].toolsDependencies[] | select(.name == \"$RVTC_NAME\") | .version" | cut -d '_' -f 2`
315+
RVTC_VERSION=`date -j -f '%Y%m%d' "$RVTC_VERSION" '+%y%m'`
316+
rvtc_jq_arg="\
317+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
318+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
319+
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
320+
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\""
321+
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
322+
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
323+
305324
##
306325
## PACKAGE JSON
307326
##

0 commit comments

Comments
 (0)