Skip to content

Commit f400176

Browse files
authored
fix(zigbee): Unlink the zigbee libs
1 parent 71121f6 commit f400176

File tree

1 file changed

+39
-25
lines changed

1 file changed

+39
-25
lines changed

tools/copy-libs.sh

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ AS_FLAGS=""
5656
INCLUDES=""
5757
DEFINES=""
5858

59+
EXCLUDE_LIBS=";"
60+
5961
LD_FLAGS=""
6062
LD_LIBS=""
6163
LD_LIB_FILES=""
@@ -78,6 +80,17 @@ else
7880
TOOLCHAIN="riscv32-esp-elf"
7981
fi
8082

83+
# copy zigbee + zboss lib
84+
if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then
85+
cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/"
86+
EXCLUDE_LIBS+="esp_zb_api_ed;"
87+
fi
88+
89+
if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then
90+
cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/"
91+
EXCLUDE_LIBS+="zboss_stack.ed;zboss_port.debug;"
92+
fi
93+
8194
#collect includes, defines and c-flags
8295
str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1`
8396
str="${str:2:${#str}-1}" #remove leading space and quotes
@@ -200,12 +213,14 @@ for item; do
200213
add_next=1
201214
LD_FLAGS+="$item "
202215
elif [ "${item:0:2}" = "-l" ]; then # -l[lib_name]
203-
LD_LIBS+="$item "
204-
exclude_libs=";m;c;gcc;stdc++;"
205216
short_name="${item:2}"
206-
if [[ $exclude_libs != *";$short_name;"* && $LD_LIBS_SEARCH != *"lib$short_name.a"* ]]; then
207-
LD_LIBS_SEARCH+="lib$short_name.a "
208-
#echo "lib add: $item"
217+
if [[ $EXCLUDE_LIBS != *";$short_name;"* ]]; then
218+
LD_LIBS+="$item "
219+
exclude_libs=";m;c;gcc;stdc++;"
220+
if [[ $exclude_libs != *";$short_name;"* && $LD_LIBS_SEARCH != *"lib$short_name.a"* ]]; then
221+
LD_LIBS_SEARCH+="lib$short_name.a "
222+
#echo "1. lib add: $item"
223+
fi
209224
fi
210225
elif [ "$item" = "-o" ]; then
211226
add_next=0
@@ -244,30 +259,38 @@ for item; do
244259
if [[ $LD_LIB_FILES != *"$item"* ]]; then
245260
# do we already have lib with the same name?
246261
if [[ $LD_LIBS != *"-l$lname"* ]]; then
247-
# echo "collecting lib '$lname' and file: $item"
248-
LD_LIB_FILES+="$item "
249-
LD_LIBS+="-l$lname "
262+
if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then
263+
#echo "2. collecting lib '$lname' and file: $item"
264+
LD_LIB_FILES+="$item "
265+
LD_LIBS+="-l$lname "
266+
fi
250267
else
251268
# echo "!!! need to rename: '$lname'"
252269
for i in {2..9}; do
253270
n_item="${item:0:${#item}-2}_$i.a"
254271
n_name=$lname"_$i"
255272
if [ -f "$n_item" ]; then
256-
# echo "renamed add: -l$n_name"
257-
LD_LIBS+="-l$n_name "
273+
if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then
274+
#echo "3. renamed add: -l$n_name"
275+
LD_LIBS+="-l$n_name "
276+
fi
258277
break
259278
elif [[ $LD_LIB_FILES != *"$n_item"* && $LD_LIBS != *"-l$n_name"* ]]; then
260-
echo "Renaming '$lname' to '$n_name': $item"
261-
cp -f "$item" "$n_item"
262-
LD_LIB_FILES+="$n_item "
263-
LD_LIBS+="-l$n_name "
279+
if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then
280+
#echo "4. Renaming '$lname' to '$n_name': $item"
281+
cp -f "$item" "$n_item"
282+
LD_LIB_FILES+="$n_item "
283+
LD_LIBS+="-l$n_name "
284+
fi
264285
break
265286
fi
266287
done
267288
fi
268289
else
269-
# echo "just add: -l$lname"
270-
LD_LIBS+="-l$lname "
290+
if [[ $EXCLUDE_LIBS != *";$lname;"* ]]; then
291+
#echo "5. just add: -l$lname"
292+
LD_LIBS+="-l$lname "
293+
fi
271294
fi
272295
else
273296
echo "*** Skipping $(basename $item): size too small $lsize"
@@ -493,15 +516,6 @@ echo -n "$LD_FLAGS" > "$FLAGS_DIR/ld_flags"
493516
echo -n "$LD_SCRIPTS" > "$FLAGS_DIR/ld_scripts"
494517
echo -n "$AR_LIBS" > "$FLAGS_DIR/ld_libs"
495518

496-
# copy zigbee + zboss lib
497-
if [ -d "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET/" ]; then
498-
cp -r "managed_components/espressif__esp-zigbee-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/"
499-
fi
500-
501-
if [ -d "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET/" ]; then
502-
cp -r "managed_components/espressif__esp-zboss-lib/lib/$IDF_TARGET"/* "$AR_SDK/lib/"
503-
fi
504-
505519
if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ]; then
506520
cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/"
507521
fi

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