更新 toolchain/build.sh

Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
zhao 2025-03-23 02:07:55 +08:00
parent fdd9627f5f
commit 6d6a4f7709

View File

@ -24,27 +24,34 @@ elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
curl -s $Github/target-modify_for_x86_64.patch | patch -p1 curl -s $Github/target-modify_for_x86_64.patch | patch -p1
fi fi
# fix gcc14 and gcc15 # fix gcc14
if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then
# 如果是 GCC 14 或 GCC 15则替换并克隆修复后的 linux-atm # linux-atm
echo "Detected GCC 14 or 15. Replacing linux-atm with a fixed version..."
# 移除原有的 linux-atm 软件包
rm -rf package/network/utils/linux-atm rm -rf package/network/utils/linux-atm
git clone https://$github/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm
# 从 GitHub 克隆修复后的 linux-atm 软件包 # glibc
git clone https://github.com/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm # Added the compiler flag -Wno-implicit-function-declaration to suppress
# warnings about implicit function declarations during the build process.
# 检查是否克隆成功 # This change addresses build issues in environments where some functions
if [ -d "package/network/utils/linux-atm" ]; then # are used without prior declaration.
echo "linux-atm has been successfully replaced for GCC 14/15 compatibility." if [ "$ENABLE_GLIBC" = "y" ]; then
else # perl
echo "Failed to clone the fixed linux-atm package. Please check your network or the repository URL." sed -i "/Target perl/i\TARGET_CFLAGS_PERL += -Wno-implicit-function-declaration -Wno-int-conversion\n" feeds/packages/lang/perl/Makefile
exit 1 sed -i '/HOST_BUILD_PARALLEL/aPKG_BUILD_FLAGS:=no-mold' feeds/packages/lang/perl/Makefile
# lucihttp
sed -i "/TARGET_CFLAGS/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" feeds/luci/contrib/package/lucihttp/Makefile
# rpcd
sed -i "/TARGET_LDFLAGS/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" package/system/rpcd/Makefile
# ucode-mod-lua
sed -i "/Build\/Configure/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" feeds/luci/contrib/package/ucode-mod-lua/Makefile
# luci-base
sed -i "s/-DNDEBUG/-DNDEBUG -Wno-implicit-function-declaration/g" feeds/luci/modules/luci-base/src/Makefile
# uhttpd
sed -i "/Package\/uhttpd\/install/i\TARGET_CFLAGS += -Wno-implicit-function-declaration\n" package/network/services/uhttpd/Makefile
# shadow
sed -i '/TARGET_LDFLAGS/d' feeds/packages/utils/shadow/Makefile
sed -i 's/libxcrypt/openssl/g' feeds/packages/utils/shadow/Makefile
fi fi
else
# 如果不是 GCC 14 或 GCC 15则什么都不做
echo "GCC 14 or 15 not enabled. Skipping linux-atm replacement."
fi fi
# fix gcc-15 # fix gcc-15