更新 toolchain/build.sh

Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
zhao 2025-03-23 10:09:52 +08:00
parent 653cb1f9b2
commit 416e4b5dc6

View File

@ -1,6 +1,7 @@
#!/bin/bash -e #!/bin/bash -e
export Github=https://raw.githubusercontent.com/oppen321/ZeroWrt-Action/refs/heads/master/patch export Github=https://raw.githubusercontent.com/oppen321/ZeroWrt-Action/refs/heads/master/patch
# Clone source code # Clone source code
git clone -b openwrt-24.10 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt openwrt git clone -b openwrt-24.10 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt openwrt
@ -15,13 +16,13 @@ cd openwrt
sed -i 's/noinitrd/noinitrd mitigations=off/g' target/linux/x86/image/grub-efi.cfg sed -i 's/noinitrd/noinitrd mitigations=off/g' target/linux/x86/image/grub-efi.cfg
# gcc15 patches # gcc15 patches
curl -s $Github/gcc-15/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1 curl -s $Github/patch/gcc-15/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1
# GCC Optimization level -O3 # GCC Optimization level -O3
if [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then if [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then
curl -s $Github/target-modify_for_rockchip.patch | patch -p1 curl -s $Github/patch/target-modify_for_rockchip.patch | patch -p1
elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
curl -s $Github/target-modify_for_x86_64.patch | patch -p1 curl -s $Github/patch/target-modify_for_x86_64.patch | patch -p1
fi fi
# fix gcc14 # fix gcc14
@ -57,26 +58,26 @@ fi
# fix gcc-15 # fix gcc-15
if [ "$USE_GCC15" = y ]; then if [ "$USE_GCC15" = y ]; then
# Mbedtls # Mbedtls
curl -s $Github/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch > package/libs/mbedtls/patches/901-tests-fix-string-initialization-error-on-gcc15.patch curl -s $Github/patch/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch > package/libs/mbedtls/patches/901-tests-fix-string-initialization-error-on-gcc15.patch
sed -i '/TARGET_CFLAGS/ s/$/ -Wno-error=unterminated-string-initialization/' package/libs/mbedtls/Makefile sed -i '/TARGET_CFLAGS/ s/$/ -Wno-error=unterminated-string-initialization/' package/libs/mbedtls/Makefile
# elfutils # elfutils
curl -s $Github/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch > package/libs/elfutils/patches/901-backends-fix-string-initialization-error-on-gcc15.patch curl -s $Github/patch/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch > package/libs/elfutils/patches/901-backends-fix-string-initialization-error-on-gcc15.patch
# libwebsockets # libwebsockets
mkdir -p feeds/packages/libs/libwebsockets/patches mkdir -p feeds/packages/libs/libwebsockets/patches
curl -s $Github/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libwebsockets/patches/901-fix-string-initialization-error-on-gcc15.patch curl -s $Github/patch/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libwebsockets/patches/901-fix-string-initialization-error-on-gcc15.patch
# libxcrypt # libxcrypt
mkdir -p feeds/packages/libs/libxcrypt/patches mkdir -p feeds/packages/libs/libxcrypt/patches
curl -s $Github/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libxcrypt/patches/901-fix-string-initialization-error-on-gcc15.patch curl -s $Github/patch/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libxcrypt/patches/901-fix-string-initialization-error-on-gcc15.patch
fi fi
# fix gcc-15.0.1 C23 # fix gcc-15.0.1 C23
if [ "$USE_GCC15" = y ]; then if [ "$USE_GCC15" = y ]; then
# gmp # gmp
mkdir -p package/libs/gmp/patches mkdir -p package/libs/gmp/patches
curl -s $Github/gcc-15-c23/gmp/001-fix-build-with-gcc-15.patch > package/libs/gmp/patches/001-fix-build-with-gcc-15.patch curl -s $Github/patch/gcc-15-c23/gmp/001-fix-build-with-gcc-15.patch > package/libs/gmp/patches/001-fix-build-with-gcc-15.patch
# htop # htop
mkdir -p feeds/packages/admin/htop/patches mkdir -p feeds/packages/admin/htop/patches
curl -s $Github/gcc-15-c23/htop/001-Avoid-compilation-issues-with-ncurses-on-GCC-15.patch > feeds/packages/admin/htop/patches/001-Avoid-compilation-issues-with-ncurses-on-GCC-15.patch curl -s $Github/patch/gcc-15-c23/htop/001-Avoid-compilation-issues-with-ncurses-on-GCC-15.patch > feeds/packages/admin/htop/patches/001-Avoid-compilation-issues-with-ncurses-on-GCC-15.patch
# libtirpc # libtirpc
sed -i '/TARGET_CFLAGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/libtirpc/Makefile sed -i '/TARGET_CFLAGS/i TARGET_CFLAGS += -std=gnu17\n' feeds/packages/libs/libtirpc/Makefile
# libsepol # libsepol
@ -145,18 +146,18 @@ elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
fi fi
# bpf # bpf
[ "$ENABLE_BPF" = "y" ] && curl -s $mirror/openwrt/generic/config-bpf >> .config [ "$ENABLE_BPF" = "y" ] && curl -s $Github/generic/config-bpf >> .config
# LTO # LTO
export ENABLE_LTO=$ENABLE_LTO export ENABLE_LTO=$ENABLE_LTO
[ "$ENABLE_LTO" = "y" ] && curl -s $mirror/openwrt/generic/config-lto >> .config [ "$ENABLE_LTO" = "y" ] && curl -s $Github/generic/config-lto >> .config
# mold # mold
[ "$ENABLE_MOLD" = "y" ] && echo 'CONFIG_USE_MOLD=y' >> .config [ "$ENABLE_MOLD" = "y" ] && echo 'CONFIG_USE_MOLD=y' >> .config
# glibc # glibc
[ "$ENABLE_GLIBC" = "y" ] && { [ "$ENABLE_GLIBC" = "y" ] && {
curl -s $mirror/openwrt/generic/config-glibc >> .config curl -s $Github/generic/config-glibc >> .config
sed -i '/NaiveProxy/d' .config sed -i '/NaiveProxy/d' .config
} }