From e5f08410e0b27af9a8a3655161083a5a525ff903 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Fri, 21 Feb 2020 11:55:07 +0800 Subject: [PATCH] adjust build script (#3235) * download.pl: add jsDelivr mirror for GitHub and add utsc mirrors * m520: fix 'hlos' not found * dependence: add python3 * netfilter: Revert delete support for kernel 4.9 * scons: move to packages feed --- .github/workflows/openwrt-ci.yml | 2 +- README | 5 +-- include/image-commands.mk | 2 +- include/netfilter.mk | 45 +++++++++++----------- scripts/download.pl | 12 ++++-- tools/Makefile | 2 +- tools/scons/Makefile | 35 ----------------- tools/scons/files/pywrap.sh | 15 -------- tools/scons/patches/001-platform_env.patch | 11 ------ 9 files changed, 36 insertions(+), 93 deletions(-) delete mode 100644 tools/scons/Makefile delete mode 100755 tools/scons/files/pywrap.sh delete mode 100644 tools/scons/patches/001-platform_env.patch diff --git a/.github/workflows/openwrt-ci.yml b/.github/workflows/openwrt-ci.yml index 0d0fb9e7be1362..284b111677c76e 100644 --- a/.github/workflows/openwrt-ci.yml +++ b/.github/workflows/openwrt-ci.yml @@ -33,7 +33,7 @@ jobs: sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* sudo -E apt-get update - sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler + sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler sudo -E apt-get -y autoremove --purge sudo -E apt-get clean diff --git a/README b/README index 491173c646b42d..6b3c56c0a5fad2 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ 1. 首先装好 Ubuntu 64bit,推荐 Ubuntu 14 LTS x64 2. 命令行输入 sudo apt-get update ,然后输入 -sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler +sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler 3. git clone https://github.com/coolsnowwolf/lede 命令下载好源代码,然后 cd lede 进入目录 @@ -36,8 +36,7 @@ sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git Please use "make menuconfig" to choose your preferred configuration for the toolchain and firmware. -You need to have installed gcc, binutils, bzip2, flex, python, perl, make, -find, grep, diff, unzip, gawk, getopt, subversion, libz-dev and libc headers. +You need gcc, binutils, bzip2, flex, python3.5+, perl, make, find, grep, diff, unzip, gawk, getopt, subversion, libz-dev and libc headers installed. Run "./scripts/feeds update -a" to get all the latest package definitions defined in feeds.conf / feeds.conf.default respectively diff --git a/include/image-commands.mk b/include/image-commands.mk index 37cb083bbfbca2..4cf12937265685 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -319,7 +319,7 @@ endef define Build/qsdk-ipq-factory-nor $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \ - $@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) + $@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new @mv $@.new $@ endef diff --git a/include/netfilter.mk b/include/netfilter.mk index c62b9a827f114a..009f3502ee051b 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -185,7 +185,7 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt)) # kernel only $(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT, $(P_XT)nf_nat),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect, ge 3.19.0),)) $(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_IPV4, $(P_V4)nf_nat_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_MASQUERADE_IPV4, $(P_V4)nf_nat_masquerade_ipv4, lt 4.18),)) @@ -261,8 +261,8 @@ $(eval $(call nf_add,IPT_DEBUG,CONFIG_NETFILTER_XT_TARGET_TRACE, $(P_XT)xt_TRACE # tproxy $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket)) -$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4)) -$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6)) +$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4, ge 4.10)) +$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6, ge 4.10)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4, ge 4.18)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6, ge 4.18)) @@ -273,8 +273,8 @@ $(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED)) # tee $(eval $(call nf_add,IPT_TEE,CONFIG_NETFILTER_XT_TARGET_TEE, $(P_XT)xt_TEE)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV4, $(P_V4)nf_dup_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV4, $(P_V4)nf_dup_ipv4, ge 4.3),)) +$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6, ge 4.3),)) # u32 @@ -336,26 +336,25 @@ $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nf # nftables $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES, $(P_XT)nf_tables),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_INET, $(P_XT)nf_tables_inet, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_tables_ipv4, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_tables_ipv6, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, $(P_XT)nf_tables_set, ge 4.18),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, $(P_XT)nft_counter),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, $(P_XT)nft_exthdr),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, $(P_XT)nft_limit),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_META, $(P_XT)nft_meta),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, $(P_XT)nft_numgen),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_OBJREF, $(P_XT)nft_objref),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, $(P_XT)nft_quota),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, $(P_XT)nft_redir),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, $(P_XT)nft_numgen, ge 4.9.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, $(P_XT)nft_set_rbtree, ge 4.9.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_RBTREE, $(P_XT)nft_rbtree, lt 4.9.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, $(P_XT)nft_set_hash, ge 4.9.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash, lt 4.9.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, $(P_XT)nft_counter),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, $(P_XT)nft_limit),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT, $(P_XT)nft_reject $(P_V4)nft_reject_ipv4 $(P_V6)nft_reject_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT_INET, $(P_XT)nft_reject_inet),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, $(P_XT)nft_set_hash, lt 4.18),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, $(P_XT)nft_set_rbtree, lt 4.18),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_tables_ipv4, lt 4.17),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_tables_ipv6, lt 4.17),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, $(P_XT)nft_redir, ge 3.19.0),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, $(P_XT)nft_quota, ge 4.9.0),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_ARP,CONFIG_NF_TABLES_ARP, $(P_V4)nf_tables_arp, lt 4.17),)) @@ -365,11 +364,11 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EB $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_CHAIN_NAT_IPV4, $(P_V4)nft_chain_nat_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4, ge 3.19.0),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, $(P_XT)nft_masq),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, $(P_V4)nft_masq_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6, ge 3.19.0),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_CHAIN_NAT_IPV6, $(P_V6)nft_chain_nat_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_MASQ_IPV6, $(P_V6)nft_masq_ipv6),)) diff --git a/scripts/download.pl b/scripts/download.pl index accb5f99a49433..fb4c488f49efdc 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -194,6 +194,7 @@ sub cleanup push @mirrors, "https://downloads.sourceforge.net/$1"; } } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { + push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; @@ -204,11 +205,16 @@ sub cleanup push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1"; push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1"; } elsif ($mirror =~ /^\@GITHUB\/(.+)$/) { + my $dir = $1; + my $i = 0; + # replace the 2nd '/' with '@' for jsDelivr mirror + push @mirrors, "https://cdn.jsdelivr.net/gh/". $dir =~ s{\/}{++$i == 2 ? '@' : $&}ger; # give github a few more tries (different mirrors) for (1 .. 5) { - push @mirrors, "https://raw.githubusercontent.com/$1"; + push @mirrors, "https://raw.githubusercontent.com/$dir"; } } elsif ($mirror =~ /^\@GNU\/(.+)$/) { + push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1"; push @mirrors, "https://mirror.netcologne.de/gnu/$1"; push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1"; @@ -234,7 +240,7 @@ sub cleanup push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - push @mirrors, "http://mirrors.ustc.edu.cn/kernel.org/$dir"; + push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://mirror.rackspace.com/kernel.org/pub/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; @@ -245,6 +251,7 @@ sub cleanup push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir"; } } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { + push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; @@ -271,4 +278,3 @@ sub cleanup } $SIG{INT} = \&cleanup; - diff --git a/tools/Makefile b/tools/Makefile index eccfbe9fe7f17f..1bb272fedb4be4 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -25,7 +25,7 @@ tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image quilt padjffs2 -tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf +tools-y += mm-macros missing-macros cmake bc findutils gengetopt patchelf tools-y += mtools dosfstools libressl tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-y += ucl upx diff --git a/tools/scons/Makefile b/tools/scons/Makefile deleted file mode 100644 index fc325bff02a612..00000000000000 --- a/tools/scons/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2011-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=scons -PKG_VERSION:=3.0.1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=@SF/scons \ - http://fossies.org/linux/misc/ -PKG_HASH:=24475e38d39c19683bc88054524df018fe6949d70fbd4c69e298d39a0269f173 - -include $(INCLUDE_DIR)/host-build.mk - -define Host/Configure -endef - -define Host/Compile -endef - -define Host/Install - ./files/pywrap.sh $(HOST_BUILD_DIR)/setup.py install --prefix=$(STAGING_DIR_HOST) - rm -f $(STAGING_DIR_HOST)/bin/scons*.py - for bin in $(STAGING_DIR_HOST)/bin/scons*; do \ - mv "$$$$bin" "$$$$bin.py"; \ - cp ./files/pywrap.sh "$$$$bin"; \ - done -endef - -$(eval $(call HostBuild)) diff --git a/tools/scons/files/pywrap.sh b/tools/scons/files/pywrap.sh deleted file mode 100755 index f62f590e0bce40..00000000000000 --- a/tools/scons/files/pywrap.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -case "${0##*/}" in - pywrap.sh) arg1="";; - *) arg1="$0.py" ;; -esac - -for bin in python python2 python2.7 python2.6 python2.5 python2.4; do - case "$($bin -V 2>&1)" in - "Python 2"*) exec $bin $arg1 "$@" ;; - esac -done - -echo "Unable to find a Python 2.x interpreter for executing ${arg1:+$arg1 }$@ !" >&2 -exit 1 diff --git a/tools/scons/patches/001-platform_env.patch b/tools/scons/patches/001-platform_env.patch deleted file mode 100644 index 2be31470c27d86..00000000000000 --- a/tools/scons/patches/001-platform_env.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/engine/SCons/Platform/__init__.py -+++ b/engine/SCons/Platform/__init__.py -@@ -65,6 +65,8 @@ def platform_default(): - care about the machine architecture. - """ - osname = os.name -+ if 'PLATFORM' in os.environ: -+ return os.environ['PLATFORM'] - if osname == 'java': - osname = os._osType - if osname == 'posix':