From 9f8000a6d635aeb594505ca9538add537fae11f5 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 21 Feb 2020 02:41:00 +0800 Subject: [PATCH] sync build script for OpenWrt 19.07 --- config/Config-build.in | 3 + include/autotools.mk | 4 +- include/cmake.mk | 1 + include/download.mk | 4 +- include/feeds.mk | 4 +- include/host-build.mk | 2 +- include/image-commands.mk | 2 +- include/image.mk | 21 +- include/kernel-build.mk | 11 +- include/kernel-defaults.mk | 1 + include/kernel-version.mk | 2 +- include/kernel.mk | 16 +- include/netfilter.mk | 45 +-- include/package-dumpinfo.mk | 3 +- include/package-ipkg.mk | 16 +- include/package.mk | 57 ++- include/prereq-build.mk | 25 +- include/prereq.mk | 12 + include/quilt.mk | 10 +- include/rootfs.mk | 9 +- include/scan.mk | 21 +- include/scons.mk | 23 -- include/target.mk | 11 +- include/toolchain-build.mk | 1 + include/toplevel.mk | 17 +- include/u-boot.mk | 2 +- include/uclibc++.mk | 12 +- include/unpack.mk | 9 +- include/version.mk | 1 + package/Makefile | 8 +- package/libs/libcxx/Makefile | 62 +++ package/libs/libcxx/files/g++-libcxx | 19 + package/libs/uclient/Makefile | 2 +- package/libs/ustream-ssl/Makefile | 2 +- package/system/ubus/Makefile | 2 +- scripts/arm-magic.sh | 2 +- scripts/clean-package.sh | 3 +- scripts/config/Makefile | 12 +- scripts/config/expr.c | 5 +- scripts/config/zconf.hash.c_shipped | 4 +- scripts/config/zconf.lex.c_shipped | 541 +++++++++++++++------------ scripts/dl_github_archive.py | 19 +- scripts/download.pl | 12 +- scripts/env | 12 +- scripts/feeds | 65 +++- scripts/flashing/eva_ramboot.py | 30 +- scripts/flashing/jungo-image.py | 52 +-- scripts/gen-dependencies.sh | 6 +- scripts/gen_image_generic.sh | 6 +- scripts/ipkg-make-index.sh | 2 +- scripts/ipkg-remove | 5 + scripts/metadata.pm | 6 + scripts/mkits.sh | 13 +- scripts/package-metadata.pl | 57 ++- scripts/patch-specs.sh | 2 +- scripts/qemustart | 93 ++++- scripts/remote-gdb | 8 +- scripts/sign_images.sh | 27 ++ scripts/strip-kmod.sh | 6 +- scripts/symlink-tree.sh | 2 +- scripts/sysupgrade-tar.sh | 13 +- scripts/target-metadata.pl | 21 +- scripts/time.pl | 2 +- 63 files changed, 949 insertions(+), 517 deletions(-) delete mode 100644 include/scons.mk create mode 100644 package/libs/libcxx/Makefile create mode 100755 package/libs/libcxx/files/g++-libcxx create mode 100755 scripts/sign_images.sh diff --git a/config/Config-build.in b/config/Config-build.in index fa48fe9ce4a14d..357a82efcbde24 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -180,6 +180,9 @@ menu "Global build settings" config USE_UCLIBCXX bool "uClibc++" + config USE_LIBCXX + bool "libc++" + config USE_LIBSTDCXX bool "libstdc++" endchoice diff --git a/include/autotools.mk b/include/autotools.mk index aa044aa0b4e516..ae320fbde0f90d 100644 --- a/include/autotools.mk +++ b/include/autotools.mk @@ -39,7 +39,9 @@ define autoreconf [ -e $(p)/config.rpath ] || \ ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \ touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \ - $(AM_TOOL_PATHS) $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \ + $(AM_TOOL_PATHS) \ + LIBTOOLIZE='$(STAGING_DIR_HOST)/bin/libtoolize --install' \ + $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \ $(if $(word 2,$(3)),--no-recursive) \ -B $(STAGING_DIR_HOST)/share/aclocal \ $(patsubst %,-I %,$(5)) \ diff --git a/include/cmake.mk b/include/cmake.mk index b66665d20ae6bd..a5ba7d31bf92a5 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -103,6 +103,7 @@ define Host/Configure/Default -DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \ -DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \ -DCMAKE_SKIP_RPATH=TRUE \ + -DCMAKE_INSTALL_LIBDIR=lib \ $(CMAKE_HOST_OPTIONS) \ $(HOST_CMAKE_SOURCE_DIR) \ ) diff --git a/include/download.mk b/include/download.mk index 33141910fce817..14d68bf8f5e929 100644 --- a/include/download.mk +++ b/include/download.mk @@ -55,7 +55,8 @@ define dl_pack $(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown)) endef define dl_tar_pack - $(TAR) --numeric-owner --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) + $(TAR) --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \ + $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1)) endef ifdef CHECK @@ -288,6 +289,7 @@ endef define Download/default FILE:=$(PKG_SOURCE) URL:=$(PKG_SOURCE_URL) + URL_FILE:=$(PKG_SOURCE_URL_FILE) SUBDIR:=$(PKG_SOURCE_SUBDIR) PROTO:=$(PKG_SOURCE_PROTO) $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR))) diff --git a/include/feeds.mk b/include/feeds.mk index 3ff618595aa346..9637424c5bc249 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -6,10 +6,10 @@ # See /LICENSE for more information. # --include $(TMP_DIR)/.packagesubdirs +-include $(TMP_DIR)/.packageauxvars FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*)) -FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n)) +FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null)) PACKAGE_SUBDIRS=$(PACKAGE_DIR) ifneq ($(CONFIG_PER_FEED_REPO),) diff --git a/include/host-build.mk b/include/host-build.mk index 827ea6bbfb1be7..9fc14241c64b69 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -190,11 +190,11 @@ ifndef DUMP host-install: host-compile host-clean-build: FORCE + $(call Host/Uninstall) rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_BUILT) host-clean: host-clean-build $(call Host/Clean) - $(call Host/Uninstall) rm -rf $(HOST_STAMP_INSTALLED) ifneq ($(CONFIG_AUTOREMOVE),) diff --git a/include/image-commands.mk b/include/image-commands.mk index 4cf12937265685..37cb083bbfbca2 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 kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) + $@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new @mv $@.new $@ endef diff --git a/include/image.mk b/include/image.mk index 26da4d68193ea6..fd04d4020bf6ca 100644 --- a/include/image.mk +++ b/include/image.mk @@ -157,18 +157,13 @@ endif # Disable noisy checks by default as in upstream -ifeq ($(strip $(call kernel_patchver_ge,4.7.0)),1) - DTC_FLAGS += -Wno-unit_address_vs_reg -endif -ifeq ($(strip $(call kernel_patchver_ge,4.12.0)),1) - DTC_FLAGS += \ - -Wno-unit_address_vs_reg \ - -Wno-simple_bus_reg \ - -Wno-unit_address_format \ - -Wno-pci_bridge \ - -Wno-pci_device_bus_num \ - -Wno-pci_device_reg -endif +DTC_FLAGS += \ + -Wno-unit_address_vs_reg \ + -Wno-simple_bus_reg \ + -Wno-unit_address_format \ + -Wno-pci_bridge \ + -Wno-pci_device_bus_num \ + -Wno-pci_device_reg ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1) DTC_FLAGS += \ -Wno-avoid_unnecessary_addr_size \ @@ -593,7 +588,7 @@ define Device/Build/image DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \ TARGET="$(BOARD)" \ - SUBTARGET="$(SUBTARGET)" \ + SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \ VERSION_NUMBER="$(VERSION_NUMBER)" \ VERSION_CODE="$(VERSION_CODE)" \ SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \ diff --git a/include/kernel-build.mk b/include/kernel-build.mk index b7bcf0e17deb8a..b1d3fc07fd2335 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -131,10 +131,16 @@ define BuildKernel $(Kernel/Configure) touch $$@ + $(LINUX_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST) + $(LINUX_DIR)/.modules: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig + $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE $(Kernel/CompileModules) touch $$@ + $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST) + $(LINUX_DIR)/.image: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig + $(LINUX_DIR)/.image: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE $(Kernel/CompileImage) $(Kernel/CollectDebug) @@ -157,8 +163,11 @@ define BuildKernel $(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config $(_SINGLE)$(KERNEL_MAKE) \ $(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \ + YACC=$(STAGING_DIR_HOST)/bin/bison \ $$@ - $(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET) + $(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config | \ + grep -vE '(CONFIG_CC_(HAS_ASM_GOTO|IS_GCC|IS_CLANG)|GCC_VERSION)=' \ + > $(LINUX_RECONFIG_TARGET) install: $(LINUX_DIR)/.image +$(MAKE) -C image compile install TARGET_BUILD= diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index cc1e2361be5043..db93a53d71e42e 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -146,6 +146,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) define Kernel/CompileImage/Initramfs $(call Kernel/Configure/Initramfs) $(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init + $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init) rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio* +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules $(call Kernel/CopyImage,-initramfs) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 90c0fc0a74ad00..a1f646d8475aae 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -40,4 +40,4 @@ KERNEL_PATCHVER ?= $(KERNEL) # disable the md5sum check for unknown kernel versions LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION))) -LINUX_KERNEL_HASH?=x +LINUX_KERNEL_HASH?=x \ No newline at end of file diff --git a/include/kernel.mk b/include/kernel.mk index 19ecf4fa9a8494..02d0949a7210f0 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -77,7 +77,7 @@ else TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR) ifneq ($(TARGET_BUILD),1) - PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) + PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) endif endif @@ -104,6 +104,7 @@ endif KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS) KERNEL_MAKE_FLAGS = \ + KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \ HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \ CROSS_COMPILE="$(KERNEL_CROSS)" \ ARCH="$(LINUX_KARCH)" \ @@ -113,6 +114,7 @@ KERNEL_MAKE_FLAGS = \ KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \ KBUILD_BUILD_VERSION="0" \ HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \ + KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \ CONFIG_SHELL="$(BASH)" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ $(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \ @@ -129,6 +131,11 @@ ifdef CONFIG_USE_SPARSE KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse endif +ifneq ($(HOST_OS),Linux) + KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION= + export SKIP_STACK_VALIDATION:=1 +endif + PKG_EXTMOD_SUBDIRS ?= . define populate_module_symvers @@ -141,7 +148,10 @@ endef define collect_module_symvers for subdir in $(PKG_EXTMOD_SUBDIRS); do \ - grep -F $$$$(readlink -f $(PKG_BUILD_DIR)) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ + realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \ + grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ + [ "$(PKG_BUILD_DIR)" = "$$$$realdir" ] || \ + grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ done; \ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_INFO_DIR)/$(PKG_NAME).symvers @@ -243,7 +253,7 @@ $(call KernelPackage/$(1)/config) exit 1; \ fi; \ done; - $(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(wordlist 3,99,$(AUTOLOAD))) + $(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(sort $(wordlist 3,99,$(AUTOLOAD)))) $(call KernelPackage/$(1)/install,$$(1)) endef $(if $(CONFIG_PACKAGE_kmod-$(1)), diff --git a/include/netfilter.mk b/include/netfilter.mk index 009f3502ee051b..c62b9a827f114a 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, ge 3.19.0),)) +$(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_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, 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_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_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, ge 4.3),)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6, ge 4.3),)) +$(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),)) # u32 @@ -336,25 +336,26 @@ $(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_NFT_EXTHDR, $(P_XT)nft_exthdr),)) -$(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, 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_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_LOG, $(P_XT)nft_log),)) +$(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_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_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_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_ARP,CONFIG_NF_TABLES_ARP, $(P_V4)nf_tables_arp, lt 4.17),)) @@ -364,11 +365,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, ge 3.19.0),)) +$(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_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, ge 3.19.0),)) +$(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_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/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 8a42be5bd186ec..ef98c482fbd3ba 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -24,7 +24,8 @@ $(if $(MENU),Menu: $(MENU) )$(if $(DEFAULT),Default: $(DEFAULT) )$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1 )Version: $(VERSION) -Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) +$(if $(ABI_VERSION),ABIVersion: $(ABI_VERSION) +)Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) Conflicts: $(CONFLICTS) Menu-Depends: $(MDEPENDS) Provides: $(PROVIDES) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 200a5cf4eb1588..c4c8f4a36feb61 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -35,7 +35,8 @@ PARENR :=) dep_split=$(subst :,$(space),$(1)) dep_rem=$(subst !,,$(subst $(strip $(PARENL)),,$(subst $(strip $(PARENR)),,$(word 1,$(call dep_split,$(1)))))) -dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(CONFIG_$(cond)))) +dep_and=dep_and_res:=$$(and $(subst $(space),$(comma),$(foreach cond,$(subst &&, ,$(1)),$$(CONFIG_$(cond))))) +dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(eval $(call dep_and,$(cond)))$(dep_and_res))) dep_pos=$(if $(call dep_confvar,$(1)),$(call dep_val,$(1))) dep_neg=$(if $(call dep_confvar,$(1)),,$(call dep_val,$(1))) dep_if=$(if $(findstring !,$(1)),$(call dep_neg,$(1)),$(call dep_pos,$(1))) @@ -123,6 +124,8 @@ ifeq ($(DUMP),) endif $(PKG_INSTALL_STAMP).$(1): prepare-package-install echo "$(1)" >> $(PKG_INSTALL_STAMP) + else + $(if $(CONFIG_PACKAGE_$(1)),$$(warning WARNING: skipping $(1) -- package has no install section)) endif endif @@ -162,7 +165,7 @@ Package: $(1)$$(ABIV_$(1)) Version: $(VERSION) $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS)) -)$$(call addfield,Provides,$$(call mergelist,$(PROVIDES)$$(if $$(ABIV_$(1)), $(1))) +)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(call GetABISuffix,$(provide)))))) )$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES)) )$$(call addfield,Source,$(SOURCE) )$$(call addfield,SourceName,$(1) @@ -199,6 +202,15 @@ $(_endef) $(CheckDependencies) $(RSTRIP) $$(IDIR_$(1)) + + ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),) + (cd $$(IDIR_$(1)); \ + ( \ + find . -type f \! -path ./CONTROL/\* -exec sha256sum \{\} \; 2> /dev/null | \ + sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \ + ) || true \ + ) + endif (cd $$(IDIR_$(1))/CONTROL; \ ( \ echo "$$$$CONTROL"; \ diff --git a/include/package.mk b/include/package.mk index a03db11119c454..c541f6edf7a967 100644 --- a/include/package.mk +++ b/include/package.mk @@ -11,7 +11,7 @@ all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile)) include $(INCLUDE_DIR)/download.mk -PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) +PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_BUILD_PARALLEL ?= PKG_USE_MIPS16 ?= 1 @@ -40,6 +40,10 @@ include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/unpack.mk include $(INCLUDE_DIR)/depends.mk +ifneq ($(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git),) + USE_GIT_SRC_CHECKOUT:=1 + QUILT:=1 +endif ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),) USE_GIT_TREE:=1 QUILT:=1 @@ -53,14 +57,26 @@ endif include $(INCLUDE_DIR)/quilt.mk -find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ - $(filter-out $(BUILD_PACKAGES),$(foreach dep, \ - $(filter-out @%, $(patsubst +%,%,$(1))), \ - $(if $(findstring :,$(dep)), \ - $(word 2,$(subst :,$(space),$(dep))), \ - $(dep) \ - ) \ - )))) +find_library_dependencies = \ + $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ + $(sort $(foreach dep4, \ + $(sort $(foreach dep3, \ + $(sort $(foreach dep2, \ + $(sort $(foreach dep1, \ + $(sort $(foreach dep0, \ + $(Package/$(1)/depends), \ + $(Package/$(dep0)/depends) $(dep0) \ + )), \ + $(Package/$(dep1)/depends) $(dep1) \ + )), \ + $(Package/$(dep2)/depends) $(dep2) \ + )), \ + $(Package/$(dep3)/depends) $(dep3) \ + )), \ + $(Package/$(dep4)/depends) $(dep4) \ + )), \ + )) + PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR))) STAMP_NO_AUTOREBUILD=$(wildcard $(PKG_BUILD_DIR)/.no_autorebuild) @@ -81,9 +97,10 @@ STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).lis define CleanStaging rm -f $(STAMP_INSTALLED) @-(\ - cd "$(STAGING_DIR)"; \ - if [ -f packages/$(STAGING_FILES_LIST) ]; then \ - cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \ + if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \ + $(SCRIPT_DIR)/clean-package.sh \ + "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \ + "$(STAGING_DIR)"; \ fi; \ ) endef @@ -116,6 +133,18 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),) endif endif +ifdef USE_GIT_SRC_CHECKOUT + define Build/Prepare/Default + mkdir -p $(PKG_BUILD_DIR) + ln -s $(TOPDIR)/git-src/$(PKG_NAME)/.git $(PKG_BUILD_DIR)/.git + ( cd $(PKG_BUILD_DIR); \ + git checkout .; \ + git submodule update --recursive; \ + git submodule foreach git config --unset core.worktree; \ + git submodule foreach git checkout .; \ + ) + endef +endif ifdef USE_GIT_TREE define Build/Prepare/Default mkdir -p $(PKG_BUILD_DIR) @@ -235,7 +264,7 @@ define Build/CoreTargets endef define Build/DefaultTargets - $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) + $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) $(if $(DUMP),,$(Build/CoreTargets)) define Build/DefaultTargets @@ -257,7 +286,7 @@ endef endif BUILD_PACKAGES += $(1) - $(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(DEPENDS))) + $(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(1))) $(foreach FIELD, TITLE CATEGORY SECTION VERSION, ifeq ($($(FIELD)),) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index f39ecbd0635779..a711ae33f7edd9 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -24,7 +24,7 @@ $(eval $(call TestHostCommand,case-sensitive-fs, \ $(eval $(call TestHostCommand,proper-umask, \ Please build with umask 022 - other values produce broken packages, \ - umask | grep -xE 00[012][012])) + umask | grep -xE 0?0[012][012])) $(eval $(call SetupHostCommand,gcc, \ Please install the GNU C Compiler (gcc) 4.8 or later, \ @@ -105,9 +105,9 @@ $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \ gcp --help 2>&1 | grep 'Copy SOURCE', \ cp --help 2>&1 | grep 'Copy SOURCE')) -$(eval $(call SetupHostCommand,seq,, \ +$(eval $(call SetupHostCommand,seq,Please install seq, \ gseq --version, \ - seq --version)) + seq --version 2>&1 | grep seq)) $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \ gawk --version 2>&1 | grep GNU, \ @@ -141,10 +141,21 @@ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) -$(eval $(call SetupHostCommand,python,Please install Python 2.x, \ - python2.7 -V 2>&1 | grep Python, \ - python2 -V 2>&1 | grep Python, \ - python -V 2>&1 | grep Python)) +$(eval $(call CleanupPython2)) + +$(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \ + python3.8 -V 2>&1 | grep 'Python 3', \ + python3.7 -V 2>&1 | grep 'Python 3', \ + python3.6 -V 2>&1 | grep 'Python 3', \ + python3.5 -V 2>&1 | grep 'Python 3', \ + python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?')) + +$(eval $(call SetupHostCommand,python3,Please install Python >= 3.5, \ + python3.8 -V 2>&1 | grep 'Python 3', \ + python3.7 -V 2>&1 | grep 'Python 3', \ + python3.6 -V 2>&1 | grep 'Python 3', \ + python3.5 -V 2>&1 | grep 'Python 3', \ + python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?')) $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule)) diff --git a/include/prereq.mk b/include/prereq.mk index 0f0f2537448f2f..83ac21242c6535 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -66,6 +66,18 @@ define RequireHeader $$(eval $$(call Require,$(1),$(2))) endef +define CleanupPython2 + define Require/python2-cleanup + if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ + $(STAGING_DIR_HOST)/bin/python -V 2>&1 | \ + grep -q 'Python 2'; then \ + rm $(STAGING_DIR_HOST)/bin/python; \ + fi + endef + + $$(eval $$(call Require,python2-cleanup)) +endef + define QuoteHostCommand '$(subst ','"'"',$(strip $(1)))' endef diff --git a/include/quilt.mk b/include/quilt.mk index 61dcc7964cf431..56f674a2f39e49 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -94,17 +94,17 @@ endef kernel_files=$(foreach fdir,$(GENERIC_FILES_DIR) $(FILES_DIR),$(fdir)/.) define Kernel/Patch/Default - $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches) + $(if $(QUILT),rm -rf $(LINUX_DIR)/patches; mkdir -p $(LINUX_DIR)/patches) $(if $(kernel_files),$(CP) $(kernel_files) $(LINUX_DIR)/) find $(LINUX_DIR)/ -name \*.rej -or -name \*.orig | $(XARGS) rm -f if [ -d $(GENERIC_PLATFORM_DIR)/patches$(if $(wildcard $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) ]; then \ echo "generic patches directory is present. please move your patches to the pending directory" ; \ exit 1; \ fi - $(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/) - $(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_PATCH_DIR),generic/) - $(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_HACK_DIR),generic-hack/) - $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),platform/) + $(call PatchDir,$(LINUX_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/) + $(call PatchDir,$(LINUX_DIR),$(GENERIC_PATCH_DIR),generic/) + $(call PatchDir,$(LINUX_DIR),$(GENERIC_HACK_DIR),generic-hack/) + $(call PatchDir,$(LINUX_DIR),$(PATCH_DIR),platform/) endef define Quilt/RefreshDir diff --git a/include/rootfs.mk b/include/rootfs.mk index dc8621dbae4df6..b6775c7e15fb00 100644 --- a/include/rootfs.mk +++ b/include/rootfs.mk @@ -78,7 +78,13 @@ define prepare_rootfs done; \ for script in ./etc/init.d/*; do \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \ + IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + echo "Enabling" $$(basename $$script); \ + else \ + IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script disable; \ + echo "Disabling" $$(basename $$script); \ + fi; \ done || true \ ) $(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status) @@ -93,4 +99,5 @@ define prepare_rootfs rm -rf $(1)/boot $(call clean_ipkg,$(1)) $(call mklibs,$(1)) + $(if $(SOURCE_DATE_EPOCH),find $(1)/ -mindepth 1 -execdir touch -hcd "@$(SOURCE_DATE_EPOCH)" "{}" +) endef diff --git a/include/scan.mk b/include/scan.mk index e6b21b27b009ce..7df5dc64865c5d 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -12,26 +12,35 @@ OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) +define feedname +$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1)))) +endef + ifeq ($(SCAN_NAME),target) SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk image/*.mk else SCAN_DEPS=$(TOPDIR)/include/package*.mk +ifneq ($(call feedname,$(SCAN_DIR)),) + SCAN_DEPS += $(TOPDIR)/feeds/$(call feedname,$(SCAN_DIR))/*.mk +endif endif ifeq ($(IS_TTY),1) - define progress + ifneq ($(strip $(NO_COLOR)),1) + define progress printf "\033[M\r$(1)" >&2; - endef + endef + else + define progress + printf "\r$(1)" >&2; + endef + endif else define progress :; endef endif -define feedname -$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1)))) -endef - define PackageDir $(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1) $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(foreach DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP)))) diff --git a/include/scons.mk b/include/scons.mk deleted file mode 100644 index 2b767105429e78..00000000000000 --- a/include/scons.mk +++ /dev/null @@ -1,23 +0,0 @@ -export PLATFORM=posix - -SCONS_VARS = \ - CC="$(TARGET_CC_NOCACHE)" \ - CXX="$(TARGET_CXX_NOCACHE)" \ - CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ - CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \ - CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ - DESTDIR="$(PKG_INSTALL_DIR)" - -define Build/Configure/Default - (cd $(PKG_BUILD_DIR); \ - $(SCONS_VARS) \ - scons \ - prefix=/usr \ - $(SCONS_OPTIONS) \ - install \ - ) -endef - -define Build/Compile -endef diff --git a/include/target.mk b/include/target.mk index 0e52d6d1daf981..2445925e69f09f 100644 --- a/include/target.mk +++ b/include/target.mk @@ -21,7 +21,7 @@ luci-app-pptp-server luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramf luci-app-sfe luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol \ ddns-scripts_aliyun ddns-scripts_dnspod # For nas targets -DEFAULT_PACKAGES.nas:=fdisk lsblk mdadm automount autosamba luci-app-usb-printer +DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm # For router targets DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall kmod-ipt-offload kmod-tcp-bbr DEFAULT_PACKAGES.bootloader:= @@ -57,10 +57,6 @@ else endif endif -ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),) - DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router)) -endif - # Add device specific packages (here below to allow device type set from subtarget) DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE)) @@ -186,7 +182,6 @@ ifeq ($(DUMP),1) CPU_TYPE ?= pentium CPU_CFLAGS_pentium = -march=pentium-mmx CPU_CFLAGS_pentium4 = -march=pentium4 - CPU_CFLAGS_core2 = -march=core2 endif ifneq ($(findstring arm,$(ARCH)),) CPU_TYPE ?= xscale @@ -232,6 +227,9 @@ ifeq ($(DUMP),1) .SILENT: $(TMP_CONFIG) .PRECIOUS: $(TMP_CONFIG) + ifdef KERNEL_TESTING_PATCHVER + FEATURES += testing-kernel + endif ifneq ($(CONFIG_OF),) FEATURES += dt endif @@ -290,6 +288,7 @@ define BuildTargets/DumpCurrent echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \ echo 'CPU-Type: $(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))'; \ echo 'Linux-Version: $(LINUX_VERSION)'; \ + $(if $(LINUX_TESTING_VERSION),echo 'Linux-Testing-Version: $(LINUX_TESTING_VERSION)';) \ echo 'Linux-Release: $(LINUX_RELEASE)'; \ echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \ $(if $(SUBTARGET),,$(if $(DEFAULT_SUBTARGET), echo 'Default-Subtarget: $(DEFAULT_SUBTARGET)'; )) \ diff --git a/include/toolchain-build.mk b/include/toolchain-build.mk index 883d74d25c8285..35d8c9380ec190 100644 --- a/include/toolchain-build.mk +++ b/include/toolchain-build.mk @@ -12,6 +12,7 @@ HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR) BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN) include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/hardening.mk HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared diff --git a/include/toplevel.mk b/include/toplevel.mk index b57dcd8544f603..2b3b55db9f75d7 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -88,9 +88,9 @@ prepare-tmpinfo: FORCE f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ done - [ tmp/.config-feeds.in -nt tmp/.packagesubdirs ] || ./scripts/feeds feed_config > tmp/.config-feeds.in + [ tmp/.config-feeds.in -nt tmp/.packageauxvars ] || ./scripts/feeds feed_config > tmp/.config-feeds.in ./scripts/package-metadata.pl mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } - ./scripts/package-metadata.pl subdirs tmp/.packageinfo > tmp/.packagesubdirs || { rm -f tmp/.packagesubdirs; false; } + ./scripts/package-metadata.pl pkgaux tmp/.packageinfo > tmp/.packageauxvars || { rm -f tmp/.packageauxvars; false; } touch $(TOPDIR)/tmp/.build .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo) @@ -99,13 +99,18 @@ prepare-tmpinfo: FORCE $(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \ fi +ifneq ($(DISTRO_PKG_CONFIG),) +scripts/config/mconf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) +endif scripts/config/mconf: @$(_SINGLE)$(SUBMAKE) -s -C scripts/config all CC="$(HOSTCC_WRAPPER)" $(eval $(call rdep,scripts/config,scripts/config/mconf)) scripts/config/qconf: - @$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf CC="$(HOSTCC_WRAPPER)" + @$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf \ + CC="$(HOSTCC_WRAPPER)" \ + DISTRO-PKG-CONFIG="$(DISTRO_PKG_CONFIG)" scripts/config/conf: @$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)" @@ -145,7 +150,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo FORCE fi $< Config.in -prepare_kernel_conf: .config FORCE +prepare_kernel_conf: .config toolchain/install FORCE ifeq ($(wildcard staging_dir/host/bin/quilt),) prepare_kernel_conf: @@ -157,6 +162,10 @@ endif kernel_oldconfig: prepare_kernel_conf $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig +ifneq ($(DISTRO_PKG_CONFIG),) +kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) +kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) +endif kernel_menuconfig: prepare_kernel_conf $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig diff --git a/include/u-boot.mk b/include/u-boot.mk index 9ba9c50968519a..02e37d0f4c18b9 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -42,7 +42,7 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ - HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \ + HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" define Build/U-Boot/Target diff --git a/include/uclibc++.mk b/include/uclibc++.mk index a1a61f26d419fd..27533279c99ce6 100644 --- a/include/uclibc++.mk +++ b/include/uclibc++.mk @@ -4,8 +4,8 @@ ifndef DUMP endif endif -PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX -CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp +PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX CONFIG_USE_LIBCXX +CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBCXX:libcxx +USE_LIBSTDCXX:libstdcpp ifneq ($(CONFIG_USE_UCLIBCXX),) ifneq ($(CONFIG_CCACHE),) @@ -14,3 +14,11 @@ ifneq ($(CONFIG_USE_UCLIBCXX),) TARGET_CXX=g++-uc endif endif + +ifneq ($(CONFIG_USE_LIBCXX),) + ifneq ($(CONFIG_CCACHE),) + TARGET_CXX_NOCACHE=g++-libcxx + else + TARGET_CXX=g++-libcxx + endif +endif diff --git a/include/unpack.mk b/include/unpack.mk index a139827490f53b..6141b1c7225db7 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -58,18 +58,13 @@ ifeq ($(strip $(UNPACK_CMD)),) UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD) endif endif - ifneq ($(strip $(CRLF_WORKAROUND)),) - CRLF_CMD := && find $(PKG_BUILD_DIR) -type f -print0 | xargs -0 perl -pi -e 's!\r$$$$!!g' - else - CRLF_CMD := - endif endif ifdef PKG_BUILD_DIR - PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) $(call CRLF_CMD,$(PKG_BUILD_DIR)) + PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) endif ifdef HOST_BUILD_DIR - HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) $(call CRLF_CMD,$(HOST_BUILD_DIR)) + HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) endif endif # PKG_SOURCE diff --git a/include/version.mk b/include/version.mk index 32483c10172887..7d3c1ad6400f24 100644 --- a/include/version.mk +++ b/include/version.mk @@ -108,3 +108,4 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' + diff --git a/package/Makefile b/package/Makefile index abbf5f91f2e117..58c1ba2bbf655c 100644 --- a/package/Makefile +++ b/package/Makefile @@ -84,8 +84,12 @@ $(curdir)/index: FORCE mkdir -p $$d; \ cd $$d || continue; \ $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ - grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages && \ - gzip -9nc Packages > Packages.gz; \ + grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \ + case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \ + $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \ + { echo ""; echo ""; } >> Packages;; \ + esac; \ + gzip -9nc Packages > Packages.gz; \ ); done ifdef CONFIG_SIGNED_PACKAGES @echo Signing package index... diff --git a/package/libs/libcxx/Makefile b/package/libs/libcxx/Makefile new file mode 100644 index 00000000000000..c1fa1d6b0776d1 --- /dev/null +++ b/package/libs/libcxx/Makefile @@ -0,0 +1,62 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libcxx +PKG_VERSION:=9.0.1 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.llvm.org/git/libcxx +PKG_SOURCE_VERSION:=2076f539f410805ef88692b9c0ce0a0b882a7680 +PKG_MIRROR_HASH:=6dff036660d478bfaa14e407fc5de26d22da1087118c897b1a3ad2e90cb7bf39 + +PKG_MAINTAINER:=Rosen Penev +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.txt + +PKG_BUILD_PARALLEL:=1 +CMAKE_BINARY_SUBDIR:=build + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/libcxx + SECTION:=libs + CATEGORY:=Libraries + TITLE:=LLVM libstdc++ + URL:=https://libcxx.llvm.org/ + DEPENDS:=+libatomic +libpthread +endef + +define Package/libcxx/description + LLVM C++ library targeting C++11 and above +endef + +CMAKE_OPTIONS += \ + -DLIBCXX_ENABLE_ASSERTIONS=OFF \ + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \ + -DLIBCXX_INCLUDE_BENCHMARKS=OFF \ + -DLIBCXX_INCLUDE_DOCS=OFF \ + -DLIBCXX_INCLUDE_TESTS=OFF \ + -DLIBCXX_HAS_MUSL_LIBC=ON \ + -DLIBCXX_STANDALONE_BUILD=ON + +TARGET_CXXFLAGS += -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -Wno-attributes -flto +TARGET_LDFLAGS += -Wl,--as-needed + +define Build/InstallDev + $(call Build/InstallDev/cmake,$(1)) + $(CP) files/g++-libcxx $(TOOLCHAIN_DIR)/bin/ + $(SED) 's,CXX,$(TARGET_CXX),g' $(TOOLCHAIN_DIR)/bin/g++-libcxx +endef + +define Package/libcxx/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libc++.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libcxx)) diff --git a/package/libs/libcxx/files/g++-libcxx b/package/libs/libcxx/files/g++-libcxx new file mode 100755 index 00000000000000..81ca46eb0eef7e --- /dev/null +++ b/package/libs/libcxx/files/g++-libcxx @@ -0,0 +1,19 @@ +#!/bin/sh + +WRAPPER_INCLUDEDIR="-I$STAGING_DIR/usr/include/c++/v1" +WRAPPER_LIBDIR="-L$STAGING_DIR/usr/lib" +WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared" + +WRAPPER_OPTIONS="" +WRAPPER_INCLIB="Y" +for arg +do + case "$arg" in + -c|-E|-S) WRAPPER_INCLIB="N" ;; + -static) [ "$WRAPPER_LIBS" != "-lc -lgcc_s -lssp_nonshared -lgcc_eh" ] && WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared -lgcc_eh" ;; + esac +done +[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lsupc++ $WRAPPER_LIBS" + +exec CXX -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS + diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile index 256c172f518be7..01dc48e35e5e14 100644 --- a/package/libs/uclient/Makefile +++ b/package/libs/uclient/Makefile @@ -24,7 +24,7 @@ define Package/libuclient SECTION:=libs CATEGORY:=Libraries TITLE:=HTTP/1.1 client library - ABI_VERSION:=$(PKG_VERSION) + ABI_VERSION:=20160123 DEPENDS:=+libubox endef diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index 2ea5bf0bd59a63..a15f3d8ab8e22f 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -25,7 +25,7 @@ define Package/libustream/default CATEGORY:=Libraries TITLE:=ustream SSL Library DEPENDS:=+libubox - ABI_VERSION:=$(PKG_VERSION) + ABI_VERSION:=20150806 endef define Package/libustream-openssl diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 8fd5cf6edbb16d..3b0a95598d66ff 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -36,7 +36,7 @@ define Package/libubus SECTION:=libs CATEGORY:=Libraries DEPENDS:=+libubox - ABI_VERSION:=$(PKG_VERSION) + ABI_VERSION:=20191227 TITLE:=OpenWrt RPC client library endef diff --git a/scripts/arm-magic.sh b/scripts/arm-magic.sh index 29ec88ab2f05c1..b4b0fa94f574df 100755 --- a/scripts/arm-magic.sh +++ b/scripts/arm-magic.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # Empty/wrong machtype-workaround generator # diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh index d1a257889d96ac..6dd9bf730686f4 100755 --- a/scripts/clean-package.sh +++ b/scripts/clean-package.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +IFS=$'\n' [ -n "$1" -a -n "$2" ] || { echo "Usage: $0 " exit 1 @@ -14,7 +15,7 @@ cat "$1" | ( [ -f "$entry" ] && rm -f $entry done ) -cat "$1" | ( +sort -r "$1" | ( cd "$2" while read entry; do [ -n "$entry" ] || break diff --git a/scripts/config/Makefile b/scripts/config/Makefile index 745a5d0f84dcac..0eac8edd228717 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -20,8 +20,6 @@ check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1)) export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags) export CXXFLAGS += -DKBUILD_NO_NLS -DISTRO-PKG-CONFIG := $(shell which -a pkg-config | grep -E '\/usr' | head -n 1) - conf-objs := conf.o zconf.tab.o mconf-objs := mconf.o zconf.tab.o qconf-cxxobjs := qconf.o @@ -31,7 +29,7 @@ lxdialog-objs := \ lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \ lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o -clean-files := zconf.tab.c lex.zconf.c zconf.hash.c +clean-files := zconf.tab.c zconf.lex.c zconf.hash.c # Remove qconf junk files clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf @@ -42,7 +40,7 @@ mconf: $(mconf-objs) $(lxdialog-objs) $(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC)) qconf: $(qconf-cxxobjs) $(qconf-objs) ifneq ($(DISTRO-PKG-CONFIG),) - $(CXX) $(HOSTLOADLIBES_qconf) -o $@ $^ + $(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf) else echo "You don't have 'pkg-config' installed. Cannot continue" echo "For now, you may use 'make menuconfig' instead of 'make xconfig'" @@ -55,9 +53,9 @@ zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c kconfig_load.o: lkc_defs.h -zconf.tab.c: zconf.y -zconf.lex.c: zconf.l -zconf.hash.c: zconf.gperf +zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped) +zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped) +zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped) %.tab.c: %.y cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $< diff --git a/scripts/config/expr.c b/scripts/config/expr.c index cbf4996dd9c104..8cee597d33a594 100644 --- a/scripts/config/expr.c +++ b/scripts/config/expr.c @@ -893,7 +893,10 @@ static enum string_value_kind expr_parse_string(const char *str, switch (type) { case S_BOOLEAN: case S_TRISTATE: - return k_string; + val->s = !strcmp(str, "n") ? 0 : + !strcmp(str, "m") ? 1 : + !strcmp(str, "y") ? 2 : -1; + return k_signed; case S_INT: val->s = strtoll(str, &tail, 10); kind = k_signed; diff --git a/scripts/config/zconf.hash.c_shipped b/scripts/config/zconf.hash.c_shipped index 2c6ae7be1cfcbd..f9680d6eb2c708 100644 --- a/scripts/config/zconf.hash.c_shipped +++ b/scripts/config/zconf.hash.c_shipped @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.4 */ /* Command-line: gperf */ /* Computed positions: -k'1,3' */ @@ -165,7 +165,7 @@ static struct kconf_id_strings_t kconf_id_strings_contents = #define kconf_id_strings ((const char *) &kconf_id_strings_contents) #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif diff --git a/scripts/config/zconf.lex.c_shipped b/scripts/config/zconf.lex.c_shipped index f1d652829301af..1ca209f511657f 100644 --- a/scripts/config/zconf.lex.c_shipped +++ b/scripts/config/zconf.lex.c_shipped @@ -1,6 +1,4 @@ -#line 3 "zconf.lex.c" - #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ @@ -26,8 +24,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -106,25 +104,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -160,7 +146,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -177,7 +171,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t zconfleng; +extern int zconfleng; extern FILE *zconfin, *zconfout; @@ -186,6 +180,7 @@ extern FILE *zconfin, *zconfout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -215,12 +210,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -243,7 +238,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -271,7 +266,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -290,11 +285,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when zconftext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t zconfleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int zconfleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -319,7 +314,7 @@ static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len ); void *zconfalloc (yy_size_t ); void *zconfrealloc (void *,yy_size_t ); @@ -351,12 +346,12 @@ void zconffree (void * ); /* Begin user sect3 */ -#define zconfwrap() 1 +#define zconfwrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; -FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0; +FILE *zconfin = NULL, *zconfout = NULL; typedef int yy_state_type; @@ -365,324 +360,343 @@ extern int zconflineno; int zconflineno = 1; extern char *zconftext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr zconftext -static yyconst flex_int16_t yy_nxt[][17] = + +static yyconst flex_int16_t yy_nxt[][18] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0 }, { 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12 + 12, 12, 12, 12, 12, 12, 12, 12 }, { 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12 + 12, 12, 12, 12, 12, 12, 12, 12 }, { 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 18, 16, 16, 16 + 16, 18, 16, 16, 16, 16, 16, 16 }, { 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 18, 16, 16, 16 + 16, 18, 16, 16, 16, 16, 16, 16 }, { 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19 + 19, 19, 19, 19, 19, 19, 19, 19 }, { 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19 + 19, 19, 19, 19, 19, 19, 19, 19 }, { 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, - 22, 22, 22, 22, 22, 25, 22 + 22, 22, 22, 22, 22, 22, 25, 22 }, { 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, - 22, 22, 22, 22, 22, 25, 22 + 22, 22, 22, 22, 22, 22, 25, 22 }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 35, 36, 37, 38, 39, 40 }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 35, 36, 37, 38, 39, 40 }, { -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11 + -11, -11, -11, -11, -11, -11, -11, -11 }, { 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12 + -12, -12, -12, -12, -12, -12, -12, -12 }, { - 11, -13, 39, 40, -13, -13, 41, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13 + 11, -13, 41, 42, -13, -13, 43, -13, -13, -13, + -13, -13, -13, -13, -13, -13, -13, -13 }, { 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14 + -14, -14, -14, -14, -14, -14, -14, -14 }, { - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42 + 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44 }, { 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16 + -16, -16, -16, -16, -16, -16, -16, -16 }, { 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17 + -17, -17, -17, -17, -17, -17, -17, -17 }, { 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, 44, -18, -18, -18 + -18, 46, -18, -18, -18, -18, -18, -18 }, { - 11, 45, 45, -19, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45 + 11, 47, 47, -19, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47 }, { - 11, -20, 46, 47, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20 + 11, -20, 48, 49, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20 }, { - 11, 48, -21, -21, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48 + 11, 50, -21, -21, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50 }, { - 11, 49, 49, 50, 49, -22, 49, 49, -22, 49, - 49, 49, 49, 49, 49, -22, 49 + 11, 51, 51, 52, 51, -22, 51, 51, -22, 51, + 51, 51, 51, 51, 51, 51, -22, 51 }, { 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23 + -23, -23, -23, -23, -23, -23, -23, -23 }, { 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24 + -24, -24, -24, -24, -24, -24, -24, -24 }, { - 11, 51, 51, 52, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51 + 11, 53, 53, 54, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53 }, { 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26 + -26, -26, -26, -26, -26, -26, -26, -26 }, { - 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27 + 11, -27, 55, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27 }, { 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, 53, -28, -28 + -28, -28, -28, -28, -28, -28, -28, -28 }, { 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29 + -29, -29, -29, -29, 56, -29, -29, -29 }, { - 11, 54, 54, -30, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54 + 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30, -30, -30, -30, -30, -30, -30 }, { - 11, -31, -31, -31, -31, -31, -31, 55, -31, -31, - -31, -31, -31, -31, -31, -31, -31 + 11, 57, 57, -31, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57 }, { - 11, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32 + 11, -32, -32, -32, -32, -32, -32, 58, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32 }, { 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33 + -33, -33, -33, -33, -33, -33, -33, -33 }, { 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, 56, 57, 57, -34, -34, -34 + -34, -34, -34, -34, -34, -34, -34, -34 }, { 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, 57, 57, 57, -35, -35, -35 + -35, 59, 59, -35, -35, -35, -35, -35 }, { 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36 + -36, -36, -36, -36, 60, -36, -36, -36 }, { - 11, -37, -37, 58, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37 + 11, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37 }, { 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, 59 + -38, -38, -38, -38, 61, -38, -38, -38 }, { - 11, -39, 39, 40, -39, -39, 41, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39 + 11, -39, -39, 62, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39 }, { 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, - -40, -40, -40, -40, -40, -40, -40 + -40, -40, -40, -40, -40, -40, -40, 63 }, { - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42 + 11, -41, 41, 42, -41, -41, 43, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41 }, { - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42 + 11, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42 }, { - 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43 + 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44 }, { - 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, 44, -44, -44, -44 + 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44 }, { - 11, 45, 45, -45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45 + 11, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45 }, { - 11, -46, 46, 47, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46 + 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, 46, -46, -46, -46, -46, -46, -46 }, { - 11, 48, -47, -47, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48 + 11, 47, 47, -47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47 }, { - 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48 + 11, -48, 48, 49, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48 }, { - 11, 49, 49, 50, 49, -49, 49, 49, -49, 49, - 49, 49, 49, 49, 49, -49, 49 + 11, 50, -49, -49, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50 }, { 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50 + -50, -50, -50, -50, -50, -50, -50, -50 }, { - 11, -51, -51, 52, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51 + 11, 51, 51, 52, 51, -51, 51, 51, -51, 51, + 51, 51, 51, 51, 51, 51, -51, 51 }, { 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52 + -52, -52, -52, -52, -52, -52, -52, -52 }, { - 11, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53 + 11, -53, -53, 54, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53 }, { - 11, 54, 54, -54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54 + 11, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54 }, { - 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55 + 11, -55, 55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55 }, { 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, 60, 57, 57, -56, -56, -56 + -56, -56, -56, -56, -56, -56, -56, -56 }, { - 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, 57, 57, 57, -57, -57, -57 + 11, 57, 57, -57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57 }, { 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58 + -58, -58, -58, -58, -58, -58, -58, -58 }, { 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59 + -59, 59, 59, -59, -59, -59, -59, -59 }, { 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, 57, 57, 57, -60, -60, -60 + -60, -60, -60, -60, -60, -60, -60, -60 + }, + + { + 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61 + }, + + { + 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62 + }, + + { + 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63 }, } ; @@ -690,20 +704,20 @@ static yyconst flex_int16_t yy_nxt[][17] = static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up zconftext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - zconfleng = (size_t) (yy_cp - yy_bp); \ + zconfleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 33 -#define YY_END_OF_BUFFER 34 +#define YY_NUM_RULES 37 +#define YY_END_OF_BUFFER 38 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -711,32 +725,33 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[61] = +static yyconst flex_int16_t yy_accept[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 34, 5, 4, 2, 3, 7, 8, 6, 32, 29, - 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, - 22, 11, 12, 19, 19, 14, 22, 22, 4, 2, - 3, 3, 1, 6, 32, 29, 31, 30, 24, 23, - 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 + 38, 5, 4, 2, 3, 7, 8, 6, 36, 33, + 35, 28, 32, 31, 30, 26, 25, 21, 13, 20, + 23, 26, 11, 12, 22, 18, 14, 19, 26, 26, + 4, 2, 3, 3, 1, 6, 36, 33, 35, 34, + 28, 27, 30, 29, 25, 15, 23, 9, 22, 16, + 17, 24, 10 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, - 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, - 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 1, 15, 1, 1, 13, 1, 13, 13, 13, 13, - - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 1, 16, 1, 1, 1, 1, 1, 1, + 10, 1, 1, 1, 11, 12, 12, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 1, 1, 13, + 14, 15, 1, 1, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 1, 16, 1, 1, 11, 1, 11, 11, 11, 11, + + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -832,6 +847,13 @@ static void alloc_string(const char *str, int size) text[size] = 0; } +static void warn_ignored_character(char chr) +{ + fprintf(stderr, + "%s:%d:warning: ignoring unsupported character '%c'\n", + zconf_curname(), zconf_lineno(), chr); +} + #define INITIAL 0 #define COMMAND 1 #define HELP 2 @@ -867,19 +889,19 @@ void zconfset_extra (YY_EXTRA_TYPE user_defined ); FILE *zconfget_in (void ); -void zconfset_in (FILE * in_str ); +void zconfset_in (FILE * _in_str ); FILE *zconfget_out (void ); -void zconfset_out (FILE * out_str ); +void zconfset_out (FILE * _out_str ); -yy_size_t zconfget_leng (void ); + int zconfget_leng (void ); char *zconfget_text (void ); int zconfget_lineno (void ); -void zconfset_lineno (int line_number ); +void zconfset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -893,8 +915,12 @@ extern int zconfwrap (void ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -915,7 +941,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -923,7 +954,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) +#define ECHO do { if (fwrite( zconftext, (size_t) zconfleng, 1, zconfout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -932,7 +963,7 @@ static int input (void ); #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ - while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \ + while ( (result = (int) read( fileno(zconfin), buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ @@ -986,7 +1017,7 @@ extern int zconflex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -996,13 +1027,10 @@ extern int zconflex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; - int str = 0; - int ts, i; - if ( !(yy_init) ) { (yy_init) = 1; @@ -1029,7 +1057,12 @@ YY_DECL zconf_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { + + int str = 0; + int ts, i; + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -1103,7 +1136,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP - +warn_ignored_character(*zconftext); YY_BREAK case 8: /* rule 8 can match eol */ @@ -1145,22 +1178,34 @@ return T_UNEQUAL; YY_BREAK case 16: YY_RULE_SETUP +return T_LESS_EQUAL; + YY_BREAK +case 17: +YY_RULE_SETUP +return T_GREATER_EQUAL; + YY_BREAK +case 18: +YY_RULE_SETUP +return T_LESS; + YY_BREAK +case 19: +YY_RULE_SETUP +return T_GREATER; + YY_BREAK +case 20: +YY_RULE_SETUP { str = zconftext[0]; new_string(); BEGIN(STRING); } YY_BREAK -case 17: -/* rule 17 can match eol */ +case 21: +/* rule 21 can match eol */ YY_RULE_SETUP BEGIN(INITIAL); current_file->lineno++; return T_EOL; YY_BREAK -case 18: -YY_RULE_SETUP -/* ignore */ - YY_BREAK -case 19: +case 22: YY_RULE_SETUP { const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); @@ -1173,18 +1218,22 @@ YY_RULE_SETUP return T_WORD; } YY_BREAK -case 20: +case 23: YY_RULE_SETUP /* comment */ YY_BREAK -case 21: -/* rule 21 can match eol */ +case 24: +/* rule 24 can match eol */ YY_RULE_SETUP current_file->lineno++; YY_BREAK -case 22: +case 25: YY_RULE_SETUP + YY_BREAK +case 26: +YY_RULE_SETUP +warn_ignored_character(*zconftext); YY_BREAK case YY_STATE_EOF(PARAM): { @@ -1192,9 +1241,10 @@ case YY_STATE_EOF(PARAM): } YY_BREAK -case 23: -/* rule 23 can match eol */ +case 27: +/* rule 27 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ +YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP @@ -1204,15 +1254,16 @@ YY_RULE_SETUP return T_WORD_QUOTE; } YY_BREAK -case 24: +case 28: YY_RULE_SETUP { append_string(zconftext, zconfleng); } YY_BREAK -case 25: -/* rule 25 can match eol */ +case 29: +/* rule 29 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ +YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP @@ -1222,13 +1273,13 @@ YY_RULE_SETUP return T_WORD_QUOTE; } YY_BREAK -case 26: +case 30: YY_RULE_SETUP { append_string(zconftext + 1, zconfleng - 1); } YY_BREAK -case 27: +case 31: YY_RULE_SETUP { if (str == zconftext[0]) { @@ -1239,8 +1290,8 @@ YY_RULE_SETUP append_string(zconftext, 1); } YY_BREAK -case 28: -/* rule 28 can match eol */ +case 32: +/* rule 32 can match eol */ YY_RULE_SETUP { printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); @@ -1255,7 +1306,7 @@ case YY_STATE_EOF(STRING): } YY_BREAK -case 29: +case 33: YY_RULE_SETUP { ts = 0; @@ -1280,9 +1331,10 @@ YY_RULE_SETUP } } YY_BREAK -case 30: -/* rule 30 can match eol */ +case 34: +/* rule 34 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ +YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP @@ -1292,15 +1344,15 @@ YY_RULE_SETUP return T_HELPTEXT; } YY_BREAK -case 31: -/* rule 31 can match eol */ +case 35: +/* rule 35 can match eol */ YY_RULE_SETUP { current_file->lineno++; append_string("\n", 1); } YY_BREAK -case 32: +case 36: YY_RULE_SETUP { while (zconfleng) { @@ -1331,7 +1383,7 @@ case YY_STATE_EOF(COMMAND): yyterminate(); } YY_BREAK -case 33: +case 37: YY_RULE_SETUP YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK @@ -1463,6 +1515,7 @@ YY_FATAL_ERROR( "flex scanner jammed" ); "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of zconflex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1474,9 +1527,9 @@ YY_FATAL_ERROR( "flex scanner jammed" ); */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1505,7 +1558,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1518,7 +1571,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1532,7 +1585,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1545,7 +1598,7 @@ static int yy_get_next_buffer (void) } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1587,9 +1640,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1608,8 +1661,8 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); @@ -1628,7 +1681,7 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; + int yy_is_jam; yy_current_state = yy_nxt[yy_current_state][1]; yy_is_jam = (yy_current_state <= 0); @@ -1636,9 +1689,11 @@ static int yy_get_next_buffer (void) return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1648,10 +1703,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1660,7 +1715,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1673,6 +1728,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1697,7 +1754,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1721,7 +1778,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( zconfwrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1822,7 +1879,7 @@ static void zconf_load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -1969,7 +2026,7 @@ void zconfpop_buffer_state (void) */ static void zconfensure_buffer_stack (void) { - yy_size_t num_to_alloc; + int num_to_alloc; if (!(yy_buffer_stack)) { @@ -1977,15 +2034,15 @@ static void zconfensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -1994,7 +2051,7 @@ static void zconfensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc @@ -2014,7 +2071,7 @@ static void zconfensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) { @@ -2024,7 +2081,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) @@ -2033,7 +2090,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -2056,7 +2113,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) { - return zconf_scan_bytes(yystr,strlen(yystr) ); + return zconf_scan_bytes(yystr,(int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will @@ -2066,7 +2123,7 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -2074,7 +2131,7 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) zconfalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); @@ -2100,9 +2157,9 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2130,7 +2187,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int zconfget_lineno (void) { - + return zconflineno; } @@ -2153,7 +2210,7 @@ FILE *zconfget_out (void) /** Get the length of the current token. * */ -yy_size_t zconfget_leng (void) +int zconfget_leng (void) { return zconfleng; } @@ -2168,29 +2225,29 @@ char *zconfget_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void zconfset_lineno (int line_number ) +void zconfset_lineno (int _line_number ) { - zconflineno = line_number; + zconflineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * * @see zconf_switch_to_buffer */ -void zconfset_in (FILE * in_str ) +void zconfset_in (FILE * _in_str ) { - zconfin = in_str ; + zconfin = _in_str ; } -void zconfset_out (FILE * out_str ) +void zconfset_out (FILE * _out_str ) { - zconfout = out_str ; + zconfout = _out_str ; } int zconfget_debug (void) @@ -2198,9 +2255,9 @@ int zconfget_debug (void) return zconf_flex_debug; } -void zconfset_debug (int bdebug ) +void zconfset_debug (int _bdebug ) { - zconf_flex_debug = bdebug ; + zconf_flex_debug = _bdebug ; } static int yy_init_globals (void) @@ -2209,10 +2266,10 @@ static int yy_init_globals (void) * This function is called from zconflex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -2221,8 +2278,8 @@ static int yy_init_globals (void) zconfin = stdin; zconfout = stdout; #else - zconfin = (FILE *) 0; - zconfout = (FILE *) 0; + zconfin = NULL; + zconfout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2260,7 +2317,8 @@ int zconflex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2269,7 +2327,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2279,11 +2337,12 @@ static int yy_flex_strlen (yyconst char * s ) void *zconfalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } void *zconfrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2291,12 +2350,12 @@ void *zconfrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void zconffree (void * ptr ) { - free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */ + free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py index 4bb7d131bb8303..59fd7067be921d 100755 --- a/scripts/dl_github_archive.py +++ b/scripts/dl_github_archive.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2018 Yousong Zhou # @@ -20,7 +20,7 @@ import subprocess import sys import time -import urllib2 +import urllib.request TMPDIR = os.environ.get('TMP_DIR') or '/tmp' TMPDIR_DL = os.path.join(TMPDIR, 'dl') @@ -177,7 +177,7 @@ def get(self, k): def set(self, k, v): """Update timestamp with ``k``.""" fileno = os.open(self.cachef, os.O_RDWR | os.O_CREAT) - with os.fdopen(fileno, 'wb+') as f: + with os.fdopen(fileno, 'w+') as f: try: fcntl.lockf(fileno, fcntl.LOCK_EX) self._cache_init(f) @@ -194,7 +194,7 @@ def _cache_init(self, fin): self.cache[k] = (ts, updated) def _cache_flush(self, fout): - cache = sorted(self.cache.iteritems(), cmp=lambda a, b: b[1][1] - a[1][1]) + cache = sorted(self.cache.items(), key=lambda a: a[1][1]) cache = cache[:self.__cachen] self.cache = {} os.ftruncate(fout.fileno(), 0) @@ -345,6 +345,7 @@ def _init_commit_ts(self): version_is_sha1sum = len(self.version) == 40 if not version_is_sha1sum: apis.insert(0, apis.pop()) + reasons = '' for api in apis: url = api['url'] attr_path = api['attr_path'] @@ -357,9 +358,9 @@ def _init_commit_ts(self): self.commit_ts = ct self.commit_ts_cache.set(url, ct) return - except Exception: - pass - raise self._error('Cannot fetch commit ts: {}'.format(url)) + except Exception as e: + reasons += '\n' + (" {}: {}".format(url, e)) + raise self._error('Cannot fetch commit ts:{}'.format(reasons)) def _init_commit_ts_remote_get(self, url, attrpath): resp = self._make_request(url) @@ -397,9 +398,9 @@ def _make_request(self, path): 'Accept': 'application/vnd.github.v3+json', 'User-Agent': 'OpenWrt', } - req = urllib2.Request(url, headers=headers) + req = urllib.request.Request(url, headers=headers) sslcontext = ssl._create_unverified_context() - fileobj = urllib2.urlopen(req, context=sslcontext) + fileobj = urllib.request.urlopen(req, context=sslcontext) return fileobj def _error(self, msg): diff --git a/scripts/download.pl b/scripts/download.pl index fb4c488f49efdc..accb5f99a49433 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -194,7 +194,6 @@ 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"; @@ -205,16 +204,11 @@ 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/$dir"; + push @mirrors, "https://raw.githubusercontent.com/$1"; } } 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"; @@ -240,7 +234,7 @@ sub cleanup push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; + push @mirrors, "http://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"; @@ -251,7 +245,6 @@ 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"; @@ -278,3 +271,4 @@ sub cleanup } $SIG{INT} = \&cleanup; + diff --git a/scripts/env b/scripts/env index 84166ae5fe45dd..7bfca58c5dd9dc 100755 --- a/scripts/env +++ b/scripts/env @@ -73,7 +73,7 @@ env_init() { } env_sync_data() { - [ \! -L "$BASEDIR/.config" -a -f "$BASEDIR/.config" ] && mv "$BASEDIR/.config" "$ENVDIR" + [ \! -L "$BASEDIR/.config" ] && [ -f "$BASEDIR/.config" ] && mv "$BASEDIR/.config" "$ENVDIR" git add . git add -u } @@ -136,7 +136,7 @@ env_clear() { env_init [ -L "$BASEDIR/.config" ] && rm -f "$BASEDIR/.config" [ -L "$BASEDIR/files" ] && rm -f "$BASEDIR/files" - [ -f "$ENVDIR/.config" ] || ( cd "$ENVDIR/files" && find | grep -vE '^\.$' > /dev/null ) + [ -f "$ENVDIR/.config" ] || ( cd "$ENVDIR/files" && find . | grep -vE '^\.$' > /dev/null ) env_sync_data if ask_bool 1 "Do you want to keep your current config and files"; then mkdir -p "$BASEDIR/files" @@ -185,7 +185,7 @@ env_new() { env_init 1 branch="$(git branch | grep '^\* ' | awk '{print $2}')" - if [ -n "$branch" -a "$branch" != "master" ]; then + if [ -n "$branch" ] && [ "$branch" != "master" ]; then env_ask_sync if ask_bool 0 "Do you want to clone the current environment?"; then from="$branch" @@ -193,15 +193,15 @@ env_new() { rm -f "$BASEDIR/.config" "$BASEDIR/files" fi git checkout -b "$1" "$from" - if [ -f "$BASEDIR/.config" -o -d "$BASEDIR/files" ]; then + if [ -f "$BASEDIR/.config" ] || [ -d "$BASEDIR/files" ]; then if ask_bool 1 "Do you want to start your configuration repository with the current configuration?"; then - [ -d "$BASEDIR/files" -a \! -L "$BASEDIR/files" ] && { + if [ -d "$BASEDIR/files" ] && [ \! -L "$BASEDIR/files" ]; then mkdir -p "$ENVDIR/files" shopt -s dotglob mv "$BASEDIR/files/"* "$ENVDIR/files/" 2>/dev/null shopt -u dotglob rmdir "$BASEDIR/files" - } + fi env_sync else rm -rf "$BASEDIR/.config" "$BASEDIR/files" diff --git a/scripts/feeds b/scripts/feeds index 304ef6cbafd141..69ab60278a1a12 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -41,34 +41,56 @@ my $feed_src = {}; my $feed_target = {}; my $feed_vpackage = {}; -sub parse_config() { +sub parse_file($$); + +sub parse_file($$) { + my ($fname, $existing) = @_; my $line = 0; - my %name; + my $fh; - open FEEDS, "feeds.conf" or - open FEEDS, "feeds.conf.default" or - die "Unable to open feeds configuration"; - while () { + open $fh, $fname or return undef; + while (<$fh>) { chomp; s/#.+$//; - next unless /\S/; - my @line = split /\s+/, $_, 3; - my @src; $line++; + next unless /\S/; - my $valid = 1; - $line[0] =~ /^src-[\w-]+$/ or $valid = 0; - $line[1] =~ /^\w+$/ or $valid = 0; - @src = split /\s+/, ($line[2] or ''); - @src = ('') if @src == 0; - $valid or die "Syntax error in feeds.conf, line: $line\n"; + my ($type, $flags, $name, $urls) = m!^src-([\w\-]+)((?:\s+--\w+(?:=\S+)?)*)\s+(\w+)(?:\s+(\S.*))?$!; + unless ($type && $name) { + die "Syntax error in $fname, line $line\n"; + } + + if ($existing->{$name}++) { + die "Duplicate feed name '$name' in '$fname' line: $line\n"; + } - $name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n"; - $name{$line[1]} = 1; + my @src = defined($urls) ? split /\s+/, $urls : (); + push @src, '' if @src == 0; - push @feeds, [$line[0], $line[1], \@src]; + my %flags; + if (defined $flags) { + while ($flags =~ m!\s+--(\w+)(?:=(\S+))?!g) { + $flags{$1} = defined($2) ? $2 : 1; + } + } + + if ($type eq "include") { + parse_file($urls, $existing) or + die "Unable to open included file '$urls'"; + next; + } + + push @feeds, ["src-$type", $name, \@src, \%flags]; } - close FEEDS; + close $fh; + return 1; +} + +sub parse_config() { + my %name; + parse_file("feeds.conf", \%name) or + parse_file("feeds.conf.default", \%name) or + die "Unable to open feeds configuration"; } sub update_location($$) @@ -506,6 +528,11 @@ sub install_src { get_feed($feed->[1]); my $src = $feed_src->{$name} or return 1; + # enable force flag if feed src line was declared with --force + if (exists($feed->[3]{force})) { + $force = 1; + } + # If it's a core package and we don't want to override, just return my $override = 0; if (is_core_src($name)) { diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py index b825d2768b9897..b182f09d21c723 100755 --- a/scripts/flashing/eva_ramboot.py +++ b/scripts/flashing/eva_ramboot.py @@ -1,24 +1,32 @@ -#!/usr/bin/python +#!/usr/bin/env python3 + +import argparse from ftplib import FTP from sys import argv from os import stat -assert len(argv) == 3 -ip = argv[1] -image = argv[2] +parser = argparse.ArgumentParser(description='Tool to boot AVM EVA ramdisk images.') +parser.add_argument('ip', type=str, help='IP-address to transfer the image to') +parser.add_argument('image', type=str, help='Location of the ramdisk image') +parser.add_argument('--offset', type=lambda x: int(x,0), help='Offset to load the image to in hex format with leading 0x. Only needed for non-lantiq devices.') +args = parser.parse_args() -size = stat(image).st_size +size = stat(args.image).st_size # arbitrary size limit, to prevent the address calculations from overflows etc. assert size < 0x2000000 -# We need to align the address. A page boundary seems to be sufficient on 7362sl -# and 7412 -addr = ((0x8000000 - size) & ~0xfff) -haddr = 0x80000000 + addr -img = open(image, "rb") +if args.offset: + addr = size + haddr = args.offset +else: + # We need to align the address. + # A page boundary seems to be sufficient on 7362sl and 7412 + addr = ((0x8000000 - size) & ~0xfff) + haddr = 0x80000000 + addr -ftp = FTP(ip, 'adam2', 'adam2') +img = open(args.image, "rb") +ftp = FTP(args.ip, 'adam2', 'adam2') def adam(cmd): print("> %s"%(cmd)) diff --git a/scripts/flashing/jungo-image.py b/scripts/flashing/jungo-image.py index 9947e7c72091ef..fdd4562374fe44 100755 --- a/scripts/flashing/jungo-image.py +++ b/scripts/flashing/jungo-image.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2008, 2009 (C) Jose Vasconcellos # @@ -32,9 +32,9 @@ import string import binascii import socket -import thread -import SocketServer -import SimpleHTTPServer +import _thread +import socketserver +import http.server reboot = 0 HOST = "192.168.1.1" @@ -56,8 +56,8 @@ #################### def start_server(server): - httpd = SocketServer.TCPServer((server,PORT),SimpleHTTPServer.SimpleHTTPRequestHandler) - thread.start_new_thread(httpd.serve_forever,()) + httpd = socketserver.TCPServer((server,PORT),http.server.SimpleHTTPRequestHandler) + _thread.start_new_thread(httpd.serve_forever,()) #################### @@ -66,11 +66,11 @@ def get_flash_size(): tn.write("cat /proc/cpuinfo\n") buf = tn.read_until("Returned 0", 3) if not buf: - print "Unable to obtain CPU information; make sure to not use A0 stepping!" + print("Unable to obtain CPU information; make sure to not use A0 stepping!") elif buf.find('rev 0') > 0: - print "Warning: IXP42x stepping A0 detected!" + print("Warning: IXP42x stepping A0 detected!") if imagefile or url: - print "Error: No linux support for A0 stepping!" + print("Error: No linux support for A0 stepping!") sys.exit(2) # now get flash size @@ -86,9 +86,9 @@ def get_flash_size(): i = buf.rfind('Range ') if i > 0: return int(buf[i+17:].split()[0],16) - print "Can't determine flash size!" + print("Can't determine flash size!") else: - print "Unable to obtain flash size!" + print("Unable to obtain flash size!") sys.exit(2) def image_dump(tn, dumpfile): @@ -110,13 +110,13 @@ def image_dump(tn, dumpfile): if i > 0: i += 4 else: - print "No MAC address found! (use -f option)" + print("No MAC address found! (use -f option)") sys.exit(1) dumpfile = "%s-%s.bin" % (platform, buf[i:i+17].replace(':','')) else: tn.write("\n") - print "Dumping flash contents (%dMB) to %s" % (flashsize/1048576, dumpfile) + print("Dumping flash contents (%dMB) to %s" % (flashsize/1048576, dumpfile)) f = open(dumpfile, "wb") t=flashsize/dumplen @@ -137,7 +137,7 @@ def image_dump(tn, dumpfile): if s and s[0][-1] == ':': a=int(s[0][:-1],16) if a != count: - print "Format error: %x != %x"%(a,count) + print("Format error: %x != %x"%(a,count)) sys.exit(2) count += 16 f.write(binascii.a2b_hex(string.join(s[1:],''))) @@ -145,7 +145,7 @@ def image_dump(tn, dumpfile): f.close() if verbose: - print "" + print("") def telnet_option(sock,cmd,option): #print "Option: %d %d" % (ord(cmd), ord(option)) @@ -156,11 +156,11 @@ def telnet_option(sock,cmd,option): sock.sendall(telnetlib.IAC + c + option) def telnet_timeout(): - print "Fatal error: telnet timeout!" + print("Fatal error: telnet timeout!") sys.exit(1) def usage(): - print __doc__ % os.path.basename(sys.argv[0]) + print(__doc__ % os.path.basename(sys.argv[0])) #################### @@ -178,7 +178,7 @@ def usage(): usage() sys.exit(1) elif o in ("-V", "--version"): - print "%s: 0.11" % sys.argv[0] + print("%s: 0.11" % sys.argv[0]) sys.exit(1) elif o in ("-d", "--no-dump"): do_dump = 1 @@ -213,8 +213,8 @@ def usage(): # create a telnet session to the router try: tn = telnetlib.Telnet(HOST) -except socket.error, msg: - print "Unable to establish telnet session to %s: %s" % (HOST, msg) +except socket.error as msg: + print("Unable to establish telnet session to %s: %s" % (HOST, msg)) sys.exit(1) tn.set_option_negotiation_callback(telnet_option) @@ -250,7 +250,7 @@ def usage(): cmd = "load -u http://%s:%d/%s -r 0\n" % (server, PORT, splitpath[1]) if not os.access(imagefile, os.R_OK): - print "File access error: %s" % (imagefile) + print("File access error: %s" % (imagefile)) sys.exit(3) # make sure we're in the directory where the image is located @@ -260,23 +260,23 @@ def usage(): start_server(server) if verbose: - print "Unlocking flash..." + print("Unlocking flash...") tn.write("unlock 0 0x%x\n" % flashsize) buf = tn.read_until("Returned 0",5) if verbose: - print "Writing new image..." - print cmd, + print("Writing new image...") + print(cmd, end=' ') tn.write(cmd) buf = tn.read_until("Returned 0",10) # wait till the transfer completed buf = tn.read_until("Download completed successfully",20) if buf: - print "Flash update complete!" + print("Flash update complete!") if reboot: tn.write("reboot\n") - print "Rebooting..." + print("Rebooting...") tn.write("exit\n") tn.close() diff --git a/scripts/gen-dependencies.sh b/scripts/gen-dependencies.sh index 0aa01b78ec375d..4beff74bb0221a 100755 --- a/scripts/gen-dependencies.sh +++ b/scripts/gen-dependencies.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # Copyright (C) 2012 OpenWrt.org # @@ -24,8 +24,8 @@ find $TARGETS -type f -a -exec file {} \; | \ awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \ sort -u -tmp=`mktemp $TMP_DIR/dep.XXXXXXXX` -for kmod in `find $TARGETS -type f -name \*.ko`; do +tmp=$(mktemp $TMP_DIR/dep.XXXXXXXX) +for kmod in $(find $TARGETS -type f -name \*.ko); do $OBJCOPY -O binary -j .modinfo $kmod $tmp sed -e 's,\x00,\n,g' $tmp | \ sed -ne '/^depends=.\+/ { s/^depends=//; s/,/.ko\n/g; s/$/.ko/p; q }' diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh index d9beeb02953a22..2c57d56f073ca4 100755 --- a/scripts/gen_image_generic.sh +++ b/scripts/gen_image_generic.sh @@ -17,10 +17,10 @@ rm -f "$OUTPUT" head=16 sect=63 -cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512))) +cyl=$(( (KERNELSIZE + ROOTFSSIZE) * 1024 * 1024 / (head * sect * 512))) # create partition table -set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE}` +set $(ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE}) KERNELOFFSET="$(($1 / 512))" KERNELSIZE="$2" @@ -30,6 +30,6 @@ ROOTFSSIZE="$(($4 / 512))" [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc -make_ext4fs -J -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR" +make_ext4fs -J -L kernel -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR" dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc rm -f "$OUTPUT.kernel" diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh index dcd11ca191adc3..f6f15d7dd8c339 100755 --- a/scripts/ipkg-make-index.sh +++ b/scripts/ipkg-make-index.sh @@ -17,7 +17,7 @@ for pkg in `find $pkg_dir -name '*.ipk' | sort`; do [[ "$name" = "kernel" ]] && continue [[ "$name" = "libc" ]] && continue echo "Generating index for package $pkg" >&2 - file_size=$(ls -l $pkg | awk '{print $5}') + file_size=$(stat -L -c%s $pkg) sha256sum=$(mkhash sha256 $pkg) # Take pains to make variable value sed-safe sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'` diff --git a/scripts/ipkg-remove b/scripts/ipkg-remove index c0e0ec880f5b28..f4957004c0ebca 100755 --- a/scripts/ipkg-remove +++ b/scripts/ipkg-remove @@ -10,6 +10,11 @@ for pkg in "$@"; do break fi done + case "$pkg" in + */"${sourcename}_"*.ipk) + rm -vf "$pkg" + ;; + esac done exit 0 diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 8ca963e7573392..1826a040a11650 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -131,6 +131,7 @@ sub parse_target_metadata($) { /^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1; /^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1; /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; + /^Linux-Testing-Version:\s*(.+)\s*$/ and $target->{testing_version} = $1; /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; /^Default-Subtarget:\s*(.+)\s*$/ and $target->{def_subtarget} = $1; @@ -139,6 +140,8 @@ sub parse_target_metadata($) { $profile = { id => $1, name => $1, + has_image_metadata => 0, + supported_devices => [], priority => 999, packages => [], default => "y if TARGET_ALL_PROFILES" @@ -147,6 +150,8 @@ sub parse_target_metadata($) { push @{$target->{profiles}}, $profile; }; /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1; + /^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and $profile->{has_image_metadata} = $1; + /^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and $profile->{supported_devices} = [ split(/\s+/, $1) ]; /^Target-Profile-Priority:\s*(\d+)\s*$/ and do { $profile->{priority} = $1; $target->{sort} = 1; @@ -240,6 +245,7 @@ sub parse_package_metadata($) { /^Build-Types:\s*(.+)\s*$/ and $src->{buildtypes} = [ split /\s+/, $1 ]; next unless $pkg; /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1; + /^ABIVersion: \s*(.+)\s*$/ and $pkg->{abiversion} = $1; /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1; /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1; /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1; diff --git a/scripts/mkits.sh b/scripts/mkits.sh index 5d836be8e43e6d..32a978e18d1b6f 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -15,7 +15,7 @@ # usage() { - echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \ + echo "Usage: $(basename $0) -A arch -C comp -a addr -e entry" \ "-v version -k kernel [-D name -d dtb] -o its_file" echo -e "\t-A ==> set architecture to 'arch'" echo -e "\t-C ==> set compression type 'comp'" @@ -55,11 +55,11 @@ if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \ usage fi -ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'` +ARCH_UPPER=$(echo $ARCH | tr '[:lower:]' '[:upper:]') # Conditionally create fdt information if [ -n "${DTB}" ]; then - FDT=" + FDT_NODE=" fdt@1 { description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\"; data = /incbin/(\"${DTB}\"); @@ -74,6 +74,7 @@ if [ -n "${DTB}" ]; then }; }; " + FDT_PROP="fdt = \"fdt@1\";" fi # Create a default, fully populated DTS file @@ -100,9 +101,7 @@ DATA="/dts-v1/; algo = \"sha1\"; }; }; - -${FDT} - +${FDT_NODE} }; configurations { @@ -110,7 +109,7 @@ ${FDT} ${CONFIG} { description = \"OpenWrt\"; kernel = \"kernel@1\"; - fdt = \"fdt@1\"; + ${FDT_PROP} }; }; };" diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 53bb45a62c83d6..5abc1bdef3f70e 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -191,9 +191,9 @@ sub mconf_depends { $depend = shift @vdeps; if (@vdeps > 1) { - $condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')'; + $condition = ($condition ? "$condition && " : '') . join("&&", map { "PACKAGE_$_ 0) { - $condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0]; + $condition = ($condition ? "$condition && " : '') . "PACKAGE_${vdeps[0]}{name} && $pkg->{repository}) { print "Package/$name/subdir = $pkg->{repository}\n"; } + if ($pkg->{name} && defined($pkg->{abiversion}) && length($pkg->{abiversion})) { + my $abiv; + + if ($pkg->{abiversion} =~ m!^(\d{4})-(\d{2})-(\d{2})-[0-9a-f]{7,40}$!) { + print STDERR "WARNING: Reducing ABI version '$pkg->{abiversion}' of package '$name' to '$1$2$3'\n"; + $abiv = "$1$2$3"; + } + else { + $abiv = $pkg->{abiversion}; + } + + foreach my $n (@{$pkg->{provides}}) { + print "Package/$n/abiversion = $abiv\n"; + } + } + my %depends; + foreach my $dep (@{$pkg->{depends} || []}) { + if ($dep =~ m!^\+?(?:[^:]+:)?([^@]+)$!) { + $depends{$1}++; + } + } + my @depends = sort keys %depends; + if (@depends > 0) { + foreach my $n (@{$pkg->{provides}}) { + print "Package/$n/depends = @depends\n"; + } + } } } @@ -565,7 +608,7 @@ () /^config$/ and return gen_package_config(); /^kconfig/ and return gen_kconfig_overrides(); /^source$/ and return gen_package_source(); - /^subdirs$/ and return gen_package_subdirs(); + /^pkgaux$/ and return gen_package_auxiliary(); /^license$/ and return gen_package_license(0); /^licensefull$/ and return gen_package_license(1); /^usergroup$/ and return gen_usergroup_list(); @@ -577,7 +620,7 @@ () $0 config [file] Package metadata in Kconfig format $0 kconfig [file] [config] [patchver] Kernel config overrides $0 source [file] Package source file information - $0 subdirs [file] Package subdir information in makefile format + $0 pkgaux [file] Package auxiliary variables in makefile format $0 license [file] Package license information $0 licensefull [file] Package license information (full list) $0 usergroup [file] Package usergroup allocation list diff --git a/scripts/patch-specs.sh b/scripts/patch-specs.sh index 3307b6b0904501..2262e218fe2cb4 100755 --- a/scripts/patch-specs.sh +++ b/scripts/patch-specs.sh @@ -35,7 +35,7 @@ patch_specs() { echo -n "Patching specs ... " STAGING_DIR="$DIR" "$CPP" -dumpspecs | awk ' mode ~ "link" { - sub("%{L.}", "%{L*} -L %:getenv(STAGING_DIR /usr/lib) -rpath-link %:getenv(STAGING_DIR /usr/lib)") + sub(/(%@?\{L.\})/, "& -L %:getenv(STAGING_DIR /usr/lib) -rpath-link %:getenv(STAGING_DIR /usr/lib)") } mode ~ "cpp" { $0 = $0 " -idirafter %:getenv(STAGING_DIR /usr/include)" diff --git a/scripts/qemustart b/scripts/qemustart index 5bb8ca5f3a353b..dbb8deddafd809 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -74,6 +74,7 @@ check_setup_() { } check_setup() { + [ -n "$o_network" ] || return 0 check_setup_ || { __errmsg "please check the script content to see the environment requirement" return 1 @@ -88,6 +89,8 @@ Usage: $SELF [-h|--help] [ []] [--kernel ] [--rootfs ] + [--machine ] + [-n|--network] will default to "generic" and must be specified if are present @@ -100,13 +103,14 @@ the actual in use. They will default to files under bin/targets/ Examples $SELF x86 64 - $SELF x86 64 -enable-kvm -device virtio-balloon-pci + $SELF x86 64 --machine q35,accel=kvm -device virtio-balloon-pci $SELF x86 64 -incoming tcp:0:4444 $SELF x86 64-glibc $SELF malta be -m 64 $SELF malta le64 $SELF malta be-glibc $SELF armvirt 32 \\ + --machine virt,highmem=off \\ --kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\ --rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4 EOF @@ -117,11 +121,19 @@ rand_mac() { } parse_args() { + o_network= o_qemu_extra=() while [ "$#" -gt 0 ]; do + # Cmdline options for the script itself SHOULD try to be + # prefixed with two dashes to distinguish them from those for + # qemu executables. + # + # Also note that qemu accepts both --opt and -opt case "$1" in --kernel) o_kernel="$2"; shift 2 ;; --rootfs) o_rootfs="$2"; shift 2 ;; + --machine|-machine|-M) o_mach="$2"; shift 2 ;; + --network|-n) o_network=1; shift ;; --help|-h) usage exit 0 @@ -152,6 +164,7 @@ parse_args() { start_qemu_armvirt() { local kernel="$o_kernel" local rootfs="$o_rootfs" + local mach="${o_mach:-virt}" local cpu local qemu_exe @@ -181,9 +194,16 @@ start_qemu_armvirt() { ) } - "$qemu_exe" -machine virt -cpu "$cpu" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ + [ -z "$o_network" ] || { + o_qemu_extra+=( \ + "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \ + "-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \ + "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \ + "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \ + ) + } + + "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } @@ -192,7 +212,9 @@ start_qemu_malta() { local is64 local isel local qemu_exe + local rootfs="$o_rootfs" local kernel="$o_kernel" + local mach="${o_mach:-malta}" # o_subtarget can be le, be, le64, be64, le-glibc, le64-glibc, etc.. is64="$(echo $o_subtarget | grep -o 64)" @@ -201,19 +223,36 @@ start_qemu_malta() { [ -n "$kernel" ] || kernel="$o_bindir/openwrt-malta-${o_subtarget%-*}-vmlinux-initramfs.elf" + [ -z "$rootfs" ] || { + if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then + gunzip "$rootfs.gz" + fi + o_qemu_extra+=( \ + "-drive" "file=$rootfs,format=raw" \ + "-append" "root=/dev/sda rootwait" \ + ) + } + # NOTE: order of wan, lan -device arguments matters as it will affect which # one will be actually used as the wan, lan network interface inside the # guest machine - "$qemu_exe" -machine malta -nographic \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \ + [ -z "$o_network" ] || { + o_qemu_extra+=( + -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" + -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" + ) + } + + "$qemu_exe" -machine "$mach" -nographic \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } start_qemu_x86() { - local rootfs="$o_rootfs" local qemu_exe + local kernel="$o_kernel" + local rootfs="$o_rootfs" + local mach="${o_mach:-pc}" [ -n "$rootfs" ] || { rootfs="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-combined-ext4.img" @@ -227,7 +266,7 @@ start_qemu_x86() { # 64: 64-bit, kvm guest, virtio # case "${o_subtarget%-*}" in - legacy) qemu_exe="qemu-system-i386" ;; + legacy) qemu_exe="qemu-system-i386" ;; generic|64) qemu_exe="qemu-system-x86_64" ;; *) __errmsg "target $o_target: unknown subtarget $o_subtarget" @@ -235,6 +274,30 @@ start_qemu_x86() { ;; esac + [ -n "$kernel" ] && { + o_qemu_extra+=( \ + "-kernel" "$kernel" \ + "-append" "root=/dev/vda console=ttyS0 rootwait" \ + ) + } + + [ -z "$o_network" ] || { + case "${o_subtarget%-*}" in + legacy) + o_qemu_extra+=( + -netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "e1000,id=devlan,netdev=lan,mac=$MAC_LAN" + -netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "e1000,id=devwan,netdev=wan,mac=$MAC_WAN" + ) + ;; + generic|64) + o_qemu_extra+=( + -netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" + -netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" + ) + ;; + esac + } + case "${o_subtarget%-*}" in legacy) # use IDE (PATA) disk instead of AHCI (SATA). Refer to link @@ -247,17 +310,13 @@ start_qemu_x86() { # -drive "file=$rootfs,format=raw,id=drv0,if=none" \ # # [1] https://dev.openwrt.org/ticket/17947 - "$qemu_exe" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \ + "$qemu_exe" -machine "$mach" -nographic \ -device ide-drive,drive=drv0 \ -drive "file=$rootfs,format=raw,id=drv0,if=none" \ "${o_qemu_extra[@]}" ;; generic|64) - "$qemu_exe" -nographic \ - -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ - -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ + "$qemu_exe" -machine "$mach" -nographic \ -drive "file=$rootfs,format=raw,if=virtio" \ "${o_qemu_extra[@]}" ;; @@ -276,6 +335,6 @@ start_qemu() { esac } -check_setup \ - && parse_args "$@" \ +parse_args "$@" \ + && check_setup \ && start_qemu diff --git a/scripts/remote-gdb b/scripts/remote-gdb index 99c9d386d3862f..d8e2336d0e98ae 100755 --- a/scripts/remote-gdb +++ b/scripts/remote-gdb @@ -14,9 +14,9 @@ if( opendir SD, "$Bin/../staging_dir" ) { my ( $tid, $arch, $libc, @arches ); - if( $ARGV[1] =~ m!\btarget-(.+?)_(([^/_]+libc|musl)[^/_]*)\b!i ) + if( $ARGV[1] =~ m!\btarget-(.+?)_([^/_]+libc|musl)_?([^/]*).*\b!i ) { - print("Using target $1 ($2)\n"); + print("Using target $1 ($2, $3)\n"); ($arch, $libc) = ($1, $2); } else @@ -26,10 +26,10 @@ if( opendir SD, "$Bin/../staging_dir" ) while( defined( my $e = readdir SD ) ) { - if( -d "$Bin/../staging_dir/$e" && $e =~ /^target-(.+?)_(([^_]+libc|musl).*)/i ) + if( -d "$Bin/../staging_dir/$e" && $e =~ /^target-(.+?)_([^\/_]+libc|musl)_?([^\/]*).*/i ) { push @arches, [ $1, $2 ]; - printf(" %2d) %s (%s)\n", @arches + 0, $1, $2); + printf(" %2d) %s (%s %s)\n", @arches + 0, $1, $2, $3); } } diff --git a/scripts/sign_images.sh b/scripts/sign_images.sh new file mode 100755 index 00000000000000..c41b21e0918ee4 --- /dev/null +++ b/scripts/sign_images.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# directory where search for images +TOP_DIR="${TOP_DIR:-./bin/targets}" +# key to sign images +BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unifiy naming? +# remove other signatures (added e.g. by buildbot) +REMOVE_OTER_SIGNATURES="${REMOVE_OTER_SIGNATURES:-1}" + +# find all sysupgrade images in TOP_DIR +# factory images don't need signatures as non OpenWrt system doen't check them anyway +for image in $(find $TOP_DIR -type f -name "*-sysupgrade.bin"); do + # check if image actually support metadata + if fwtool -i /dev/null "$image"; then + # remove all previous signatures + if [ -n "$REMOVE_OTER_SIGNATURES" ]; then + while [ "$?" = 0 ]; do + fwtool -t -s /dev/null "$image" + done + fi + # run same operation as build root does for signing + cp "$BUILD_KEY.ucert" "$image.ucert" + usign -S -m "$image" -s "$BUILD_KEY" -x "$image.sig" + ucert -A -c "$image.ucert" -x "$image.sig" + fwtool -S "$image.ucert" "$image" + fi +done diff --git a/scripts/strip-kmod.sh b/scripts/strip-kmod.sh index 313015b909af69..e5b2868f5d5f54 100755 --- a/scripts/strip-kmod.sh +++ b/scripts/strip-kmod.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh [ -n "$CROSS" ] || { echo "The variable CROSS must be set to point to the cross-compiler prefix" exit 1 @@ -19,7 +19,7 @@ else fi if [ -z "$KEEP_BUILD_ID" ]; then - ARGS="$ARGS -R .note.gnu.build-id" + ARGS="$ARGS -R .note.gnu.build-id" fi ${CROSS}objcopy \ @@ -50,6 +50,6 @@ $3 && $2 ~ /[brtd]/ && $3 !~ /\$LC/ && !def[$3] { } ' > "$MODULE.tmp1" -${CROSS}objcopy `cat ${MODULE}.tmp1` ${MODULE}.tmp ${MODULE}.out +${CROSS}objcopy $(cat ${MODULE}.tmp1) ${MODULE}.tmp ${MODULE}.out mv "${MODULE}.out" "${MODULE}" rm -f "${MODULE}".t* diff --git a/scripts/symlink-tree.sh b/scripts/symlink-tree.sh index aa169e2455f810..6ed91dfb5a2943 100755 --- a/scripts/symlink-tree.sh +++ b/scripts/symlink-tree.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Create a new openwrt tree with symlinks pointing at the current tree # Usage: ./scripts/symlink-tree.sh diff --git a/scripts/sysupgrade-tar.sh b/scripts/sysupgrade-tar.sh index d1d627a96efb8b..b93b2584bb4970 100755 --- a/scripts/sysupgrade-tar.sh +++ b/scripts/sysupgrade-tar.sh @@ -1,5 +1,7 @@ #!/bin/sh +. $TOPDIR/scripts/functions.sh + board="" kernel="" rootfs="" @@ -53,7 +55,16 @@ fi mkdir -p "${tmpdir}/sysupgrade-${board}" echo "BOARD=${board}" > "${tmpdir}/sysupgrade-${board}/CONTROL" -[ -z "${rootfs}" ] || cp "${rootfs}" "${tmpdir}/sysupgrade-${board}/root" +if [ -n "${rootfs}" ]; then + case "$( get_fs_type ${rootfs} )" in + "squashfs") + dd if="${rootfs}" of="${tmpdir}/sysupgrade-${board}/root" bs=1024 conv=sync + ;; + *) + cp "${rootfs}" "${tmpdir}/sysupgrade-${board}/root" + ;; + esac +fi [ -z "${kernel}" ] || cp "${kernel}" "${tmpdir}/sysupgrade-${board}/kernel" mtime="" diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index b4613a75d08312..541499564896cd 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -42,6 +42,7 @@ (@) /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n"; /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n"; /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; + /^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n"; } return $ret; } @@ -83,11 +84,14 @@ ($) } my $v = kver($target->{version}); + my $tv = kver($target->{testing_version}); + $tv or $tv = $v; if (@{$target->{subtargets}} == 0) { $confstr = <{conf} bool "$target->{name}" - select LINUX_$v + select LINUX_$v if !TESTING_KERNEL + select LINUX_$tv if TESTING_KERNEL EOF } else { @@ -387,15 +391,18 @@ () my %kver; foreach my $target (@target) { - my $v = kver($target->{version}); - next if $kver{$v}; - $kver{$v} = 1; - print <{version}, $target->{testing_version}) { + next unless $tv; + my $v = kver($tv); + next if $kver{$v}; + $kver{$v} = 1; + print <{id} } @{$cur->{profiles}})."\n"; foreach my $profile (@{$cur->{profiles}}) { print $profile->{id}.'_NAME:='.$profile->{name}."\n"; + print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n"; + if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) { + print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n"; + } print $profile->{id}.'_PACKAGES:='.join(' ', @{$profile->{packages}})."\n"; } } diff --git a/scripts/time.pl b/scripts/time.pl index a23b57c89e3c8c..6f10170b3b6838 100755 --- a/scripts/time.pl +++ b/scripts/time.pl @@ -54,7 +54,7 @@ sub gettime { my ($sec2, $usec2) = gettime(); my (undef, undef, $cuser, $csystem) = times(); - printf STDERR "%s#%.2f#%.2f#%.2f\n", + printf STDOUT "%s#%.2f#%.2f#%.2f\n", $prefix, $cuser, $csystem, ($sec2 - $sec) + ($usec2 - $usec) / 1000000;