diff --git a/Makefile b/Makefile index d58aef26c..0e0cae5bb 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,9 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE direct world: -DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) +DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1) + +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH) ifneq ($(OPENWRT_BUILD),1) @@ -38,6 +40,9 @@ else include tools/Makefile include toolchain/Makefile +# Include the test suite Makefile if it exists +-include tests/Makefile + $(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check) $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) diff --git a/config/Config-build.in b/config/Config-build.in index 5425ab056..ae4498554 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -5,7 +5,6 @@ config EXPERIMENTAL bool "Enable experimental features by default" - default n help Set this option to build with latest bleeding edge features which may or may not work as expected. @@ -27,6 +26,14 @@ menu "Global build settings" directory containing machine readable list of built profiles and resulting images. + config JSON_CYCLONEDX_SBOM + bool "Create CycloneDX SBOM JSON" + default BUILDBOT + help + Create a JSON files *.bom.cdx.json in the build + directory containing Software Bill Of Materials in CycloneDX + format. + config ALL_NONSHARED bool "Select all target specific packages by default" select ALL_KMODS @@ -42,7 +49,6 @@ menu "Global build settings" config BUILDBOT bool "Set build defaults for automatic builds (e.g. via buildbot)" - default n help This option changes several defaults to be more suitable for automatic builds. This includes the following changes: @@ -62,6 +68,11 @@ menu "Global build settings" bool "Enable TLS certificate verification during package download" default y + config USE_APK + imply PACKAGE_apk-mbedtls + bool "Use APK instead of OPKG to build distribution (BROKEN)" + depends on BROKEN + comment "General build options" config TESTING_KERNEL @@ -75,10 +86,8 @@ menu "Global build settings" config DISPLAY_SUPPORT bool "Show packages that require graphics support (local or remote)" - default n config BUILD_PATENTED - default n bool "Compile with support for patented functionality" help When this option is disabled, software which provides patented functionality @@ -86,7 +95,6 @@ menu "Global build settings" functionality, this optional support will get disabled for this package. config BUILD_NLS - default n bool "Compile with full language support" help When this option is enabled, packages are built with the full versions of @@ -100,7 +108,6 @@ menu "Global build settings" config CLEAN_IPKG bool prompt "Remove ipkg/opkg status data files in final images" - default n help This removes all ipkg/opkg status data files from the target directory before building the root filesystem. @@ -108,14 +115,13 @@ menu "Global build settings" config IPK_FILES_CHECKSUMS bool prompt "Record files checksums in package metadata" - default n + depends on !USE_APK help This makes file checksums part of package metadata. It increases size but provides you with pkg_check command to check for flash corruptions. config INCLUDE_CONFIG bool "Include build configuration in firmware" if DEVEL - default n help If enabled, buildinfo files will be stored in /etc/build.* of firmware. @@ -149,7 +155,6 @@ menu "Global build settings" config DEBUG bool prompt "Compile packages with debugging info" - default n help Adds -g3 to the CFLAGS. @@ -168,6 +173,19 @@ menu "Global build settings" Adds LTO flags to the CFLAGS and LDFLAGS. Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto + config MOLD + depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64) + depends on !GCC_USE_VERSION_11 + def_bool $(shell, ./config/check-hostcxx.sh 10 2 12) + + config USE_MOLD + bool + prompt "Use the mold linker for all packages" + depends on MOLD + help + Link packages with mold, a modern linker + Packages can opt-out via setting PKG_BUILD_FLAGS:=no-mold + config IPV6 def_bool y @@ -207,17 +225,16 @@ menu "Global build settings" help Specifies arguments passed to the strip command when stripping binaries. - config SSTRIP_ARGS - string - prompt "Sstrip arguments" - depends on USE_SSTRIP - default "-z" + config SSTRIP_DISCARD_TRAILING_ZEROES + bool "Strip trailing zero bytes" + depends on USE_SSTRIP && !USE_MOLD + default y help - Specifies arguments passed to the sstrip command when stripping binaries. + Use sstrip's -z option to discard trailing zero bytes config STRIP_KERNEL_EXPORTS bool "Strip unnecessary exports from the kernel image" - depends on !LINUX_6_6 + depends on BROKEN help Reduces kernel size by stripping unused kernel exports from the kernel image. Note that this might make the kernel incompatible with any kernel @@ -279,12 +296,22 @@ menu "Global build settings" Enable GCC Stack Smashing Protection (SSP) for userspace applications config PKG_CC_STACKPROTECTOR_NONE bool "None" + help + No stack smashing protection. config PKG_CC_STACKPROTECTOR_REGULAR bool "Regular" + help + Protects functions with vulnerable objects. + This includes functions with buffers larger than 8 bytes or calls to alloca. config PKG_CC_STACKPROTECTOR_STRONG bool "Strong" + help + Like Regular, but also protects functions with + local arrays or references to local frame addresses. config PKG_CC_STACKPROTECTOR_ALL bool "All" + help + Protects all functions. endchoice choice @@ -294,10 +321,18 @@ menu "Global build settings" Enable GCC Stack-Smashing Protection (SSP) for the kernel config KERNEL_CC_STACKPROTECTOR_NONE bool "None" + help + No stack smashing protection. config KERNEL_CC_STACKPROTECTOR_REGULAR bool "Regular" + help + Protects functions with vulnerable objects. + This includes functions with buffers larger than 8 bytes or calls to alloca. config KERNEL_CC_STACKPROTECTOR_STRONG bool "Strong" + help + Like Regular, but also protects functions with + local arrays or references to local frame addresses. endchoice config KERNEL_STACKPROTECTOR diff --git a/config/Config-devel.in b/config/Config-devel.in index e16e6ecaa..cbac91c09 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -4,11 +4,9 @@ menuconfig DEVEL bool "Advanced configuration options (for developers)" - default n config BROKEN bool "Show broken platforms / packages / devices" if DEVEL - default n config BINARY_FOLDER string "Binary folder" if DEVEL @@ -53,7 +51,6 @@ menuconfig DEVEL config AUTOREMOVE bool "Automatic removal of build directories" if DEVEL - default n help Automatically delete build directories after make target completed. This allows you to symlink build_dir into a scratch location, e.g. a ramdisk, @@ -61,7 +58,6 @@ menuconfig DEVEL config BUILD_ALL_HOST_TOOLS bool "Compile all host tools" if DEVEL - default n help Compile all host host tools even if not needed. This is needed to prepare a universal precompiled host tools archive to use in another buildroot. @@ -84,7 +80,6 @@ menuconfig DEVEL config CCACHE bool "Use ccache" if DEVEL - default n help Compiler cache; see https://ccache.samba.org/ diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 101b4b5b6..91678cf2a 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -47,12 +47,12 @@ config KERNEL_MIPS_FP_SUPPORT config KERNEL_ARM_PMU bool - default y if TARGET_armvirt + default y if TARGET_armsr_armv8 depends on (arm || aarch64) config KERNEL_ARM_PMUV3 bool - default y if TARGET_armvirt + default y if TARGET_armsr_armv8 depends on (arm_v7 || aarch64) && LINUX_6_6 config KERNEL_RISCV_PMU @@ -66,7 +66,6 @@ config KERNEL_RISCV_PMU_SBI config KERNEL_X86_VSYSCALL_EMULATION bool "Enable vsyscall emulation" - default n depends on x86_64 help This enables emulation of the legacy vsyscall page. Disabling @@ -84,14 +83,12 @@ config KERNEL_X86_VSYSCALL_EMULATION config KERNEL_PERF_EVENTS bool "Compile the kernel with performance events and counters" - default n select KERNEL_ARM_PMU if (arm || aarch64) select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6 select KERNEL_RISCV_PMU if riscv64 config KERNEL_PROFILING bool "Compile the kernel with profiling enabled" - default n select KERNEL_PERF_EVENTS help Enable the extended profiling support mechanisms used by profilers such @@ -318,7 +315,6 @@ config KERNEL_KCOV_INSTRUMENT_ALL config KERNEL_TASKSTATS bool "Compile the kernel with task resource/io statistics and accounting" - default n help Enable the collection and publishing of task/io statistics and accounting. Enable this option to enable i/o monitoring in system @@ -337,6 +333,25 @@ if KERNEL_TASKSTATS endif +config KERNEL_PSI + bool "Compile the kernel with pressure stall information tracking" + help + Collect metrics that indicate how overcommitted the CPU, memory, + and IO capacity are in the system. + + If you say Y here, the kernel will create /proc/pressure/ with the + pressure statistics files cpu, memory, and io. These will indicate + the share of walltime in which some or all tasks in the system are + delayed due to contention of the respective resource. + + In kernels with cgroup support, cgroups (cgroup2 only) will + have cpu.pressure, memory.pressure, and io.pressure files, + which aggregate pressure stalls for the grouped tasks only. + + For more details see Documentation/accounting/psi.rst. + + Say N if unsure. + config KERNEL_KALLSYMS bool "Compile the kernel with symbol table information" default y if !SMALL_FLASH @@ -346,37 +361,30 @@ config KERNEL_KALLSYMS config KERNEL_FTRACE bool "Compile the kernel with tracing support" depends on !TARGET_uml - default n config KERNEL_FTRACE_SYSCALLS bool "Trace system calls" depends on KERNEL_FTRACE - default n config KERNEL_ENABLE_DEFAULT_TRACERS bool "Trace process context switches and events" depends on KERNEL_FTRACE - default n config KERNEL_FUNCTION_TRACER bool "Function tracer" depends on KERNEL_FTRACE - default n config KERNEL_FUNCTION_GRAPH_TRACER bool "Function graph tracer" depends on KERNEL_FUNCTION_TRACER - default n config KERNEL_DYNAMIC_FTRACE bool "Enable/disable function tracing dynamically" depends on KERNEL_FUNCTION_TRACER - default n config KERNEL_FUNCTION_PROFILER bool "Function profiler" depends on KERNEL_FUNCTION_TRACER - default n config KERNEL_IRQSOFF_TRACER bool "Interrupts-off Latency Tracer" @@ -427,7 +435,6 @@ config KERNEL_HIST_TRIGGERS config KERNEL_DEBUG_KERNEL bool - default n config KERNEL_DEBUG_INFO bool "Compile the kernel with debug information" @@ -438,7 +445,6 @@ config KERNEL_DEBUG_INFO config KERNEL_DEBUG_INFO_BTF bool "Enable additional BTF type information" - default n depends on !HOST_OS_MACOS depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED select DWARVES @@ -508,7 +514,6 @@ config KERNEL_DEBUG_LL config KERNEL_DEBUG_VIRTUAL bool "Compile the kernel with VM translations debugging" select KERNEL_DEBUG_KERNEL - default n help Enable checks sanity checks to catch invalid uses of virt_to_phys()/phys_to_virt() against the non-linear address space. @@ -516,7 +521,6 @@ config KERNEL_DEBUG_VIRTUAL config KERNEL_DYNAMIC_DEBUG bool "Compile the kernel with dynamic printk" select KERNEL_DEBUG_FS - default n help Compiles debug level messages into the kernel, which would not otherwise be available at runtime. These messages can then be @@ -528,7 +532,6 @@ config KERNEL_DYNAMIC_DEBUG config KERNEL_EARLY_PRINTK bool "Compile the kernel with early printk" default y if TARGET_bcm53xx - default n depends on arm select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_LL if arm @@ -539,7 +542,6 @@ config KERNEL_EARLY_PRINTK config KERNEL_KPROBES bool "Compile the kernel with kprobes support" - default n select KERNEL_FTRACE select KERNEL_PERF_EVENTS help @@ -556,7 +558,6 @@ config KERNEL_KPROBE_EVENTS config KERNEL_BPF_EVENTS bool "Compile the kernel with BPF event support" - default n select KERNEL_KPROBES help Allows to attach BPF programs to kprobe, uprobe and tracepoint events. @@ -592,7 +593,6 @@ config KERNEL_FANOTIFY config KERNEL_BLK_DEV_BSG bool "Compile the kernel with SCSI generic v4 support for any block device" - default n config KERNEL_TRANSPARENT_HUGEPAGE bool @@ -616,7 +616,6 @@ config KERNEL_HUGETLB_PAGE bool "Compile the kernel with HugeTLB support" select KERNEL_TRANSPARENT_HUGEPAGE select KERNEL_HUGETLBFS - default n config KERNEL_MAGIC_SYSRQ bool "Compile the kernel with SysRq support" @@ -641,7 +640,6 @@ config KERNEL_ELF_CORE config KERNEL_PROVE_LOCKING bool "Enable kernel lock checking" select KERNEL_DEBUG_KERNEL - default n config KERNEL_SOFTLOCKUP_DETECTOR bool "Compile the kernel with detect Soft Lockups" @@ -764,16 +762,13 @@ config KERNEL_CRASH_DUMP config USE_RFKILL bool "Enable rfkill support" - default y if TARGET_rockchip default RFKILL_SUPPORT config USE_SPARSE bool "Enable sparse check during kernel build" - default n config KERNEL_DEVTMPFS bool "Compile the kernel with device tmpfs enabled" - default n help devtmpfs is a simple, kernel-managed /dev filesystem. The kernel creates devices nodes for all registered devices to simplify boot, but leaves more @@ -783,7 +778,6 @@ if KERNEL_DEVTMPFS config KERNEL_DEVTMPFS_MOUNT bool "Automatically mount devtmpfs after root filesystem is mounted" - default n endif @@ -794,17 +788,14 @@ config KERNEL_KEYS config KERNEL_PERSISTENT_KEYRINGS bool "Enable kernel persistent keyrings" depends on KERNEL_KEYS - default n config KERNEL_KEYS_REQUEST_CACHE bool "Enable temporary caching of the last request_key() result" depends on KERNEL_KEYS - default n config KERNEL_BIG_KEYS bool "Enable large payload keys on kernel keyrings" depends on KERNEL_KEYS - default n # # CGROUP support symbols @@ -818,7 +809,6 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_DEBUG bool "Example debug cgroup subsystem" - default n help This option enables a simple cgroup subsystem that exports useful debugging information about the cgroups @@ -829,7 +819,6 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_FREEZER bool "legacy Freezer cgroup subsystem" - default n select KERNEL_FREEZER help Provides a way to freeze and unfreeze all tasks in a @@ -839,7 +828,6 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_DEVICE bool "legacy Device controller for cgroups" - default n help Provides a cgroup implementing whitelists for devices which a process in the cgroup can mknod or open. @@ -847,7 +835,6 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_HUGETLB bool "HugeTLB controller" - default n select KERNEL_HUGETLB_PAGE config KERNEL_CGROUP_PIDS @@ -876,7 +863,6 @@ if KERNEL_CGROUPS config KERNEL_PROC_PID_CPUSET bool "Include legacy /proc//cpuset file" - default n depends on KERNEL_CPUSETS config KERNEL_CGROUP_CPUACCT @@ -942,7 +928,6 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_SWAP_ENABLED bool "Memory Resource Controller Swap Extension enabled by default" - default n depends on KERNEL_MEMCG_SWAP help Memory Resource Controller Swap Extension comes with its price in @@ -971,7 +956,6 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_PERF bool "Enable perf_event per-cpu per-container group (cgroup) monitoring" select KERNEL_PERF_EVENTS - default n help This option extends the per-cpu mode to restrict monitoring to threads which belong to the cgroup specified and run on the @@ -1048,7 +1032,6 @@ if KERNEL_CGROUPS config KERNEL_DEBUG_BLK_CGROUP bool "Enable Block IO controller debugging" - default n depends on KERNEL_BLK_CGROUP help Enable some debugging help. Currently it exports additional stat @@ -1056,15 +1039,12 @@ if KERNEL_CGROUPS config KERNEL_NET_CLS_CGROUP bool "legacy Control Group Classifier" - default n config KERNEL_CGROUP_NET_CLASSID bool "legacy Network classid cgroup" - default n config KERNEL_CGROUP_NET_PRIO bool "legacy Network priority cgroup" - default n endif @@ -1226,9 +1206,11 @@ endif config KERNEL_NET_L3_MASTER_DEV bool "L3 Master device support" + default y if !SMALL_FLASH help This module provides glue between core networking code and device drivers to support L3 master devices like VRF. + Increases the compressed kernel size by ~4kB (as of Linux 6.6). config KERNEL_XDP_SOCKETS bool "XDP sockets support" @@ -1242,7 +1224,6 @@ config KERNEL_PAGE_POOL config KERNEL_PAGE_POOL_STATS bool "Page pool stats support" depends on KERNEL_PAGE_POOL - depends on !(LINUX_5_4||LINUX_5_10) config KERNEL_MPTCP bool "Multi-Path TCP support" @@ -1292,14 +1273,20 @@ if KERNEL_IP_PNP endif +config KERNEL_BTRFS_FS + bool "Compile the kernel with built-in BTRFS support" + help + Say Y here if you want to make the kernel to be able to boot off a + BTRFS partition. + menu "Filesystem ACL and attr support options" config USE_FS_ACL_ATTR bool "Use filesystem ACL and attr support by default" - default n + default y if !SMALL_FLASH help Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default - for kernel and packages, except tmpfs, flash filesystems, - and old NFS. Also enable userspace extended attribute support + for kernel and packages, except old NFS. + Also enable userspace extended attribute support by default. (OpenWrt already has an expection it will be present in the kernel). @@ -1320,17 +1307,17 @@ menu "Filesystem ACL and attr support options" config KERNEL_F2FS_FS_POSIX_ACL bool "Enable POSIX ACL for F2FS Filesystems" select KERNEL_FS_POSIX_ACL - default n + default y if USE_FS_ACL_ATTR config KERNEL_JFFS2_FS_POSIX_ACL bool "Enable POSIX ACL for JFFS2 Filesystems" select KERNEL_FS_POSIX_ACL - default n + default y if USE_FS_ACL_ATTR config KERNEL_TMPFS_POSIX_ACL bool "Enable POSIX ACL for TMPFS Filesystems" select KERNEL_FS_POSIX_ACL - default n + default y if USE_FS_ACL_ATTR config KERNEL_CIFS_ACL bool "Enable CIFS ACLs" @@ -1353,15 +1340,12 @@ menu "Filesystem ACL and attr support options" config KERNEL_NFS_V3_ACL_SUPPORT bool "Enable ACLs for NFSv3" - default n config KERNEL_NFSD_V2_ACL_SUPPORT bool "Enable ACLs for NFSDv2" - default n config KERNEL_NFSD_V3_ACL_SUPPORT bool "Enable ACLs for NFSDv3" - default n config KERNEL_REISER_FS_POSIX_ACL bool "Enable POSIX ACLs for ReiserFS" @@ -1470,12 +1454,30 @@ config KERNEL_LSM config KERNEL_EXT4_FS_SECURITY bool "Ext4 Security Labels" + default y if !SMALL_FLASH config KERNEL_F2FS_FS_SECURITY bool "F2FS Security Labels" + default y if !SMALL_FLASH config KERNEL_UBIFS_FS_SECURITY bool "UBIFS Security Labels" + default y if !SMALL_FLASH config KERNEL_JFFS2_FS_SECURITY bool "JFFS2 Security Labels" + default y if !SMALL_FLASH + +config KERNEL_WERROR + bool "Compile the kernel with warnings as errors" + help + A kernel build should not cause any compiler warnings, and this + enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags + to enforce that rule by default. Certain warnings from other tools + such as the linker may be upgraded to errors with this option as + well. + + However, if you have a new (or very old) compiler or linker with odd + and unusual warnings, or you have some architecture with problems, + you may need to disable this config option in order to + successfully build the kernel. diff --git a/config/check-hostcxx.sh b/config/check-hostcxx.sh new file mode 100755 index 000000000..442f4cfb4 --- /dev/null +++ b/config/check-hostcxx.sh @@ -0,0 +1,12 @@ +cat << EOF | "$STAGING_DIR_HOST/bin/g++" -c -x c++ -o /dev/null - >/dev/null 2>&1 +#if __clang__ + #if __clang_major__ < $3 + #error "clang too old" + #endif +#else + #if __GNUC__ < $1 || (__GNUC__ == $1 && (__GNUC_MINOR__ < $2)) + #error "gcc too old" + #endif +#endif +EOF +[ $? -eq 0 ] && echo y || echo n diff --git a/include/autotools.mk b/include/autotools.mk index f659bac3c..cba36ccd9 100644 --- a/include/autotools.mk +++ b/include/autotools.mk @@ -23,7 +23,8 @@ AM_TOOL_PATHS:= \ LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \ LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \ M4=$(STAGING_DIR_HOST)/bin/m4 \ - AUTOPOINT=true + AUTOPOINT=true \ + GTKDOCIZE=true # 1: build dir # 2: remove files diff --git a/package/libs/gettext-full/Makefile b/package/libs/gettext-full/Makefile index 55164644e..0a7782c1f 100644 --- a/package/libs/gettext-full/Makefile +++ b/package/libs/gettext-full/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gettext-full -PKG_VERSION:=0.21.1 +PKG_VERSION:=0.22.5 PKG_RELEASE:=1 PKG_SOURCE:=gettext-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gettext -PKG_HASH:=50dbc8f39797950aa2c98e939947c527e5ac9ebd2c1b99dd7b06ba33a6767ae6 +PKG_HASH:=fe10c37353213d78a5b83d48af231e005c4da84db5ce88037d88355938259640 PKG_BUILD_DIR:=$(BUILD_DIR)/gettext-$(PKG_VERSION) HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/gettext-$(PKG_VERSION) @@ -21,12 +21,44 @@ PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-3.0-or-later PKG_CPE_ID:=cpe:/a:gnu:gettext -PKG_FIXUP:=autoreconf PKG_INSTALL:=1 -PKG_BUILD_DEPENDS:=gettext-full/host +PKG_BUILD_DEPENDS:=gettext-full/host libunistring libxml2 PKG_BUILD_PARALLEL:=0 + +PKG_FIXUP:=autoreconf + +HOST_BUILD_DEPENDS:=gperf/host libiconv-full/host libunistring/host libxml2/host HOST_BUILD_PARALLEL:=0 +PKG_SUBDIRS:= \ + $$$$(foreach dir, \ + intl \ + intl-csharp \ + intl-java \ + its \ + gnulib-lib \ + gnulib-local \ + lib \ + $$$$(SUBDIR_libasprintf) \ + libgettextpo \ + libgrep \ + libtextstyle \ + m4 \ + misc \ + po \ + projects \ + src \ + styles \ + gettext-runtime \ + gettext-tools \ + ,$$$$(wildcard $$$$(dir)) ) + +PKG_MAKEFILES_FAKE:= \ + gnulib-local/m4/Makefile \ + libtextstyle/gnulib-local/Makefile \ + libtextstyle/m4/Makefile \ + m4/Makefile + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -38,6 +70,8 @@ define Package/libintl-full ABI_VERSION:=8 endef +export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR) + TARGET_CFLAGS += $(FPIC) ifneq ($(HOST_OS),Linux) TARGET_CFLAGS += -I$(STAGING_DIR_HOSTPKG)/include @@ -55,6 +89,8 @@ CONFIGURE_ARGS += \ --with-included-gettext \ --without-libintl-prefix \ --without-libexpat-prefix \ + --with-libunistring-prefix=$(STAGING_DIR)/usr \ + --with-libxml2-prefix=$(STAGING_DIR) \ --without-emacs HOST_CONFIGURE_ARGS += \ @@ -64,18 +100,62 @@ HOST_CONFIGURE_ARGS += \ --disable-rpath \ --disable-java \ --disable-openmp \ - --disable-curses \ --without-emacs \ - --without-libxml2-prefix + --with-libiconv-prefix=$(STAGING_DIR_HOSTPKG) \ + --with-libunistring-prefix=$(STAGING_DIR_HOSTPKG) \ + --with-libxml2-prefix=$(STAGING_DIR_HOSTPKG) HOST_CONFIGURE_VARS += \ EMACS="no" \ - am_cv_lib_iconv=no \ - am_cv_func_iconv=no \ - ac_cv_header_iconv_h=no \ HOST_CFLAGS += $(HOST_FPIC) +define Host/Bootstrap + ( \ + cd $(HOST_BUILD_DIR); \ + $(AM_TOOL_PATHS) \ + ./autogen.sh \ + ) +endef + +define Host/Prepare + $(call Host/Prepare/Default) + $(if $(QUILT),,$(call Host/Bootstrap)) +endef + +define Host/Configure + $(if $(QUILT),$(call Host/Bootstrap)) + $(call Host/Configure/Default) +endef + +define Host/Compile + $(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(HOST_BUILD_DIR)/$(makefile); ) + $(call Host/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)') +endef + +define Build/Bootstrap + ( \ + cd $(PKG_BUILD_DIR); \ + $(AM_TOOL_PATHS) \ + ./autogen.sh \ + ) +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(if $(QUILT),,$(call Build/Bootstrap)) +endef + +define Build/Configure + $(if $(QUILT),$(call Build/Bootstrap)) + $(call Build/Configure/Default) +endef + +define Build/Compile + $(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(PKG_BUILD_DIR)/$(makefile); ) + $(call Build/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)') +endef + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/libintl-full/include $(CP) $(PKG_INSTALL_DIR)/usr/include/libintl.h $(1)/usr/lib/libintl-full/include/ @@ -90,10 +170,14 @@ define Build/InstallDev endef define Host/Install - $(call Host/Install/Default) + $(call Host/Compile/Default,install SUBDIRS='$(PKG_SUBDIRS)') $(LN) msgfmt $(STAGING_DIR_HOSTPKG)/bin/gmsgfmt endef +define Build/Install + $(call Build/Install/Default,install SUBDIRS='$(PKG_SUBDIRS)') +endef + define Package/libintl-full/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libintl.so.* $(1)/usr/lib/ diff --git a/package/libs/gettext-full/patches/001-no_examples_and_tests.patch b/package/libs/gettext-full/patches/001-no_examples_and_tests.patch deleted file mode 100644 index d813d20ed..000000000 --- a/package/libs/gettext-full/patches/001-no_examples_and_tests.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/gettext-runtime/Makefile.am -+++ b/gettext-runtime/Makefile.am -@@ -27,7 +27,7 @@ SUBDIR_libasprintf = libasprintf - else - SUBDIR_libasprintf = - endif --SUBDIRS = doc intl intl-java intl-csharp gnulib-lib $(SUBDIR_libasprintf) src po man m4 tests -+SUBDIRS = intl intl-java intl-csharp gnulib-lib $(SUBDIR_libasprintf) src po m4 - - EXTRA_DIST = BUGS - ---- a/gettext-tools/Makefile.am -+++ b/gettext-tools/Makefile.am -@@ -19,7 +19,7 @@ - AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies - ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4 - --SUBDIRS = intl gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 tests system-tests gnulib-tests examples doc -+SUBDIRS = intl gnulib-lib libgrep src libgettextpo po its projects styles misc m4 - - EXTRA_DIST = misc/DISCLAIM - MOSTLYCLEANFILES = core *.stackdump diff --git a/package/libs/gettext-full/patches/010-m4.patch b/package/libs/gettext-full/patches/010-m4.patch deleted file mode 100644 index fe896db31..000000000 --- a/package/libs/gettext-full/patches/010-m4.patch +++ /dev/null @@ -1,342 +0,0 @@ ---- a/gettext-runtime/gnulib-m4/stddef_h.m4 -+++ b/gettext-runtime/gnulib-m4/stddef_h.m4 -@@ -9,7 +9,7 @@ dnl A placeholder for , for pl - AC_DEFUN_ONCE([gl_STDDEF_H], - [ - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) - - dnl Persuade OpenBSD to declare max_align_t. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ---- a/gettext-runtime/gnulib-m4/stdint.m4 -+++ b/gettext-runtime/gnulib-m4/stdint.m4 -@@ -15,7 +15,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - AC_REQUIRE([gl_LIMITS_H]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - - dnl For backward compatibility. Some packages may still be testing these - dnl macros. ---- a/gettext-runtime/gnulib-m4/wchar_h.m4 -+++ b/gettext-runtime/gnulib-m4/wchar_h.m4 -@@ -27,7 +27,7 @@ AC_DEFUN_ONCE([gl_WCHAR_H], - - AC_REQUIRE([gl_FEATURES_H]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/gettext-runtime/gnulib-m4/wchar_t.m4 -+++ b/gettext-runtime/gnulib-m4/wchar_t.m4 -@@ -8,7 +8,7 @@ dnl From Bruno Haible. - dnl Test whether has the 'wchar_t' type. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WCHAR_T], -+AC_DEFUN([gt_TYPE_WCHAR_T_GT], - [ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( ---- a/gettext-runtime/gnulib-m4/wctype_h.m4 -+++ b/gettext-runtime/gnulib-m4/wctype_h.m4 -@@ -22,7 +22,7 @@ AC_DEFUN_ONCE([gl_WCTYPE_H], - fi - AC_SUBST([HAVE_ISWCNTRL]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/gettext-runtime/gnulib-m4/wcwidth.m4 -+++ b/gettext-runtime/gnulib-m4/wcwidth.m4 -@@ -12,8 +12,8 @@ AC_DEFUN([gl_FUNC_WCWIDTH], - dnl Persuade glibc to declare wcwidth(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - - AC_CHECK_HEADERS_ONCE([wchar.h]) - AC_CHECK_FUNCS_ONCE([wcwidth]) ---- a/gettext-runtime/gnulib-m4/wint_t.m4 -+++ b/gettext-runtime/gnulib-m4/wint_t.m4 -@@ -9,7 +9,7 @@ dnl Test whether has the 'wint - dnl or would, if present, override 'wint_t'. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WINT_T], -+AC_DEFUN([gt_TYPE_WINT_T_GT], - [ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( ---- a/gettext-runtime/libasprintf/configure.ac -+++ b/gettext-runtime/libasprintf/configure.ac -@@ -76,8 +76,8 @@ dnl Checks for typedefs, structures, and - AC_C_INLINE - AC_TYPE_SIZE_T - AC_TYPE_LONG_LONG_INT --gt_TYPE_WCHAR_T --gt_TYPE_WINT_T -+gt_TYPE_WCHAR_T_GT -+gt_TYPE_WINT_T_GT - AC_TYPE_MBSTATE_T - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], ---- a/gettext-runtime/libasprintf/gnulib-m4/wchar_t.m4 -+++ b/gettext-runtime/libasprintf/gnulib-m4/wchar_t.m4 -@@ -8,7 +8,7 @@ dnl From Bruno Haible. - dnl Test whether has the 'wchar_t' type. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WCHAR_T], -+AC_DEFUN([gt_TYPE_WCHAR_T_GT], - [ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( ---- a/gettext-runtime/libasprintf/gnulib-m4/wint_t.m4 -+++ b/gettext-runtime/libasprintf/gnulib-m4/wint_t.m4 -@@ -9,7 +9,7 @@ dnl Test whether has the 'wint - dnl or would, if present, override 'wint_t'. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WINT_T], -+AC_DEFUN([gt_TYPE_WINT_T_GT], - [ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( ---- a/gettext-runtime/m4/intl.m4 -+++ b/gettext-runtime/m4/intl.m4 -@@ -31,8 +31,8 @@ AC_DEFUN([AM_INTL_SUBDIR], - AC_REQUIRE([gl_VISIBILITY])dnl - AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl - AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl -- AC_REQUIRE([gt_TYPE_WCHAR_T])dnl -- AC_REQUIRE([gt_TYPE_WINT_T])dnl -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT])dnl -+ AC_REQUIRE([gt_TYPE_WINT_T_GT])dnl - AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([gt_TYPE_INTMAX_T]) - AC_REQUIRE([gt_PRINTF_POSIX]) ---- a/gettext-tools/gnulib-m4/stdint.m4 -+++ b/gettext-tools/gnulib-m4/stdint.m4 -@@ -15,7 +15,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - AC_REQUIRE([gl_LIMITS_H]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - - dnl For backward compatibility. Some packages may still be testing these - dnl macros. ---- a/gettext-tools/gnulib-m4/vasnprintf.m4 -+++ b/gettext-tools/gnulib-m4/vasnprintf.m4 -@@ -32,16 +32,16 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], - # Prerequisites of lib/printf-args.h, lib/printf-args.c. - AC_DEFUN([gl_PREREQ_PRINTF_ARGS], - [ -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - ]) - - # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. - AC_DEFUN([gl_PREREQ_PRINTF_PARSE], - [ - AC_REQUIRE([gl_FEATURES_H]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], -@@ -54,8 +54,8 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], - AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], - [ - AC_REQUIRE([AC_FUNC_ALLOCA]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) - dnl Use the _snprintf function only if it is declared (because on NetBSD it - dnl is defined as a weak alias of snprintf; we prefer to use the latter). ---- a/gettext-tools/gnulib-m4/wchar_h.m4 -+++ b/gettext-tools/gnulib-m4/wchar_h.m4 -@@ -27,7 +27,7 @@ AC_DEFUN_ONCE([gl_WCHAR_H], - - AC_REQUIRE([gl_FEATURES_H]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/gettext-tools/gnulib-m4/wchar_t.m4 -+++ b/gettext-tools/gnulib-m4/wchar_t.m4 -@@ -8,7 +8,7 @@ dnl From Bruno Haible. - dnl Test whether has the 'wchar_t' type. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WCHAR_T], -+AC_DEFUN([gt_TYPE_WCHAR_T_GT], - [ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( ---- a/gettext-tools/gnulib-m4/wctype_h.m4 -+++ b/gettext-tools/gnulib-m4/wctype_h.m4 -@@ -22,7 +22,7 @@ AC_DEFUN_ONCE([gl_WCTYPE_H], - fi - AC_SUBST([HAVE_ISWCNTRL]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/gettext-tools/gnulib-m4/wcwidth.m4 -+++ b/gettext-tools/gnulib-m4/wcwidth.m4 -@@ -12,8 +12,8 @@ AC_DEFUN([gl_FUNC_WCWIDTH], - dnl Persuade glibc to declare wcwidth(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - - AC_CHECK_HEADERS_ONCE([wchar.h]) - AC_CHECK_FUNCS_ONCE([wcwidth]) ---- a/gettext-tools/gnulib-m4/wint_t.m4 -+++ b/gettext-tools/gnulib-m4/wint_t.m4 -@@ -9,7 +9,7 @@ dnl Test whether has the 'wint - dnl or would, if present, override 'wint_t'. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WINT_T], -+AC_DEFUN([gt_TYPE_WINT_T_GT], - [ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( ---- a/libtextstyle/gnulib-m4/stdint.m4 -+++ b/libtextstyle/gnulib-m4/stdint.m4 -@@ -15,7 +15,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - AC_REQUIRE([gl_LIMITS_H]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - - dnl For backward compatibility. Some packages may still be testing these - dnl macros. ---- a/libtextstyle/gnulib-m4/vasnprintf.m4 -+++ b/libtextstyle/gnulib-m4/vasnprintf.m4 -@@ -32,16 +32,16 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], - # Prerequisites of lib/printf-args.h, lib/printf-args.c. - AC_DEFUN([gl_PREREQ_PRINTF_ARGS], - [ -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - ]) - - # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. - AC_DEFUN([gl_PREREQ_PRINTF_PARSE], - [ - AC_REQUIRE([gl_FEATURES_H]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPE([ptrdiff_t], , - [AC_DEFINE([ptrdiff_t], [long], -@@ -54,8 +54,8 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], - AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], - [ - AC_REQUIRE([AC_FUNC_ALLOCA]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) - dnl Use the _snprintf function only if it is declared (because on NetBSD it - dnl is defined as a weak alias of snprintf; we prefer to use the latter). ---- a/libtextstyle/gnulib-m4/wchar_h.m4 -+++ b/libtextstyle/gnulib-m4/wchar_h.m4 -@@ -27,7 +27,7 @@ AC_DEFUN_ONCE([gl_WCHAR_H], - - AC_REQUIRE([gl_FEATURES_H]) - -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 - else ---- a/libtextstyle/gnulib-m4/wchar_t.m4 -+++ b/libtextstyle/gnulib-m4/wchar_t.m4 -@@ -8,7 +8,7 @@ dnl From Bruno Haible. - dnl Test whether has the 'wchar_t' type. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WCHAR_T], -+AC_DEFUN([gt_TYPE_WCHAR_T_GT], - [ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( ---- a/libtextstyle/gnulib-m4/wint_t.m4 -+++ b/libtextstyle/gnulib-m4/wint_t.m4 -@@ -9,7 +9,7 @@ dnl Test whether has the 'wint - dnl or would, if present, override 'wint_t'. - dnl Prerequisite: AC_PROG_CC - --AC_DEFUN([gt_TYPE_WINT_T], -+AC_DEFUN([gt_TYPE_WINT_T_GT], - [ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_COMPILE_IFELSE( ---- a/gettext-tools/gnulib-m4/gnulib-comp.m4 -+++ b/gettext-tools/gnulib-m4/gnulib-comp.m4 -@@ -2218,8 +2218,8 @@ changequote([, ])dnl - AC_REQUIRE([gl_SOCKETLIB]) - AC_REQUIRE([gl_SOCKETS]) - gl_TYPE_SOCKLEN_T -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -- AC_REQUIRE([gt_TYPE_WINT_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) -+ AC_REQUIRE([gt_TYPE_WINT_T_GT]) - gl_FUNC_STRERROR_R - AS_IF([test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1], [ - AC_LIBOBJ([strerror_r]) ---- a/libtextstyle/gnulib-m4/stddef_h.m4 -+++ b/libtextstyle/gnulib-m4/stddef_h.m4 -@@ -9,7 +9,7 @@ dnl A placeholder for , for pl - AC_DEFUN_ONCE([gl_STDDEF_H], - [ - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) - - dnl Persuade OpenBSD to declare max_align_t. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ---- a/gettext-tools/gnulib-m4/stddef_h.m4 -+++ b/gettext-tools/gnulib-m4/stddef_h.m4 -@@ -9,7 +9,7 @@ dnl A placeholder for , for pl - AC_DEFUN_ONCE([gl_STDDEF_H], - [ - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) -- AC_REQUIRE([gt_TYPE_WCHAR_T]) -+ AC_REQUIRE([gt_TYPE_WCHAR_T_GT]) - - dnl Persuade OpenBSD to declare max_align_t. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/package/libs/gettext-full/patches/020-fix_clang.patch b/package/libs/gettext-full/patches/020-fix_clang.patch deleted file mode 100644 index 284b5ab9f..000000000 --- a/package/libs/gettext-full/patches/020-fix_clang.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libtextstyle/lib/iconv-ostream.c -+++ b/libtextstyle/lib/iconv-ostream.c -@@ -231,7 +231,7 @@ iconv_ostream__write_mem (iconv_ostream_t stream, const void *data, size_t len) - } - - static void --iconv_ostream__flush (iconv_ostream_t stream) -+iconv_ostream__flush (iconv_ostream_t stream, ostream_flush_scope_t scope) - { - abort (); - } diff --git a/package/libs/gettext-full/patches/100-libxml-no-force-included.patch b/package/libs/gettext-full/patches/100-libxml-no-force-included.patch new file mode 100644 index 000000000..af5c0a47e --- /dev/null +++ b/package/libs/gettext-full/patches/100-libxml-no-force-included.patch @@ -0,0 +1,31 @@ +--- a/libtextstyle/gnulib-local/modules/libxml.diff ++++ /dev/null +@@ -1,28 +0,0 @@ +-*** libxml.orig 2018-10-28 14:37:07.007164889 +0100 +---- libxml 2019-02-14 22:19:29.994771110 +0100 +-*************** +-*** 118,124 **** +- fabs +- +- configure.ac: +-! gl_LIBXML +- +- Makefile.am: +- if INCLUDED_LIBXML +---- 118,133 ---- +- fabs +- +- configure.ac: +-! # In libtextstyle, we don't want to use an external libxml, because its +-! # dependencies and their dynamic relocations have an impact on the startup +-! # time of a program that is linked with it. As you can see by using +-! # 'readelf -r ... | wc -l' and 'readelf -d ... | grep NEEDED': +-! # - libxml2.so has more than 3300 relocations and depends on libicuuc. +-! # - libicuuc.so has more than 4900 relocations and depends on libstdc++. +-! # - libstdc++.so has more than 4600 relocations. +-! # These are more than 12800 relocations, to perform at program startup. +-! # So, force the use of the included libxml part. +-! gl_LIBXML([yes]) +- +- Makefile.am: +- if INCLUDED_LIBXML diff --git a/package/libs/gettext-full/patches/150-disable_libxml_iconv.patch b/package/libs/gettext-full/patches/150-disable_libxml_iconv.patch deleted file mode 100644 index bf60ecbdb..000000000 --- a/package/libs/gettext-full/patches/150-disable_libxml_iconv.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/gettext-tools/gnulib-lib/libxml/xmlversion.in.h -+++ b/gettext-tools/gnulib-lib/libxml/xmlversion.in.h -@@ -302,7 +302,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(i - * - * Whether iconv support is available - */ --#if 1 -+#if 0 - #define LIBXML_ICONV_ENABLED - #endif - ---- a/gnulib-local/lib/libxml/xmlversion.in.h -+++ b/gnulib-local/lib/libxml/xmlversion.in.h -@@ -302,7 +302,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(i - * - * Whether iconv support is available - */ --#if 1 -+#if 0 - #define LIBXML_ICONV_ENABLED - #endif - diff --git a/package/libs/gettext-full/patches/200-libunistring-missing-link.patch b/package/libs/gettext-full/patches/200-libunistring-missing-link.patch new file mode 100644 index 000000000..19a1ae177 --- /dev/null +++ b/package/libs/gettext-full/patches/200-libunistring-missing-link.patch @@ -0,0 +1,21 @@ +--- a/autogen.sh ++++ b/autogen.sh +@@ -81,6 +81,7 @@ if ! $skip_gnulib; then + getopt-gnu + gettext-h + havelib ++ libunistring-optional + memmove + noreturn + progname +--- a/gettext-runtime/src/Makefile.am ++++ b/gettext-runtime/src/Makefile.am +@@ -43,7 +43,7 @@ envsubst_SOURCES = envsubst.c + + # Link dependencies. + # Need @LTLIBICONV@ because striconv.c uses iconv(). +-LDADD = ../gnulib-lib/libgrt.a @LTLIBINTL@ @LTLIBICONV@ $(WOE32_LDADD) ++LDADD = ../gnulib-lib/libgrt.a $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ $(WOE32_LDADD) + + # Specify installation directory, for --enable-relocatable. + gettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\" diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 21764a2d2..44bf22f78 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -25,10 +25,14 @@ PKG_LICENSE_FILES:= COPYING \ libuuid/COPYING \ Documentation/licenses/COPYING.BSD-3 +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 +DISABLE_NLS:=--disable-nls + include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/meson.mk define Package/util-linux/Default SECTION:=utils @@ -548,69 +552,44 @@ define Package/wipefs/description libblkid. endef -MESON_ARGS += \ - -Dsystemd=disabled \ - -Dtinfo=disabled \ - -Dcryptsetup=disabled \ - -Dlibutil=disabled \ - -Dlibutempter=disabled \ - -Dlibpcre2-posix=disabled \ - -Dlibuser=disabled \ - -Duse-tty-group=false \ - -Duse-tls=false \ - -Dbuild-python=disabled \ - -Dbuild-zramctl=disabled \ - -Dbuild-fsck=disabled \ - -Dbuild-wipefs=disabled \ - -Dbuild-fallocate=disabled \ - -Dbuild-setpriv=disabled \ - -Dbuild-hardlink=disabled \ - -Dbuild-cramfs=disabled \ - -Dbuild-bfs=disabled \ - -Dbuild-minix=disabled \ - -Dbuild-fdformat=disabled \ - -Dbuild-lslogins=disabled \ - -Dbuild-wdctl=disabled \ - -Dbuild-cal=disabled \ - -Dbuild-switch_root=disabled \ - -Dbuild-pivot_root=disabled \ - -Dbuild-lsmem=disabled \ - -Dbuild-lsirq=disabled \ - -Dbuild-irqtop=disabled \ - -Dbuild-chmem=disabled \ - -Dbuild-ipcrm=disabled \ - -Dbuild-rfkill=disabled \ - -Dbuild-tunelp=disabled \ - -Dbuild-kill=disabled \ - -Dbuild-last=disabled \ - -Dbuild-utmpdump=disabled \ - -Dbuild-line=disabled \ - -Dbuild-mesg=disabled \ - -Dbuild-raw=disabled \ - -Dbuild-vipw=disabled \ - -Dbuild-newgrp=disabled \ - -Dbuild-chfn-chsh=disabled \ - -Dbuild-login=disabled \ - -Dbuild-nologin=disabled \ - -Dbuild-sulogin=disabled \ - -Dbuild-su=disabled \ - -Dbuild-runuser=disabled \ - -Dbuild-ul=disabled \ - -Dbuild-pg=disabled \ - -Dbuild-write=disabled \ - -Dbuild-bash-completion=disabled \ - -Dbuild-pylibmount=disabled \ - -Dreadline=disabled \ - -Dmagic=disabled \ - -Dncursesw=enabled +CONFIGURE_ARGS += \ + --disable-use-tty-group \ + --disable-rpath \ + --disable-tls \ + --disable-su \ + --disable-sulogin \ + --disable-makeinstall-chown \ + --disable-login \ + --disable-nologin \ + --disable-lslogins \ + --disable-runuser \ + --disable-chfn-chsh \ + --disable-raw \ + --without-python \ + --without-udev \ + --without-readline \ + --without-libmagic \ + --with-ncursesw + +TARGET_CFLAGS += $(FPIC) -std=gnu99 define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/blkid.pc $(1)/usr/lib/pkgconfig + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/blkid.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/blkid.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fdisk.pc $(1)/usr/lib/pkgconfig + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/fdisk.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/fdisk.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/mount.pc $(1)/usr/lib/pkgconfig + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/mount.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/mount.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/smartcols.pc $(1)/usr/lib/pkgconfig + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/smartcols.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/smartcols.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/uuid.pc $(1)/usr/lib/pkgconfig + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/uuid.pc + $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/uuid.pc $(INSTALL_DIR) $(1)/usr/include/blkid $(CP) $(PKG_INSTALL_DIR)/usr/include/blkid/blkid.h $(1)/usr/include/blkid @@ -624,37 +603,43 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/include/libsmartcols/libsmartcols.h $(1)/usr/include/libsmartcols $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so* $(1)/usr/lib + + $(LN) libblkid.so.1 $(1)/usr/lib/libblkid.so + $(LN) libfdisk.so.1 $(1)/usr/lib/libfdisk.so + $(LN) libmount.so.1 $(1)/usr/lib/libmount.so + $(LN) libuuid.so.1 $(1)/usr/lib/libuuid.so + $(LN) libsmartcols.so.1 $(1)/usr/lib/libsmartcols.so endef define Package/libfdisk/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so.* $(1)/usr/lib/ endef define Package/libblkid/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so.* $(1)/usr/lib/ endef define Package/libmount/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so.* $(1)/usr/lib/ endef define Package/libsmartcols/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so.* $(1)/usr/lib/ endef define Package/libuuid/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so.* $(1)/usr/lib/ endef define Package/agetty/install diff --git a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch b/package/utils/util-linux/patches/030-meson-don-t-use-run.patch deleted file mode 100644 index 7803dd772..000000000 --- a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch +++ /dev/null @@ -1,34 +0,0 @@ -From e25db9169450d3d5fb43656a2eae5c08999310f4 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:56:54 -0700 -Subject: [PATCH 2/7] meson: don't use run - -Fixes cross compilation. run is not needed anyway. - -Signed-off-by: Rosen Penev ---- - meson.build | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - ---- a/meson.build -+++ b/meson.build -@@ -577,8 +577,7 @@ int main(void) { - return tzname ? 0 : 1; - } - '''.format(have ? 1 : 0) --result = cc.run(code, name : 'using tzname[]') --have = result.compiled() and result.returncode() == 0 -+have = cc.compiles(code, name : 'using tzname[]') - conf.set('HAVE_TZNAME', have ? 1 : false) - - socket_libs = [] -@@ -641,8 +640,7 @@ int main(void) { - return (*__progname != 0); - } - ''' --result = cc.run(code, name : 'using __progname') --have = result.compiled() and result.returncode() == 0 -+have = cc.compiles(code, name : 'using __progname') - conf.set('HAVE___PROGNAME', have ? 1 : false) - - build_plymouth_support = get_option('build-plymouth-support') diff --git a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch b/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch deleted file mode 100644 index bdbfc4bfe..000000000 --- a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 4194bb5b35e9b5f3296bf17b7cabcc5cb1632ba3 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:55:15 -0700 -Subject: [PATCH 3/7] meson: fix cpu_set_t test - -_GNU_SOURCE is needed here. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -379,7 +379,7 @@ endforeach - have = cc.has_header('sched.h') - conf.set10('HAVE_DECL_CPU_ALLOC', have) - # We get -1 if the size cannot be determined --have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#include ') > 0 -+have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 - conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) - - have = cc.has_header_symbol('stdlib.h', 'environ') diff --git a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch b/package/utils/util-linux/patches/050-meson-fix-environ-search.patch deleted file mode 100644 index 2cd02e5b4..000000000 --- a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 1e9e2b9fe365cc4a0025d44dc0a9c54bfffe9058 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:16:17 -0700 -Subject: [PATCH 4/7] meson: fix environ search - -musl has it defined in unistd.h and hidden behind _GNU_SOURCE. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -382,7 +382,7 @@ conf.set10('HAVE_DECL_CPU_ALLOC', have) - have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 - conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) - --have = cc.has_header_symbol('stdlib.h', 'environ') -+have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') - conf.set10('HAVE_ENVIRON_DECL', have) - - have = cc.has_header_symbol('signal.h', 'sighandler_t') diff --git a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch b/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch deleted file mode 100644 index 7f9137f8b..000000000 --- a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 5d7557eb3827664b2b78145373907f2a6994bdf9 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:17:52 -0700 -Subject: [PATCH 5/7] meson: add _GNU_SOURCE for sighandler_t - -musl requires it. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -385,7 +385,7 @@ conf.set('HAVE_CPU_SET_T', have_cpu_set_ - have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') - conf.set10('HAVE_ENVIRON_DECL', have) - --have = cc.has_header_symbol('signal.h', 'sighandler_t') -+have = cc.has_header_symbol('signal.h', 'sighandler_t', prefix : '#define _GNU_SOURCE') - conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) - - have = cc.has_header_symbol('string.h', 'strsignal') diff --git a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch b/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch deleted file mode 100644 index a0b104f80..000000000 --- a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 777652585924034deeba98ae3192f26bc32bb661 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 18:19:53 -0700 -Subject: [PATCH 6/7] meson: fix isnan check - -musl only has isnan as a macro, not as a function. Handle the former -case. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -622,7 +622,7 @@ rtas_libs = cc.find_library('rtas', requ - conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) - - math_libs = [] --if not cc.has_function('isnan') -+if not cc.has_header_symbol('math.h', 'isnan') - lib = cc.find_library('m', required : true) - if (cc.has_function('isnan', dependencies : lib) and - cc.has_function('__isnan', dependencies : lib)) diff --git a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch b/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch deleted file mode 100644 index f5d53c4d3..000000000 --- a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 9a6b2618b46a859388139d1eb18f876886786659 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 19:00:53 -0700 -Subject: [PATCH] meson: fix tzname check - -tzname is not a type but a variable. sizeof only works on types. - -Signed-off-by: Rosen Penev ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -565,7 +565,7 @@ have = cc.has_member('struct tm', 'tm_zo - prefix : '#include ') - conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) - --have = cc.sizeof('tzname', prefix : '#include ') > 0 -+have = cc.has_header_symbol('time.h', 'tzname') - conf.set('HAVE_DECL_TZNAME', have ? 1 : false) - - code = ''' diff --git a/package/utils/util-linux/patches/090-meson-libpam.patch b/package/utils/util-linux/patches/090-meson-libpam.patch deleted file mode 100644 index c9a91b993..000000000 --- a/package/utils/util-linux/patches/090-meson-libpam.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/meson.build -+++ b/meson.build -@@ -299,10 +299,14 @@ conf.set('HAVE_LIBUDEV', lib_udev.found( - - lib_crypt = cc.find_library('crypt') - --lib_pam = cc.find_library('pam') -+req_libpam = not (get_option('build-login').disabled() or get_option('build-chfn-chsh').disabled() -+ or get_option('build-su').disabled() or get_option('build-runuser').disabled()) -+lib_pam = cc.find_library('pam', required : req_libpam) - if lib_pam.found() - lib_pam_misc = cc.find_library('pam_misc') - lib_pam = [lib_pam, lib_pam_misc] -+else -+ lib_pam_misc = declare_dependency() - endif - - lib_cryptsetup = dependency( diff --git a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch b/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch deleted file mode 100644 index d8b119900..000000000 --- a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cd23a4336f49ba6a12ade557a09589f2a7c966f4 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Mon, 2 May 2022 16:18:33 -0700 -Subject: [PATCH] meson: make libcap-ng dependent on setpriv - -Signed-off-by: Rosen Penev ---- - meson.build | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/meson.build -+++ b/meson.build -@@ -334,7 +334,8 @@ have = cc.has_function( - conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) - - lib_cap_ng = dependency( -- 'libcap-ng') -+ 'libcap-ng', -+ required : get_option('build-setpriv')) - - lib_selinux = dependency( - 'libselinux', -@@ -1754,7 +1755,7 @@ if opt and not is_disabler(exe) - exes += exe - endif - --opt = not get_option('build-setpriv').disabled() -+opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() - exe = executable( - 'setpriv', - setpriv_sources, diff --git a/package/utils/util-linux/patches/210-use-urandom.patch b/package/utils/util-linux/patches/100-use_urandom.patch similarity index 100% rename from package/utils/util-linux/patches/210-use-urandom.patch rename to package/utils/util-linux/patches/100-use_urandom.patch diff --git a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch b/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch deleted file mode 100644 index 8529c8268..000000000 --- a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch +++ /dev/null @@ -1,20 +0,0 @@ -From e0c1a86bf88b568a7afe8ebaea1b9f84afb892c2 Mon Sep 17 00:00:00 2001 -From: Eli Schwartz -Date: Wed, 4 May 2022 23:52:31 -0400 -Subject: [PATCH] meson: get the project version from the version-gen script - -This matches autotools and ensures that the version number is actually -reliable. ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -1,5 +1,5 @@ - project('util-linux', 'c', -- version : '2.37', -+ version : run_command('tools/git-version-gen', check: true).stdout(), - license : 'GPLv2+') - - pkgconfig = import('pkgconfig') diff --git a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch b/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch deleted file mode 100644 index 75e88682e..000000000 --- a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch +++ /dev/null @@ -1,26 +0,0 @@ -From dc307e1cbf73f6dbf72bb049c19d332774cdb4e7 Mon Sep 17 00:00:00 2001 -From: Eli Schwartz -Date: Thu, 5 May 2022 00:16:15 -0400 -Subject: [PATCH] meson: fix error in processing version for pc files - -This awk command was copied verbatim from configure.ac, which included -non-awk syntax because configure.ac cannot contain [ literals. - -Rewrite these autoconf quadrigraphs as their actual values, for meson. - -Fixes always setting the micro version to "0". ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -41,7 +41,7 @@ conf.set_quoted('PACKAGE_VERSION', meson - - codes = [''' {print $1} ''', - ''' {sub("-.*","",$2); print $2} ''', -- ''' {sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0} '''] -+ ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} '''] - pc_version = [] - foreach code : codes - res = run_command('bash', '-c', diff --git a/package/utils/util-linux/patches/200-meson-no-po.patch b/package/utils/util-linux/patches/200-meson-no-po.patch deleted file mode 100644 index d626036bb..000000000 --- a/package/utils/util-linux/patches/200-meson-no-po.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/meson.build -+++ b/meson.build -@@ -774,7 +774,6 @@ subdir('disk-utils') - subdir('misc-utils') - subdir('text-utils') - subdir('term-utils') --subdir('po') - - includes = [dir_include, - dir_libblkid, diff --git a/rules.mk b/rules.mk index 7a3a4b58a..54df407fc 100644 --- a/rules.mk +++ b/rules.mk @@ -20,14 +20,35 @@ endif export TMP_DIR:=$(TOPDIR)/tmp export TMPDIR:=$(TMP_DIR) +##@ +# @brief Strip quotes `"` and pounds `#` from string. +# +# @param 1: String. +## qstrip=$(strip $(subst ",,$(1))) #")) empty:= space:= $(empty) $(empty) comma:=, +pound:=\# +##@ +# @brief Merge strings by removing spaces. +# +# @param 1: String. +## merge=$(subst $(space),,$(1)) +##@ +# @brief Get hash sum of variable list. +# +# @param 1: List of variable names. +## confvar=$(shell echo '$(foreach v,$(1),$(v)=$(subst ','\'',$($(v))))' | $(MKHASH) md5) +##@ +# @brief Strip last extension from file name. +# +# @param 1: File name. +## strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1)) paren_left = ( @@ -50,9 +71,18 @@ __tr_head = $(subst $(paren_left)subst,$(paren_left)subst$(space),$(__tr_head_st __tr_tail = $(subst $(space),,$(foreach cv,$(1),$(paren_right))) __tr_template = $(__tr_head)$$(1)$(__tr_tail) +##@ +# @brief Convert string characters to upper. +## $(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper))) +##@ +# @brief Convert string characters to lower. +## $(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower))) +##@ +# @brief Abbreviate version. Truncate to 8 characters. +## version_abbrev = $(if $(if $(CHECK),,$(DUMP)),$(1),$(shell printf '%.8s' $(1))) _SINGLE=export MAKEFLAGS=$(space); @@ -101,6 +131,13 @@ endif DEFAULT_SUBDIR_TARGETS:=clean download prepare compile update refresh prereq dist distcheck configure check check-depends +##@ +# @brief Create default targets. +# +# Targets are created from @DEFAULT_SUBDIR_TARGETS and input argument lists. +# +# @param 1: Additional targets list. +## define DefaultTargets $(foreach t,$(DEFAULT_SUBDIR_TARGETS) $(1), .$(t): @@ -140,8 +177,8 @@ ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),) iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2) endif -PACKAGE_DIR:=$(BIN_DIR)/packages -PACKAGE_DIR_ALL:=$(TOPDIR)/staging_dir/packages/$(BOARD) +PACKAGE_DIR?=$(BIN_DIR)/packages +PACKAGE_DIR_ALL?=$(TOPDIR)/staging_dir/packages/$(BOARD) BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME) STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME) BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/$(TOOLCHAIN_DIR_NAME) @@ -184,33 +221,38 @@ ifndef DUMP -include $(TOOLCHAIN_DIR)/info.mk export GCC_HONOUR_COPTS:=0 TARGET_CROSS:=$(if $(TARGET_CROSS),$(TARGET_CROSS),$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))-) + TOOLCHAIN_ROOT_DIR:=$(TOPDIR)/staging_dir/$(TOOLCHAIN_DIR_NAME) + TOOLCHAIN_BIN_DIRS:=$(TOOLCHAIN_ROOT_DIR)/bin + TOOLCHAIN_INC_DIRS:=$(TOOLCHAIN_ROOT_DIR)/usr/include $(TOOLCHAIN_ROOT_DIR)/include + TOOLCHAIN_LIB_DIRS:=$(TOOLCHAIN_ROOT_DIR)/usr/lib $(TOOLCHAIN_ROOT_DIR)/lib TARGET_CFLAGS+= -fhonour-copts - TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/usr/include ifeq ($(CONFIG_USE_MUSL),y) - TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include/fortify + TOOLCHAIN_INC_DIRS+= $(TOOLCHAIN_DIR)/include/fortify endif - TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include - TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib - TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH) else ifeq ($(CONFIG_NATIVE_TOOLCHAIN),) + -include $(TOOLCHAIN_DIR)/info.mk TARGET_CROSS:=$(call qstrip,$(CONFIG_TOOLCHAIN_PREFIX)) TOOLCHAIN_ROOT_DIR:=$(call qstrip,$(CONFIG_TOOLCHAIN_ROOT)) TOOLCHAIN_BIN_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_BIN_PATH))) TOOLCHAIN_INC_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_INC_PATH))) TOOLCHAIN_LIB_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_LIB_PATH))) - ifneq ($(TOOLCHAIN_BIN_DIRS),) - TARGET_PATH:=$(subst $(space),:,$(TOOLCHAIN_BIN_DIRS)):$(TARGET_PATH) - endif - ifneq ($(TOOLCHAIN_INC_DIRS),) - TARGET_CPPFLAGS+= $(patsubst %,-I%,$(TOOLCHAIN_INC_DIRS)) - endif - ifneq ($(TOOLCHAIN_LIB_DIRS),) - TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS)) - endif endif endif + ifneq ($(TOOLCHAIN_BIN_DIRS),) + TARGET_PATH:=$(subst $(space),:,$(TOOLCHAIN_BIN_DIRS)):$(TARGET_PATH) + endif + ifneq ($(TOOLCHAIN_INC_DIRS),) + TARGET_CPPFLAGS+= $(patsubst %,-I%,$(TOOLCHAIN_INC_DIRS)) + endif + ifneq ($(TOOLCHAIN_LIB_DIRS),) + TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS)) + endif endif + +TARGET_LINKER?=bfd +TARGET_LDFLAGS+= -fuse-ld=$(TARGET_LINKER) + TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(STAGING_DIR_HOSTPKG)/bin:$(TARGET_PATH) ifeq ($(CONFIG_SOFT_FLOAT),y) @@ -227,6 +269,7 @@ else endif endif +export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) export PATH:=$(TARGET_PATH) export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh; @@ -235,14 +278,16 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config export PKG_CONFIG -HOSTCC:=gcc -HOSTCXX:=g++ +HOSTCC:=$(STAGING_DIR_HOST)/bin/gcc +HOSTCXX:=$(STAGING_DIR_HOST)/bin/g++ HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include) -HOST_CXXFLAGS:= HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS) +HOST_CXXFLAGS:=$(HOST_CFLAGS) HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib) BUILD_KEY=$(TOPDIR)/key-build +BUILD_KEY_APK_SEC=$(TOPDIR)/private-key.pem +BUILD_KEY_APK_PUB=$(TOPDIR)/public-key.pem FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot @@ -251,7 +296,9 @@ TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib TARGET_NM:=$(TARGET_CROSS)gcc-nm TARGET_CC:=$(TARGET_CROSS)gcc TARGET_CXX:=$(TARGET_CROSS)g++ +TARGET_LD:=$(TARGET_CROSS)ld.$(TARGET_LINKER) KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh +FILECMD:=$(STAGING_DIR_HOST)/bin/file SED:=$(STAGING_DIR_HOST)/bin/sed -i -e ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash @@ -267,6 +314,14 @@ FIND:=find PATCH:=patch PYTHON:=python3 +ifeq ($(HOST_OS),Darwin) + TRUE:=/usr/bin/env gtrue + FALSE:=/usr/bin/env gfalse +else + TRUE:=/usr/bin/env true + FALSE:=/usr/bin/env false +endif + INSTALL_BIN:=install -m0755 INSTALL_SUID:=install -m4755 INSTALL_DIR:=install -d -m0755 @@ -283,8 +338,8 @@ export HOSTCC_NOCACHE export HOSTCXX_NOCACHE ifneq ($(CONFIG_CCACHE),) - TARGET_CC:= ccache_cc - TARGET_CXX:= ccache_cxx + TARGET_CC:= ccache $(TARGET_CC) + TARGET_CXX:= ccache $(TARGET_CXX) HOSTCC:= ccache $(HOSTCC) HOSTCXX:= ccache $(HOSTCXX) export CCACHE_BASEDIR:=$(TOPDIR) @@ -295,7 +350,7 @@ endif TARGET_CONFIGURE_OPTS = \ AR="$(TARGET_AR)" \ AS="$(TARGET_CC) -c $(TARGET_ASFLAGS)" \ - LD=$(TARGET_CROSS)ld \ + LD="$(TARGET_LD)" \ NM="$(TARGET_NM)" \ CC="$(TARGET_CC)" \ GCC="$(TARGET_CC)" \ @@ -315,7 +370,7 @@ else STRIP:=$(TARGET_CROSS)strip $(call qstrip,$(CONFIG_STRIP_ARGS)) else ifneq ($(CONFIG_USE_SSTRIP),) - STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(call qstrip,$(CONFIG_SSTRIP_ARGS)) + STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(if $(CONFIG_SSTRIP_DISCARD_TRAILING_ZEROES),-z) endif endif RSTRIP= \ @@ -352,17 +407,45 @@ export BISON_PKGDATADIR:=$(STAGING_DIR_HOST)/share/bison export HOST_GNULIB_SRCDIR:=$(STAGING_DIR_HOST)/share/gnulib export M4:=$(STAGING_DIR_HOST)/bin/m4 +##@ +# @brief Slugify variable name and prepend suffix. +## define shvar V_$(subst .,_,$(subst -,_,$(subst /,_,$(1)))) endef +##@ +# @brief Create and export variable, set to function result. +# +# @param 1: Function name. Used as variable name, prepended with `V_`. +## define shexport export $(call shvar,$(1))=$$(call $(1)) endef -# Execute commands under flock -# $(1) => The shell expression. -# $(2) => The lock name. If not given, the global lock will be used. +##@ +# @brief Support 64 bit tine in C code. +# +# Test support for 64-bit time with C code from largefile.m4 provided by GNU Gnulib +# the value is `y` when successful and `` otherwise +## +define YEAR_2038 +$(shell \ + mkdir -p $(TMP_DIR); \ + echo '$(pound) include ' > $(TMP_DIR)/year2038.c; \ + echo '$(pound) define LARGE_TIME_T ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))' >> $(TMP_DIR)/year2038.c; \ + echo 'int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1];' >> $(TMP_DIR)/year2038.c; \ + echo 'int main (void) {return 0;}' >> $(TMP_DIR)/year2038.c; \ + $(HOSTCC) $(TMP_DIR)/year2038.c -o /dev/null 2>/dev/null && echo y && rm -f $(TMP_DIR)/year2038.c || rm -f $(TMP_DIR)/year2038.c; \ +) +endef + +##@ +# @brief Execute commands under flock +# +# @param 1: The shell expression. +# @param 2: The lock name. If not given, the global lock will be used. +## ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),) define locked SHELL= \ @@ -374,10 +457,14 @@ else locked=$(1) endif -# Recursively copy paths into another directory, purge dangling + +##@ +# @brief Recursively copy paths into another directory, purge dangling # symlinks before. -# $(1) => File glob expression -# $(2) => Destination directory +# +# @param 1: File glob expression. +# @param 1: Destination directory. +## define file_copy for src_dir in $(sort $(foreach d,$(wildcard $(1)),$(dir $(d)))); do \ ( cd $$src_dir; find -type f -or -type d ) | \ @@ -392,19 +479,30 @@ define file_copy $(CP) $(1) $(2) endef -# Calculate sha256sum of any plain file within a given directory -# $(1) => Input directory -# $(2) => If set, recurse into subdirectories +##@ +# @brief Calculate sha256sum of any plain file within a given directory. +# +# @param 1: Input directory. +# @param 2: If set, recurse into subdirectories. +## define sha256sums (cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ xargs -r $(MKHASH) -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums) endef -# file extension +##@ +# @brief Retrieve file extension. +# +# @param 1: File name. +## ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) -# Count Git commits of a package -# $(1) => if non-empty: count commits since last ": [uU]pdate to " or ": [bB]ump to " in commit message +##@ +# @brief Count Git commits of a package. +# +# @param 1: if non-empty: count commits since last ": [uU]pdate to " +# or ": [bB]ump to " in commit message. +## define commitcount $(shell \ if git log -1 >/dev/null 2>/dev/null; then \ @@ -426,6 +524,11 @@ $(shell \ ) endef +##@ +# @brief Get ABI version string, stripping `-`, `_` and `.`. +# +# @param 1: Version string. +## abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1)))) COMMITCOUNT = $(if $(DUMP),0,$(call commitcount)) diff --git a/tools/7z/Makefile b/tools/7z/Makefile index 90362e797..962fd5729 100644 --- a/tools/7z/Makefile +++ b/tools/7z/Makefile @@ -1,32 +1,27 @@ include $(TOPDIR)/rules.mk PKG_NAME:=7z -PKG_VERSION:=22.01 -PKG_SOURCE_VERSION:=2201 +PKG_VERSION:=24.05 -PKG_SOURCE:=$(PKG_NAME)$(PKG_SOURCE_VERSION)-src.tar.xz +PKG_SOURCE:=$(PKG_NAME)$(subst .,,$(PKG_VERSION))-src.tar.xz PKG_SOURCE_URL:=https://7-zip.org/a/ -PKG_HASH:=393098730c70042392af808917e765945dc2437dee7aae3cfcc4966eb920fbc5 +PKG_HASH:=63f341cf80b8d287c6e945519b3da0fa75553c85572a471b7fa6e68f9a90b790 + +PKG_CPE_ID:=cpe:/a:7-zip:7-zip # This builds the 7zr variant which supports only 7z, so no non-LGPL code should be included PKG_LICENSE:=LGPL-2.1-or-later PKG_LICENSE_FILES:=DOC/License.txt DOC/copying.txt -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) +HOST_MAKE_PATH:=CPP/7zip/Bundles/Alone7z include $(INCLUDE_DIR)/host-build.mk -TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) - -ALONE_DIR=$(HOST_BUILD_DIR)/CPP/7zip/Bundles/Alone7z - -define Host/Compile - $(MAKE) -C $(ALONE_DIR) -f makefile.gcc -endef +TAR_OPTIONS := -C $(HOST_BUILD_DIR) $(TAR_OPTIONS) +HOST_MAKE_FLAGS += -f makefile.gcc define Host/Install - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin - $(INSTALL_BIN) $(ALONE_DIR)/_o/7zr $(STAGING_DIR_HOST)/bin/7zr + $(INSTALL_BIN) $(HOST_BUILD_DIR)/$(HOST_MAKE_PATH)/_o/7zr $(STAGING_DIR_HOST)/bin/ endef define Host/Clean diff --git a/tools/7z/patches/7-zip-flags.patch b/tools/7z/patches/7-zip-flags.patch new file mode 100644 index 000000000..5c684b068 --- /dev/null +++ b/tools/7z/patches/7-zip-flags.patch @@ -0,0 +1,20 @@ +--- a/CPP/7zip/7zip_gcc.mak ++++ b/CPP/7zip/7zip_gcc.mak +@@ -24,7 +24,7 @@ PROGPATH_STATIC = $(O)/$(PROG)s + + + ifneq ($(CC), xlc) +-CFLAGS_WARN_WALL = -Werror -Wall -Wextra ++CFLAGS_WARN_WALL = -Wall -Wextra + endif + + # for object file +@@ -50,7 +50,7 @@ endif + endif + + # CFLAGS_BASE_LIST = -S +-CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \ ++CFLAGS_BASE = $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) -D_GNU_SOURCE \ + $(CFLAGS_DEBUG) -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + -fPIC + diff --git a/tools/7z/patches/7-zip-musl.patch b/tools/7z/patches/7-zip-musl.patch new file mode 100644 index 000000000..a08520a25 --- /dev/null +++ b/tools/7z/patches/7-zip-musl.patch @@ -0,0 +1,36 @@ +--- a/C/Threads.c ++++ b/C/Threads.c +@@ -265,7 +265,7 @@ WRes Thread_Create_With_CpuSet(CThread * + */ + + // ret2 = +- pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); ++ //pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + #endif + } +@@ -275,14 +275,12 @@ WRes Thread_Create_With_CpuSet(CThread * + if (!ret) + { + p->_created = 1; +- /* + if (cpuSet) + { + // ret2 = + pthread_setaffinity_np(p->_tid, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + } +- */ + } + } + // ret2 = +--- a/C/Threads.h ++++ b/C/Threads.h +@@ -29,6 +29,7 @@ Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_ + #endif + + #include ++#include + + #endif + diff --git a/tools/Makefile b/tools/Makefile index d18c5f167..df6cb64e5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -20,6 +20,9 @@ endif ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_BRCMSMAC_USE_FW_FROM_WL),) BUILD_B43_TOOLS = y endif +ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),) + BUILD_BZIP2_TOOLS = y +endif ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),) BUILD_LZ4_TOOLS = y endif @@ -36,6 +39,7 @@ tools-y += cmake tools-y += cpio tools-y += dosfstools tools-y += e2fsprogs +tools-y += elfutils tools-y += expat tools-y += fakeroot tools-y += findutils @@ -60,26 +64,28 @@ tools-y += patch-image tools-y += patchelf tools-y += pkgconf tools-y += quilt -tools-y += squashfskit4 +tools-y += squashfs4 tools-y += sstrip tools-y += util-linux +tools-y += xz tools-y += zip tools-y += zlib -tools-y += zstd tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS),y) += liblzo tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_BZIP2_TOOLS),y) += bzip2 tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZ4_TOOLS),y) += lz4 tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZO_TOOLS),y) += lzop tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs -tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs3-lzma tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_mxs),y) += elftosb sdimage tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_realtek),y) += 7z tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_tegra),y) += cbootimage cbootimage-configs -tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += kernel2minor +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += yafut tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_SPARSE),y) += sparse tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_MOLD),y) += mold # builddir dependencies $(curdir)/autoconf/compile := $(curdir)/m4/compile @@ -90,7 +96,8 @@ $(curdir)/bison/compile := $(curdir)/flex/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/dosfstools/compile := $(curdir)/automake/compile -$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile +$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile $(curdir)/util-linux/compile +$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile $(curdir)/libtool/compile $(curdir)/fakeroot/compile := $(curdir)/libtool/compile $(curdir)/findutils/compile := $(curdir)/bison/compile $(curdir)/firmware-utils/compile += $(curdir)/cmake/compile @@ -101,7 +108,8 @@ $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/isl/compile := $(curdir)/gmp/compile $(curdir)/liblzo/compile := $(curdir)/cmake/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile -$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile +$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/gnulib/compile $(curdir)/missing-macros/compile +$(curdir)/lz4/compile := $(curdir)/meson/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/lzop/compile := $(curdir)/cmake/compile $(curdir)/liblzo/compile $(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile @@ -110,6 +118,7 @@ $(curdir)/meson/compile := $(curdir)/ninja/compile $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile $(curdir)/mkimage/compile += $(curdir)/bison/compile $(curdir)/libressl/compile $(curdir)/mklibs/compile := $(curdir)/libtool/compile +$(curdir)/mold/compile := $(curdir)/cmake/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile $(curdir)/mpfr/compile := $(curdir)/gmp/compile $(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile @@ -118,22 +127,21 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile $(curdir)/pkgconf/compile := $(curdir)/meson/compile $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile $(curdir)/sdcc/compile := $(curdir)/bison/compile -$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile -$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile -$(curdir)/util-linux/compile := $(curdir)/meson/compile $(curdir)/bison/compile -$(curdir)/zstd/compile := $(curdir)/meson/compile +$(curdir)/squashfs3-lzma/compile := $(curdir)/lzma-old/compile +$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile +$(curdir)/util-linux/compile := $(curdir)/bison/compile $(curdir)/automake/compile +$(curdir)/yafut/compile := $(curdir)/cmake/compile ifneq ($(HOST_OS),Linux) - $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile + $(curdir)/coreutils/compile += $(curdir)/automake/compile $(curdir)/bison/compile $(curdir)/gnulib/compile + $(curdir)/squashfs4/compile += $(curdir)/coreutils/compile tools-y += coreutils endif ifeq ($(HOST_OS),Darwin) tools-y += bash else $(curdir)/dwarves/compile += $(curdir)/elfutils/compile - $(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves - tools-y += elfutils endif ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) @@ -146,22 +154,23 @@ endif # dependency for tools which have patches directory $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/compile))) -$(foreach tool, $(filter-out xz,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/xz/compile)) +$(foreach tool, $(filter-out zstd,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/zstd/compile)) # make any tool depend on the following to ensure that archives can be unpacked and patched properly tools-core += libdeflate tools-core += patch tools-core += tar -tools-core += xz +tools-core += zstd $(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/compile,$(tools-core)))) tools-y += $(tools-core) -# make core tools depend on sed and flock -$(foreach tool, $(filter-out xz,$(tools-core)), $(eval $(curdir)/$(tool)/compile += $(curdir)/sed/compile)) -$(curdir)/xz/compile += $(curdir)/flock/compile +# make some core tools depend on sed and flock +$(curdir)/patch/compile += $(curdir)/sed/compile +$(curdir)/tar/compile += $(curdir)/sed/compile +$(curdir)/zstd/compile += $(curdir)/libdeflate/compile -$(curdir)/sed/compile := $(curdir)/flock/compile $(curdir)/xz/compile +$(curdir)/sed/compile := $(curdir)/flock/compile $(curdir)/zstd/compile tools-y += flock sed $(curdir)/autoremove := 1 diff --git a/tools/autoconf-archive/Makefile b/tools/autoconf-archive/Makefile index 228a27cf6..a4ab42377 100644 --- a/tools/autoconf-archive/Makefile +++ b/tools/autoconf-archive/Makefile @@ -1,28 +1,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=autoconf-archive -PKG_VERSION:=2021.02.19 +PKG_VERSION:=2023.02.20 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/autoconf-archive -PKG_HASH:=e8a6eb9d28ddcba8ffef3fa211653239e9bf239aba6a01a6b7cfc7ceaec69cbd +PKG_HASH:=71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33 include $(INCLUDE_DIR)/host-build.mk -HOST_CONFIGURE_ARGS += \ - --datarootdir=$(STAGING_DIR_HOST)/share - -define Host/Compile - export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) -endef - -define Host/Install - export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) install -endef - -define Host/Clean - -export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) endef $(eval $(call HostBuild)) diff --git a/tools/autoconf-archive/patches/001-fix_ax_c_float_words_bigendian.patch b/tools/autoconf-archive/patches/001-fix_ax_c_float_words_bigendian.patch deleted file mode 100644 index 521cb9786..000000000 --- a/tools/autoconf-archive/patches/001-fix_ax_c_float_words_bigendian.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- a/m4/ax_c_float_words_bigendian.m4 -+++ b/m4/ax_c_float_words_bigendian.m4 -@@ -27,32 +27,81 @@ - # If neither value is found, the user is instructed to specify the - # ordering. - # -+# Early versions of this macro (i.e., before serial 12) would not work -+# when interprocedural optimization (via link-time optimization) was -+# enabled. This would happen when, say, the GCC/clang "-flto" flag, or the -+# ICC "-ipo" flag was used, for example. The problem was that under these -+# conditions, the compiler did not allocate for and write the special -+# float value in the data segment of the object file, since doing so might -+# not prove optimal once more context was available. Thus, the special -+# value (in platform-dependent binary form) could not be found in the -+# object file, and the macro would fail. -+# -+# The solution to the above problem was to: -+# -+# 1) Compile and link a whole test program rather than just compile an -+# object file. This ensures that we reach the point where even an -+# interprocedural optimizing compiler writes values to the data segment. -+# -+# 2) Add code that requires the compiler to write the special value to -+# the data segment, as opposed to "optimizing away" the variable's -+# allocation. This could be done via compiler keywords or options, but -+# it's tricky to make this work for all versions of all compilers with -+# all optimization settings. The chosen solution was to make the exit -+# code of the test program depend on the storing of the special value -+# in memory (in the data segment). Because the exit code can be -+# verified, any compiler that aspires to be correct will produce a -+# program binary that contains the value, which the macro can then find. -+# -+# How does the exit code depend on the special value residing in memory? -+# Memory, unlike variables and registers, can be addressed indirectly at -+# run time. The exit code of this test program is a result of indirectly -+# reading and writing to the memory region where the special value is -+# supposed to reside. The actual memory addresses used and the values to -+# be written are derived from the the program input ("argv") and are -+# therefore not known at compile or link time. The compiler has no choice -+# but to defer the computation to run time, and to prepare by allocating -+# and populating the data segment with the special value. For further -+# details, refer to the source code of the test program. -+# -+# Note that the test program is never meant to be run. It only exists to -+# host a double float value in a given platform's binary format. Thus, -+# error handling is not included. -+# - # LICENSE - # --# Copyright (c) 2008 Daniel Amelang -+# Copyright (c) 2008, 2023 Daniel Amelang - # - # Copying and distribution of this file, with or without modification, are - # permitted in any medium without royalty provided the copyright notice - # and this notice are preserved. This file is offered as-is, without any - # warranty. - --#serial 11 -+#serial 13 - - AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN], - [AC_CACHE_CHECK(whether float word ordering is bigendian, - ax_cv_c_float_words_bigendian, [ - - ax_cv_c_float_words_bigendian=unknown --AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -+AC_LINK_IFELSE([AC_LANG_SOURCE([[ -+ -+#include -+ -+static double m[] = {9.090423496703681e+223, 0.0}; - --double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0; -+int main (int argc, char *argv[]) -+{ -+ m[atoi (argv[1])] += atof (argv[2]); -+ return m[atoi (argv[3])] > 0.0; -+} - - ]])], [ - --if grep noonsees conftest.$ac_objext >/dev/null ; then -+if grep noonsees conftest$EXEEXT >/dev/null ; then - ax_cv_c_float_words_bigendian=yes - fi --if grep seesnoon conftest.$ac_objext >/dev/null ; then -+if grep seesnoon conftest$EXEEXT >/dev/null ; then - if test "$ax_cv_c_float_words_bigendian" = unknown; then - ax_cv_c_float_words_bigendian=no - else diff --git a/tools/autoconf/Makefile b/tools/autoconf/Makefile index 6eb64d77d..d933c712b 100644 --- a/tools/autoconf/Makefile +++ b/tools/autoconf/Makefile @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2006-2015 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. @@ -7,31 +7,25 @@ include $(TOPDIR)/rules.mk PKG_NAME:=autoconf -PKG_VERSION:=2.69 +PKG_VERSION:=2.71 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/autoconf -PKG_HASH:=64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684 +PKG_HASH:=431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c include $(INCLUDE_DIR)/host-build.mk -HOST_CONFIGURE_ARGS += \ - --datarootdir=$(STAGING_DIR_HOST)/share - HOST_CONFIGURE_VARS += \ + EMACS="no" \ PERL="/usr/bin/env perl" define Host/Compile - export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) + -$(call Host/Compile/Default,--touch install-man1) # disable building of man pages + $(call Host/Compile/Default) endef -define Host/Install - export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) install -endef - -define Host/Clean - -export SHELL="$(BASH)"; $(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) endef $(eval $(call HostBuild)) diff --git a/tools/autoconf/patches/000-relocatable.patch b/tools/autoconf/patches/000-relocatable.patch index a935671ce..3961d2264 100644 --- a/tools/autoconf/patches/000-relocatable.patch +++ b/tools/autoconf/patches/000-relocatable.patch @@ -1,7 +1,11 @@ --- a/bin/autoheader.in +++ b/bin/autoheader.in -@@ -28,7 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0"; +@@ -30,9 +30,12 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; ++$^W = 1; ++ BEGIN { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; @@ -10,33 +14,23 @@ unshift @INC, "$pkgdatadir"; # Override SHELL. On DJGPP SHELL may not be set to a shell -@@ -50,7 +51,7 @@ use strict; - use vars qw ($config_h %verbatim %symbol); +@@ -54,7 +57,7 @@ use Autom4te::XFile; + our ($config_h, %symbol, %verbatim); # Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; +my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); - local $config_h; my $config_h_in; my @prepend_include; + my @include; --- a/bin/autom4te.in +++ b/bin/autom4te.in -@@ -1,10 +1,12 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - - eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; +@@ -26,9 +26,12 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; +$^W = 1; + - # autom4te - Wrapper around M4 libraries. - # Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc. - -@@ -24,7 +26,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0"; - BEGIN { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; @@ -45,8 +39,8 @@ unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell -@@ -44,7 +47,8 @@ use File::Basename; - use strict; +@@ -48,7 +51,8 @@ use Autom4te::General; + use Autom4te::XFile; # Data directory. -my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; @@ -55,7 +49,7 @@ # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. my %language; -@@ -87,7 +91,7 @@ my @include; +@@ -91,7 +95,7 @@ my @include; my $freeze = 0; # $M4. @@ -64,7 +58,7 @@ # Some non-GNU m4's don't reject the --help option, so give them /dev/null. fatal "need GNU m4 1.4 or later: $m4" if system "$m4 --help &1 | grep reload-state >/dev/null"; -@@ -269,6 +273,12 @@ sub load_configuration ($) +@@ -272,6 +276,12 @@ sub load_configuration ($) my @words = shellwords ($_); my $type = shift @words; @@ -79,22 +73,13 @@ fatal "$file:$.: end-language missing for: $lang" --- a/bin/autoreconf.in +++ b/bin/autoreconf.in -@@ -1,10 +1,12 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - - eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; +@@ -29,10 +29,13 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; +$^W = 1; + - # autoreconf - install the GNU Build System in a directory tree - # Copyright (C) 1994, 1999-2012 Free Software Foundation, Inc. - -@@ -26,7 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0"; - + my $buildauxdir; BEGIN { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; @@ -102,31 +87,25 @@ + ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; - # Override SHELL. On DJGPP SHELL may not be set to a shell -@@ -106,9 +109,9 @@ Written by David J. MacKenzie and Akim D + $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; +@@ -117,9 +120,9 @@ Written by David J. MacKenzie and Akim D "; # Lib files. --my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; --my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; --my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; -+my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoconf-name@' : '@bindir@/@autoconf-name@'); -+my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoheader-name@' : '@bindir@/@autoheader-name@'); -+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); - my $automake = $ENV{'AUTOMAKE'} || 'automake'; - my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; - my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; +-my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; +-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoconf-name@' : '@bindir@/@autoconf-name@'); ++my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoheader-name@' : '@bindir@/@autoheader-name@'); ++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); + my $automake = $ENV{'AUTOMAKE'} || 'automake'; + my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; + my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; --- a/bin/autoscan.in +++ b/bin/autoscan.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -23,9 +23,12 @@ - eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; +@@ -28,9 +28,12 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; +$^W = 1; + @@ -138,7 +117,7 @@ unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell -@@ -91,10 +94,10 @@ my $configure_scan = 'configure.scan'; +@@ -95,10 +98,10 @@ my %needed_macros = my $log; # Autoconf and lib files. @@ -153,15 +132,9 @@ # ----- --- a/bin/autoupdate.in +++ b/bin/autoupdate.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -24,9 +24,12 @@ - eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; +@@ -29,9 +29,12 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; +$^W = 1; + @@ -173,7 +146,7 @@ unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell -@@ -50,10 +53,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin +@@ -55,10 +58,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin my $autoconf = "$autom4te --language=autoconf"; # We need to find m4sugar. my @prepend_include; @@ -188,22 +161,12 @@ # $HELP --- a/bin/ifnames.in +++ b/bin/ifnames.in -@@ -1,10 +1,12 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - - eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; +@@ -33,9 +33,12 @@ use 5.006; + use strict; + use warnings FATAL => 'all'; +$^W = 1; + - # ifnames - print the identifiers used in C preprocessor conditionals - - # Copyright (C) 1994-1995, 1999-2003, 2005-2012 Free Software -@@ -31,7 +33,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0"; - BEGIN { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; @@ -214,15 +177,18 @@ # Override SHELL. On DJGPP SHELL may not be set to a shell --- a/bin/autoconf.as +++ b/bin/autoconf.as -@@ -84,7 +84,11 @@ exit_missing_arg=' +@@ -89,8 +89,13 @@ exit_missing_arg=' # restore font-lock: ' # Variables. -: ${AUTOM4TE='@bindir@/@autom4te-name@'} +-: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} +if test -n "$STAGING_DIR_HOST"; then + : ${AUTOM4TE="$STAGING_DIR_HOST/bin/@autom4te-name@"} ++ : ${trailer_m4="$STAGING_DIR_HOST/share/autoconf/autoconf/trailer.m4"} +else + : ${AUTOM4TE='@bindir@/@autom4te-name@'} ++ : ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} +fi autom4te_options= outfile= diff --git a/tools/autoconf/patches/001-no_emacs_lib.patch b/tools/autoconf/patches/001-no_emacs_lib.patch deleted file mode 100644 index 35c51642e..000000000 --- a/tools/autoconf/patches/001-no_emacs_lib.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/lib/Makefile.am -+++ b/lib/Makefile.am -@@ -15,7 +15,7 @@ - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - --SUBDIRS = Autom4te m4sugar autoconf autotest autoscan emacs -+SUBDIRS = Autom4te m4sugar autoconf autotest autoscan - nodist_pkgdata_DATA = autom4te.cfg - EXTRA_DIST = autom4te.in freeze.mk - ---- a/lib/Makefile.in -+++ b/lib/Makefile.in -@@ -225,7 +225,7 @@ target_alias = @target_alias@ - top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ --SUBDIRS = Autom4te m4sugar autoconf autotest autoscan emacs -+SUBDIRS = Autom4te m4sugar autoconf autotest autoscan - nodist_pkgdata_DATA = autom4te.cfg - EXTRA_DIST = autom4te.in freeze.mk - edit = sed \ diff --git a/tools/autoconf/patches/002-musl_host_fixup.patch b/tools/autoconf/patches/002-musl_host_fixup.patch deleted file mode 100644 index 4dcb1ec3c..000000000 --- a/tools/autoconf/patches/002-musl_host_fixup.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/build-aux/config.sub -+++ b/build-aux/config.sub -@@ -122,9 +122,9 @@ esac - # Here we must recognize all the valid KERNEL-OS combinations. - maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` - case $maybe_os in -- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ -- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ -- knetbsd*-gnu* | netbsd*-gnu* | \ -+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-musl* | \ -+ linux-newlib* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ -+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os -@@ -1360,7 +1360,7 @@ case $os in - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ -- | -linux-newlib* | -linux-uclibc* \ -+ | -linux-musl* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile index 19918efde..8ec13309b 100644 --- a/tools/b43-tools/Makefile +++ b/tools/b43-tools/Makefile @@ -13,7 +13,7 @@ PKG_DATE:=2022-07-05 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git PKG_SOURCE_VERSION:=2fe10ea6690df9a068cb21cde537236bae784a14 -PKG_MIRROR_HASH:=4f1cde5da35a1e768f6a01d67888549d04512073990769342381af1b2c9e7fd2 +PKG_MIRROR_HASH:=4009d6c1f9ede43102897d6ebf4bd954331f3c4e2a94d4e61c0e5f303f929914 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/bash/Makefile b/tools/bash/Makefile index f4bfc0739..f8262d1db 100644 --- a/tools/bash/Makefile +++ b/tools/bash/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bash PKG_CPE_ID:=cpe:/a:gnu:bash -PKG_VERSION:=5.2.15 +PKG_VERSION:=5.2.21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/bash -PKG_HASH:=13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c +PKG_HASH:=c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8 HOST_BUILD_PARALLEL := 1 diff --git a/tools/bison/Makefile b/tools/bison/Makefile index 30555541e..97d34b5a1 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -9,9 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bison PKG_VERSION:=3.8.2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2 +PKG_HASH:=06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb +PKG_CPE_ID:=cpe:/a:gnu:bison HOST_BUILD_PARALLEL:=1 diff --git a/tools/bison/patches/000-relocatable.patch b/tools/bison/patches/000-relocatable.patch new file mode 100644 index 000000000..b98d7a86d --- /dev/null +++ b/tools/bison/patches/000-relocatable.patch @@ -0,0 +1,43 @@ +--- a/src/files.c ++++ b/src/files.c +@@ -560,9 +560,9 @@ pkgdatadir (void) + char const * + m4path (void) + { +- char const *m4 = getenv ("M4"); ++ char const *m4 = getenv ("STAGING_DIR_HOST"); + if (m4) +- return m4; ++ return strcat(getenv ("STAGING_DIR_HOST"), "/bin/m4"); + + /* We don't use relocate2() to store the temporary buffer and re-use + it, because m4path() is only called once. */ +--- a/src/getargs.c ++++ b/src/getargs.c +@@ -373,11 +373,13 @@ usage (int status) + A --long option is required. + Otherwise, add exceptions to ../build-aux/cross-options.pl. */ + +- printf (_("Usage: %s [OPTION]... FILE\n"), program_name); ++ printf (_("Usage: STAGING_DIR_HOST=... %s [OPTION]... FILE\n"), program_name); + fputs (_("\ + Generate a deterministic LR or generalized LR (GLR) parser employing\n\ + LALR(1), IELR(1), or canonical LR(1) parser tables.\n\ + \n\ ++Environment Variable STAGING_DIR_HOST controls path to m4\n\ ++\n\ + "), stdout); + + fputs (_("\ +@@ -450,6 +452,11 @@ Output Files:\n\ + -M, --file-prefix-map=OLD=NEW replace prefix OLD with NEW when writing file paths\n\ + in output files\n\ + "), stdout); ++ ++ fputs (_("\ ++Environment Variables:\n\ ++ STAGING_DIR_HOST Path to m4 is [STAGING_DIR_HOST]/bin/m4\n\ ++"), stdout); + putc ('\n', stdout); + + argmatch_report_usage (stdout); diff --git a/tools/bzip2/Makefile b/tools/bzip2/Makefile new file mode 100644 index 000000000..86df14382 --- /dev/null +++ b/tools/bzip2/Makefile @@ -0,0 +1,32 @@ +# +# Copyright (C) 2022 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bzip2 +PKG_VERSION:=1.0.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://sourceware.org/pub/bzip2 +PKG_HASH:=ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 + +PKG_LICENSE:=bzip2-1.0.8 +PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:bzip:bzip2 + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +HOSTCC := $(HOSTCC_NOCACHE) +HOST_CFLAGS += $(HOST_FPIC) + +CMAKE_HOST_OPTIONS += -DENABLE_EXAMPLES=off + +$(eval $(call HostBuild)) diff --git a/tools/bzip2/patches/020-no-utime.patch b/tools/bzip2/patches/020-no-utime.patch new file mode 100644 index 000000000..d0cd4f0e3 --- /dev/null +++ b/tools/bzip2/patches/020-no-utime.patch @@ -0,0 +1,27 @@ +--- a/bzip2.c ++++ b/bzip2.c +@@ -69,7 +69,6 @@ + #if BZ_UNIX + # include + # include +-# include + # include + # include + # include +@@ -1051,12 +1050,12 @@ void applySavedTimeInfoToOutputFile ( Ch + { + # if BZ_UNIX + IntNative retVal; +- struct utimbuf uTimBuf; ++ struct timespec uTimBuf[2] = {}; + +- uTimBuf.actime = fileMetaInfo.st_atime; +- uTimBuf.modtime = fileMetaInfo.st_mtime; ++ uTimBuf[0].tv_sec = fileMetaInfo.st_atime; ++ uTimBuf[1].tv_sec = fileMetaInfo.st_mtime; + +- retVal = utime ( dstName, &uTimBuf ); ++ retVal = utimensat ( AT_FDCWD, dstName, uTimBuf , 0 ); + ERROR_IF_NOT_ZERO ( retVal ); + # endif + } diff --git a/tools/bzip2/patches/100-cmake.patch b/tools/bzip2/patches/100-cmake.patch new file mode 100644 index 000000000..0ed37b2e4 --- /dev/null +++ b/tools/bzip2/patches/100-cmake.patch @@ -0,0 +1,382 @@ +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,354 @@ ++cmake_minimum_required(VERSION 3.12) ++ ++project(bzip2 ++ VERSION 1.0.8 ++ DESCRIPTION "This Bzip2/libbz2 a program and library for lossless block-sorting data compression." ++ LANGUAGES C) ++ ++# See versioning rule: ++# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html ++# ++# KEEP THESE IN SYNC WITH meson.build OR STUFF WILL BREAK! ++set(LT_CURRENT 1) ++set(LT_REVISION 8) ++set(LT_AGE 0) ++ ++set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) ++ ++include_directories(${PROJECT_BINARY_DIR}) ++ ++math(EXPR LT_SOVERSION "${LT_CURRENT} - ${LT_AGE}") ++set(LT_VERSION "${LT_SOVERSION}.${LT_AGE}.${LT_REVISION}") ++set(PACKAGE_VERSION ${PROJECT_VERSION}) ++ ++set(ENABLE_APP_DEFAULT ON) ++set(ENABLE_EXAMPLES_DEFAULT OFF) ++set(ENABLE_DOCS_DEFAULT OFF) ++include(CMakeOptions.txt) ++ ++if(ENABLE_LIB_ONLY AND (ENABLE_APP OR ENABLE_EXAMPLES)) ++ # Remember when disabled options are disabled for later diagnostics. ++ set(ENABLE_LIB_ONLY_DISABLED_OTHERS 1) ++else() ++ set(ENABLE_LIB_ONLY_DISABLED_OTHERS 0) ++endif() ++if(ENABLE_LIB_ONLY) ++ set(ENABLE_APP OFF) ++ set(ENABLE_EXAMPLES OFF) ++endif() ++ ++# Do not disable assertions based on CMAKE_BUILD_TYPE. ++foreach(_build_type Release MinSizeRel RelWithDebInfo) ++ foreach(_lang C) ++ string(TOUPPER CMAKE_${_lang}_FLAGS_${_build_type} _var) ++ string(REGEX REPLACE "(^|)[/-]D *NDEBUG($|)" " " ${_var} "${${_var}}") ++ endforeach() ++endforeach() ++ ++# Support the latest c++ standard available. ++include(CheckCCompilerFlag) ++include(CheckCXXCompilerFlag) ++ ++function(extract_valid_c_flags varname) ++ set(valid_flags) ++ foreach(flag IN LISTS ARGN) ++ string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag}) ++ set(flag_var "C_FLAG_${flag_var}") ++ check_c_compiler_flag("${flag}" "${flag_var}") ++ if(${flag_var}) ++ set(valid_flags "${valid_flags} ${flag}") ++ endif() ++ endforeach() ++ set(${varname} "${valid_flags}" PARENT_SCOPE) ++endfunction() ++if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ++ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the build type" FORCE) ++ ++ # Include "None" as option to disable any additional (optimization) flags, ++ # relying on just CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (which are empty by ++ # default). These strings are presented in cmake-gui. ++ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ++ None Debug Release MinSizeRel RelWithDebInfo) ++endif() ++ ++# Install a symlink of script to the "bin" directory. ++# Not intended for use on Windows. ++function(install_script_symlink original symlink) ++ add_custom_command(OUTPUT ${symlink} ++ COMMAND ${CMAKE_COMMAND} -E create_symlink ${original} ${symlink} ++ DEPENDS ${original} ++ COMMENT "Generating symbolic link ${symlink} of ${original}") ++ add_custom_target(${symlink}_tgt ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${symlink}) ++ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${symlink} DESTINATION ${CMAKE_INSTALL_BINDIR}) ++endfunction() ++ ++# Install a symlink of binary target to the "bin" directory. ++# On Windows, it will be a copy instead of a symlink. ++function(install_target_symlink original symlink) ++ if(WIN32) ++ set(op copy) ++ set(symlink "${symlink}.exe") ++ else() ++ set(op create_symlink) ++ endif() ++ add_custom_command(TARGET ${original} POST_BUILD ++ COMMAND ${CMAKE_COMMAND} -E ${op} $ ${symlink} ++ WORKING_DIRECTORY $ ++ COMMENT "Generating symbolic link (or copy) ${symlink} of ${original}") ++ install(PROGRAMS $/${symlink} DESTINATION ${CMAKE_INSTALL_BINDIR}) ++endfunction() ++ ++include(GNUInstallDirs) ++ ++# Checks for header files. ++include(CheckIncludeFile) ++check_include_file(arpa/inet.h HAVE_ARPA_INET_H) ++check_include_file(fcntl.h HAVE_FCNTL_H) ++check_include_file(inttypes.h HAVE_INTTYPES_H) ++check_include_file(limits.h HAVE_LIMITS_H) ++check_include_file(netdb.h HAVE_NETDB_H) ++check_include_file(netinet/in.h HAVE_NETINET_IN_H) ++check_include_file(pwd.h HAVE_PWD_H) ++check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) ++check_include_file(sys/time.h HAVE_SYS_TIME_H) ++check_include_file(syslog.h HAVE_SYSLOG_H) ++check_include_file(time.h HAVE_TIME_H) ++check_include_file(unistd.h HAVE_UNISTD_H) ++ ++include(CheckTypeSize) ++# Checks for typedefs, structures, and compiler characteristics. ++# AC_TYPE_SIZE_T ++check_type_size("ssize_t" SIZEOF_SSIZE_T) ++if(NOT SIZEOF_SSIZE_T) ++ # ssize_t is a signed type in POSIX storing at least -1. ++ # Set it to "int" to match the behavior of AC_TYPE_SSIZE_T (autotools). ++ set(ssize_t int) ++endif() ++ ++include(CheckStructHasMember) ++check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_STRUCT_TM_TM_GMTOFF) ++ ++include(CheckSymbolExists) ++# XXX does this correctly detect initgroups (un)availability on cygwin? ++check_symbol_exists(initgroups grp.h HAVE_DECL_INITGROUPS) ++if(NOT HAVE_DECL_INITGROUPS AND HAVE_UNISTD_H) ++ # FreeBSD declares initgroups() in unistd.h ++ check_symbol_exists(initgroups unistd.h HAVE_DECL_INITGROUPS2) ++ if(HAVE_DECL_INITGROUPS2) ++ set(HAVE_DECL_INITGROUPS 1) ++ endif() ++endif() ++ ++set(WARNCFLAGS) ++if(CMAKE_C_COMPILER_ID MATCHES "MSVC") ++ if(ENABLE_WERROR) ++ set(WARNCFLAGS /WX) ++ endif() ++else() ++ if(ENABLE_WERROR) ++ extract_valid_c_flags(WARNCFLAGS -Werror) ++ endif() ++ ++ # For C compiler ++ # Please keep this list in sync with meson.build ++ extract_valid_c_flags(WARNCFLAGS ++ -Wall ++ -Wextra ++ -Wmissing-prototypes ++ -Wstrict-prototypes ++ -Wmissing-declarations ++ -Wpointer-arith ++ -Wdeclaration-after-statement ++ -Wformat-security ++ -Wwrite-strings ++ -Wshadow ++ -Winline ++ -Wnested-externs ++ -Wfloat-equal ++ -Wundef ++ -Wendif-labels ++ -Wempty-body ++ -Wcast-align ++ -Wclobbered ++ -Wvla ++ -Wpragmas ++ -Wunreachable-code ++ -Waddress ++ -Wattributes ++ -Wdiv-by-zero ++ -Wshorten-64-to-32 ++ -Wconversion ++ -Wextended-offsetof ++ -Wformat-nonliteral ++ -Wlanguage-extension-token ++ -Wmissing-field-initializers ++ -Wmissing-noreturn ++ -Wmissing-variable-declarations ++ # -Wpadded # Not used because we cannot change public structs ++ -Wsign-conversion ++ # -Wswitch-enum # Not used because this basically disallows default case ++ -Wunreachable-code-break ++ -Wunused-macros ++ -Wunused-parameter ++ -Wredundant-decls ++ -Wheader-guard ++ -Wno-format-nonliteral # This is required because we pass format string as "const char*. ++ ) ++endif() ++ ++if(ENABLE_DEBUG) ++ set(DEBUGBUILD 1) ++endif() ++ ++#add_definitions(-DHAVE_CONFIG_H) ++#configure_file(cmakeconfig.h.in config.h) ++ ++# autotools-compatible names ++# Sphinx expects relative paths in the .rst files. Use the fact that the files ++# below are all one directory level deep. ++file(RELATIVE_PATH top_srcdir ${CMAKE_CURRENT_BINARY_DIR}/dir ${CMAKE_CURRENT_SOURCE_DIR}) ++file(RELATIVE_PATH top_builddir ${CMAKE_CURRENT_BINARY_DIR}/dir ${CMAKE_CURRENT_BINARY_DIR}) ++set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) ++set(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR}) ++# bzip2.pc (pkg-config file) ++set(prefix ${CMAKE_INSTALL_PREFIX}) ++set(exec_prefix ${CMAKE_INSTALL_PREFIX}) ++set(bindir ${CMAKE_INSTALL_FULL_BINDIR}) ++set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR}) ++set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) ++set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) ++set(VERSION ${PACKAGE_VERSION}) ++ ++# ++# The build targets. ++# In a larger project, the following would be in subdirectories and ++# These targets would be included with `add_subdirectory()` ++# ++set(BZ2_SOURCES ++ blocksort.c ++ huffman.c ++ crctable.c ++ randtable.c ++ compress.c ++ decompress.c ++ bzlib.c) ++ ++# The bz2 OBJECT-library, required for bzip2, bzip2recover. ++add_library(bz2_ObjLib OBJECT) ++target_sources(bz2_ObjLib ++ PRIVATE ${BZ2_SOURCES} ++ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h ++ INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h) ++ ++if(ENABLE_SHARED_LIB) ++ # The libbz2 shared library. ++ add_library(bz2 SHARED ${BZ2_RES}) ++ target_sources(bz2 ++ PRIVATE ${BZ2_SOURCES} ++ ${CMAKE_CURRENT_SOURCE_DIR}/libbz2.def ++ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h ++ INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h) ++ # Always use '-fPIC'/'-fPIE' option for shared libraries. ++ set_property(TARGET bz2 PROPERTY POSITION_INDEPENDENT_CODE ON) ++ set_target_properties(bz2 PROPERTIES ++ COMPILE_FLAGS "${WARNCFLAGS}" ++ VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}) ++ install(TARGETS bz2 DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(FILES bzlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++ ++ if(USE_OLD_SONAME) ++ # Hack to support the old libbz2.so.1.0 version by including an extra copy. ++ # Technically the old SONAME is not libtool compatible. ++ # This hack is to support binary compatibility with libbz2 in some distro packages. ++ if(UNIX AND NOT APPLE) ++ add_library(bz2_old_soname SHARED ${BZ2_RES}) ++ target_sources(bz2_old_soname ++ PRIVATE ${BZ2_SOURCES} ++ ${CMAKE_CURRENT_SOURCE_DIR}/libbz2.def ++ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h ++ INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h ++ ) ++ set_target_properties(bz2_old_soname PROPERTIES ++ COMPILE_FLAGS "${WARNCFLAGS}" ++ VERSION ${LT_SOVERSION}.${LT_AGE} SOVERSION ${LT_SOVERSION}.${LT_AGE} ++ OUTPUT_NAME bz2 ++ ) ++ install(TARGETS bz2_old_soname DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ endif() ++ endif() ++endif() ++ ++if(ENABLE_STATIC_LIB) ++ # The libbz2 static library. ++ add_library(bz2_static STATIC) ++ target_sources(bz2_static ++ PRIVATE ${BZ2_SOURCES} ++ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bzlib_private.h ++ INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/bzlib.h) ++ set_target_properties(bz2_static PROPERTIES ++ COMPILE_FLAGS "${WARNCFLAGS}" ++ VERSION ${LT_VERSION} ++ SOVERSION ${LT_SOVERSION} ++ ARCHIVE_OUTPUT_NAME bz2_static) ++ target_compile_definitions(bz2_static PUBLIC BZ2_STATICLIB) ++ install(TARGETS bz2_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(FILES bzlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++endif() ++ ++if(ENABLE_APP) ++ # The bzip2 executable. ++ add_executable(bzip2) ++ target_sources(bzip2 ++ PRIVATE bzip2.c) ++ target_link_libraries(bzip2 ++ PRIVATE bz2_ObjLib) ++ if(WIN32) ++ target_compile_definitions(bzip2 PUBLIC BZ_LCCWIN32 BZ_UNIX=0) ++ else() ++ target_compile_definitions(bzip2 PUBLIC BZ_LCCWIN32=0 BZ_UNIX) ++ endif() ++ install(TARGETS bzip2 DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ ++ # Create bzip2 copies bzcat and bunzip. ++ # The default behavior is altered in bzip2.c code by checking the program name. ++ install_target_symlink(bzip2 bzcat) ++ install_target_symlink(bzip2 bunzip) ++ ++ # The bzip2recover executable. ++ add_executable(bzip2recover) ++ target_sources(bzip2recover ++ PRIVATE bzip2recover.c) ++ target_link_libraries(bzip2recover ++ PRIVATE bz2_ObjLib) ++ if(WIN32) ++ target_compile_definitions(bzip2recover PUBLIC BZ_LCCWIN32 BZ_UNIX=0) ++ else() ++ target_compile_definitions(bzip2recover PUBLIC BZ_LCCWIN32=0 BZ_UNIX) ++ endif() ++ install(TARGETS bzip2recover DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ ++ if(ENABLE_EXAMPLES) ++ if(ENABLE_SHARED_LIB) ++ # The dlltest executable. ++ add_executable(dlltest) ++ target_sources(dlltest ++ PRIVATE dlltest.c) ++ target_link_libraries(dlltest bz2) ++ install(TARGETS dlltest DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ endif() ++ endif() ++ ++ if(NOT WIN32) ++ # Install shell scripts, and renamed copies. ++ install(PROGRAMS bzdiff bzgrep bzmore ++ DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ ++ install_script_symlink(bzdiff bzcmp) ++ ++ install_script_symlink(bzgrep bzegrep) ++ install_script_symlink(bzgrep bzfgrep) ++ ++ install_script_symlink(bzmore bzless) ++ endif() ++ ++endif() +--- /dev/null ++++ b/CMakeOptions.txt +@@ -0,0 +1,22 @@ ++# Features that can be enabled for cmake (see CMakeLists.txt) ++ ++option(ENABLE_WERROR "Turn on compile time warnings") ++ ++option(ENABLE_DEBUG "Turn on debug output") ++ ++option(ENABLE_APP "Build applications (bzip2, and bzip2recover)" ++ ${ENABLE_APP_DEFAULT}) ++ ++option(ENABLE_DOCS "Generate documentation" ++ ${ENABLE_DOCS_DEFAULT}) ++ ++option(ENABLE_EXAMPLES "Build examples" ++ ${ENABLE_EXAMPLES_DEFAULT}) ++ ++option(ENABLE_LIB_ONLY "Build libbz2 only. This is a short hand for -DENABLE_APP=0 -DENABLE_EXAMPLES=0") ++ ++option(ENABLE_STATIC_LIB "Build libbz2 in static mode also") ++ ++option(ENABLE_SHARED_LIB "Build libbz2 as a shared library" ON) ++ ++option(USE_OLD_SONAME "Use libbz2.so.1.0 for compatibility with old Makefiles" OFF) diff --git a/tools/cbootimage-configs/Makefile b/tools/cbootimage-configs/Makefile index cafd4e5a2..586d1efc9 100644 --- a/tools/cbootimage-configs/Makefile +++ b/tools/cbootimage-configs/Makefile @@ -12,7 +12,7 @@ PKG_SOURCE_DATE := 2017-04-13 PKG_SOURCE_PROTO := git PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage-configs.git PKG_SOURCE_VERSION := 7c3b458b93ed6947cd083623f543e93f9103cc0f -PKG_MIRROR_HASH := 1d24421af8cf74ec2d625e237aa8121b1273774c4380ad333e2954e052a5a4fe +PKG_MIRROR_HASH := 6ba2dde907d3cc403720954738a92431b1f40d562db5815c08971c39374d72a1 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/cbootimage/Makefile b/tools/cbootimage/Makefile index 71fdb5768..82be7950d 100644 --- a/tools/cbootimage/Makefile +++ b/tools/cbootimage/Makefile @@ -12,7 +12,7 @@ PKG_VERSION := 1.8 PKG_SOURCE_PROTO := git PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage.git PKG_SOURCE_VERSION := 7c9db585d06cce9efffa2a82245f233233680060 -PKG_MIRROR_HASH := 84d9abaaa3eddde05f506dc16effe1c9e18eb94727ed59c5e0a879baeb04e0b2 +PKG_MIRROR_HASH := e38b1e9581524fcabc7b24fff1c18d13f7e3a93accf73c55caf33832249bfd03 HOST_BUILD_PARALLEL := 1 diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 25ab4a46e..447bc3ea4 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -5,14 +5,13 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache -PKG_VERSION:=4.7.4 +PKG_VERSION:=4.10.2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) -PKG_HASH:=df0c64d15d3efaf0b4f6837dd6b1467e40eeaaa807db25ce79c3a08a46a84e36 +PKG_HASH:=108100960bb7e64573ea925af2ee7611701241abb36ce0aae3354528403a7d87 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk @@ -22,20 +21,7 @@ CMAKE_HOST_OPTIONS += \ -DCMAKE_CXX_COMPILER_LAUNCHER="" \ -DCMAKE_SKIP_RPATH=FALSE \ -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \ + -DENABLE_DOCUMENTATION=OFF \ -DREDIS_STORAGE_BACKEND=OFF -ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y) -CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF -endif - -define Host/Install/ccache - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/ - $(CP) ./files/* $(STAGING_DIR_HOST)/bin/ -endef - -define Host/Install - $(call Host/Install/Default) - $(call Host/Install/ccache) -endef - $(eval $(call HostBuild)) diff --git a/tools/ccache/files/ccache_cc b/tools/ccache/files/ccache_cc deleted file mode 100755 index 01c4ad42a..000000000 --- a/tools/ccache/files/ccache_cc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec ccache "${TARGET_CC_NOCACHE}" "$@" diff --git a/tools/ccache/files/ccache_cxx b/tools/ccache/files/ccache_cxx deleted file mode 100755 index cc60eb3a1..000000000 --- a/tools/ccache/files/ccache_cxx +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec ccache "${TARGET_CXX_NOCACHE}" "$@" diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index 5358d425c..c07c8ce8e 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,10 +1,10 @@ ---- a/src/ccache.cpp -+++ b/src/ccache.cpp -@@ -1779,6 +1779,7 @@ get_manifest_key(Context& ctx, Hash& has - "CPLUS_INCLUDE_PATH", - "OBJC_INCLUDE_PATH", - "OBJCPLUS_INCLUDE_PATH", // clang -+ "GCC_HONOUR_COPTS", - nullptr}; +--- a/src/ccache/ccache.cpp ++++ b/src/ccache/ccache.cpp +@@ -1914,6 +1914,7 @@ get_manifest_key(Context& ctx, Hash& has + "OBJCPLUS_INCLUDE_PATH", // Clang + "CLANG_CONFIG_FILE_SYSTEM_DIR", // Clang + "CLANG_CONFIG_FILE_USER_DIR", // Clang ++ "GCC_HONOUR_COPTS", + nullptr, + }; for (const char** p = envvars; *p; ++p) { - const char* v = getenv(*p); diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index ed2580fe4..152d295cb 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.25.2 +PKG_VERSION:=3.30.5 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c +PKG_HASH:=9f55e1a40508f2f29b7e065fa08c29f82c402fa0402da839fffe64a25755a86d HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 @@ -30,6 +30,7 @@ HOST_CONFIGURE_VARS += \ MAKE="$(STAGING_DIR_HOST)/bin/ninja" HOST_CONFIGURE_ARGS := \ + --no-debugger \ $(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \ --prefix="$(STAGING_DIR_HOST)" \ --system-expat \ @@ -38,8 +39,6 @@ HOST_CONFIGURE_ARGS := \ --system-zstd \ --generator=Ninja -HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib - define Host/Compile/Default +$(NINJA) -C $(HOST_BUILD_DIR) $(1) endef diff --git a/tools/cmake/patches/100-no-testing.patch b/tools/cmake/patches/100-no-testing.patch index 44452ce39..736a365e8 100644 --- a/tools/cmake/patches/100-no-testing.patch +++ b/tools/cmake/patches/100-no-testing.patch @@ -11,15 +11,15 @@ # like vs9 or vs10 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake -@@ -33,7 +33,7 @@ whether testing support should be enable - # - # +@@ -47,7 +47,7 @@ if(cmp0145 STREQUAL "") + message(AUTHOR_WARNING "${_cmp0145_warning}") + endif() -option(BUILD_TESTING "Build the testing tree." ON) +option(BUILD_TESTING "Build the testing tree." OFF) if(BUILD_TESTING) - find_package(Dart QUIET) + # We only get here if a project already ran include(Dart), --- a/Tests/Contracts/VTK/Dashboard.cmake.in +++ b/Tests/Contracts/VTK/Dashboard.cmake.in @@ -25,7 +25,7 @@ ctest_empty_binary_directory(${CTEST_BIN diff --git a/tools/cmake/patches/110-liblzma.patch b/tools/cmake/patches/110-liblzma.patch index e98dd5ade..4b8ec0d33 100644 --- a/tools/cmake/patches/110-liblzma.patch +++ b/tools/cmake/patches/110-liblzma.patch @@ -1,8 +1,8 @@ --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake -@@ -43,7 +43,13 @@ This module will set the following varia - version number as a string (ex: "5.0.3") - #]=======================================================================] +@@ -61,7 +61,13 @@ The following variables are provided for + cmake_policy(PUSH) + cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_ -find_path(LIBLZMA_INCLUDE_DIR lzma.h ) +if(UNIX) diff --git a/tools/cmake/patches/120-curl-fix-libressl-linking.patch b/tools/cmake/patches/120-curl-fix-libressl-linking.patch index 1744fe5b0..19217343d 100644 --- a/tools/cmake/patches/120-curl-fix-libressl-linking.patch +++ b/tools/cmake/patches/120-curl-fix-libressl-linking.patch @@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich --- --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt -@@ -611,6 +611,14 @@ if(CURL_USE_OPENSSL) +@@ -648,6 +648,14 @@ if(CURL_USE_OPENSSL) endif() set(SSL_ENABLED ON) set(USE_OPENSSL ON) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 70d122c9d..a2a873fce 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -1,6 +1,6 @@ --- a/bootstrap +++ b/bootstrap -@@ -1449,7 +1449,10 @@ int main(){ printf("1%c", (char)0x0a); r +@@ -1509,7 +1509,10 @@ int main(){ printf("1%c", (char)0x0a); r ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" if test "x${cmake_parallel_make}" != "x"; then diff --git a/tools/cmake/patches/140-zlib.patch b/tools/cmake/patches/140-zlib.patch index f79801c8a..17334a66e 100644 --- a/tools/cmake/patches/140-zlib.patch +++ b/tools/cmake/patches/140-zlib.patch @@ -1,6 +1,6 @@ --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake -@@ -85,10 +85,13 @@ else() +@@ -120,10 +120,13 @@ else() set(ZLIB_NAMES_DEBUG zd zlibd zdlld zlibd1 zlib1d zlibstaticd zlibwapid zlibvcd zlibstatd) endif() diff --git a/tools/cmake/patches/150-zstd-libarchive.patch b/tools/cmake/patches/150-zstd-libarchive.patch index 34f7240fe..a6f8e35e6 100644 --- a/tools/cmake/patches/150-zstd-libarchive.patch +++ b/tools/cmake/patches/150-zstd-libarchive.patch @@ -1,18 +1,11 @@ --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt -@@ -632,8 +632,13 @@ IF(ENABLE_ZSTD) +@@ -656,7 +656,7 @@ IF(ENABLE_ZSTD) SET(ZSTD_FIND_QUIETLY TRUE) ENDIF (ZSTD_INCLUDE_DIR) -- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h) -- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd) -+ IF(UNIX) -+ FIND_PACKAGE(PkgConfig QUIET) -+ PKG_SEARCH_MODULE(PC_ZSTD libzstd) -+ ENDIF() -+ -+ FIND_PATH(ZSTD_INCLUDE_DIR zstd.h HINTS ${PC_ZSTD_INCLUDEDIR} ${PC_ZSTD_INCLUDE_DIRS}) -+ FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS}) - INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR) - ELSE(ENABLE_ZSTD) +- IF(0) # CMake does not let pkg-config override its search paths. ++ IF(1) # CMake does not let pkg-config override its search paths. + IF(UNIX) + FIND_PACKAGE(PkgConfig QUIET) + PKG_SEARCH_MODULE(PC_ZSTD libzstd) diff --git a/tools/cmake/patches/160-disable_xcode_generator.patch b/tools/cmake/patches/160-disable_xcode_generator.patch new file mode 100644 index 000000000..0e29dedd9 --- /dev/null +++ b/tools/cmake/patches/160-disable_xcode_generator.patch @@ -0,0 +1,22 @@ +--- a/Source/CMakeLists.txt ++++ b/Source/CMakeLists.txt +@@ -858,7 +858,7 @@ if(CMake_USE_XCOFF_PARSER) + endif() + + # Xcode only works on Apple +-if(APPLE) ++if(APPLE_DISABLED) + target_sources( + CMakeLib + PRIVATE +--- a/Source/cmake.cxx ++++ b/Source/cmake.cxx +@@ -134,7 +134,7 @@ + # include "cmGlobalGhsMultiGenerator.h" + #endif + +-#if defined(__APPLE__) ++#if defined(__APPLE_DISABLED__) + # if !defined(CMAKE_BOOTSTRAP) + # include "cmGlobalXCodeGenerator.h" + diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index f799e83c5..73b95912e 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -8,30 +8,61 @@ include $(TOPDIR)/rules.mk PKG_NAME:=coreutils PKG_CPE_ID:=cpe:/a:gnu:coreutils -PKG_VERSION:=9.3 +PKG_VERSION:=9.5 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/coreutils -PKG_HASH:=adbcfcfe899235b71e8768dcf07cd532520b7f54f9a8064843f8d199a904bbaa +PKG_HASH:=767ae6a22950ec42f3ba5f7c1de79dd27800ee8e9b8642da5dedb5974a1741e5 HOST_BUILD_PARALLEL := 1 -BUILD_PROGRAMS = date readlink touch ln chown ginstall +PKG_PROGRAMS:=date readlink touch ln chown ginstall include $(INCLUDE_DIR)/host-build.mk -BUILD_BINS = $(patsubst %,src/%,$(BUILD_PROGRAMS)) +export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR) + +HOST_GNULIB_SKIP := \ + lib/nstrftime.c \ + lib/fprintftime.c \ + lib/fcntl.in.h \ + lib/locale.in.h HOST_CONFIGURE_ARGS += \ - --enable-install-program=$(subst $(space),$(comma),$(strip $(BUILD_PROGRAMS))) + --enable-install-program=$(subst $(space),$(comma),$(strip $(PKG_PROGRAMS))) HOST_MAKE_FLAGS += \ - PROGRAMS="$(BUILD_BINS)" \ + $(AM_TOOL_PATHS_FAKE) \ + PROGRAMS="$(patsubst %,src/%,$(PKG_PROGRAMS))" \ LIBRARIES= MANS= SUBDIRS=. +define Host/Bootstrap + ( \ + cd $(HOST_BUILD_DIR); \ + $(AM_TOOL_PATHS_FAKE) \ + ./bootstrap \ + --bootstrap-sync \ + --force \ + --no-git \ + --skip-po \ + --gnulib-srcdir=$(GNULIB_SRCDIR) \ + ) +endef + +define Host/Prepare + $(call Host/Prepare/Default) + $(if $(QUILT),,$(call Host/Bootstrap)) +endef + +define Host/Configure + $(if $(QUILT),$(call Host/Bootstrap)) + $(foreach src,$(HOST_GNULIB_SKIP),mv -f $(HOST_BUILD_DIR)/$(src)~ $(HOST_BUILD_DIR)/$(src) || true; ) + $(call Host/Configure/Default) +endef + define Host/Install $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/%,$(BUILD_BINS)) $(1)/bin/ + $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(PKG_PROGRAMS)) $(1)/bin/ ln -sf ginstall $(1)/bin/install endef diff --git a/tools/coreutils/patches/000-bootstrap.patch b/tools/coreutils/patches/000-bootstrap.patch new file mode 100644 index 000000000..68db19084 --- /dev/null +++ b/tools/coreutils/patches/000-bootstrap.patch @@ -0,0 +1,45 @@ +--- a/bootstrap ++++ b/bootstrap +@@ -244,7 +244,7 @@ check_exists() { + ($2 --version /dev/null 2>&1 ++ ($@ --version /dev/null 2>&1 + fi + + test $? -lt 126 +@@ -309,7 +309,7 @@ p + q' + + get_version() { +- app=$1 ++ app="$@" + + $app --version >/dev/null 2>&1 || { $app --version; return 1; } + +@@ -366,13 +366,13 @@ check_versions() { + if [ "$req_ver" = "-" ]; then + # Merely require app to exist; not all prereq apps are well-behaved + # so we have to rely on $? rather than get_version. +- if ! check_exists --verbose $app; then ++ if ! check_exists --verbose "$app"; then + warn_ "Error: '$app' not found" + ret=1 + fi + else + # Require app to produce a new enough version string. +- inst_ver=$(get_version $app) ++ inst_ver=$(get_version "$app") + if [ ! "$inst_ver" ]; then + warn_ "Error: '$app' not found" + ret=1 +@@ -1157,7 +1157,7 @@ autogen() + # two just-pre-run programs. + + # Import from gettext. +- with_gettext=yes ++ with_gettext=no + grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ + with_gettext=no + diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile index e037ce2e1..bcb16dd3d 100644 --- a/tools/dwarves/Makefile +++ b/tools/dwarves/Makefile @@ -3,13 +3,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dwarves -PKG_VERSION:=1.25 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.27 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://fedorapeople.org/~acme/dwarves/ -PKG_HASH:=e7d45955f6f4eca25a4c8c3bd6611059b35dc217e45976681d7db170fccdec4a +PKG_HASH:=ef7f21f1c6016896d03a01f05cab225151f9068e19cc8cddc6e754b2b5cbe279 +PKG_MAINTAINER:=Tony Ambardar PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING diff --git a/tools/dwarves/patches/100-reproducible-builds.patch b/tools/dwarves/patches/100-reproducible-builds.patch new file mode 100644 index 000000000..15bddd564 --- /dev/null +++ b/tools/dwarves/patches/100-reproducible-builds.patch @@ -0,0 +1,12 @@ +--- a/pahole.c ++++ b/pahole.c +@@ -3723,6 +3723,9 @@ int main(int argc, char *argv[]) + goto out; + } + ++ if (getenv("SOURCE_DATE_EPOCH") || getenv("KBUILD_BUILD_TIMESTAMP")) ++ conf_load.reproducible_build = true; ++ + if (dwarves__init()) { + fputs("pahole: insufficient memory\n", stderr); + goto out; diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index a8bd745af..ec07fa770 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs -PKG_VERSION:=1.46.5 -PKG_HASH:=2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e -PKG_RELEASE:=2 +PKG_VERSION:=1.46.6 +PKG_HASH:=skip +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ HOST_BUILD_PARALLEL:=1 @@ -30,7 +30,8 @@ HOST_CONFIGURE_ARGS += \ --enable-libuuid \ --disable-tls \ --disable-nls \ - --enable-threads=pth + --enable-threads=pth \ + --disable-fuse2fs define Host/Prepare $(call Host/Prepare/Default) diff --git a/tools/e2fsprogs/patches/003-no-crond.patch b/tools/e2fsprogs/patches/003-no-crond.patch index a7ea52b1a..67ddd4ab0 100644 --- a/tools/e2fsprogs/patches/003-no-crond.patch +++ b/tools/e2fsprogs/patches/003-no-crond.patch @@ -1,11 +1,11 @@ --- a/configure +++ b/configure -@@ -12538,7 +12538,7 @@ $as_echo_n "checking for system crontab +@@ -15259,7 +15259,7 @@ then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${crond_dir}" >&5 - $as_echo "${crond_dir}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${crond_dir}" >&5 + printf "%s\n" "${crond_dir}" >&6; } - have_crond="yes" + have_crond="no"; with_crond_dir="" - else + else $as_nop diff --git a/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch b/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch deleted file mode 100644 index e5a76161f..000000000 --- a/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch +++ /dev/null @@ -1,50 +0,0 @@ -From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001 -From: Lukas Czerner -Date: Thu, 21 Apr 2022 19:31:48 +0200 -Subject: libext2fs: add sanity check to extent manipulation - -It is possible to have a corrupted extent tree in such a way that a leaf -node contains zero extents in it. Currently if that happens and we try -to traverse the tree we can end up accessing wrong data, or possibly -even uninitialized memory. Make sure we don't do that. - -Additionally make sure that we have a sane number of bytes passed to -memmove() in ext2fs_extent_delete(). - -Note that e2fsck is currently unable to spot and fix such corruption in -pass1. - -Signed-off-by: Lukas Czerner -Reported-by: Nils Bars -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113 -Addresses: CVE-2022-1304 -Addresses-Debian-Bug: #1010263 -Signed-off-by: Theodore Ts'o ---- - lib/ext2fs/extent.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/lib/ext2fs/extent.c -+++ b/lib/ext2fs/extent.c -@@ -495,6 +495,10 @@ retry: - ext2fs_le16_to_cpu(eh->eh_entries); - newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max); - -+ /* Make sure there is at least one extent present */ -+ if (newpath->left <= 0) -+ return EXT2_ET_EXTENT_NO_DOWN; -+ - if (path->left > 0) { - ix++; - newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block); -@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte - - cp = path->curr; - -+ /* Sanity check before memmove() */ -+ if (path->left < 0) -+ return EXT2_ET_EXTENT_LEAF_BAD; -+ - if (path->left) { - memmove(cp, cp + sizeof(struct ext3_extent_idx), - path->left * sizeof(struct ext3_extent_idx)); diff --git a/tools/elftosb/patches/001-libm.patch b/tools/elftosb/patches/001-libm.patch index 02705d24b..6b49ac1af 100644 --- a/tools/elftosb/patches/001-libm.patch +++ b/tools/elftosb/patches/001-libm.patch @@ -1,6 +1,6 @@ ---- elftosb-10.12.01/makefile.rules 2012-03-15 11:01:44.979020178 -0400 -+++ elftosb-10.12.01/makefile.rules 2012-03-15 11:01:16.332761989 -0400 -@@ -101,7 +101,7 @@ +--- a/makefile.rules ++++ b/makefile.rules +@@ -101,7 +101,7 @@ OBJ_FILES_KEYGEN = \ keygen.o diff --git a/tools/elftosb/patches/002-fix-header-path.patch b/tools/elftosb/patches/002-fix-header-path.patch index 5e3b5091b..5099b2964 100644 --- a/tools/elftosb/patches/002-fix-header-path.patch +++ b/tools/elftosb/patches/002-fix-header-path.patch @@ -5,9 +5,8 @@ others once multiarch becomes more common. This patch makes the types a relative path, and allows the system to use whatever include paths it feels are correct. -diff -Naurp elftosb-10.12.01-orig/common/stdafx.h elftosb-10.12.01/common/stdafx.h ---- elftosb-10.12.01-orig/common/stdafx.h 2012-07-12 13:30:10.990249396 -0400 -+++ elftosb-10.12.01/common/stdafx.h 2012-07-12 13:30:06.858249391 -0400 +--- a/common/stdafx.h ++++ b/common/stdafx.h @@ -27,7 +27,7 @@ // For Linux systems only, types.h only defines the signed // integer types. This is not professional code. diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile index 4461e45b6..4e561a338 100644 --- a/tools/elfutils/Makefile +++ b/tools/elfutils/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.188 +PKG_VERSION:=0.191 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=fb8b0e8d0802005b9a309c60c1d8de32dd2951b56f0c3a3cb56d21ce01595dff +PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871 PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3 diff --git a/tools/expat/Makefile b/tools/expat/Makefile index c1a8cb8d9..d48837233 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=expat -PKG_CPE_ID:=cpe:/a:libexpat:expat -PKG_VERSION:=2.5.0 +PKG_CPE_ID:=cpe:/a:libexpat:libexpat +PKG_VERSION:=2.6.3 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=17aa6cfc5c4c219c09287abfc10bc13f0c06f30bb654b28bfe6f567ca646eb79 PKG_SOURCE_URL:=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(PKG_VERSION)) HOST_BUILD_PARALLEL:=1 @@ -24,6 +24,7 @@ HOSTCC := $(HOSTCC_NOCACHE) HOST_CONFIGURE_ARGS += \ --disable-shared \ --without-docbook \ + --without-tests \ --with-pic define Host/Uninstall diff --git a/tools/fakeroot/Makefile b/tools/fakeroot/Makefile index efd9227d1..22b2c8f24 100644 --- a/tools/fakeroot/Makefile +++ b/tools/fakeroot/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fakeroot -PKG_VERSION:=1.29 +PKG_VERSION:=1.36 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz PKG_SOURCE_URL:=@DEBIAN/pool/main/f/fakeroot -PKG_HASH:=8fbbafb780c9173e3ace4a04afbc1d900f337f3216883939f5c7db3431be7c20 +PKG_HASH:=7fe3cf3daf95ee93b47e568e85f4d341a1f9ae91766b4f9a9cdc29737dea4988 PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf diff --git a/tools/fakeroot/patches/200-disable-doc.patch b/tools/fakeroot/patches/200-disable-doc.patch index 29a3e39b2..cceb6ccc2 100644 --- a/tools/fakeroot/patches/200-disable-doc.patch +++ b/tools/fakeroot/patches/200-disable-doc.patch @@ -6,5 +6,5 @@ -SUBDIRS=doc scripts test +SUBDIRS=scripts test - noinst_LTLIBRARIES = libcommunicate.la libmacosx.la + noinst_LTLIBRARIES = libcommunicate.la libmacosx.la libfakeroot_time64.la libcommunicate_la_SOURCES = communicate.c diff --git a/tools/fakeroot/patches/300-time64-hack.patch b/tools/fakeroot/patches/300-time64-hack.patch new file mode 100644 index 000000000..46132cdd3 --- /dev/null +++ b/tools/fakeroot/patches/300-time64-hack.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -390,7 +390,7 @@ dnl Digital Unix: stat + time64_hack=no + AH_TEMPLATE([TIME64_HACK], [time64 shuffle]) + AC_MSG_CHECKING([if we need to cope with time64]) +-AC_EGREP_CPP([time64],[ ++AC_EGREP_CPP([_*[a-z0-9]+_time64[^_]],[ + #include + #if __WORDSIZE == 32 + #define __USE_TIME_BITS64 1 diff --git a/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch b/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch index f740b120a..593603491 100644 --- a/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch +++ b/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch @@ -21,14 +21,3 @@ Error relocating openwrt/staging_dir/host/lib/libfakeroot.so: SEND_GET_XATTR: sy #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b) #endif -@@ -142,8 +144,9 @@ - - /* 10.10 uses id_t in getpriority/setpriority calls, so pretend - id_t is used everywhere, just happens to be int on some OSes */ --#ifndef _ID_T -+#if !defined(_ID_T) && !defined(__DEFINED_id_t) - #define _ID_T -+#define __DEFINED_id_t - typedef int id_t; - #endif - #endif diff --git a/tools/fakeroot/patches/600-macOS.patch b/tools/fakeroot/patches/600-macOS.patch index 730367f07..df4eb2d6c 100644 --- a/tools/fakeroot/patches/600-macOS.patch +++ b/tools/fakeroot/patches/600-macOS.patch @@ -24,10 +24,10 @@ #include --- a/wrapfunc.inp +++ b/wrapfunc.inp -@@ -48,9 +48,11 @@ getattrlist$UNIX2003;int;(const char *pa - #endif +@@ -51,9 +51,11 @@ getattrlist$UNIX2003;int;(const char *pa #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + #include +#if !__DARWIN_ONLY_64_BIT_INO_T lstat$INODE64;int;(const char *file_name, struct stat *buf);(file_name, buf) stat$INODE64;int;(const char *file_name, struct stat *buf);(file_name, buf) @@ -36,7 +36,7 @@ posix_spawn;int;(pid_t * __restrict pid, const char * __restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t * __restrict attrp, char *const argv[ __restrict], char *const envp[ __restrict]);(pid, path, file_actions, attrp, argv, envp) posix_spawnp;int;(pid_t * __restrict pid, const char * __restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t * __restrict attrp, char *const argv[ __restrict], char *const envp[ __restrict]);(pid, path, file_actions, attrp, argv, envp) #endif -@@ -229,7 +231,7 @@ facl;int;(int fd, int cmd, int cnt, void +@@ -235,7 +237,7 @@ facl;int;(int fd, int cmd, int cnt, void #ifdef HAVE_FTS_READ fts_read;FTSENT *;(FTS *ftsp);(ftsp) #ifdef __APPLE__ @@ -45,7 +45,7 @@ fts_read$INODE64;FTSENT *;(FTS *ftsp);(ftsp) #endif #endif /* ifdef __APPLE__ */ -@@ -237,7 +239,7 @@ fts_read$INODE64;FTSENT *;(FTS *ftsp);(f +@@ -243,7 +245,7 @@ fts_read$INODE64;FTSENT *;(FTS *ftsp);(f #ifdef HAVE_FTS_CHILDREN fts_children;FTSENT *;(FTS *ftsp, int options);(ftsp, options) #ifdef __APPLE__ diff --git a/tools/findutils/Makefile b/tools/findutils/Makefile index ac1d5312c..6587c759f 100644 --- a/tools/findutils/Makefile +++ b/tools/findutils/Makefile @@ -8,11 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=findutils PKG_CPE_ID:=cpe:/a:gnu:findutils -PKG_VERSION:=4.9.0 +PKG_VERSION:=4.10.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=a2bfb8c09d436770edc59f50fa483e785b161a3b7b9d547573cb08065fd462fe +PKG_HASH:=1387e0b67ff247d2abde998f90dfbf70c1491391a59ddfecb8ae698789f0a4f5 + +PKG_PROGRAMS:=find locate updatedb xargs HOST_BUILD_PARALLEL:=1 diff --git a/tools/findutils/patches/010-endpwent.patch b/tools/findutils/patches/010-endpwent.patch deleted file mode 100644 index dc346f3f7..000000000 --- a/tools/findutils/patches/010-endpwent.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/find/parser.c -+++ b/find/parser.c -@@ -67,12 +67,12 @@ - #include "findutils-version.h" - #include "system.h" - -- --#ifndef HAVE_ENDGRENT --# define endgrent () -+#if ! HAVE_ENDGRENT -+# define endgrent() ((void) 0) - #endif --#ifndef HAVE_ENDPWENT --# define endpwent () -+ -+#if ! HAVE_ENDPWENT -+# define endpwent() ((void) 0) - #endif - - static bool parse_accesscheck (const struct parser_table*, char *argv[], int *arg_ptr); diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 1c47a3109..62222b6da 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2022-12-15 -PKG_SOURCE_VERSION:=bd856eff48509fa4511169ee55f639ede8dd4ac6 -PKG_MIRROR_HASH:=4dc754b403b10f43dc2871f17ef7b223c85ad3b14c57899497f0b6bb304756d9 +PKG_SOURCE_DATE:=2024-10-20 +PKG_SOURCE_VERSION:=4b7638925d3eac03e614e40bc30cb49f5877c46d +PKG_MIRROR_HASH:=ea0e30f2b20211e4153704019ebb3f8789269893a4af6d853a85fae7c091802c include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch deleted file mode 100644 index 45900e982..000000000 --- a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff -ruN firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c firmware-utils-2022-02-28-002cfaf0/src/ptgen.c ---- firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c 2022-04-23 19:02:07.307896842 +0200 -+++ firmware-utils-2022-02-28-002cfaf0/src/ptgen.c 2022-04-22 18:48:54.477970950 +0200 -@@ -82,6 +82,14 @@ - GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ - 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) - -+#define GUID_PARTITION_SIFIVE_SPL \ -+ GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ -+ 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) -+ -+#define GUID_PARTITION_SIFIVE_UBOOT \ -+ GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ -+ 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) -+ - #define GPT_HEADER_SIZE 92 - #define GPT_ENTRY_SIZE 128 - #define GPT_ENTRY_MAX 128 -@@ -276,6 +284,19 @@ - (1ULL << 56); /* success=1 */ - return true; - } -+ -+ if (!strcmp(type, "sifiveu_spl")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_SPL; -+ return true; -+ } -+ -+ if (!strcmp(type, "sifiveu_uboot")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_UBOOT; -+ return true; -+ } -+ - return false; - } - diff --git a/tools/flex/Makefile b/tools/flex/Makefile index da037ae72..177136b78 100644 --- a/tools/flex/Makefile +++ b/tools/flex/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=flex -PKG_CPE_ID:=cpe:/a:flex_project:flex +PKG_CPE_ID:=cpe:/a:westes:flex PKG_VERSION:=2.6.4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -21,13 +21,17 @@ include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_ARGS += --disable-shared +define Host/Compile + $(call Host/Compile/Default,SUBDIRS='src tools') +endef + define Host/Install - $(call Host/Install/Default) + $(call Host/Compile/Default,install SUBDIRS='src tools') $(LN) flex $(STAGING_DIR_HOST)/bin/lex endef define Host/Uninstall - -$(call Host/Compile/Default,uninstall) + -$(call Host/Compile/Default,uninstall SUBDIRS='src tools') endef define Host/Clean diff --git a/tools/flex/patches/100-disable-tests-docs.patch b/tools/flex/patches/100-disable-tests-docs.patch deleted file mode 100644 index f7097f212..000000000 --- a/tools/flex/patches/100-disable-tests-docs.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/Makefile.am -+++ b/Makefile.am -@@ -43,10 +43,7 @@ EXTRA_DIST = \ - - SUBDIRS = \ - src \ -- doc \ -- examples \ - po \ -- tests \ - tools - - # Create the ChangeLog, but only if we're inside a git working directory diff --git a/tools/flex/patches/300-m4-path.patch b/tools/flex/patches/300-m4-path.patch new file mode 100644 index 000000000..48e376f27 --- /dev/null +++ b/tools/flex/patches/300-m4-path.patch @@ -0,0 +1,23 @@ +--- a/src/main.c ++++ b/src/main.c +@@ -213,6 +213,8 @@ int main (int argc, char *argv[]) + + void check_options (void) + { ++ const char * staging_dir = NULL; ++ char * m4_staging = NULL; + int i; + const char * m4 = NULL; + +@@ -341,7 +343,10 @@ void check_options (void) + + /* Setup the filter chain. */ + output_chain = filter_create_int(NULL, filter_tee_header, headerfilename); +- if ( !(m4 = getenv("M4"))) { ++ if ( (staging_dir = getenv("STAGING_DIR_HOST"))) { ++ asprintf(&m4_staging, "%s/bin/m4", staging_dir); ++ m4 = m4_staging; ++ } else if ( !(m4 = getenv("M4"))) { + char *slash; + m4 = M4; + if ((slash = strrchr(M4, '/')) != NULL) { diff --git a/tools/gengetopt/Makefile b/tools/gengetopt/Makefile index 563ecccf9..5a5b5eb7c 100644 --- a/tools/gengetopt/Makefile +++ b/tools/gengetopt/Makefile @@ -13,12 +13,16 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) PKG_HASH:=b941aec9011864978dd7fdeb052b1943535824169d2aa2b0e7eae9ab807584ac -HOST_FIXUP:=autoreconf +PKG_SUBDIRS:=$$$$(foreach dir,gl src skels,$$$$(wildcard $$$$(dir)) ) HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +define Host/Compile + $(call Host/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)') +endef + define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/gengetopt $(STAGING_DIR_HOST)/bin/ endef diff --git a/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch b/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch new file mode 100644 index 000000000..6aa3f549d --- /dev/null +++ b/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch @@ -0,0 +1,25 @@ +From bfba6445a778007f40af5cbfbe725e12c0fcafc6 Mon Sep 17 00:00:00 2001 +From: Tomas Volf <~@wolfsden.cz> +Date: Tue, 5 Mar 2024 22:25:20 +0100 +Subject: [PATCH] gm_utils.cpp: Call clear instead of empty. + +Since the intention seem to be to erase the next word, I believe calling empty +was a mistake and it should have been clear. Empty does nothing in this +context. + +* src/gm_utils.cpp (wrap_cstr): Call clear. +--- + src/gm_utils.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/gm_utils.cpp ++++ b/src/gm_utils.cpp +@@ -311,7 +311,7 @@ void wrap_cstr(string& wrapped, unsigned + // trim leading spaces + std::size_t pos = next_word.find_first_not_of(' '); + if( pos == std::string::npos ) +- next_word.empty(); ++ next_word.clear(); + else if( pos ) + next_word.erase( 0, pos ); + diff --git a/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch b/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch new file mode 100644 index 000000000..ce997f450 --- /dev/null +++ b/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch @@ -0,0 +1,33 @@ +From a3d0a0419a35bef9b80a6a12432ab30e2d1e0f5a Mon Sep 17 00:00:00 2001 +From: Tomas Volf <~@wolfsden.cz> +Date: Tue, 5 Mar 2024 22:27:42 +0100 +Subject: [PATCH] gm_utils.h: Drop std::unary_function. + +I am not sure what it does, it is deprecated/removed (depending on C++ version) +and the advice seems to be that is just is not necessary. So just remove it. + +* src/gm_utils.h (print_f, pair_print_f): Drop std::unary_function. +--- + src/gm_utils.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/gm_utils.h ++++ b/src/gm_utils.h +@@ -117,7 +117,7 @@ bool string_contains(const char *s, cons + * Function object to print something into a stream (to be used with for_each) + */ + template +-struct print_f : public std::unary_function ++struct print_f + { + print_f(std::ostream& out, const string &s = ", ") : os(out), sep(s) {} + void operator() (T x) { os << x << sep; } +@@ -129,7 +129,7 @@ struct print_f : public std::unary_funct + * Function object to print a pair into two streams (to be used with for_each) + */ + template +-struct pair_print_f : public std::unary_function ++struct pair_print_f + { + pair_print_f(std::ostream& out1, std::ostream& out2, const string &s = ", ") : + os1(out1), os2(out2), sep(s) {} diff --git a/tools/gengetopt/patches/100-no-tests-docs.patch b/tools/gengetopt/patches/100-no-tests-docs.patch deleted file mode 100644 index d8c53af4f..000000000 --- a/tools/gengetopt/patches/100-no-tests-docs.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/Makefile.am -+++ b/Makefile.am -@@ -18,7 +18,7 @@ - ACLOCAL_AMFLAGS = -I m4 -I gl/m4 - - EXTRA_DIST = configure TODO LICENSE gl/m4/gnulib-cache.m4 --SUBDIRS = gl src doc tests -+SUBDIRS = gl src - - gengetoptdoc_DATA = ChangeLog COPYING NEWS THANKS INSTALL README LICENSE - ---- a/Makefile.in -+++ b/Makefile.in -@@ -593,7 +593,7 @@ top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - ACLOCAL_AMFLAGS = -I m4 -I gl/m4 - EXTRA_DIST = configure TODO LICENSE gl/m4/gnulib-cache.m4 --SUBDIRS = gl src doc tests -+SUBDIRS = gl src - gengetoptdoc_DATA = ChangeLog COPYING NEWS THANKS INSTALL README LICENSE - TARBALL = $(top_builddir)/gengetopt-$(PACKAGE_VERSION).tar.xz - all: config.h ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -16,7 +16,7 @@ - # with gengetopt; see the file COPYING. If not, write to the Free Software - # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - --SUBDIRS = skels tests -+SUBDIRS = skels - - bin_PROGRAMS = gengetopt - diff --git a/tools/gmp/Makefile b/tools/gmp/Makefile index cfd6e30e0..f1aa5b1a4 100644 --- a/tools/gmp/Makefile +++ b/tools/gmp/Makefile @@ -7,11 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gmp -PKG_VERSION:=6.2.1 +PKG_VERSION:=6.3.0 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/gmp/ -PKG_HASH:=fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 +PKG_HASH:=e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c +PKG_CPE_ID:=cpe:/a:gmplib:gmp HOST_FIXUP:=autoreconf diff --git a/tools/gnulib/Makefile b/tools/gnulib/Makefile index c5b7e78c5..511935552 100644 --- a/tools/gnulib/Makefile +++ b/tools/gnulib/Makefile @@ -2,11 +2,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gnulib PKG_CPE_ID:=cpe:/a:gnu:$(PKG_NAME) -PKG_VERSION:=f9a4ee73c3e7b544f640d0d04b55983d3a7b894e# # master +PKG_VERSION:=c99c8d491850dc3a6e0b8604a2729d8bc5c0eff1# # stable-202401 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.savannah.gnu.org/cgit/$(PKG_NAME).git/snapshot -PKG_HASH:=514716d58987a9c0de0d69fb22d42bcd19edf80eed099882a004ff162060f1a8 +PKG_HASH:=8e6f4a907d9677b55fd452e1340a3e030a6f530b138d420c11975da33f086b1e include $(INCLUDE_DIR)/host-build.mk @@ -14,12 +14,15 @@ define Host/Configure endef define Host/Install + $(INSTALL_DIR) $(1)/share/aclocal + $(INSTALL_DATA) $(HOST_BUILD_DIR)/m4/*.m4 $(1)/share/aclocal/ $(INSTALL_DIR) $(1)/share/gnulib $(CP) $(HOST_BUILD_DIR)/* $(1)/share/gnulib/ + ln -sf ../share/gnulib/gnulib-tool $(STAGING_DIR_HOST)/bin/gnulib-tool endef define Host/Clean - rm -rf $(STAGING_DIR_HOST)/share/gnulib + rm -rf $(STAGING_DIR_HOST)/bin/gnulib-tool $(STAGING_DIR_HOST)/share/gnulib endef $(eval $(call HostBuild)) diff --git a/tools/gnulib/patches/000-bootstrap.patch b/tools/gnulib/patches/000-bootstrap.patch index 40ed41125..120586694 100644 --- a/tools/gnulib/patches/000-bootstrap.patch +++ b/tools/gnulib/patches/000-bootstrap.patch @@ -43,7 +43,7 @@ if [ ! "$inst_ver" ]; then warn_ "Error: '$app' not found" ret=1 -@@ -1135,7 +1135,7 @@ autogen() +@@ -1157,7 +1157,7 @@ autogen() # two just-pre-run programs. # Import from gettext. diff --git a/tools/gnulib/patches/010-autoconf-version.patch b/tools/gnulib/patches/010-autoconf-version.patch new file mode 100644 index 000000000..a091bb2e1 --- /dev/null +++ b/tools/gnulib/patches/010-autoconf-version.patch @@ -0,0 +1,47 @@ +--- a/gnulib-tool ++++ b/gnulib-tool +@@ -346,6 +346,34 @@ Options for --import, --add/remove-impor + Report bugs to ." + } + ++get_version_sed=' ++# Move version to start of line. ++s/.*[v ]\([0-9]\)/\1/ ++ ++# Skip lines that do not start with version. ++/^[0-9]/!d ++ ++# Remove characters after the version. ++s/[^.a-z0-9-].*// ++ ++# The first component must be digits only. ++s/^\([0-9]*\)[a-z-].*/\1/ ++ ++# The following essentially does s/5.005/5.5/ ++s/\.0*\([1-9]\)/.\1/g ++p ++q' ++ ++# get_version ++# copied from build-aux/bootstrap ++get_version () { ++ app=$1 ++ ++ $app --version >/dev/null 2>&1 || { $app --version; return 1; } ++ ++ $app --version 2>&1 | sed -n "$get_version_sed" ++} ++ + # func_version + # outputs to stdout the --version message. + func_version () +@@ -1620,6 +1648,9 @@ func_determine_path_separator + fi + case "$autoconf_minversion" in + 1.* | 2.[0-5]* | 2.6[0-3]*) ++ # if the version of autoconf in use is high enough, do not error ++ case "$(get_version autoconf)" in 1.* | 2.[0-5]* | 2.6[0-3]*) false ;; esac && \ ++ func_warning "gnulib requires a newer version of autoconf than configure.ac ( $DEFAULT_AUTOCONF_MINVERSION > AC_PREREQ([$autoconf_minversion]) )" || \ + func_fatal_error "minimum supported autoconf version is 2.64. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;; + esac + diff --git a/tools/gnulib/patches/120-unmangle-darwin-fts-h.patch b/tools/gnulib/patches/120-unmangle-darwin-fts-h.patch new file mode 100644 index 000000000..19e46b910 --- /dev/null +++ b/tools/gnulib/patches/120-unmangle-darwin-fts-h.patch @@ -0,0 +1,19 @@ +--- /dev/null ++++ b/lib/fts.h +@@ -0,0 +1,6 @@ ++#ifdef __APPLE__ ++# define _FTS_H_ 1 ++# include ++#else ++# include_next ++#endif +--- a/modules/fts ++++ b/modules/fts +@@ -2,6 +2,7 @@ Description: + Traverse a file hierarchy. + + Files: ++lib/fts.h + lib/fts_.h + lib/fts.c + lib/fts-cycle.c diff --git a/tools/gnulib/patches/150-portable-tdestroy.patch b/tools/gnulib/patches/150-portable-tdestroy.patch new file mode 100644 index 000000000..39c291f19 --- /dev/null +++ b/tools/gnulib/patches/150-portable-tdestroy.patch @@ -0,0 +1,193 @@ +--- a/lib/search.in.h ++++ b/lib/search.in.h +@@ -112,6 +112,11 @@ _GL_CXXALIASWARN (lsearch); + # define twalk rpl_twalk + # endif + # endif ++# if @REPLACE_TDESTROY@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# define tdestroy rpl_tdestroy ++# endif ++# endif + + /* See + +@@ -137,6 +142,7 @@ extern "C" { + # if !GNULIB_defined_search_fn_types + typedef int (*_gl_search_compar_fn) (const void *, const void *); + typedef void (*_gl_search_action_fn) (const void *, VISIT, int); ++typedef void (*_gl_search_free_fn) (void *); + # define GNULIB_defined_search_fn_types 1 + # endif + # ifdef __cplusplus +@@ -252,9 +258,36 @@ _GL_CXXALIAS_SYS (twalk, void, + _GL_CXXALIASWARN (twalk); + # endif + ++/* Removes the whole tree pointed to by root, ++ freeing all resources allocated by the tsearch() function. ++ The FREE_NODE function is called: ++ - For the data in each tree node. ++ - Even when no such work is necessary, to a function doing nothing ++ The arguments passed to FREE_NODE are: ++ 1. The pointer to the data. */ ++# if @REPLACE_TDESTROY@ ++_GL_FUNCDECL_RPL (tdestroy, void, ++ (void *vroot, _gl_search_free_fn freefct) ++ _GL_ARG_NONNULL ((2))); ++_GL_CXXALIAS_RPL (tdestroy, void, ++ (void *vroot, _gl_search_free_fn freefct)); ++# else ++# if !@HAVE_TDESTROY@ ++_GL_FUNCDECL_SYS (tdestroy, void, ++ (void *vroot, _gl_search_free_fn freefct) ++ _GL_ARG_NONNULL ((2))); ++# endif ++_GL_CXXALIAS_SYS (tdestroy, void, ++ (void *vroot, _gl_search_free_fn freefct)); ++# endif ++# if __GLIBC__ >= 2 ++_GL_CXXALIASWARN (tdestroy); ++# endif ++ + /* Flags used by tsearch.c. */ + # define GNULIB_defined_tsearch (@REPLACE_TSEARCH@ || !@HAVE_TSEARCH@) + # define GNULIB_defined_twalk (@REPLACE_TWALK@ || !@HAVE_TWALK@) ++# define GNULIB_defined_tdestroy (@REPLACE_TDESTROY@ || !@HAVE_TDESTROY@) + + #elif defined GNULIB_POSIXCHECK + # undef tsearch +@@ -277,6 +310,11 @@ _GL_WARN_ON_USE (tdelete, "tdelete is un + _GL_WARN_ON_USE (twalk, "twalk is unportable - " + "use gnulib module tsearch for portability"); + # endif ++# undef tdestroy ++# if HAVE_RAW_DECL_TDESTROY ++_GL_WARN_ON_USE (tdestroy, "tdestroy is unportable - " ++ "use gnulib module tsearch for portability"); ++# endif + #endif + + +--- a/lib/tsearch.c ++++ b/lib/tsearch.c +@@ -98,12 +98,14 @@ + + typedef int (*__compar_fn_t) (const void *, const void *); + typedef void (*__action_fn_t) (const void *, VISIT, int); ++typedef void (*__free_fn_t) (void *); + + #ifndef weak_alias + # define __tsearch tsearch + # define __tfind tfind + # define __tdelete tdelete + # define __twalk twalk ++# define __tdestroy tdestroy + #endif + + #ifndef internal_function +@@ -656,7 +658,7 @@ weak_alias (__twalk, twalk) + #endif /* GNULIB_defined_twalk */ + + +-#ifdef _LIBC ++#if defined(_LIBC) || GNULIB_defined_tdestroy + + /* The standardized functions miss an important functionality: the + tree cannot be removed easily. We provide a function to do this. */ +@@ -683,6 +685,8 @@ __tdestroy (void *vroot, __free_fn_t fre + if (root != NULL) + tdestroy_recurse (root, freefct); + } ++#ifdef weak_alias + weak_alias (__tdestroy, tdestroy) ++#endif + +-#endif /* _LIBC */ ++#endif /* defined(_LIBC) || GNULIB_defined_tdestroy */ +--- a/m4/search_h.m4 ++++ b/m4/search_h.m4 +@@ -39,7 +39,7 @@ AC_DEFUN_ONCE([gl_SEARCH_H], + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include +- ]], [tdelete tfind tsearch twalk]) ++ ]], [tdelete tfind tsearch twalk tdestroy]) + + AC_REQUIRE([AC_C_RESTRICT]) + ]) +@@ -75,8 +75,10 @@ AC_DEFUN([gl_SEARCH_H_DEFAULTS], + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LFIND], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEARCH], [1]) + dnl Assume proper GNU behavior unless another module says otherwise. +- HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH]) +- HAVE_TWALK=1; AC_SUBST([HAVE_TWALK]) +- REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH]) +- REPLACE_TWALK=0; AC_SUBST([REPLACE_TWALK]) ++ HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH]) ++ HAVE_TWALK=1; AC_SUBST([HAVE_TWALK]) ++ HAVE_TDESTROY=1; AC_SUBST([HAVE_TDESTROY]) ++ REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH]) ++ REPLACE_TWALK=0; AC_SUBST([REPLACE_TWALK]) ++ REPLACE_TDESTROY=0; AC_SUBST([REPLACE_TDESTROY]) + ]) +--- a/m4/tsearch.m4 ++++ b/m4/tsearch.m4 +@@ -9,6 +9,7 @@ AC_DEFUN([gl_FUNC_TSEARCH], + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + gl_CHECK_FUNCS_ANDROID([tsearch], [[#include ]]) + gl_CHECK_FUNCS_ANDROID([twalk], [[#include ]]) ++ gl_CHECK_FUNCS_ANDROID([tdestroy], [[#include ]]) + if test $ac_cv_func_tsearch = yes; then + dnl On OpenBSD 4.0, the return value of tdelete() is incorrect. + AC_REQUIRE([AC_PROG_CC]) +@@ -50,6 +51,7 @@ main () + *no) + REPLACE_TSEARCH=1 + REPLACE_TWALK=1 ++ REPLACE_TDESTROY=1 + ;; + esac + else +@@ -64,6 +66,12 @@ main () + future*) REPLACE_TWALK=1 ;; + esac + fi ++ if test $ac_cv_func_tdestroy != yes; then ++ HAVE_TDESTROY=0 ++ case "$gl_cv_onwards_func_tdestroy" in ++ future*) REPLACE_TDESTROY=1 ;; ++ esac ++ fi + ]) + + # Prerequisites of lib/tsearch.c. +--- a/modules/search ++++ b/modules/search +@@ -37,8 +37,10 @@ search.h: search.in.h $(top_builddir)/co + -e 's/@''GNULIB_MDA_LSEARCH''@/$(GNULIB_MDA_LSEARCH)/g' \ + -e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \ + -e 's|@''HAVE_TWALK''@|$(HAVE_TWALK)|g' \ ++ -e 's|@''HAVE_TDESTROY''@|$(HAVE_TDESTROY)|g' \ + -e 's|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \ + -e 's|@''REPLACE_TWALK''@|$(REPLACE_TWALK)|g' \ ++ -e 's|@''REPLACE_TDESTROY''@|$(REPLACE_TDESTROY)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ +--- a/modules/tsearch ++++ b/modules/tsearch +@@ -11,7 +11,12 @@ search + configure.ac: + gl_FUNC_TSEARCH + gl_CONDITIONAL([GL_COND_OBJ_TSEARCH], +- [test $HAVE_TSEARCH = 0 || test $HAVE_TWALK = 0 || test $REPLACE_TSEARCH = 1 || test $REPLACE_TWALK = 1]) ++ [test $HAVE_TSEARCH = 0 || ++ test $HAVE_TWALK = 0 || ++ test $HAVE_TDESTROY = 0 || ++ test $REPLACE_TSEARCH = 1 || ++ test $REPLACE_TWALK = 1 || ++ test $REPLACE_TDESTROY = 1]) + AM_COND_IF([GL_COND_OBJ_TSEARCH], [ + gl_PREREQ_TSEARCH + ]) diff --git a/tools/gnulib/patches/160-flag-reallocarray.patch b/tools/gnulib/patches/160-flag-reallocarray.patch new file mode 100644 index 000000000..8ffe273e1 --- /dev/null +++ b/tools/gnulib/patches/160-flag-reallocarray.patch @@ -0,0 +1,115 @@ +--- a/lib/ialloc.h ++++ b/lib/ialloc.h +@@ -106,6 +106,8 @@ icalloc (idx_t n, idx_t s) + return calloc (n, s); + } + ++#if GNULIB_REALLOCARRAY ++ + /* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size). + It returns a non-NULL pointer to num * size bytes of memory. + Upon failure, it returns NULL with errno set. */ +@@ -131,6 +133,8 @@ ireallocarray (void *p, idx_t n, idx_t s + return _gl_alloc_nomem (); + } + ++#endif /* GNULIB_REALLOCARRAY */ ++ + #ifdef __cplusplus + } + #endif +--- a/lib/xmalloc.c ++++ b/lib/xmalloc.c +@@ -51,12 +51,16 @@ ximalloc (idx_t s) + return nonnull (imalloc (s)); + } + ++#if GNULIB_REALLOCARRAY ++ + char * + xcharalloc (size_t n) + { + return XNMALLOC (n, char); + } + ++#endif /* GNULIB_REALLOCARRAY */ ++ + /* Change the size of an allocated block of memory P to S bytes, + with error checking. */ + +@@ -75,6 +79,8 @@ xirealloc (void *p, idx_t s) + return nonnull (irealloc (p, s)); + } + ++#if GNULIB_REALLOCARRAY ++ + /* Change the size of an allocated block of memory P to an array of N + objects each of S bytes, with error checking. */ + +@@ -205,6 +211,8 @@ x2nrealloc (void *p, size_t *pn, size_t + return p; + } + ++#endif /* GNULIB_REALLOCARRAY */ ++ + /* Grow PA, which points to an array of *PN items, and return the + location of the reallocated array, updating *PN to reflect its + new size. The new array will contain at least N_INCR_MIN more +--- a/lib/xalloc.h ++++ b/lib/xalloc.h +@@ -129,6 +129,7 @@ char *xstrdup (char const *str) + # define XCALLOC(n, t) \ + ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) + ++# if GNULIB_REALLOCARRAY + + /* Allocate an array of N objects, each with S bytes of memory, + dynamically, with error checking. S must be nonzero. */ +@@ -156,6 +157,8 @@ char *xcharalloc (size_t n) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; + ++# endif /* GNULIB_REALLOCARRAY */ ++ + #endif /* GNULIB_XALLOC */ + + +--- a/lib/safe-alloc.h ++++ b/lib/safe-alloc.h +@@ -36,6 +36,8 @@ _GL_INLINE_HEADER_BEGIN + # define SAFE_ALLOC_INLINE _GL_INLINE + #endif + ++#if GNULIB_REALLOCARRAY ++ + /* Don't call these directly - use the macros below. */ + SAFE_ALLOC_INLINE void * + safe_alloc_realloc_n (void *ptr, size_t count, size_t size) +@@ -51,6 +53,9 @@ safe_alloc_realloc_n (void *ptr, size_t + #endif + return ptr; + } ++ ++#endif /* GNULIB_REALLOCARRAY */ ++ + _GL_ATTRIBUTE_NODISCARD SAFE_ALLOC_INLINE int + safe_alloc_check (void *ptr) + { +@@ -84,6 +89,8 @@ safe_alloc_check (void *ptr) + #define ALLOC_N(ptr, count) \ + safe_alloc_check ((ptr) = calloc (count, sizeof *(ptr))) + ++#if GNULIB_REALLOCARRAY ++ + /** + * ALLOC_N_UNINITIALIZED: + * @ptr: pointer to allocated memory +@@ -112,6 +119,8 @@ safe_alloc_check (void *ptr) + #define REALLOC_N(ptr, count) \ + safe_alloc_check ((ptr) = safe_alloc_realloc_n (ptr, count, sizeof *(ptr))) + ++#endif /* GNULIB_REALLOCARRAY */ ++ + /** + * FREE: + * @ptr: pointer holding address to be freed diff --git a/tools/gnulib/patches/200-force-disable-after-configure.patch b/tools/gnulib/patches/200-force-disable-after-configure.patch new file mode 100644 index 000000000..55335b27d --- /dev/null +++ b/tools/gnulib/patches/200-force-disable-after-configure.patch @@ -0,0 +1,56 @@ +--- a/lib/fcntl.c ++++ b/lib/fcntl.c +@@ -198,6 +198,8 @@ static int klibc_fcntl (int fd, int acti + FD_CLOEXEC is portable, but other flags may be present); otherwise + return -1 and set errno. */ + ++#if (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl) ++ + int + fcntl (int fd, int action, /* arg */...) + #undef fcntl +@@ -443,6 +445,8 @@ fcntl (int fd, int action, /* arg */...) + return result; + } + ++#endif /* (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl) */ ++ + static int + rpl_fcntl_DUPFD (int fd, int target) + { +--- a/lib/stdlib.in.h ++++ b/lib/stdlib.in.h +@@ -1447,10 +1447,16 @@ _GL_FUNCDECL_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); + _GL_CXXALIAS_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); ++# if !GNULIB_defined_rpl_reallocarray ++# define GNULIB_defined_rpl_reallocarray 1 ++# endif + # else + # if ! @HAVE_REALLOCARRAY@ + _GL_FUNCDECL_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); ++# if !GNULIB_defined_reallocarray ++# define GNULIB_defined_reallocarray 1 ++# endif + # endif + _GL_CXXALIAS_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +--- a/lib/reallocarray.c ++++ b/lib/reallocarray.c +@@ -23,6 +23,8 @@ + #include + #include + ++#if (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray) ++ + void * + reallocarray (void *ptr, size_t nmemb, size_t size) + { +@@ -36,3 +38,5 @@ reallocarray (void *ptr, size_t nmemb, s + /* Rely on the semantics of GNU realloc. */ + return realloc (ptr, nbytes); + } ++ ++#endif /* (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray) */ diff --git a/tools/gnulib/patches/320-modules-fallocate-posix.patch b/tools/gnulib/patches/320-modules-fallocate-posix.patch new file mode 100644 index 000000000..e30a7172a --- /dev/null +++ b/tools/gnulib/patches/320-modules-fallocate-posix.patch @@ -0,0 +1,326 @@ +--- /dev/null ++++ b/modules/fallocate-posix +@@ -0,0 +1,43 @@ ++Description: ++posix_fallocate function that is glibc compatible. ++ ++Files: ++lib/posix_fallocate.c ++m4/fcntl_h.m4 ++m4/posix_fallocate.m4 ++ ++Depends-on: ++errno [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++fcntl [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++fstat [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++ftruncate [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++pread [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++pwrite [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++stdint [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++sys_stat [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++unistd [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1] ++fcntl-h ++ ++configure.ac: ++gl_FUNC_POSIX_FALLOCATE ++gl_CONDITIONAL([GL_COND_OBJ_POSIX_FALLOCATE], ++ [test $HAVE_FALLOCATE_POSIX = 0 || test $REPLACE_FALLOCATE_POSIX = 1]) ++AM_COND_IF([GL_COND_OBJ_POSIX_FALLOCATE], [ ++ gl_PREREQ_POSIX_FALLOCATE ++]) ++gl_MODULE_INDICATOR([fallocate-posix]) ++gl_FCNTL_MODULE_INDICATOR([fallocate-posix]) ++ ++Makefile.am: ++if GL_COND_OBJ_POSIX_FALLOCATE ++lib_SOURCES += posix_fallocate.c ++endif ++ ++Include: ++ ++ ++License: ++LGPLv2+ ++ ++Maintainer: ++all +--- /dev/null ++++ b/m4/posix_fallocate.m4 +@@ -0,0 +1,20 @@ ++# posix_fallocate.m4 serial 1 ++dnl Copyright (C) 2024 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_POSIX_FALLOCATE], ++[ ++ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) ++ gl_CHECK_FUNCS_ANDROID([posix_fallocate], [[#include ]]) ++ if test "$ac_cv_func_posix_fallocate" = no; then ++ HAVE_FALLOCATE_POSIX=0 ++ case "$gl_cv_onwards_func_posix_fallocate" in ++ future*) REPLACE_FALLOCATE_POSIX=1 ;; ++ esac ++ fi ++]) ++ ++# Prerequisites of lib/posix_fallocate.c. ++AC_DEFUN([gl_PREREQ_POSIX_FALLOCATE], [:]) +--- a/m4/fcntl_h.m4 ++++ b/m4/fcntl_h.m4 +@@ -23,7 +23,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H], + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include +- ]], [fcntl openat]) ++ ]], [fcntl openat posix_fallocate]) + ]) + + # gl_FCNTL_MODULE_INDICATOR([modulename]) +@@ -50,6 +50,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) ++ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FALLOCATE_POSIX]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) +@@ -61,10 +62,12 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], + AC_DEFUN([gl_FCNTL_H_DEFAULTS], + [ + dnl Assume proper GNU behavior unless another module says otherwise. +- HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) +- HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) +- REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) +- REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) +- REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) +- REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) ++ HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) ++ HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) ++ HAVE_FALLOCATE_POSIX=1; AC_SUBST([HAVE_FALLOCATE_POSIX]) ++ REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) ++ REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) ++ REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) ++ REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) ++ REPLACE_FALLOCATE_POSIX=0; AC_SUBST([REPLACE_FALLOCATE_POSIX]) + ]) +--- a/modules/fcntl-h ++++ b/modules/fcntl-h +@@ -40,14 +40,17 @@ fcntl.h: fcntl.in.h $(top_builddir)/conf + -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ ++ -e 's/@''GNULIB_FALLOCATE_POSIX''@/$(GNULIB_FALLOCATE_POSIX)/g' \ + -e 's/@''GNULIB_MDA_CREAT''@/$(GNULIB_MDA_CREAT)/g' \ + -e 's/@''GNULIB_MDA_OPEN''@/$(GNULIB_MDA_OPEN)/g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ ++ -e 's|@''HAVE_FALLOCATE_POSIX''@|$(HAVE_FALLOCATE_POSIX)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ ++ -e 's|@''REPLACE_FALLOCATE_POSIX''@|$(REPLACE_FALLOCATE_POSIX)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ +--- a/lib/fcntl.in.h ++++ b/lib/fcntl.in.h +@@ -238,6 +238,33 @@ _GL_WARN_ON_USE (openat, "openat is not + # endif + #endif + ++#if @GNULIB_FALLOCATE_POSIX@ ++# if @REPLACE_FALLOCATE_POSIX@ ++# if !(defined __cplusplus && defined GNULIB_NAMESPACE) ++# undef posix_fallocate ++# define posix_fallocate rpl_posix_fallocate ++# endif ++_GL_FUNCDECL_RPL (posix_fallocate, int, ++ (int fd, off_t offset, off_t len)); ++_GL_CXXALIAS_RPL (posix_fallocate, int, ++ (int fd, off_t offset, off_t len)); ++# else ++# if !@HAVE_FALLOCATE_POSIX@ ++_GL_FUNCDECL_SYS (posix_fallocate, int, ++ (int fd, off_t offset, off_t len)); ++# endif ++_GL_CXXALIAS_SYS (posix_fallocate, int, ++ (int fd, off_t offset, off_t len)); ++# endif ++_GL_CXXALIASWARN (posix_fallocate); ++#elif defined GNULIB_POSIXCHECK ++# undef posix_fallocate ++# if HAVE_RAW_DECL_POSIX_FALLOCATE ++_GL_WARN_ON_USE (posix_fallocate, "posix_fallocate is not portable - " ++ "use gnulib module fallocate-posix for portability"); ++# endif ++#endif ++ + + /* Fix up the FD_* macros, only known to be missing on mingw. */ + +--- /dev/null ++++ b/lib/posix_fallocate.c +@@ -0,0 +1,150 @@ ++/* posix_fallocate function that is glibc compatible. ++ ++ Copyright (C) 2024 Free Software Foundation, Inc. ++ ++ This file is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as ++ published by the Free Software Foundation; either version 2.1 of the ++ License, or (at your option) any later version. ++ ++ This file is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef __APPLE__ ++# include ++# include ++#else ++# include ++#endif ++ ++/* Reserve storage for the data of the file associated with FD. This ++ emulation is far from perfect, but the kernel cannot do not much ++ better for network file systems, either. */ ++ ++int ++posix_fallocate (int fd, off_t offset, off_t len) ++{ ++ int ret; ++ struct stat st; ++ ++ if (fd < 0 || offset < 0 || len < 0) ++ return EINVAL; ++ ++ /* Perform overflow check. The outer cast relies on a GCC ++ extension. */ ++ if ((off_t) ((uint64_t) offset + (uint64_t) len) < 0) ++ return EFBIG; ++ ++ /* pwrite below will not do the right thing in O_APPEND mode. */ ++ { ++ int flags = fcntl (fd, F_GETFL, 0); ++ if (flags < 0 || (flags & O_APPEND) != 0) ++ return EBADF; ++ } ++ ++ /* We have to make sure that this is really a regular file. */ ++ if (fstat (fd, &st) != 0) ++ return EBADF; ++ if (S_ISFIFO (st.st_mode)) ++ return ESPIPE; ++ if (! S_ISREG (st.st_mode)) ++ return ENODEV; ++ ++ if (len == 0) ++ { ++ /* This is racy, but there is no good way to satisfy a ++ zero-length allocation request. */ ++ if (st.st_size < offset) ++ { ++ ret = ftruncate (fd, offset); ++ ++ if (ret != 0) ++ ret = errno; ++ return ret; ++ } ++ return ret; ++ } ++ ++#ifdef __APPLE__ ++ fstore_t sto = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, offset + len, 0}; ++ /* allocate continuous */ ++ ret = fcntl (fd, F_PREALLOCATE, &sto); ++ if (ret < 0) ++ { ++ /* allocate non-continuous */ ++ sto.fst_flags = F_ALLOCATEALL; ++ ret = fcntl (fd, F_PREALLOCATE, &sto); ++ if (ret < 0) ++ { ++ return ret; ++ } ++ } ++ ret = ftruncate(fd, offset + len); ++#else ++ ++ /* Minimize data transfer for network file systems, by issuing ++ single-byte write requests spaced by the file system block size. ++ (Most local file systems have fallocate support, so this fallback ++ code is not used there.) */ ++ ++ unsigned increment; ++ { ++ struct statfs f; ++ ++ if (fstatfs (fd, &f) != 0) ++ return errno; ++ if (f.f_bsize == 0) ++ increment = 512; ++ else if (f.f_bsize < 4096) ++ increment = f.f_bsize; ++ else ++ /* NFS does not propagate the block size of the underlying ++ storage and may report a much larger value which would still ++ leave holes after the loop below, so we cap the increment at ++ 4096. */ ++ increment = 4096; ++ } ++ ++ /* Write a null byte to every block. This is racy; we currently ++ lack a better option. Compare-and-swap against a file mapping ++ might additional local races, but requires interposition of a ++ signal handler to catch SIGBUS. */ ++ for (offset += (len - 1) % increment; len > 0; offset += increment) ++ { ++ len -= increment; ++ ++ if (offset < st.st_size) ++ { ++ unsigned char c; ++ ssize_t rsize = pread (fd, &c, 1, offset); ++ ++ if (rsize < 0) ++ return errno; ++ /* If there is a non-zero byte, the block must have been ++ allocated already. */ ++ else if (rsize == 1 && c != 0) ++ continue; ++ } ++ ++ if (pwrite (fd, "", 1, offset) != 1) ++ return errno; ++ } ++ ++#endif /* __APPLE__ */ ++ ++ return ret; ++} +--- a/MODULES.html.sh ++++ b/MODULES.html.sh +@@ -2552,6 +2552,7 @@ func_all_modules () + func_module execve + func_module execvp + func_module execvpe ++ func_module fallocate-posix + func_module fchdir + func_module fclose + func_module fcntl-h diff --git a/tools/include/asm/bitsperlong.h b/tools/include/asm/bitsperlong.h new file mode 100644 index 000000000..75f320fa9 --- /dev/null +++ b/tools/include/asm/bitsperlong.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_BITS_PER_LONG +#define __ASM_GENERIC_BITS_PER_LONG + +#ifndef __BITS_PER_LONG +/* + * In order to keep safe and avoid regression, only unify uapi + * bitsperlong.h for some archs which are using newer toolchains + * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__. + * See the following link for more info: + * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/ + */ +#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__) +#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) +#else +/* + * There seems to be no way of detecting this automatically from user + * space, so 64 bit architectures should override this in their + * bitsperlong.h. In particular, an architecture that supports + * both 32 and 64 bit user space must not rely on CONFIG_64BIT + * to decide it, but rather check a compiler provided macro. + */ +#define __BITS_PER_LONG 32 +#endif +#endif + +#endif /* __ASM_GENERIC_BITS_PER_LONG */ diff --git a/tools/include/asm/byteorder.h b/tools/include/asm/byteorder.h new file mode 100644 index 000000000..8e7d779d7 --- /dev/null +++ b/tools/include/asm/byteorder.h @@ -0,0 +1,12 @@ +#ifndef __ASM_BYTEORDER_H +#define __ASM_BYTEORDER_H + +#include + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#include +#else +#include +#endif + +#endif diff --git a/tools/include/asm/errno-base.h b/tools/include/asm/errno-base.h new file mode 100644 index 000000000..9653140bf --- /dev/null +++ b/tools/include/asm/errno-base.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_ERRNO_BASE_H +#define _ASM_GENERIC_ERRNO_BASE_H + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ + +#endif diff --git a/tools/include/asm/errno.h b/tools/include/asm/errno.h new file mode 100644 index 000000000..a96d52533 --- /dev/null +++ b/tools/include/asm/errno.h @@ -0,0 +1,123 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_ERRNO_H +#define _ASM_GENERIC_ERRNO_H + +#include + +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ + +/* + * This error code is special: arch syscall entry code will return + * -ENOSYS if users try to call a syscall that doesn't exist. To keep + * failures of syscalls that really do exist distinguishable from + * failures due to attempts to use a nonexistent syscall, syscall + * implementations should refrain from returning -ENOSYS. + */ +#define ENOSYS 38 /* Invalid system call number */ + +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define ECANCELED 125 /* Operation Canceled */ +#define ENOKEY 126 /* Required key not available */ +#define EKEYEXPIRED 127 /* Key has expired */ +#define EKEYREVOKED 128 /* Key has been revoked */ +#define EKEYREJECTED 129 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 130 /* Owner died */ +#define ENOTRECOVERABLE 131 /* State not recoverable */ + +#define ERFKILL 132 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 133 /* Memory page has hardware error */ + +#endif diff --git a/tools/include/asm/posix_types.h b/tools/include/asm/posix_types.h new file mode 100644 index 000000000..10f5e6ef4 --- /dev/null +++ b/tools/include/asm/posix_types.h @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_POSIX_TYPES_H +#define __ASM_GENERIC_POSIX_TYPES_H + +#include + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. + * + * First the types that are often defined in different ways across + * architectures, so that you can override them. + */ + +#ifndef __kernel_long_t +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; +#endif + +#ifndef __kernel_ino_t +typedef __kernel_ulong_t __kernel_ino_t; +#endif + +#ifndef __kernel_mode_t +typedef unsigned int __kernel_mode_t; +#endif + +#ifndef __kernel_pid_t +typedef int __kernel_pid_t; +#endif + +#ifndef __kernel_ipc_pid_t +typedef int __kernel_ipc_pid_t; +#endif + +#ifndef __kernel_uid_t +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +#endif + +#ifndef __kernel_suseconds_t +typedef __kernel_long_t __kernel_suseconds_t; +#endif + +#ifndef __kernel_daddr_t +typedef int __kernel_daddr_t; +#endif + +#ifndef __kernel_uid32_t +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +#endif + +#ifndef __kernel_old_uid_t +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +#endif + +#ifndef __kernel_old_dev_t +typedef unsigned int __kernel_old_dev_t; +#endif + +/* + * Most 32 bit architectures use "unsigned int" size_t, + * and all 64 bit architectures use "unsigned long" size_t. + */ +#ifndef __kernel_size_t +#if __BITS_PER_LONG != 64 +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +#else +typedef __kernel_ulong_t __kernel_size_t; +typedef __kernel_long_t __kernel_ssize_t; +typedef __kernel_long_t __kernel_ptrdiff_t; +#endif +#endif + +#ifndef __kernel_fsid_t +typedef struct { + int val[2]; +} __kernel_fsid_t; +#endif + +/* + * anything below here should be completely generic + */ +typedef __kernel_long_t __kernel_off_t; +typedef long long __kernel_loff_t; +typedef __kernel_long_t __kernel_old_time_t; +typedef __kernel_long_t __kernel_time_t; +typedef long long __kernel_time64_t; +typedef __kernel_long_t __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; + +#endif /* __ASM_GENERIC_POSIX_TYPES_H */ diff --git a/tools/include/asm/swab.h b/tools/include/asm/swab.h new file mode 100644 index 000000000..f2da4e4fd --- /dev/null +++ b/tools/include/asm/swab.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_SWAB_H +#define _ASM_GENERIC_SWAB_H + +#include + +/* + * 32 bit architectures typically (but not always) want to + * set __SWAB_64_THRU_32__. In user space, this is only + * valid if the compiler supports 64 bit data types. + */ + +#if __BITS_PER_LONG == 32 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __SWAB_64_THRU_32__ +#endif +#endif + +#endif /* _ASM_GENERIC_SWAB_H */ diff --git a/tools/include/asm/types.h b/tools/include/asm/types.h index 2c9123261..5a12bbe91 100644 --- a/tools/include/asm/types.h +++ b/tools/include/asm/types.h @@ -10,15 +10,20 @@ #define _ASM_GENERIC_INT_LL64_H typedef __signed__ char __s8; +typedef unsigned char __u8; typedef __signed__ short __s16; +typedef unsigned short __u16; typedef __signed__ int __s32; +typedef unsigned int __u32; #ifdef __GNUC__ __extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; #else typedef __signed__ long long __s64; +typedef unsigned long long __u64; #endif #endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/tools/include/endian.h b/tools/include/endian.h index e2ac75566..f625689f3 100644 --- a/tools/include/endian.h +++ b/tools/include/endian.h @@ -37,4 +37,52 @@ #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif +#ifndef __linux__ +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe16(x) bswap_16(x) +#define be16toh(x) bswap_16(x) +#define htobe32(x) bswap_32(x) +#define be32toh(x) bswap_32(x) +#define htobe64(x) bswap_64(x) +#define be64toh(x) bswap_64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define htole16(x) bswap_16(x) +#define le16toh(x) bswap_16(x) +#define htole32(x) bswap_32(x) +#define le32toh(x) bswap_32(x) +#define htole64(x) bswap_64(x) +#define le64toh(x) bswap_64(x) +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define betoh16(x) bswap_16(x) +#define betoh32(x) bswap_32(x) +#define betoh64(x) bswap_64(x) +#define letoh16(x) (uint16_t)(x) +#define letoh32(x) (uint32_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define betoh16(x) (uint16_t)(x) +#define betoh32(x) (uint32_t)(x) +#define betoh64(x) (uint64_t)(x) +#define letoh16(x) bswap_16(x) +#define letoh32(x) bswap_32(x) +#define letoh64(x) bswap_64(x) +#endif +#endif +#endif + #endif diff --git a/tools/include/linux/big_endian.h b/tools/include/linux/big_endian.h new file mode 100644 index 000000000..3bb87c573 --- /dev/null +++ b/tools/include/linux/big_endian.h @@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H +#define _LINUX_BYTEORDER_BIG_ENDIAN_H + +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif +#ifndef __BIG_ENDIAN_BITFIELD +#define __BIG_ENDIAN_BITFIELD +#endif + +#include +#include +#include + +#define __constant_htonl(x) ((__be32)(__u32)(x)) +#define __constant_ntohl(x) ((__u32)(__be32)(x)) +#define __constant_htons(x) ((__be16)(__u16)(x)) +#define __constant_ntohs(x) ((__u16)(__be16)(x)) +#define __constant_cpu_to_le64(x) ((__le64)___constant_swab64((x))) +#define __constant_le64_to_cpu(x) ___constant_swab64((__u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__le32)___constant_swab32((x))) +#define __constant_le32_to_cpu(x) ___constant_swab32((__u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__le16)___constant_swab16((x))) +#define __constant_le16_to_cpu(x) ___constant_swab16((__u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__be64)(__u64)(x)) +#define __constant_be64_to_cpu(x) ((__u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__be32)(__u32)(x)) +#define __constant_be32_to_cpu(x) ((__u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__be16)(__u16)(x)) +#define __constant_be16_to_cpu(x) ((__u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__le64)__swab64((x))) +#define __le64_to_cpu(x) __swab64((__u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__le32)__swab32((x))) +#define __le32_to_cpu(x) __swab32((__u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__le16)__swab16((x))) +#define __le16_to_cpu(x) __swab16((__u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__be64)(__u64)(x)) +#define __be64_to_cpu(x) ((__u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__be32)(__u32)(x)) +#define __be32_to_cpu(x) ((__u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__be16)(__u16)(x)) +#define __be16_to_cpu(x) ((__u16)(__be16)(x)) + +static __always_inline __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__le64)__swab64p(p); +} +static __always_inline __u64 __le64_to_cpup(const __le64 *p) +{ + return __swab64p((__u64 *)p); +} +static __always_inline __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__le32)__swab32p(p); +} +static __always_inline __u32 __le32_to_cpup(const __le32 *p) +{ + return __swab32p((__u32 *)p); +} +static __always_inline __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__le16)__swab16p(p); +} +static __always_inline __u16 __le16_to_cpup(const __le16 *p) +{ + return __swab16p((__u16 *)p); +} +static __always_inline __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__be64)*p; +} +static __always_inline __u64 __be64_to_cpup(const __be64 *p) +{ + return (__u64)*p; +} +static __always_inline __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__be32)*p; +} +static __always_inline __u32 __be32_to_cpup(const __be32 *p) +{ + return (__u32)*p; +} +static __always_inline __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__be16)*p; +} +static __always_inline __u16 __be16_to_cpup(const __be16 *p) +{ + return (__u16)*p; +} +#define __cpu_to_le64s(x) __swab64s((x)) +#define __le64_to_cpus(x) __swab64s((x)) +#define __cpu_to_le32s(x) __swab32s((x)) +#define __le32_to_cpus(x) __swab32s((x)) +#define __cpu_to_le16s(x) __swab16s((x)) +#define __le16_to_cpus(x) __swab16s((x)) +#define __cpu_to_be64s(x) do { (void)(x); } while (0) +#define __be64_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be32s(x) do { (void)(x); } while (0) +#define __be32_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be16s(x) do { (void)(x); } while (0) +#define __be16_to_cpus(x) do { (void)(x); } while (0) + + +#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ diff --git a/tools/include/linux/errno.h b/tools/include/linux/errno.h new file mode 100644 index 000000000..70f2bd34e --- /dev/null +++ b/tools/include/linux/errno.h @@ -0,0 +1 @@ +#include diff --git a/tools/include/linux/little_endian.h b/tools/include/linux/little_endian.h new file mode 100644 index 000000000..ba6c199c9 --- /dev/null +++ b/tools/include/linux/little_endian.h @@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H +#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H + +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif +#ifndef __LITTLE_ENDIAN_BITFIELD +#define __LITTLE_ENDIAN_BITFIELD +#endif + +#include +#include +#include + +#define __constant_htonl(x) ((__be32)___constant_swab32((x))) +#define __constant_ntohl(x) ___constant_swab32((__be32)(x)) +#define __constant_htons(x) ((__be16)___constant_swab16((x))) +#define __constant_ntohs(x) ___constant_swab16((__be16)(x)) +#define __constant_cpu_to_le64(x) ((__le64)(__u64)(x)) +#define __constant_le64_to_cpu(x) ((__u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__le32)(__u32)(x)) +#define __constant_le32_to_cpu(x) ((__u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__le16)(__u16)(x)) +#define __constant_le16_to_cpu(x) ((__u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__be64)___constant_swab64((x))) +#define __constant_be64_to_cpu(x) ___constant_swab64((__u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__be32)___constant_swab32((x))) +#define __constant_be32_to_cpu(x) ___constant_swab32((__u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__be16)___constant_swab16((x))) +#define __constant_be16_to_cpu(x) ___constant_swab16((__u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__le64)(__u64)(x)) +#define __le64_to_cpu(x) ((__u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__le32)(__u32)(x)) +#define __le32_to_cpu(x) ((__u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__le16)(__u16)(x)) +#define __le16_to_cpu(x) ((__u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__be64)__swab64((x))) +#define __be64_to_cpu(x) __swab64((__u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__be32)__swab32((x))) +#define __be32_to_cpu(x) __swab32((__u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__be16)__swab16((x))) +#define __be16_to_cpu(x) __swab16((__u16)(__be16)(x)) + +static __always_inline __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__le64)*p; +} +static __always_inline __u64 __le64_to_cpup(const __le64 *p) +{ + return (__u64)*p; +} +static __always_inline __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__le32)*p; +} +static __always_inline __u32 __le32_to_cpup(const __le32 *p) +{ + return (__u32)*p; +} +static __always_inline __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__le16)*p; +} +static __always_inline __u16 __le16_to_cpup(const __le16 *p) +{ + return (__u16)*p; +} +static __always_inline __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__be64)__swab64p(p); +} +static __always_inline __u64 __be64_to_cpup(const __be64 *p) +{ + return __swab64p((__u64 *)p); +} +static __always_inline __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__be32)__swab32p(p); +} +static __always_inline __u32 __be32_to_cpup(const __be32 *p) +{ + return __swab32p((__u32 *)p); +} +static __always_inline __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__be16)__swab16p(p); +} +static __always_inline __u16 __be16_to_cpup(const __be16 *p) +{ + return __swab16p((__u16 *)p); +} +#define __cpu_to_le64s(x) do { (void)(x); } while (0) +#define __le64_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_le32s(x) do { (void)(x); } while (0) +#define __le32_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_le16s(x) do { (void)(x); } while (0) +#define __le16_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be64s(x) __swab64s((x)) +#define __be64_to_cpus(x) __swab64s((x)) +#define __cpu_to_be32s(x) __swab32s((x)) +#define __be32_to_cpus(x) __swab32s((x)) +#define __cpu_to_be16s(x) __swab16s((x)) +#define __be16_to_cpus(x) __swab16s((x)) + + +#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ diff --git a/tools/include/linux/stddef.h b/tools/include/linux/stddef.h new file mode 100644 index 000000000..e3d20e76b --- /dev/null +++ b/tools/include/linux/stddef.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_STDDEF_H +#define _UAPI_LINUX_STDDEF_H + +#ifndef __always_inline +#define __always_inline inline +#endif + +/** + * __struct_group() - Create a mirrored named and anonyomous struct + * + * @TAG: The tag name for the named sub-struct (usually empty) + * @NAME: The identifier name of the mirrored sub-struct + * @ATTRS: Any struct attributes (usually empty) + * @MEMBERS: The member declarations for the mirrored structs + * + * Used to create an anonymous union of two structs with identical layout + * and size: one anonymous and one named. The former's members can be used + * normally without sub-struct naming, and the latter can be used to + * reason about the start, end, and size of the group of struct members. + * The named struct can also be explicitly tagged for layer reuse, as well + * as both having struct attributes appended. + */ +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ + union { \ + struct { MEMBERS } ATTRS; \ + struct TAG { MEMBERS } ATTRS NAME; \ + } ATTRS + +#ifdef __cplusplus +/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */ +#define __DECLARE_FLEX_ARRAY(T, member) \ + T member[0] +#else +/** + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union + * + * @TYPE: The type of each flexible array element + * @NAME: The name of the flexible array member + * + * In order to have a flexible array member in a union or alone in a + * struct, it needs to be wrapped in an anonymous struct with at least 1 + * named member, but that member can be empty. + */ +#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif + +#ifndef __counted_by +#define __counted_by(m) +#endif + +#endif /* _UAPI_LINUX_STDDEF_H */ diff --git a/tools/include/linux/swab.h b/tools/include/linux/swab.h new file mode 100644 index 000000000..7e3bad56c --- /dev/null +++ b/tools/include/linux/swab.h @@ -0,0 +1,305 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_SWAB_H +#define _LINUX_SWAB_H + +#include +#include +#include +#include + +/* + * casts are necessary for constants, because we never know how for sure + * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. + */ +#define ___constant_swab16(x) ((__u16)( \ + (((__u16)(x) & (__u16)0x00ffU) << 8) | \ + (((__u16)(x) & (__u16)0xff00U) >> 8))) + +#define ___constant_swab32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ + (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ + (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ + (((__u32)(x) & (__u32)0xff000000UL) >> 24))) + +#define ___constant_swab64(x) ((__u64)( \ + (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ + (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ + (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ + (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ + (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ + (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ + (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ + (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) + +#define ___constant_swahw32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ + (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) + +#define ___constant_swahb32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ + (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) + +/* + * Implement the following as inlines, but define the interface using + * macros to allow constant folding when possible: + * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 + */ + +static __inline__ __u16 __fswab16(__u16 val) +{ +#if defined (__arch_swab16) + return __arch_swab16(val); +#else + return ___constant_swab16(val); +#endif +} + +static __inline__ __u32 __fswab32(__u32 val) +{ +#if defined(__arch_swab32) + return __arch_swab32(val); +#else + return ___constant_swab32(val); +#endif +} + +static __inline__ __u64 __fswab64(__u64 val) +{ +#if defined (__arch_swab64) + return __arch_swab64(val); +#elif defined(__SWAB_64_THRU_32__) + __u32 h = val >> 32; + __u32 l = val & ((1ULL << 32) - 1); + return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h))); +#else + return ___constant_swab64(val); +#endif +} + +static __inline__ __u32 __fswahw32(__u32 val) +{ +#ifdef __arch_swahw32 + return __arch_swahw32(val); +#else + return ___constant_swahw32(val); +#endif +} + +static __inline__ __u32 __fswahb32(__u32 val) +{ +#ifdef __arch_swahb32 + return __arch_swahb32(val); +#else + return ___constant_swahb32(val); +#endif +} + +/** + * __swab16 - return a byteswapped 16-bit value + * @x: value to byteswap + */ +#ifdef __HAVE_BUILTIN_BSWAP16__ +#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) +#else +#define __swab16(x) \ + (__u16)(__builtin_constant_p(x) ? \ + ___constant_swab16(x) : \ + __fswab16(x)) +#endif + +/** + * __swab32 - return a byteswapped 32-bit value + * @x: value to byteswap + */ +#ifdef __HAVE_BUILTIN_BSWAP32__ +#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) +#else +#define __swab32(x) \ + (__u32)(__builtin_constant_p(x) ? \ + ___constant_swab32(x) : \ + __fswab32(x)) +#endif + +/** + * __swab64 - return a byteswapped 64-bit value + * @x: value to byteswap + */ +#ifdef __HAVE_BUILTIN_BSWAP64__ +#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) +#else +#define __swab64(x) \ + (__u64)(__builtin_constant_p(x) ? \ + ___constant_swab64(x) : \ + __fswab64(x)) +#endif + +static __always_inline unsigned long __swab(const unsigned long y) +{ +#if __BITS_PER_LONG == 64 + return __swab64(y); +#else /* __BITS_PER_LONG == 32 */ + return __swab32(y); +#endif +} + +/** + * __swahw32 - return a word-swapped 32-bit value + * @x: value to wordswap + * + * __swahw32(0x12340000) is 0x00001234 + */ +#define __swahw32(x) \ + (__builtin_constant_p((__u32)(x)) ? \ + ___constant_swahw32(x) : \ + __fswahw32(x)) + +/** + * __swahb32 - return a high and low byte-swapped 32-bit value + * @x: value to byteswap + * + * __swahb32(0x12345678) is 0x34127856 + */ +#define __swahb32(x) \ + (__builtin_constant_p((__u32)(x)) ? \ + ___constant_swahb32(x) : \ + __fswahb32(x)) + +/** + * __swab16p - return a byteswapped 16-bit value from a pointer + * @p: pointer to a naturally-aligned 16-bit value + */ +static __always_inline __u16 __swab16p(const __u16 *p) +{ +#ifdef __arch_swab16p + return __arch_swab16p(p); +#else + return __swab16(*p); +#endif +} + +/** + * __swab32p - return a byteswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + */ +static __always_inline __u32 __swab32p(const __u32 *p) +{ +#ifdef __arch_swab32p + return __arch_swab32p(p); +#else + return __swab32(*p); +#endif +} + +/** + * __swab64p - return a byteswapped 64-bit value from a pointer + * @p: pointer to a naturally-aligned 64-bit value + */ +static __always_inline __u64 __swab64p(const __u64 *p) +{ +#ifdef __arch_swab64p + return __arch_swab64p(p); +#else + return __swab64(*p); +#endif +} + +/** + * __swahw32p - return a wordswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahw32() for details of wordswapping. + */ +static __inline__ __u32 __swahw32p(const __u32 *p) +{ +#ifdef __arch_swahw32p + return __arch_swahw32p(p); +#else + return __swahw32(*p); +#endif +} + +/** + * __swahb32p - return a high and low byteswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahb32() for details of high/low byteswapping. + */ +static __inline__ __u32 __swahb32p(const __u32 *p) +{ +#ifdef __arch_swahb32p + return __arch_swahb32p(p); +#else + return __swahb32(*p); +#endif +} + +/** + * __swab16s - byteswap a 16-bit value in-place + * @p: pointer to a naturally-aligned 16-bit value + */ +static __inline__ void __swab16s(__u16 *p) +{ +#ifdef __arch_swab16s + __arch_swab16s(p); +#else + *p = __swab16p(p); +#endif +} +/** + * __swab32s - byteswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + */ +static __always_inline void __swab32s(__u32 *p) +{ +#ifdef __arch_swab32s + __arch_swab32s(p); +#else + *p = __swab32p(p); +#endif +} + +/** + * __swab64s - byteswap a 64-bit value in-place + * @p: pointer to a naturally-aligned 64-bit value + */ +static __always_inline void __swab64s(__u64 *p) +{ +#ifdef __arch_swab64s + __arch_swab64s(p); +#else + *p = __swab64p(p); +#endif +} + +/** + * __swahw32s - wordswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahw32() for details of wordswapping + */ +static __inline__ void __swahw32s(__u32 *p) +{ +#ifdef __arch_swahw32s + __arch_swahw32s(p); +#else + *p = __swahw32p(p); +#endif +} + +/** + * __swahb32s - high and low byteswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahb32() for details of high and low byte swapping + */ +static __inline__ void __swahb32s(__u32 *p) +{ +#ifdef __arch_swahb32s + __arch_swahb32s(p); +#else + *p = __swahb32p(p); +#endif +} + + +#endif /* _LINUX_SWAB_H */ diff --git a/tools/isl/Makefile b/tools/isl/Makefile index 0fab02fe3..1ce20fb49 100644 --- a/tools/isl/Makefile +++ b/tools/isl/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=isl -PKG_VERSION:=0.25 +PKG_VERSION:=0.26 PKG_SOURCE_URL:=https://libisl.sourceforge.io/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=be7b210647ccadf90a2f0b000fca11a4d40546374a850db67adb32fad4b230d9 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=b10473024cbf17d7db85323121eff0e50f03de14342a03738b4d384b587ce212 HOST_BUILD_PARALLEL:=1 diff --git a/tools/kernel2minor/Makefile b/tools/kernel2minor/Makefile deleted file mode 100644 index be730b4df..000000000 --- a/tools/kernel2minor/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (C) 2016 adron@yapic.net -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -PKG_NAME:=kernel2minor -PKG_VERSION:=0.25 -PKG_RELEASE:=1 - -PKG_SOURCE_URL:=https://github.com/adron-s/kernel2minor.git -PKG_MIRROR_HASH:=6083c46c2fe0da37bacd04d5d5439c0e2a9d00e58ff47a63acfd5057d2aa2145 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=1e5a52c7941945f6d64807ebca4a5923ba5466bd -PKG_HASH:=33ca413403a3341af0c9a8e6d9bb58f4ad080a5339e8a8729b83637d35bfaf1b - -include $(INCLUDE_DIR)/host-build.mk - -define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/kernel2minor $(STAGING_DIR_HOST)/bin/ -endef - -define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/kernel2minor -endef - -$(eval $(call HostBuild)) diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile index 53a674440..8f7946d90 100644 --- a/tools/libdeflate/Makefile +++ b/tools/libdeflate/Makefile @@ -7,16 +7,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libdeflate -PKG_VERSION:=1.17 -PKG_RELEASE:=2 +PKG_VERSION:=1.22 +PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate.git -PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=v$(PKG_VERSION) -PKG_MIRROR_HASH:=ee5790cf3140aa6a2e0f0c400d4b32539f13cb270e9357135c51927ba3784dc7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate/releases/download/v$(PKG_VERSION) +PKG_HASH:=7834d9adbc9a809e0fb0d7b486060a9ae5f7819eb7f55bb8c22b10d7b3bed8da include $(INCLUDE_DIR)/host-build.mk +DECOMPRESS_CMD:=$(STAGING_DIR_HOST)/bin/gzip -dc $(DL_DIR)/$(PKG_SOURCE) | + define Host/Compile $(HOSTCC_NOCACHE) $(HOST_CFLAGS) $(HOST_LDFLAGS) \ $(HOST_BUILD_DIR)/lib/*{,/*}.c \ diff --git a/tools/liblzo/Makefile b/tools/liblzo/Makefile index 4ebda0c33..9f6010913 100644 --- a/tools/liblzo/Makefile +++ b/tools/liblzo/Makefile @@ -17,6 +17,7 @@ PKG_HASH:=c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:lzo_project:lzo CMAKE_BINARY_SUBDIR:=openwrt-build diff --git a/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch index 9ab27fc92..e0ba41016 100644 --- a/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch +++ b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch @@ -1,6 +1,6 @@ ---- a/CMakeLists.txt 2022-11-28 06:34:39.171209779 -0800 -+++ b/CMakeLists.txt 2022-11-28 06:33:13.368239757 -0800 -@@ -51,8 +51,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,8 +51,11 @@ endif() project(lzo VERSION 2.10 LANGUAGES C) # configuration options @@ -14,7 +14,7 @@ if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED) set(ENABLE_STATIC ON) endif() -@@ -127,14 +130,20 @@ +@@ -127,14 +130,20 @@ macro(lzo_add_executable t) endif() endmacro() # main test driver @@ -35,7 +35,7 @@ # some boring internal test programs if(0) lzo_add_executable(align tests/align.c) -@@ -144,7 +153,7 @@ +@@ -144,7 +153,7 @@ if(0) endif() # miniLZO @@ -44,7 +44,7 @@ add_executable(testmini minilzo/testmini.c minilzo/minilzo.c) target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h" endif() -@@ -263,8 +272,10 @@ +@@ -263,8 +272,10 @@ add_test(NAME lzotest-03 COMMAND lzotest if(DEFINED CMAKE_INSTALL_FULL_LIBDIR) @@ -57,7 +57,7 @@ set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h -@@ -285,7 +296,7 @@ +@@ -285,7 +296,7 @@ if(ENABLE_SHARED) ) endif() diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index f687f6b41..407219476 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,9 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=3.7.0 -PKG_HASH:=3fc1290f4007ec75f6e9acecbb25512630d1b9ab8c53ba79844e395868c3e006 -PKG_RELEASE:=1 +PKG_VERSION:=3.7.3 +PKG_HASH:=7948c856a90c825bd7268b6f85674a8dcd254bae42e221781b24e3f8dc335db3 PKG_CPE_ID:=cpe:/a:openbsd:libressl diff --git a/tools/libtool/Makefile b/tools/libtool/Makefile index fcac06e26..533360d19 100644 --- a/tools/libtool/Makefile +++ b/tools/libtool/Makefile @@ -8,38 +8,53 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtool PKG_CPE_ID:=cpe:/a:gnu:libtool -PKG_VERSION:=2.4.2 +PKG_VERSION:=2.4.7 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=1d7b6862c1ed162e327f083a6f78f40eae29218f0db8c38393d61dab764c4407 +PKG_HASH:=04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8 HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR) + HOST_CONFIGURE_VARS += \ lt_cv_sys_dlsearch_path="" +define Host/Bootstrap + ( \ + cd $(HOST_BUILD_DIR); \ + $(AM_TOOL_PATHS) \ + ./bootstrap \ + --copy \ + --force \ + --skip-git \ + --skip-po \ + --gnulib-srcdir=$(GNULIB_SRCDIR) \ + ) +endef + define Host/Prepare $(call Host/Prepare/Default) - (cd $(STAGING_DIR_HOST)/share/aclocal/ && rm -f libtool.m4 ltdl.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4) - (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap) + $(call Host/Uninstall) + $(if $(QUILT),,$(call Host/Bootstrap)) +endef + +define Host/Configure + $(if $(QUILT),$(call Host/Bootstrap)) + $(call Host/Configure/Default) endef define Host/Install - $(MAKE) -C $(HOST_BUILD_DIR) install + $(call Host/Compile/Default,install) $(SED) 's,\(hardcode_into_libs\)=yes,\1=no,g' $(STAGING_DIR_HOST)/bin/libtool - $(CP) $(STAGING_DIR_HOST)/bin/libtool $(STAGING_DIR_HOST)/bin/libtool-ucxx - $(SED) 's,-lstdc++,-luClibc++,g' $(STAGING_DIR_HOST)/bin/libtool-ucxx endef define Host/Uninstall -$(call Host/Compile/Default,uninstall) -endef - -define Host/Clean - $(call Host/Clean/Default) + (cd $(STAGING_DIR_HOST)/share/aclocal/ && rm -f libtool.m4 ltdl.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4) endef $(eval $(call HostBuild)) diff --git a/tools/libtool/patches/000-relocatable.patch b/tools/libtool/patches/000-relocatable.patch index 996e6445b..9c3bcb69f 100644 --- a/tools/libtool/patches/000-relocatable.patch +++ b/tools/libtool/patches/000-relocatable.patch @@ -1,121 +1,84 @@ ---- a/libltdl/config/general.m4sh -+++ b/libltdl/config/general.m4sh -@@ -45,15 +45,22 @@ progpath="$0" - M4SH_VERBATIM([[ - : ${CP="cp -f"} - test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} --: ${EGREP="@EGREP@"} --: ${FGREP="@FGREP@"} --: ${GREP="@GREP@"} - : ${LN_S="@LN_S@"} - : ${MAKE="make"} - : ${MKDIR="mkdir"} - : ${MV="mv -f"} - : ${RM="rm -f"} --: ${SED="@SED@"} -+if test -n "$STAGING_DIR_HOST"; then -+ : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"} -+ : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"} -+ : ${GREP="$STAGING_DIR_HOST/bin/grep"} -+ : ${SED="$STAGING_DIR_HOST/bin/sed"} -+else -+ : ${EGREP="@EGREP@"} -+ : ${FGREP="@FGREP@"} -+ : ${GREP="@GREP@"} -+ : ${SED="@SED@"} -+fi - : ${SHELL="${CONFIG_SHELL-/bin/sh}"} - : ${Xsed="$SED -e 1s/^X//"} - +From ca10caa502f971f90d8c041aa2476de54ef0ce2b Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 16:41:11 -0300 +Subject: openwrt: make relocatable, search resources relative to STAGING_DIR + +This was originally commited to openwrt by Jo-Philipp Wich +. + +Signed-off-by: Eneas U de Queiroz + --- a/libtoolize.in +++ b/libtoolize.in -@@ -334,15 +334,22 @@ as_unset=as_fn_unset +@@ -38,14 +38,23 @@ + # with bootstrap, so set those here where they can still be over- + # ridden by the user, but otherwise take precedence. - : ${CP="cp -f"} - test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +-: ${AUTOCONF="autoconf"} +-: ${AUTOMAKE="automake"} -: ${EGREP="@EGREP@"} -: ${FGREP="@FGREP@"} -: ${GREP="@GREP@"} : ${LN_S="@LN_S@"} - : ${MAKE="make"} - : ${MKDIR="mkdir"} - : ${MV="mv -f"} - : ${RM="rm -f"} -: ${SED="@SED@"} + +if test -n "$STAGING_DIR_HOST"; then ++ : ${AUTOCONF="$STAGING_DIR_HOST/bin/autoconf"} ++ : ${AUTOMAKE="$STAGING_DIR_HOST/bin/automake"} + : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"} + : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"} + : ${GREP="$STAGING_DIR_HOST/bin/grep"} + : ${SED="$STAGING_DIR_HOST/bin/sed"} +else ++ : ${AUTOCONF="autoconf"} ++ : ${AUTOMAKE="automake"} + : ${EGREP="@EGREP@"} + : ${FGREP="@FGREP@"} + : ${GREP="@GREP@"} + : ${SED="@SED@"} +fi - : ${SHELL="${CONFIG_SHELL-/bin/sh}"} - : ${Xsed="$SED -e 1s/^X//"} -@@ -2487,10 +2494,17 @@ func_check_macros () + ## -------------------------- ## + ## Source external libraries. ## +@@ -1903,11 +1912,21 @@ func_require_seen_libtool () + pkgmacro_files="@pkgmacro_files@" # Locations for important files: - prefix=@prefix@ -- datadir=@datadir@ -- pkgdatadir=@pkgdatadir@ -- pkgltdldir=@pkgdatadir@ -- aclocaldir=@aclocaldir@ +- prefix="@prefix@" +- datadir="@datadir@" +- pkgauxdir="@pkgauxdir@" +- pkgltdldir="@pkgdatadir@" +- aclocaldir="@aclocaldir@" + if test -n "$STAGING_DIR_HOST"; then ++ prefix="$STAGING_DIR_HOST" + datadir="$STAGING_DIR_HOST/share" ++ pkgauxdir="$STAGING_DIR_HOST/share/libtool/build-aux" + pkgdatadir="$STAGING_DIR_HOST/share/libtool" + pkgltdldir="$STAGING_DIR_HOST/share/libtool" + aclocaldir="$STAGING_DIR_HOST/share/aclocal" + else -+ datadir=@datadir@ -+ pkgdatadir=@pkgdatadir@ -+ pkgltdldir=@pkgdatadir@ -+ aclocaldir=@aclocaldir@ ++ prefix="@prefix@" ++ datadir="@datadir@" ++ pkgauxdir="@pkgauxdir@" ++ pkgdatadir="@pkgdatadir@" ++ pkgltdldir="@pkgdatadir@" ++ aclocaldir="@aclocaldir@" + fi - auxdir= - macrodir= - configure_ac=configure.in ---- a/libtoolize.m4sh -+++ b/libtoolize.m4sh -@@ -1453,10 +1453,17 @@ func_check_macros () - # Locations for important files: - prefix=@prefix@ -- datadir=@datadir@ -- pkgdatadir=@pkgdatadir@ -- pkgltdldir=@pkgdatadir@ -- aclocaldir=@aclocaldir@ -+ if test -n "$STAGING_DIR_HOST"; then -+ datadir="$STAGING_DIR_HOST/share" -+ pkgdatadir="$STAGING_DIR_HOST/share/libtool" -+ pkgltdldir="$STAGING_DIR_HOST/share/libtool" -+ aclocaldir="$STAGING_DIR_HOST/share/aclocal" -+ else -+ datadir=@datadir@ -+ pkgdatadir=@pkgdatadir@ -+ pkgltdldir=@pkgdatadir@ -+ aclocaldir=@aclocaldir@ -+ fi - auxdir= - macrodir= - configure_ac=configure.in ---- a/libltdl/m4/libtool.m4 -+++ b/libltdl/m4/libtool.m4 -@@ -907,9 +907,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], []) - # ---------------- - m4_defun([_LT_TAG_COMPILER], + # Allow the user to override the master libtoolize repository: + if test -n "$_lt_pkgdatadir"; then +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -933,7 +933,7 @@ m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl -- + _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/include"], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl -@@ -7660,9 +7659,9 @@ m4_defun([_LT_DECL_EGREP], +@@ -8183,9 +8183,9 @@ m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep @@ -128,7 +91,7 @@ dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) -@@ -7695,9 +7694,8 @@ AC_SUBST([DLLTOOL]) +@@ -8226,9 +8226,8 @@ _LT_DECL([], [FILECMD], [1], [A file(cmd # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED diff --git a/tools/libtool/patches/100-libdir-fixes.patch b/tools/libtool/patches/100-libdir-fixes.patch index 3df2b14b6..2a563901a 100644 --- a/tools/libtool/patches/100-libdir-fixes.patch +++ b/tools/libtool/patches/100-libdir-fixes.patch @@ -1,83 +1,55 @@ ---- a/libltdl/config/ltmain.m4sh -+++ b/libltdl/config/ltmain.m4sh -@@ -5731,8 +5731,14 @@ func_mode_link () - absdir="$abs_ladir" - libdir="$abs_ladir" +From 67ffe8e8582a7ba1f1d1307a419098e6dd88bdaf Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 16:41:11 -0300 +Subject: openwrt: cross-compilation path adjustments + +Comments from the patch: + +Adding 'libdir' from the .la file to our library search paths +breaks crosscompilation horribly. We cheat here and don't add +it, instead adding the path where we found the .la. -CL + +OE sets installed=no in staging. We need to look in $objdir and $absdir, +preferring $objdir. RP 31/04/2008 + +This was originally commited to openwrt by Jo-Philipp Wich +. + +Signed-off-by: Eneas U de Queiroz + +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -6097,8 +6097,14 @@ func_mode_link () + absdir=$abs_ladir + libdir=$abs_ladir else -- dir="$lt_sysroot$libdir" -- absdir="$lt_sysroot$libdir" +- dir=$lt_sysroot$libdir +- absdir=$lt_sysroot$libdir + # Adding 'libdir' from the .la file to our library search paths + # breaks crosscompilation horribly. We cheat here and don't add + # it, instead adding the path where we found the .la. -CL + dir="$lt_sysroot$abs_ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" -+ #dir="$libdir" -+ #absdir="$lt_sysroot$libdir" ++ #dir=$lt_sysroot$libdir ++ #absdir=$lt_sysroot$libdir fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + test yes = "$hardcode_automatic" && avoidtemprpath=yes else -@@ -6130,8 +6136,6 @@ func_mode_link () - add="$libdir/$linklib" +@@ -6496,8 +6502,6 @@ func_mode_link () + add=$libdir/$linklib fi else - # We cannot seem to hardcode it, guess we'll fake it. -- add_dir="-L$libdir" +- add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in -@@ -6286,7 +6290,17 @@ func_mode_link () +@@ -6652,7 +6656,17 @@ func_mode_link () fi ;; *) -- path="-L$absdir/$objdir" -+ # OE sets installed=no in staging. We need to look in $objdir and $absdir, -+ # preferring $objdir. RP 31/04/2008 -+ if test -f "$absdir/$objdir/$depdepl" ; then -+ depdepl="$absdir/$objdir/$depdepl" -+ path="-L$absdir/$objdir" -+ elif test -f "$absdir/$depdepl" ; then -+ depdepl="$absdir/$depdepl" -+ path="-L$absdir" -+ else -+ path="-L$absdir/$objdir" -+ fi - ;; - esac - else ---- a/libltdl/config/ltmain.sh -+++ b/libltdl/config/ltmain.sh -@@ -6518,8 +6518,14 @@ func_mode_link () - absdir="$abs_ladir" - libdir="$abs_ladir" - else -- dir="$lt_sysroot$libdir" -- absdir="$lt_sysroot$libdir" -+ # Adding 'libdir' from the .la file to our library search paths -+ # breaks crosscompilation horribly. We cheat here and don't add -+ # it, instead adding the path where we found the .la. -CL -+ dir="$lt_sysroot$abs_ladir" -+ absdir="$abs_ladir" -+ libdir="$abs_ladir" -+ #dir="$libdir" -+ #absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else -@@ -6917,8 +6923,6 @@ func_mode_link () - add="$libdir/$linklib" - fi - else -- # We cannot seem to hardcode it, guess we'll fake it. -- add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in -@@ -7073,7 +7077,17 @@ func_mode_link () - fi - ;; - *) -- path="-L$absdir/$objdir" +- path=-L$absdir/$objdir + # OE sets installed=no in staging. We need to look in $objdir and $absdir, + # preferring $objdir. RP 31/04/2008 + if test -f "$absdir/$objdir/$depdepl" ; then diff --git a/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch b/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch index bbfd12500..2d2189e76 100644 --- a/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch +++ b/tools/libtool/patches/110-dont-use-target-dir-for-relinking.patch @@ -1,20 +1,32 @@ ---- a/libltdl/config/ltmain.m4sh -+++ b/libltdl/config/ltmain.m4sh -@@ -6120,7 +6120,6 @@ func_mode_link () - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then -- add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in ---- a/libltdl/config/ltmain.sh -+++ b/libltdl/config/ltmain.sh -@@ -6907,7 +6907,6 @@ func_mode_link () - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then -- add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then +From 375833af93999f8b0a747c8a1dfa3ec8d347743d Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 16:52:37 -0300 +Subject: openwrt: don't use target dir for relinking + +This was originally commited to openwrt by Jo-Philipp Wich +. + +Signed-off-by: Eneas U de Queiroz + +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -6482,13 +6482,13 @@ func_mode_link () + add_dir= + add= + # Finalize command for both is simple: just hardcode it. +- if test yes = "$hardcode_direct" && +- test no = "$hardcode_direct_absolute"; then +- add=$libdir/$linklib +- elif test yes = "$hardcode_minus_L"; then ++ if test "$hardcode_direct" = yes && ++ test "$hardcode_direct_absolute" = no; then ++ add="$libdir/$linklib" ++ elif test "$hardcode_minus_L" = yes; then + add_dir=-L$libdir +- add=-l$name +- elif test yes = "$hardcode_shlibpath_var"; then ++ add="-l$name" ++ elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; diff --git a/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch b/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch index 8840ee056..132f1c9bd 100644 --- a/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch +++ b/tools/libtool/patches/120-strip-unsafe-dirs-for-relinking.patch @@ -1,24 +1,25 @@ ---- a/libltdl/config/ltmain.m4sh -+++ b/libltdl/config/ltmain.m4sh -@@ -2183,6 +2183,9 @@ func_mode_install () +From 7f2b8a1ab4fa1475eeeddfb84eb5b92594bfce43 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 16:54:12 -0300 +Subject: openwrt: strip unsave directories from relink command + +strip unsave directories from relink command, nuke every -L that looks +like /usr/lib or /lib + +This was originally commited to openwrt by Jo-Philipp Wich +. + +Signed-off-by: Eneas U de Queiroz + +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -2400,6 +2400,9 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi + relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"` + - func_warning "relinking \`$file'" + func_warning "relinking '$file'" func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' ---- a/libltdl/config/ltmain.sh -+++ b/libltdl/config/ltmain.sh -@@ -2973,6 +2973,9 @@ func_mode_install () - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - -+ relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"` -+ relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"` -+ - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' diff --git a/tools/libtool/patches/150-trailingslash.patch b/tools/libtool/patches/130-trailingslash.patch similarity index 57% rename from tools/libtool/patches/150-trailingslash.patch rename to tools/libtool/patches/130-trailingslash.patch index 423911cf4..78fdf0a41 100644 --- a/tools/libtool/patches/150-trailingslash.patch +++ b/tools/libtool/patches/130-trailingslash.patch @@ -1,3 +1,8 @@ +From 1b45c3c0d6682be7f4876b620780ee246a5acbaa Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 16:56:16 -0300 +Subject: openwrt: remove trailing slash in install destdir + A command like /bin/sh ../../i586-poky-linux-libtool --mode=install /usr/bin/install -c gck-roots-store-standalone.la '/media/data1/builds/poky1/tmp/work/core2-poky-linux/gnome-keyring-2.26.1-r1/image/usr/lib/gnome-keyring/standalone/' fails (e.g. gnome-keyring or pulseaudio) This is because libdir has a trailing slash which breaks the comparision. @@ -9,28 +14,11 @@ Merged a patch received from Gary Thomas Date: 2010/07/12 Nitin A Kamble ---- a/libltdl/config/ltmain.m4sh -+++ b/libltdl/config/ltmain.m4sh -@@ -2167,8 +2167,15 @@ func_mode_install () - func_append dir "$objdir" - - if test -n "$relink_command"; then -+ # Strip any trailing slash from the destination. -+ func_stripname '' '/' "$libdir" -+ destlibdir=$func_stripname_result -+ -+ func_stripname '' '/' "$destdir" -+ s_destdir=$func_stripname_result -+ - # Determine the prefix the user has applied to our future dir. -- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` -+ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that ---- a/libltdl/config/ltmain.sh -+++ b/libltdl/config/ltmain.sh -@@ -2954,8 +2954,15 @@ func_mode_install () +Signed-off-by: Eneas U de Queiroz + +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -2381,8 +2381,15 @@ func_mode_install () func_append dir "$objdir" if test -n "$relink_command"; then diff --git a/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch b/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch new file mode 100644 index 000000000..342296138 --- /dev/null +++ b/tools/libtool/patches/140-don-t-quote-SHELL-in-Makefile.am.patch @@ -0,0 +1,72 @@ +From 879578d3f4dc9bc42aa433b1fb6b584564f83617 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Wed, 21 Jul 2021 13:38:24 -0300 +Subject: openwrt: don't quote $(SHELL) in Makefile.am + +This allows to use SHELL="env bash" to get a controlled enviroment. + +Signed-off-by: Eneas U de Queiroz + +--- a/Makefile.am ++++ b/Makefile.am +@@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES = + # Using 'cd' in backquotes may print the directory name, use this instead: + lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + +-git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' '$(VERSION)' '.tarball-version' ++git_version_gen = $(SHELL) '$(aux_dir)/git-version-gen' '--fallback' '$(VERSION)' '.tarball-version' + rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | $(SED) 's|-.*$$||'` + + +@@ -306,7 +306,7 @@ libtool: $(ltmain_sh) $(config_status) $ + if test 0 = '$(AM_DEFAULT_VERBOSITY)' && test 1 != '$(V)'; \ + then echo " GEN " $@; \ + else echo '$(SHELL) $(top_builddir)/config.status "$@"'; fi; \ +- cd '$(top_builddir)' && '$(SHELL)' ./config.status '$@'; \ ++ cd '$(top_builddir)' && $(SHELL) ./config.status '$@'; \ + fi + + +@@ -789,13 +789,13 @@ testsuite_deps_uninstalled = $(testsuite + # Hook the test suite into the check rule + check-local: $(testsuite_deps_uninstalled) + $(AM_V_at)$(CD_TESTDIR); \ +- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ ++ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ + $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) $(TESTSUITEFLAGS) + + # Run the test suite on the *installed* tree. + installcheck-local: $(testsuite_deps) + $(AM_V_at)$(CD_TESTDIR); \ +- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ ++ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ + $(TESTS_ENVIRONMENT) $(INSTALLCHECK_ENVIRONMENT) $(TESTSUITEFLAGS) \ + AUTOTEST_PATH='$(exec_prefix)/bin' + +@@ -807,7 +807,7 @@ check-noninteractive-old: + .PHONY: check-noninteractive-new + check-noninteractive-new: $(testsuite_deps_uninstalled) + $(AM_V_at)$(CD_TESTDIR); \ +- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ ++ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ + $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \ + -k '!interactive' INNER_TESTSUITEFLAGS=',!interactive' \ + $(TESTSUITEFLAGS) +@@ -816,7 +816,7 @@ check-noninteractive-new: $(testsuite_de + .PHONY: check-interactive + check-interactive: $(testsuite_deps_uninstalled) + $(AM_V_at)$(CD_TESTDIR); \ +- CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ ++ CONFIG_SHELL=$(SHELL) $(SHELL) "$$abs_srcdir/$(TESTSUITE)" \ + $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \ + -k interactive -k recursive INNER_TESTSUITEFLAGS=',interactive' \ + $(TESTSUITEFLAGS) +@@ -828,7 +828,7 @@ check-noninteractive: check-noninteracti + clean-local: + -$(CD_TESTDIR); \ + test -f "$$abs_srcdir/$(TESTSUITE)" && \ +- '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" --clean ++ $(SHELL) "$$abs_srcdir/$(TESTSUITE)" --clean + + ## An empty target to depend on when a rule needs to always run + ## whenever it is visited. diff --git a/tools/libtool/patches/160-passthrough-ssp.patch b/tools/libtool/patches/160-passthrough-ssp.patch deleted file mode 100644 index da44c614e..000000000 --- a/tools/libtool/patches/160-passthrough-ssp.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur libtool-2.4.orig/libltdl/config/ltmain.m4sh libtool-2.4/libltdl/config/ltmain.m4sh ---- libtool-2.4.orig/libltdl/config/ltmain.m4sh 2015-06-18 10:46:15.499996979 +0200 -+++ libtool-2.4/libltdl/config/ltmain.m4sh 2015-06-18 10:48:24.686882213 +0200 -@@ -5076,7 +5076,7 @@ - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -- -O*|-flto*|-fwhopr*|-fuse-linker-plugin) -+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" diff --git a/tools/libtool/patches/200-openwrt-branding.patch b/tools/libtool/patches/200-openwrt-branding.patch index 3fc0afb86..5876f8bfa 100644 --- a/tools/libtool/patches/200-openwrt-branding.patch +++ b/tools/libtool/patches/200-openwrt-branding.patch @@ -1,112 +1,34 @@ ---- a/libltdl/config/general.m4sh -+++ b/libltdl/config/general.m4sh -@@ -359,7 +359,7 @@ opt_warning=: - # name if it has been set yet. - func_echo () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" +From 90707200efadc8e230635c7c204c9c272cbc8631 Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Tue, 20 Jul 2021 17:01:03 -0300 +Subject: openwrt: add openwrt branding + +This prepends program name with "OpenWrt-". + +This was originally commited to openwrt by Jo-Philipp Wich +. + +Signed-off-by: Eneas U de Queiroz + +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -82,7 +82,7 @@ func_echo () + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS +- $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" ++ $ECHO "OpenWrt-$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS } - - # func_verbose arg... -@@ -385,14 +385,14 @@ func_echo_all () - # Echo program name prefixed message to standard error. - func_error () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +--- a/build-aux/funclib.sh ++++ b/build-aux/funclib.sh +@@ -699,7 +699,7 @@ func_echo () + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS +- $ECHO "$progname: $_G_line" ++ $ECHO "OpenWrt-$progname: $_G_line" + done + IFS=$func_echo_IFS } - - # func_warning arg... - # Echo program name prefixed warning message to standard error. - func_warning () - { -- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 -+ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : ---- a/libltdl/config/ltmain.sh -+++ b/libltdl/config/ltmain.sh -@@ -439,7 +439,7 @@ opt_warning=: - # name if it has been set yet. - func_echo () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" - } - - # func_verbose arg... -@@ -465,14 +465,14 @@ func_echo_all () - # Echo program name prefixed message to standard error. - func_error () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 - } - - # func_warning arg... - # Echo program name prefixed warning message to standard error. - func_warning () - { -- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 -+ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : ---- a/libtoolize.in -+++ b/libtoolize.in -@@ -648,7 +648,7 @@ opt_warning=: - # name if it has been set yet. - func_echo () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" - } - - # func_verbose arg... -@@ -674,14 +674,14 @@ func_echo_all () - # Echo program name prefixed message to standard error. - func_error () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 - } - - # func_warning arg... - # Echo program name prefixed warning message to standard error. - func_warning () - { -- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 -+ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : ---- a/tests/defs.in -+++ b/tests/defs.in -@@ -596,7 +596,7 @@ opt_warning=: - # name if it has been set yet. - func_echo () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*" - } - - # func_verbose arg... -@@ -622,14 +622,14 @@ func_echo_all () - # Echo program name prefixed message to standard error. - func_error () - { -- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -+ $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 - } - - # func_warning arg... - # Echo program name prefixed warning message to standard error. - func_warning () - { -- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 -+ $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 71509511e..a36ca0647 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=llvm-project -PKG_VERSION:=15.0.7 -PKG_RELEASE:=1 +PKG_VERSION:=18.1.7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) -PKG_HASH:=8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 +PKG_HASH:=74446ab6943f686391954cbda0d77ae92e8a60c432eff437b8666e121d748ec4 +PKG_CPE_ID:=cpe:/a:llvm:llvm HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src @@ -22,21 +22,37 @@ CMAKE_SOURCE_SUBDIR := llvm include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk +ifneq ($(HOST_OS),Linux) + HOST_CFLAGS := $(filter-out -I$(STAGING_DIR_HOST)/include,$(HOST_CFLAGS)) + HOST_CXXFLAGS := $(filter-out -I$(STAGING_DIR_HOST)/include,$(HOST_CXXFLAGS)) +endif + LLVM_BPF_PREFIX = llvm-bpf-$(PKG_VERSION).$(HOST_OS)-$(HOST_ARCH) CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/$(LLVM_BPF_PREFIX) CMAKE_HOST_OPTIONS += \ - -DLLVM_ENABLE_BINDINGS=OFF \ - -DLLVM_INCLUDE_DOCS=OFF \ - -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_TARGETS_TO_BUILD=BPF \ - -DCLANG_BUILD_EXAMPLES=OFF \ + -DLLVM_DEFAULT_TARGET_TRIPLE=bpf \ + -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_DOCS=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_ENABLE_BINDINGS=OFF \ + -DLLVM_ENABLE_IDE=OFF \ + -DLLVM_ENABLE_LIBEDIT=OFF \ + -DLLVM_ENABLE_LIBPFM=OFF \ + -DLLVM_ENABLE_LIBXML2=OFF \ + -DLLVM_ENABLE_OCAMLDOC=OFF \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_Z3_SOLVER=OFF \ + -DLLVM_ENABLE_ZLIB=OFF \ + -DLLVM_ENABLE_ZSTD=OFF \ + -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_SKIP_RPATH=OFF define Host/Install diff --git a/tools/lz4/Makefile b/tools/lz4/Makefile index c5d4f6f16..cf1738a52 100644 --- a/tools/lz4/Makefile +++ b/tools/lz4/Makefile @@ -16,34 +16,23 @@ PKG_HASH:=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b PKG_LICENSE:=BSD-2-Clause PKG_LICENSE_FILES:=LICENSE lib/LICENSE - -HOST_BUILD_PARALLEL:=1 +PKG_CPE_ID:=cpe:/a:lz4_project:lz4 include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/meson.mk + +MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/contrib/meson/openwrt-build # Always optimize for speed HOST_CFLAGS := $(filter-out -O%,$(HOST_CFLAGS)) -O3 -HOST_MAKE_FLAGS+=PREFIX=$(HOST_BUILD_PREFIX) \ - ENABLE_DOCS=1 - -define Host/Configure -endef - -define Host/Compile - $(call Host/Compile/Default,default) -endef - -define Host/Install - $(call Host/Compile/Default,install) -endef - -define Host/Uninstall - $(call Host/Compile/Default,uninstall) - $(call Host/Compile/Default,clean) -endef - -define Host/Clean -endef +MESON_HOST_ARGS += \ + -Ddefault_library=static \ + -Ddebug-level=0 \ + -Dunstable=false \ + -Dprograms=true \ + -Dtests=false \ + -Dcontrib=false \ + -Dexamples=false $(eval $(call HostBuild)) diff --git a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch deleted file mode 100644 index 5d6dca33f..000000000 --- a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch +++ /dev/null @@ -1,60 +0,0 @@ -+++ a/programs/Makefile 2022-08-15 15:45:31.000000000 -0700 ---- b/programs/Makefile 2022-11-28 16:34:21.315593784 -0800 -@@ -66,6 +66,7 @@ - MD2ROFF = ronn - MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" - -+ENABLE_DOCS ?= 1 - - default: lz4-release - -@@ -120,6 +121,7 @@ - lz4c32 : $(SRCFILES) - $(CC) $(FLAGS) $^ -o $@$(EXT) - -+ifeq ($(ENABLE_DOCS),1) - lz4.1: lz4.1.md $(LIBVER_SRC) - cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@ - -@@ -130,6 +132,7 @@ - - preview-man: clean-man man - man ./lz4.1 -+endif - - clean: - ifeq ($(WINBASED),yes) -@@ -172,16 +175,19 @@ - - install: lz4 - @echo Installing binaries in $(DESTDIR)$(bindir) -- $(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/ -+ $(INSTALL_DIR) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) - $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) - $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) - $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) -+ifeq ($(ENABLE_DOCS),1) - @echo Installing man pages in $(DESTDIR)$(man1dir) -+ $(INSTALL_DIR) $(DESTDIR)$(man1dir)/ - $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 - $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 - $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 - $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 -+endif - @echo lz4 installation completed - - uninstall: -@@ -189,10 +195,12 @@ - $(RM) $(DESTDIR)$(bindir)/unlz4$(EXT) - $(RM) $(DESTDIR)$(bindir)/lz4$(EXT) - $(RM) $(DESTDIR)$(bindir)/lz4c$(EXT) -+ifeq ($(ENABLE_DOCS),1) - $(RM) $(DESTDIR)$(man1dir)/lz4.1 - $(RM) $(DESTDIR)$(man1dir)/lz4c.1 - $(RM) $(DESTDIR)$(man1dir)/lz4cat.1 - $(RM) $(DESTDIR)$(man1dir)/unlz4.1 -+endif - @echo lz4 programs successfully uninstalled - - endif diff --git a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch deleted file mode 100644 index 159dc67f1..000000000 --- a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff -ur a/lib/Makefile b/lib/Makefile ---- a/lib/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/lib/Makefile 2022-12-05 00:00:59.172307488 -0800 -@@ -195,8 +195,8 @@ - $(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir) - else - $(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir) -- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR) -- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT) -+ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_VER) liblz4.$(SHARED_EXT_MAJOR)) -+ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_MAJOR) liblz4.$(SHARED_EXT)) - endif - endif - @echo Installing headers in $(DESTDIR)$(includedir) -diff -ur a/Makefile b/Makefile ---- a/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/Makefile 2022-12-04 23:42:09.693836654 -0800 -@@ -77,12 +77,12 @@ - - .PHONY: clean - clean: -- $(MAKE) -C $(LZ4DIR) $@ > $(VOID) -- $(MAKE) -C $(PRGDIR) $@ > $(VOID) -- $(MAKE) -C $(TESTDIR) $@ > $(VOID) -- $(MAKE) -C $(EXDIR) $@ > $(VOID) -- $(MAKE) -C $(FUZZDIR) $@ > $(VOID) -- $(MAKE) -C contrib/gen_manual $@ > $(VOID) -+ $(MAKE) -C $(LZ4DIR) $@ -+ $(MAKE) -C $(PRGDIR) $@ -+ $(MAKE) -C $(TESTDIR) $@ -+ $(MAKE) -C $(EXDIR) $@ -+ $(MAKE) -C $(FUZZDIR) $@ -+ $(MAKE) -C contrib/gen_manual $@ - $(RM) lz4$(EXT) - $(RM) -r $(CMAKE_BUILD_DIR) - @echo Cleaning completed -diff -ur a/programs/Makefile b/programs/Makefile ---- a/programs/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/programs/Makefile 2022-12-04 23:42:30.849582910 -0800 -@@ -138,7 +138,7 @@ - ifeq ($(WINBASED),yes) - $(RM) *.rc - endif -- $(MAKE) -C $(LZ4DIR) $@ > $(VOID) -+ $(MAKE) -C $(LZ4DIR) $@ - $(RM) core *.o *.test tmp* \ - lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \ - unlz4$(EXT) lz4cat$(EXT) -@@ -177,16 +177,16 @@ - @echo Installing binaries in $(DESTDIR)$(bindir) - $(INSTALL_DIR) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) -- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) -- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) -- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) -+ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4c$(EXT)) -+ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4cat$(EXT)) -+ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) unlz4$(EXT)) - ifeq ($(ENABLE_DOCS),1) - @echo Installing man pages in $(DESTDIR)$(man1dir) - $(INSTALL_DIR) $(DESTDIR)$(man1dir)/ - $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 -- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 -- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 -- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 -+ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4c.1) -+ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4cat.1) -+ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 unlz4.1) - endif - @echo lz4 installation completed - diff --git a/tools/lzma/patches/001-large_files.patch b/tools/lzma/patches/001-large_files.patch index b95fe9e90..65603f497 100644 --- a/tools/lzma/patches/001-large_files.patch +++ b/tools/lzma/patches/001-large_files.patch @@ -1,8 +1,6 @@ -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc -=================================================================== ---- lzma-4.65.orig/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:00:54.000000000 +0200 -@@ -3,7 +3,7 @@ +--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ++++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc +@@ -3,7 +3,7 @@ CXX = g++ -O2 -Wall CXX_C = gcc -O2 -Wall LIB = -lm RM = rm -f diff --git a/tools/lzma/patches/002-lzmp.patch b/tools/lzma/patches/002-lzmp.patch index 72d881cdb..f1d45f45f 100644 --- a/tools/lzma/patches/002-lzmp.patch +++ b/tools/lzma/patches/002-lzmp.patch @@ -1,7 +1,5 @@ -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp @@ -0,0 +1,895 @@ +/* + * LZMA command line tool similar to gzip to encode and decode LZMA files. @@ -898,10 +896,8 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp + return STATUS_OK; +} + -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/Exception.h @@ -0,0 +1,45 @@ +/* A couple of exceptions for lzmp. + * @@ -948,10 +944,8 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h + +#endif + -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc -=================================================================== ---- lzma-4.65.orig/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:00:54.000000000 +0200 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:06:13.000000000 +0200 +--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ++++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc @@ -1,9 +1,10 @@ -PROG = lzma +PROG = lzma_alone @@ -965,7 +959,7 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ifdef SystemDrive IS_MINGW = 1 -@@ -45,12 +46,35 @@ +@@ -45,12 +46,35 @@ OBJS = \ Lzma86Dec.o \ Lzma86Enc.o \ @@ -1002,17 +996,15 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc LzmaAlone.o: LzmaAlone.cpp $(CXX) $(CFLAGS) LzmaAlone.cpp -@@ -131,5 +153,5 @@ +@@ -131,5 +155,5 @@ Lzma86Enc.o: ../../../../C/LzmaUtil/Lzma $(CXX_C) $(CFLAGS) ../../../../C/LzmaUtil/Lzma86Enc.c clean: - -$(RM) $(PROG) $(OBJS) + -$(RM) $(PROG) $(PROG2) $(OBJS) -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/lzma_version.h @@ -0,0 +1,31 @@ +#ifndef LZMA_VERSION_H +#define LZMA_VERSION_H @@ -1045,11 +1037,9 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h + "named COPYING.\n"; + +#endif /* ifndef LZMA_VERSION_H */ -Index: lzma-4.65/CPP/Common/C_FileIO.h -=================================================================== ---- lzma-4.65.orig/CPP/Common/C_FileIO.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65/CPP/Common/C_FileIO.h 2009-06-01 22:06:56.000000000 +0200 -@@ -24,6 +24,7 @@ +--- a/CPP/Common/C_FileIO.h ++++ b/CPP/Common/C_FileIO.h +@@ -24,6 +24,7 @@ public: bool Close(); bool GetLength(UInt64 &length) const; off_t Seek(off_t distanceToMove, int moveMethod) const; diff --git a/tools/lzma/patches/003-compile_fixes.patch b/tools/lzma/patches/003-compile_fixes.patch index 49ae66b9c..06f7a54ae 100644 --- a/tools/lzma/patches/003-compile_fixes.patch +++ b/tools/lzma/patches/003-compile_fixes.patch @@ -1,7 +1,6 @@ -diff -urN lzma-4.65/CPP/7zip/Common/FileStreams.h lzma-4.65.new/CPP/7zip/Common/FileStreams.h ---- lzma-4.65/CPP/7zip/Common/FileStreams.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65.new/CPP/7zip/Common/FileStreams.h 2009-06-01 22:30:01.000000000 +0200 -@@ -72,6 +72,7 @@ +--- a/CPP/7zip/Common/FileStreams.h ++++ b/CPP/7zip/Common/FileStreams.h +@@ -72,6 +72,7 @@ class COutFileStream: public IOutStream, public CMyUnknownImp { @@ -9,10 +8,9 @@ diff -urN lzma-4.65/CPP/7zip/Common/FileStreams.h lzma-4.65.new/CPP/7zip/Common/ #ifdef USE_WIN_FILE NWindows::NFile::NIO::COutFile File; #else -diff -urN lzma-4.65/CPP/Common/MyWindows.h lzma-4.65.new/CPP/Common/MyWindows.h ---- lzma-4.65/CPP/Common/MyWindows.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65.new/CPP/Common/MyWindows.h 2009-06-01 22:29:26.000000000 +0200 -@@ -101,8 +101,11 @@ +--- a/CPP/Common/MyWindows.h ++++ b/CPP/Common/MyWindows.h +@@ -101,8 +101,11 @@ typedef LONG SCODE; #ifdef __cplusplus diff --git a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch index 01ebd33a3..27af782c1 100644 --- a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch +++ b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch @@ -1,6 +1,6 @@ ---- a/CMakeLists.txt 2017-08-10 04:19:45.000000000 -0700 -+++ b/CMakeLists.txt 2022-11-28 17:21:03.453548350 -0800 -@@ -50,6 +50,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,6 +50,9 @@ endif() project(lzop VERSION 1.04 LANGUAGES C) @@ -10,7 +10,7 @@ # install directories if(NOT CMAKE_INSTALL_PREFIX) message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.") -@@ -186,9 +189,11 @@ +@@ -186,9 +189,11 @@ if(DEFINED CMAKE_INSTALL_FULL_LIBDIR) install(TARGETS lzop DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") diff --git a/tools/m4/Makefile b/tools/m4/Makefile index d621000da..ee369f3cb 100644 --- a/tools/m4/Makefile +++ b/tools/m4/Makefile @@ -10,10 +10,9 @@ PKG_NAME:=m4 PKG_CPE_ID:=cpe:/a:gnu:m4 PKG_VERSION:=1.4.19 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96 -PKG_CAT:=xzcat +PKG_HASH:=3be4a26d825ffdfda52a56fc43246456989a3630093cced3fbddf4771ee58a70 HOST_BUILD_PARALLEL:=1 diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile index 77031cdce..b5616b1bc 100644 --- a/tools/make-ext4fs/Makefile +++ b/tools/make-ext4fs/Makefile @@ -13,7 +13,7 @@ PKG_SOURCE_URL=$(PROJECT_GIT)/project/make_ext4fs.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2020-01-05 PKG_SOURCE_VERSION:=5c201be7d72aff735da27e17c29852e0cefe3e52 -PKG_MIRROR_HASH:=a9b74b7b95acc84a5a5c33d6acf493faad8f161caca3180734d9bd383c9d823f +PKG_MIRROR_HASH:=ec8304dc06f94338e14e608a807f48e10d0987bdac4d90f235650b46994dfbd7 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/meson/Makefile b/tools/meson/Makefile index d53ed897a..f967f33ec 100644 --- a/tools/meson/Makefile +++ b/tools/meson/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson -PKG_VERSION:=0.61.5 +PKG_VERSION:=1.5.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION) -PKG_HASH:=5e9a0d65c1a51936362b9686d1c5e9e184a6fd245d57e7269750ce50c20f5d9a +PKG_HASH:=567e533adf255de73a2de35049b99923caf872a455af9ce03e01077e0d384bed PKG_MAINTAINER:=Andre Heider PKG_LICENSE:=Apache-2.0 diff --git a/tools/meson/files/openwrt-cross.txt.in b/tools/meson/files/openwrt-cross.txt.in index ec4b027f1..836a0e51e 100644 --- a/tools/meson/files/openwrt-cross.txt.in +++ b/tools/meson/files/openwrt-cross.txt.in @@ -1,10 +1,12 @@ [binaries] c = [@CC@] +c_ld = [@LD@] cpp = [@CXX@] +cpp_ld = [@LD@] ar = '@AR@' strip = '@STRIP@' nm = '@NM@' -pkgconfig = '@PKGCONFIG@' +pkg-config = '@PKGCONFIG@' cmake = '@CMAKE@' python = '@PYTHON@' diff --git a/tools/meson/files/openwrt-native.txt.in b/tools/meson/files/openwrt-native.txt.in index 48e09ece2..179e00b43 100644 --- a/tools/meson/files/openwrt-native.txt.in +++ b/tools/meson/files/openwrt-native.txt.in @@ -1,7 +1,7 @@ [binaries] c = [@CC@] cpp = [@CXX@] -pkgconfig = '@PKGCONFIG@' +pkg-config = '@PKGCONFIG@' cmake = '@CMAKE@' python = '@PYTHON@' diff --git a/tools/meson/patches/010-wsl2.patch b/tools/meson/patches/010-wsl2.patch deleted file mode 100644 index 4ab799d69..000000000 --- a/tools/meson/patches/010-wsl2.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 7d1ef4343ed5b2b7ab51469177a42c32c47f0528 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Tue, 6 Sep 2022 01:36:17 -0700 -Subject: [PATCH] minstall: handle extra error for selinuxenabled - -Microsoft's WSL2 uses a Plan 9 filesystem, which returns IOError when file is missing. ---- - mesonbuild/minstall.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/mesonbuild/minstall.py -+++ b/mesonbuild/minstall.py -@@ -229,7 +229,7 @@ def restore_selinux_contexts() -> None: - ''' - try: - subprocess.check_call(['selinuxenabled']) -- except (FileNotFoundError, NotADirectoryError, PermissionError, subprocess.CalledProcessError): -+ except (FileNotFoundError, NotADirectoryError, OSError, PermissionError, subprocess.CalledProcessError): - # If we don't have selinux or selinuxenabled returned 1, failure - # is ignored quietly. - return diff --git a/tools/missing-macros/Makefile b/tools/missing-macros/Makefile index 1e423621b..edbcb8430 100644 --- a/tools/missing-macros/Makefile +++ b/tools/missing-macros/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=missing-macros -PKG_RELEASE:=11 +PKG_RELEASE:=12 include $(INCLUDE_DIR)/host-build.mk @@ -23,6 +23,11 @@ define Host/Install $(INSTALL_DATA) ./src/m4/*.m4 $(STAGING_DIR_HOST)/share/aclocal/ $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin $(INSTALL_BIN) ./src/bin/* $(STAGING_DIR_HOST)/bin/ + $(LN) makeinfo $(STAGING_DIR_HOST)/bin/texi2any + $(LN) makeinfo $(STAGING_DIR_HOST)/bin/texi2pdf + $(LN) makeinfo $(STAGING_DIR_HOST)/bin/texi2dvi + $(LN) makeinfo $(STAGING_DIR_HOST)/bin/pdftexi2dvi + $(LN) makeinfo $(STAGING_DIR_HOST)/bin/texi2html endef $(eval $(call HostBuild)) diff --git a/tools/missing-macros/src/README b/tools/missing-macros/src/README index d2305ff55..dd9a9d3c9 100644 --- a/tools/missing-macros/src/README +++ b/tools/missing-macros/src/README @@ -2,26 +2,13 @@ The m4/ directory below contains various m4 macros used by different packages in the OpenWrt feed. -From GNU gettext: -Library linking and rpath helper macros. - - lib-ld.m4 - lib-link.m4 - lib-prefix.m4 - Integer data type test macros. intmax.m4 - wint_t.m4 inttypes-pri.m4 uintmax_t.m4 - stdint_h.m4 intdiv0.m4 - inttypes_h.m4 -Program test macro. - - progtest.m4 GNU libc version test macros. diff --git a/tools/missing-macros/src/bin/makeinfo b/tools/missing-macros/src/bin/makeinfo index e163cba08..d698f7b79 100755 --- a/tools/missing-macros/src/bin/makeinfo +++ b/tools/missing-macros/src/bin/makeinfo @@ -26,7 +26,7 @@ Getopt::Long::GetOptions( if ($version) { - print "makeinfo (OpenWrt stub) 4.13\n"; + print "makeinfo (OpenWrt stub) 9.99\n"; exit 0; } diff --git a/tools/missing-macros/src/m4/inttypes_h.m4 b/tools/missing-macros/src/m4/inttypes_h.m4 deleted file mode 100644 index 782d77ed8..000000000 --- a/tools/missing-macros/src/m4/inttypes_h.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# inttypes_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, -# doesn't clash with , and declares uintmax_t. - -AC_DEFUN([gl_AC_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], - [AC_TRY_COMPILE( - [#include -#include ], - [uintmax_t i = (uintmax_t) -1; return !i;], - [gl_cv_header_inttypes_h=yes], - [gl_cv_header_inttypes_h=no])]) - if test $gl_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], - [Define if exists, doesn't clash with , - and declares uintmax_t. ]) - fi -]) diff --git a/tools/missing-macros/src/m4/lib-ld.m4 b/tools/missing-macros/src/m4/lib-ld.m4 deleted file mode 100644 index ebb30528b..000000000 --- a/tools/missing-macros/src/m4/lib-ld.m4 +++ /dev/null @@ -1,110 +0,0 @@ -# lib-ld.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT([$LD]) -else - AC_MSG_RESULT([no]) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/tools/missing-macros/src/m4/lib-link.m4 b/tools/missing-macros/src/m4/lib-link.m4 deleted file mode 100644 index c73bd8e3a..000000000 --- a/tools/missing-macros/src/m4/lib-link.m4 +++ /dev/null @@ -1,774 +0,0 @@ -# lib-link.m4 serial 21 (gettext-0.18) -dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ([2.54]) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[translit([$1],[./-], [___])]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - popdef([NAME]) - popdef([Name]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. The missing-message -dnl defaults to 'no' and may contain additional hints for the user. -dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} -dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[translit([$1],[./-], [___])]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, - dnl because these -l options might require -L options that are present in - dnl LIBS. -l options benefit only from the -L options listed before it. - dnl Otherwise, add it to the front of LIBS, because it may be a static - dnl library that depends on another static library that is present in LIBS. - dnl Static libraries benefit only from the static libraries listed after - dnl it. - case " $LIB[]NAME" in - *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; - *) LIBS="$LIB[]NAME $LIBS" ;; - esac - AC_TRY_LINK([$3], [$4], - [ac_cv_lib[]Name=yes], - [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - LIB[]NAME[]_PREFIX= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - popdef([NAME]) - popdef([Name]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl acl_libext, -dnl acl_shlibext, -dnl acl_hardcode_libdir_flag_spec, -dnl acl_hardcode_libdir_separator, -dnl acl_hardcode_direct, -dnl acl_hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([P_A_C_K]) - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) diff --git a/tools/missing-macros/src/m4/lib-prefix.m4 b/tools/missing-macros/src/m4/lib-prefix.m4 deleted file mode 100644 index 1601ceaef..000000000 --- a/tools/missing-macros/src/m4/lib-prefix.m4 +++ /dev/null @@ -1,224 +0,0 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl . - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -]) diff --git a/tools/missing-macros/src/m4/progtest.m4 b/tools/missing-macros/src/m4/progtest.m4 deleted file mode 100644 index 2d804ac99..000000000 --- a/tools/missing-macros/src/m4/progtest.m4 +++ /dev/null @@ -1,92 +0,0 @@ -# progtest.m4 serial 6 (gettext-0.18) -dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1996. - -AC_PREREQ([2.50]) - -# Search path for a program which passes the given test. - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN([AM_PATH_PROG_WITH_TEST], -[ -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Find out how to test for executable files. Don't use a zero-byte file, -# as systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL([ac_cv_path_$1], -[case "[$]$1" in - [[\\/]]* | ?:[[\\/]]*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in ifelse([$5], , $PATH, [$5]); do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$][$1]) -else - AC_MSG_RESULT([no]) -fi -AC_SUBST([$1])dnl -]) diff --git a/tools/missing-macros/src/m4/stdint_h.m4 b/tools/missing-macros/src/m4/stdint_h.m4 deleted file mode 100644 index b8e3c6cc7..000000000 --- a/tools/missing-macros/src/m4/stdint_h.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# stdint_h.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -# Define HAVE_STDINT_H_WITH_UINTMAX if exists, -# doesn't clash with , and declares uintmax_t. - -AC_DEFUN([gl_AC_HEADER_STDINT_H], -[ - AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], - [AC_TRY_COMPILE( - [#include -#include ], - [uintmax_t i = (uintmax_t) -1; return !i;], - [gl_cv_header_stdint_h=yes], - [gl_cv_header_stdint_h=no])]) - if test $gl_cv_header_stdint_h = yes; then - AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], - [Define if exists, doesn't clash with , - and declares uintmax_t. ]) - fi -]) diff --git a/tools/missing-macros/src/m4/wint_t.m4 b/tools/missing-macros/src/m4/wint_t.m4 deleted file mode 100644 index a6c7d15cb..000000000 --- a/tools/missing-macros/src/m4/wint_t.m4 +++ /dev/null @@ -1,28 +0,0 @@ -# wint_t.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. -dnl Test whether has the 'wint_t' type. -dnl Prerequisite: AC_PROG_CC - -AC_DEFUN([gt_TYPE_WINT_T], -[ - AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_TRY_COMPILE([ -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include - wint_t foo = (wchar_t)'\0';], , - [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) - if test $gt_cv_c_wint_t = yes; then - AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) - fi -]) diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 022ac2197..0a1712bc6 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2023.01 +PKG_VERSION:=2024.07 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ https://mirror.cyberbits.eu/u-boot \ https://ftp.denx.de/pub/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f +PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) diff --git a/tools/mkimage/patches/030-allow-to-use-different-magic.patch b/tools/mkimage/patches/030-allow-to-use-different-magic.patch index d88f1cf94..bcbdc4d6c 100644 --- a/tools/mkimage/patches/030-allow-to-use-different-magic.patch +++ b/tools/mkimage/patches/030-allow-to-use-different-magic.patch @@ -24,7 +24,7 @@ This patch makes it possible to set a custom image magic. " -a ==> set load address to 'addr' (hex)\n" " -e ==> set entry point to 'ep' (hex)\n" " -n ==> set image name to 'name'\n" -@@ -159,7 +161,7 @@ static int add_content(int type, const c +@@ -160,7 +162,7 @@ static int add_content(int type, const c } static const char optstring[] = @@ -33,7 +33,7 @@ This patch makes it possible to set a custom image magic. static const struct option longopts[] = { { "load-address", required_argument, NULL, 'a' }, -@@ -298,6 +300,14 @@ static void process_args(int argc, char +@@ -303,6 +305,14 @@ static void process_args(int argc, char case 'l': params.lflag = 1; break; @@ -50,7 +50,7 @@ This patch makes it possible to set a custom image magic. break; --- a/tools/default_image.c +++ b/tools/default_image.c -@@ -56,7 +56,7 @@ static int image_verify_header(unsigned +@@ -67,7 +67,7 @@ static int image_verify_header(unsigned */ memcpy(hdr, ptr, sizeof(struct legacy_img_hdr)); @@ -59,7 +59,7 @@ This patch makes it possible to set a custom image magic. debug("%s: Bad Magic Number: \"%s\" is no valid image\n", params->cmdname, params->imagefile); return -FDT_ERR_BADMAGIC; -@@ -119,7 +119,7 @@ static void image_set_header(void *ptr, +@@ -146,7 +146,7 @@ static void image_set_header(void *ptr, } /* Build new header */ @@ -70,7 +70,7 @@ This patch makes it possible to set a custom image magic. image_set_load(hdr, addr); --- a/tools/imagetool.h +++ b/tools/imagetool.h -@@ -59,6 +59,7 @@ struct image_tool_params { +@@ -67,6 +67,7 @@ struct image_tool_params { int arch; int type; int comp; diff --git a/tools/mkimage/patches/095-tools-disable-TOOLS_FIT_FULL_CHECK.patch b/tools/mkimage/patches/095-tools-disable-TOOLS_FIT_FULL_CHECK.patch index f2e3b9b05..ed6824b11 100644 --- a/tools/mkimage/patches/095-tools-disable-TOOLS_FIT_FULL_CHECK.patch +++ b/tools/mkimage/patches/095-tools-disable-TOOLS_FIT_FULL_CHECK.patch @@ -14,7 +14,7 @@ https://github.com/u-boot/u-boot/commit/3f04db891a353f4b127ed57279279f851c6b4917 --- a/tools/Kconfig +++ b/tools/Kconfig -@@ -31,7 +31,7 @@ config TOOLS_FIT +@@ -36,7 +36,7 @@ config TOOLS_FIT Enable FIT support in the tools builds. config TOOLS_FIT_FULL_CHECK diff --git a/tools/mkimage/patches/100-increase-tmpfile-name-length-limit.patch b/tools/mkimage/patches/100-increase-tmpfile-name-length-limit.patch deleted file mode 100644 index aae893560..000000000 --- a/tools/mkimage/patches/100-increase-tmpfile-name-length-limit.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/tools/mkimage.h -+++ b/tools/mkimage.h -@@ -44,7 +44,7 @@ static inline ulong map_to_sysmem(void * - #define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size] - - #define MKIMAGE_TMPFILE_SUFFIX ".tmp" --#define MKIMAGE_MAX_TMPFILE_LEN 256 -+#define MKIMAGE_MAX_TMPFILE_LEN 1024 - #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500" - #define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35 - diff --git a/tools/mold/Makefile b/tools/mold/Makefile new file mode 100644 index 000000000..28d760d8c --- /dev/null +++ b/tools/mold/Makefile @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mold +PKG_VERSION:=2.33.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/rui314/mold/archive/refs/tags +PKG_HASH:=37b3aacbd9b6accf581b92ba1a98ca418672ae330b78fe56ae542c2dcb10a155 + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DMOLD_LTO=ON \ + -DMOLD_MOSTLY_STATIC=ON \ + -DMOLD_USE_SYSTEM_MIMALLOC=OFF \ + -DMOLD_USE_SYSTEM_TBB=OFF + +$(eval $(call HostBuild)) diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index cdcca5f11..bfbbf399d 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpfr -PKG_VERSION:=4.2.0 +PKG_VERSION:=4.2.1 PKG_CPE_ID:=cpe:/a:mpfr:gnu_mpfr PKG_SOURCE_URL:=@GNU/mpfr http://www.mpfr.org/mpfr-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=116715552bd966c85b417c424db1bbdf639f53836eb361549d1f8d6ded5cb4c6 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 14f11acaf..7367895fc 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -7,12 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=2.1.5 +PKG_VERSION:=2.2.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/ -PKG_HASH:=386e27fd121699b6b729bc2e8e04dda987b31cca6b16e12fb6cc6dcf26449f46 +PKG_HASH:=f7ae20b2eb79ee83441468f0b99d897024cd96ff853eea59106fb1952065c803 +PKG_CPE_ID:=cpe:/a:mtd-utils_project:mtd-utils PKG_FIXUP:=autoreconf @@ -32,11 +33,12 @@ HOST_CONFIGURE_VARS+= \ UUID_CFLAGS="-I$(STAGING_DIR_HOST)/include/e2fsprogs/uuid" HOST_CONFIGURE_ARGS+= \ - --disable-tests \ + --without-tests \ --without-crypto \ --without-xattr \ --without-zstd \ - --without-lzo + --without-lzo \ + --with-lzma HOST_MAKE_FLAGS += \ PROGRAMS="mkfs.jffs2 ubinize mkfs.ubifs" diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index 73b97796a..cf5f0c8d8 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -1,9 +1,9 @@ --- a/jffsX-utils/compr_lzo.c +++ b/jffsX-utils/compr_lzo.c -@@ -26,7 +26,6 @@ +@@ -24,7 +24,6 @@ + #include + #include #include - - #ifndef WITHOUT_LZO -#include #include #include @@ -18,8 +18,8 @@ #include #include "common.h" #include "compr.h" ---- a/jffsX-utils/rbtree.h -+++ b/jffsX-utils/rbtree.h +--- a/include/rbtree.h ++++ b/include/rbtree.h @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H @@ -70,7 +70,7 @@ #include --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c -@@ -1541,6 +1541,7 @@ static int add_inode(struct stat *st, in +@@ -1568,6 +1568,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -78,7 +78,7 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1553,6 +1554,7 @@ static int add_inode(struct stat *st, in +@@ -1580,6 +1581,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_DIRSYNC_FL; if (fctx) use_flags |= UBIFS_CRYPT_FL; @@ -86,7 +86,7 @@ memset(ino, 0, UBIFS_INO_NODE_SZ); ino_key_init(&key, inum); -@@ -1638,7 +1640,9 @@ static int add_dir_inode(const char *pat +@@ -1665,7 +1667,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -96,23 +96,23 @@ flags = 0; } -@@ -1849,6 +1853,7 @@ static int add_file(const char *path_nam +@@ -1878,6 +1882,7 @@ static int add_file(const char *path_nam dn->ch.node_type = UBIFS_DATA_NODE; key_write(&key, &dn->key); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; +#ifndef NO_NATIVE_SUPPORT if (c->default_compr == UBIFS_COMPR_NONE && !c->encrypted && (flags & FS_COMPR_FL)) - #ifdef WITHOUT_LZO -@@ -1857,6 +1862,7 @@ static int add_file(const char *path_nam - use_compr = UBIFS_COMPR_LZO; + #ifdef WITH_LZO +@@ -1888,6 +1893,7 @@ static int add_file(const char *path_nam + use_compr = UBIFS_COMPR_NONE; #endif else +#endif use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1916,7 +1922,9 @@ static int add_non_dir(const char *path_ +@@ -1947,7 +1953,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch index db683063d..b03265a38 100644 --- a/tools/mtd-utils/patches/130-lzma_jffs2.patch +++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,25 +1,9 @@ --- a/jffsX-utils/Makemodule.am +++ b/jffsX-utils/Makemodule.am -@@ -4,7 +4,10 @@ mkfs_jffs2_SOURCES = \ - jffsX-utils/compr_zlib.c \ - jffsX-utils/compr.h \ - jffsX-utils/rbtree.c \ -- jffsX-utils/compr_lzo.c \ -+ jffsX-utils/compr_lzma.c \ -+ jffsX-utils/lzma/LzFind.c \ -+ jffsX-utils/lzma/LzmaEnc.c \ -+ jffsX-utils/lzma/LzmaDec.c \ - jffsX-utils/compr.c \ - jffsX-utils/compr_rtime.c \ - jffsX-utils/compr.h \ -@@ -12,8 +15,13 @@ mkfs_jffs2_SOURCES = \ - jffsX-utils/summary.h \ - include/linux/jffs2.h \ - include/mtd/jffs2-user.h -+ -+if !WITHOUT_LZO -+mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c -+endif +@@ -9,8 +9,9 @@ mkfs_jffs2_SOURCES = \ + include/mtd/jffs2-user.h \ + include/list.h \ + include/rbtree.h + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) -mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) @@ -27,36 +11,45 @@ jffs2reader_SOURCES = jffsX-utils/jffs2reader.c include/mtd/jffs2-user.h jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +@@ -32,6 +33,14 @@ if WITH_ZLIB + mkfs_jffs2_SOURCES += jffsX-utils/compr_zlib.c + endif + ++if WITH_LZMA ++mkfs_jffs2_SOURCES += \ ++ jffsX-utils/compr_lzma.c \ ++ jffsX-utils/lzma/LzFind.c \ ++ jffsX-utils/lzma/LzmaEnc.c \ ++ jffsX-utils/lzma/LzmaDec.c ++endif ++ + EXTRA_DIST += jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1 + + dist_man1_MANS += jffsX-utils/mkfs.jffs2.1 --- a/jffsX-utils/compr.c +++ b/jffsX-utils/compr.c -@@ -520,6 +520,9 @@ int jffs2_compressors_init(void) - #ifdef CONFIG_JFFS2_LZO +@@ -471,6 +471,9 @@ int jffs2_compressors_init(void) + #ifdef WITH_LZO jffs2_lzo_init(); #endif -+#ifdef CONFIG_JFFS2_LZMA ++#ifdef WITH_LZMA + jffs2_lzma_init(); +#endif return 0; } -@@ -534,5 +537,8 @@ int jffs2_compressors_exit(void) - #ifdef CONFIG_JFFS2_LZO +@@ -485,5 +488,8 @@ int jffs2_compressors_exit(void) + #ifdef WITH_LZO jffs2_lzo_exit(); #endif -+#ifdef CONFIG_JFFS2_LZMA ++#ifdef WITH_LZMA + jffs2_lzma_exit(); +#endif return 0; } --- a/jffsX-utils/compr.h +++ b/jffsX-utils/compr.h -@@ -18,13 +18,14 @@ - - #define CONFIG_JFFS2_ZLIB - #define CONFIG_JFFS2_RTIME --#define CONFIG_JFFS2_LZO -+#define CONFIG_JFFS2_LZMA - +@@ -22,8 +22,9 @@ #define JFFS2_RUBINMIPS_PRIORITY 10 #define JFFS2_DYNRUBIN_PRIORITY 20 #define JFFS2_RTIME_PRIORITY 50 @@ -68,11 +61,11 @@ #define JFFS2_COMPR_MODE_NONE 0 #define JFFS2_COMPR_MODE_PRIORITY 1 -@@ -115,5 +116,10 @@ void jffs2_rtime_exit(void); +@@ -110,5 +111,10 @@ void jffs2_rtime_exit(void); int jffs2_lzo_init(void); void jffs2_lzo_exit(void); #endif -+#ifdef CONFIG_JFFS2_LZMA ++#ifdef WITH_LZMA +int jffs2_lzma_init(void); +void jffs2_lzma_exit(void); +#endif @@ -5036,3 +5029,45 @@ } break; } +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,6 +19,10 @@ if WITH_ZSTD + AM_CPPFLAGS += -DWITH_ZSTD + endif + ++if WITH_LZMA ++AM_CPPFLAGS += -DWITH_LZMA ++endif ++ + if WITH_SELINUX + AM_CPPFLAGS += -DWITH_SELINUX + endif +--- a/configure.ac ++++ b/configure.ac +@@ -96,6 +96,10 @@ AC_ARG_WITH([zstd], + [AS_HELP_STRING([--with-zstd], [Support for ZSTD compression])], + [], [with_zstd="check"]) + ++AC_ARG_WITH([lzma], ++ [AS_HELP_STRING([--with-lzma], [Support for LZMA compression])], ++ [], [with_lzma="check"]) ++ + AC_ARG_WITH([selinux], + [AS_HELP_STRING([--with-selinux], + [Support for selinux extended attributes])], +@@ -269,6 +273,7 @@ fi + AM_CONDITIONAL([WITH_LZO], [test "x$with_lzo" = "xyes"]) + AM_CONDITIONAL([WITH_ZLIB], [test "x$with_zlib" = "xyes"]) + AM_CONDITIONAL([WITH_ZSTD], [test "x$with_zstd" = "xyes"]) ++AM_CONDITIONAL([WITH_LZMA], [test "x$with_lzma" = "xyes"]) + AM_CONDITIONAL([WITH_XATTR], [test "x$with_xattr" = "xyes"]) + AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"]) + AM_CONDITIONAL([WITH_CRYPTO], [test "x$with_crypto" = "xyes"]) +@@ -313,6 +318,7 @@ AC_MSG_RESULT([ + lzo support: ${with_lzo} + zlib support: ${with_zlib} + zstd support: ${with_zstd} ++ lzma support: ${with_lzma} + xattr/acl support: ${with_xattr} + SELinux support: ${with_selinux} + fscrypt support: ${with_crypto} diff --git a/tools/mtools/Makefile b/tools/mtools/Makefile index c0c36a9d0..b810918b9 100644 --- a/tools/mtools/Makefile +++ b/tools/mtools/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtools -PKG_VERSION:=4.0.42 +PKG_VERSION:=4.0.43 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=64bfdfde4d82af6b22f3c1c72c3e231cbb618f4c2309cc46f54d16d5502ccf15 +PKG_HASH:=541e179665dc4e272b9602f2074243591a157da89cc47064da8c5829dbd2b339 HOST_BUILD_PARALLEL:=1 diff --git a/tools/ninja/Makefile b/tools/ninja/Makefile index 4763e759d..d79f3c5d5 100644 --- a/tools/ninja/Makefile +++ b/tools/ninja/Makefile @@ -1,38 +1,35 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ninja -PKG_VERSION:=1.11.1 +PKG_VERSION:=1.12.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea +PKG_HASH:=821bdff48a3f683bc4bb3b6f0b5fe7b2d647cf65d52aeb63328c91a6c6df285a include $(INCLUDE_DIR)/host-build.mk -CONFIGURE_ARGS:= -ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) - CONFIGURE_ARGS+=--verbose -endif - define Host/Configure + cd $(HOST_BUILD_DIR) && \ + $(HOST_MAKE_VARS) \ + CXX="$(HOSTCXX_NOCACHE)" \ + $(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py \ + $(if $(shell $(STAGING_DIR_HOST)/bin/ninja --version),,--bootstrap) \ + --no-rebuild \ + --verbose + -$(Host/Install) endef define Host/Compile - cd $(HOST_BUILD_DIR) && \ - CXX="$(HOSTCXX_NOCACHE)" \ - CXXFLAGS="$(HOST_CXXFLAGS) $(HOST_CPPFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS)" \ - $(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py --bootstrap $(CONFIGURE_ARGS) + +$(NINJA) -C $(HOST_BUILD_DIR) endef define Host/Install - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin $(INSTALL_BIN) $(HOST_BUILD_DIR)/ninja $(STAGING_DIR_HOST)/bin/ endef define Host/Clean - $(call Host/Clean/Default) rm -f $(STAGING_DIR_HOST)/bin/ninja endef diff --git a/tools/ninja/patches/001-backport-gtest.patch b/tools/ninja/patches/001-backport-gtest.patch new file mode 100644 index 000000000..1440f29ef --- /dev/null +++ b/tools/ninja/patches/001-backport-gtest.patch @@ -0,0 +1,153 @@ +From afcd4a146fb82843f6ff695f89504ce4ca65ddfd Mon Sep 17 00:00:00 2001 +From: David 'Digit' Turner +Date: Sun, 12 May 2024 23:45:28 +0200 +Subject: [PATCH] configure.py: Support --gtest-source-dir to build tests. + +Allow the Ninja build plan generated by configure.py to +build `ninja_test` by compiling GoogleTest from source if +the path to the library if passed through the new option +`--gtest-source-dir` or the GTEST_SOURCE_DIR environment +variable. + +For simplicity, probing for an installed version of the +library, and linking to it, is not supported (use the +CMake build for this). + +This also removes the obsolete `--gtest-dir` option. + ++ Update README.md + +Fixes #2447 +--- + README.md | 13 ++++++++ + configure.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 95 insertions(+), 1 deletion(-) + +--- a/README.md ++++ b/README.md +@@ -34,6 +34,19 @@ via CMake. For more details see + This will generate the `ninja` binary and a `build.ninja` file you can now use + to build Ninja with itself. + ++If you have a GoogleTest source directory, you can build the tests ++by passing its path with `--gtest-source-dir=PATH` option, or the ++`GTEST_SOURCE_DIR` environment variable, e.g.: ++ ++``` ++./configure.py --bootstrap --gtest-source-dir=/path/to/googletest ++./ninja all # build ninja_test and other auxiliary binaries ++./ninja_test` # run the unit-test suite. ++``` ++ ++Use the CMake build below if you want to use a preinstalled binary ++version of the library. ++ + ### CMake + + ``` +--- a/configure.py ++++ b/configure.py +@@ -213,7 +213,10 @@ parser.add_option('--debug', action='sto + parser.add_option('--profile', metavar='TYPE', + choices=profilers, + help='enable profiling (' + '/'.join(profilers) + ')',) +-parser.add_option('--with-gtest', metavar='PATH', help='ignored') ++parser.add_option('--gtest-source-dir', metavar='PATH', ++ help='Path to GoogleTest source directory. If not provided ' + ++ 'GTEST_SOURCE_DIR will be probed in the environment. ' + ++ 'Tests will not be built without a value.') + parser.add_option('--with-python', metavar='EXE', + help='use EXE as the Python interpreter', + default=os.path.basename(sys.executable)) +@@ -425,6 +428,7 @@ n.variable('cflags', ' '.join(shell_esca + if 'LDFLAGS' in configure_env: + ldflags.append(configure_env['LDFLAGS']) + n.variable('ldflags', ' '.join(shell_escape(flag) for flag in ldflags)) ++ + n.newline() + + if platform.is_msvc(): +@@ -582,6 +586,83 @@ if options.bootstrap: + # build.ninja file. + n = ninja_writer + ++# Build the ninja_test executable only if the GTest source directory ++# is provided explicitly. Either from the environment with GTEST_SOURCE_DIR ++# or with the --gtest-source-dir command-line option. ++# ++# Do not try to look for an installed binary version, and link against it ++# because doing so properly is platform-specific (use the CMake build for ++# this). ++if options.gtest_source_dir: ++ gtest_src_dir = options.gtest_source_dir ++else: ++ gtest_src_dir = os.environ.get('GTEST_SOURCE_DIR') ++ ++if gtest_src_dir: ++ # Verify GoogleTest source directory, and add its include directory ++ # to the global include search path (even for non-test sources) to ++ # keep the build plan generation simple. ++ gtest_all_cc = os.path.join(gtest_src_dir, 'googletest', 'src', 'gtest-all.cc') ++ if not os.path.exists(gtest_all_cc): ++ print('ERROR: Missing GoogleTest source file: %s' % gtest_all_cc) ++ sys.exit(1) ++ ++ n.comment('Tests all build into ninja_test executable.') ++ ++ # Test-specific version of cflags, must include the GoogleTest ++ # include directory. Also GoogleTest can only build with a C++14 compiler. ++ test_cflags = [f.replace('std=c++11', 'std=c++14') for f in cflags] ++ test_cflags.append('-I' + os.path.join(gtest_src_dir, 'googletest', 'include')) ++ ++ test_variables = [('cflags', test_cflags)] ++ if platform.is_msvc(): ++ test_variables += [('pdb', 'ninja_test.pdb')] ++ ++ test_names = [ ++ 'build_log_test', ++ 'build_test', ++ 'clean_test', ++ 'clparser_test', ++ 'depfile_parser_test', ++ 'deps_log_test', ++ 'disk_interface_test', ++ 'dyndep_parser_test', ++ 'edit_distance_test', ++ 'graph_test', ++ 'json_test', ++ 'lexer_test', ++ 'manifest_parser_test', ++ 'ninja_test', ++ 'state_test', ++ 'string_piece_util_test', ++ 'subprocess_test', ++ 'test', ++ 'util_test', ++ ] ++ if platform.is_windows(): ++ test_names += [ ++ 'includes_normalize_test', ++ 'msvc_helper_test', ++ ] ++ ++ objs = [] ++ for name in test_names: ++ objs += cxx(name, variables=test_variables) ++ ++ # Build GTest as a monolithic source file. ++ # This requires one extra include search path, so replace the ++ # value of 'cflags' in our list. ++ gtest_all_variables = test_variables[1:] + [ ++ ('cflags', test_cflags + ['-I' + os.path.join(gtest_src_dir, 'googletest') ]), ++ ] ++ # Do not use cxx() directly to ensure the object file is under $builddir. ++ objs += n.build(built('gtest_all' + objext), 'cxx', gtest_all_cc, variables=gtest_all_variables) ++ ++ ninja_test = n.build(binary('ninja_test'), 'link', objs, implicit=ninja_lib, ++ variables=[('libs', libs)]) ++ n.newline() ++ all_targets += ninja_test ++ + n.comment('Ancillary executables.') + + if platform.is_aix() and '-maix64' not in ldflags: diff --git a/tools/ninja/patches/010-bootstrap-configure-only.patch b/tools/ninja/patches/010-bootstrap-configure-only.patch new file mode 100644 index 000000000..4785ac654 --- /dev/null +++ b/tools/ninja/patches/010-bootstrap-configure-only.patch @@ -0,0 +1,24 @@ +--- a/configure.py ++++ b/configure.py +@@ -198,6 +198,8 @@ parser = OptionParser() + profilers = ['gmon', 'pprof'] + parser.add_option('--bootstrap', action='store_true', + help='bootstrap a ninja binary from nothing') ++parser.add_option('--no-rebuild', action='store_true', ++ help='let user execute ninja after build.ninja generation') + parser.add_option('--verbose', action='store_true', + help='enable verbose build') + parser.add_option('--platform', +@@ -756,7 +758,11 @@ n.build('all', 'phony', all_targets) + n.close() + print('wrote %s.' % BUILD_FILENAME) + +-if options.bootstrap: ++if options.bootstrap and options.no_rebuild: ++ print('bootstrap complete. execute ninja in this directory...') ++ print(os.getcwd()) ++ ++elif options.bootstrap: + print('bootstrap complete. rebuilding...') + + rebuild_args = [] diff --git a/tools/ninja/patches/100-make_jobserver_support.patch b/tools/ninja/patches/100-make_jobserver_support.patch index 34d2b6c43..82ecf0222 100644 --- a/tools/ninja/patches/100-make_jobserver_support.patch +++ b/tools/ninja/patches/100-make_jobserver_support.patch @@ -18,22 +18,9 @@ Documentation for GNU make jobserver http://make.mad-scientist.net/papers/jobserver-implementation/ -Fixes https://github.com/ninja-build/ninja/issues/1139 ---- - configure.py | 2 + - src/build.cc | 63 ++++++++---- - src/build.h | 3 + - src/tokenpool-gnu-make.cc | 211 ++++++++++++++++++++++++++++++++++++++ - src/tokenpool-none.cc | 27 +++++ - src/tokenpool.h | 26 +++++ - 6 files changed, 310 insertions(+), 22 deletions(-) - create mode 100644 src/tokenpool-gnu-make.cc - create mode 100644 src/tokenpool-none.cc - create mode 100644 src/tokenpool.h - --- a/configure.py +++ b/configure.py -@@ -517,11 +517,13 @@ for name in ['build', +@@ -543,11 +543,13 @@ for name in ['build', 'state', 'status', 'string_piece_util', @@ -47,7 +34,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 'includes_normalize-win32', 'msvc_helper-win32', 'msvc_helper_main-win32']: -@@ -530,7 +532,9 @@ if platform.is_windows(): +@@ -556,7 +558,9 @@ if platform.is_windows(): objs += cxx('minidump-win32', variables=cxxvariables) objs += cc('getopt') else: @@ -58,17 +45,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if platform.is_aix(): objs += cc('getopt') if platform.is_msvc(): -@@ -588,6 +592,7 @@ for name in ['build_log_test', - 'string_piece_util_test', - 'subprocess_test', - 'test', -+ 'tokenpool_test', - 'util_test']: - objs += cxx(name, variables=cxxvariables) - if platform.is_windows(): +@@ -639,6 +643,7 @@ if gtest_src_dir: + 'string_piece_util_test', + 'subprocess_test', + 'test', ++ 'tokenpool_test', + 'util_test', + ] + if platform.is_windows(): --- a/src/build.cc +++ b/src/build.cc -@@ -35,6 +35,7 @@ +@@ -39,6 +39,7 @@ #include "state.h" #include "status.h" #include "subprocess.h" @@ -76,10 +63,12 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 #include "util.h" using namespace std; -@@ -47,8 +48,9 @@ struct DryRunCommandRunner : public Comm +@@ -50,24 +51,29 @@ struct DryRunCommandRunner : public Comm + virtual ~DryRunCommandRunner() {} // Overridden from CommandRunner: - virtual bool CanRunMore() const; +- virtual size_t CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -87,8 +76,11 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 private: queue finished_; -@@ -58,12 +60,16 @@ bool DryRunCommandRunner::CanRunMore() c - return true; + }; + +-size_t DryRunCommandRunner::CanRunMore() const { ++size_t DryRunCommandRunner::CanRunMore() { + return SIZE_MAX; } +bool DryRunCommandRunner::AcquireToken() { @@ -105,24 +97,25 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if (finished_.empty()) return false; -@@ -149,7 +155,7 @@ void Plan::EdgeWanted(const Edge* edge) +@@ -160,7 +166,7 @@ void Plan::EdgeWanted(const Edge* edge) } Edge* Plan::FindWork() { - if (ready_.empty()) + if (!more_ready()) return NULL; - EdgeSet::iterator e = ready_.begin(); - Edge* edge = *e; -@@ -448,19 +454,39 @@ void Plan::Dump() const { + + Edge* work = ready_.top(); +@@ -595,19 +601,39 @@ void Plan::Dump() const { } struct RealCommandRunner : public CommandRunner { - explicit RealCommandRunner(const BuildConfig& config) : config_(config) {} - virtual ~RealCommandRunner() {} +- virtual size_t CanRunMore() const; + explicit RealCommandRunner(const BuildConfig& config); + virtual ~RealCommandRunner(); - virtual bool CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -157,7 +150,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 vector RealCommandRunner::GetActiveEdges() { vector edges; for (map::iterator e = subproc_to_edge_.begin(); -@@ -471,14 +497,23 @@ vector RealCommandRunner::GetActi +@@ -618,9 +644,11 @@ vector RealCommandRunner::GetActi void RealCommandRunner::Abort() { subprocs_.Clear(); @@ -165,28 +158,35 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + tokens_->Clear(); } - bool RealCommandRunner::CanRunMore() const { -- size_t subproc_number = -- subprocs_.running_.size() + subprocs_.finished_.size(); -- return (int)subproc_number < config_.parallelism -- && ((subprocs_.running_.empty() || config_.max_load_average <= 0.0f) -- || GetLoadAverage() < config_.max_load_average); -+ bool parallelism_limit_not_reached = -+ tokens_ || // ignore config_.parallelism -+ ((int) (subprocs_.running_.size() + -+ subprocs_.finished_.size()) < config_.parallelism); -+ return parallelism_limit_not_reached -+ && (subprocs_.running_.empty() || -+ (max_load_average_ <= 0.0f || -+ GetLoadAverage() < max_load_average_)); -+} +-size_t RealCommandRunner::CanRunMore() const { ++size_t RealCommandRunner::CanRunMore() { + size_t subproc_number = + subprocs_.running_.size() + subprocs_.finished_.size(); + +@@ -635,6 +663,13 @@ size_t RealCommandRunner::CanRunMore() c + if (capacity < 0) + capacity = 0; + ++ if (tokens_) { ++ if (AcquireToken()) ++ return SIZE_MAX; ++ else ++ capacity = 0; ++ } + -+bool RealCommandRunner::AcquireToken() { -+ return (!tokens_ || tokens_->Acquire()); + if (capacity == 0 && subprocs_.running_.empty()) + // Ensure that we make progress. + capacity = 1; +@@ -642,24 +677,42 @@ size_t RealCommandRunner::CanRunMore() c + return capacity; } ++bool RealCommandRunner::AcquireToken() { ++ return (!tokens_ || tokens_->Acquire()); ++} ++ bool RealCommandRunner::StartCommand(Edge* edge) { -@@ -486,19 +521,33 @@ bool RealCommandRunner::StartCommand(Edg + string command = edge->EvaluateCommand(); Subprocess* subproc = subprocs_.Add(command, edge->use_console()); if (!subproc) return false; @@ -223,61 +223,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 result->status = subproc->Finish(); result->output = subproc->GetOutput(); -@@ -620,38 +669,43 @@ bool Builder::Build(string* err) { - // command runner. +@@ -790,7 +843,8 @@ bool Builder::Build(string* err) { // Second, we attempt to wait for / reap the next finished command. while (plan_.more_to_do()) { -- // See if we can start any more commands. -- if (failures_allowed && command_runner_->CanRunMore()) { -- if (Edge* edge = plan_.FindWork()) { -- if (edge->GetBindingBool("generator")) { -+ // See if we can start any more commands... -+ bool can_run_more = -+ failures_allowed && -+ plan_.more_ready() && -+ command_runner_->CanRunMore(); -+ -+ // ... but we also need a token to do that. -+ if (can_run_more && command_runner_->AcquireToken()) { -+ Edge* edge = plan_.FindWork(); -+ if (edge->GetBindingBool("generator")) { - scan_.build_log()->Close(); - } - -- if (!StartEdge(edge, err)) { -+ if (!StartEdge(edge, err)) { -+ Cleanup(); -+ status_->BuildFinished(); -+ return false; -+ } -+ -+ if (edge->is_phony()) { -+ if (!plan_.EdgeFinished(edge, Plan::kEdgeSucceeded, err)) { - Cleanup(); - status_->BuildFinished(); - return false; - } -- -- if (edge->is_phony()) { -- if (!plan_.EdgeFinished(edge, Plan::kEdgeSucceeded, err)) { -- Cleanup(); -- status_->BuildFinished(); -- return false; -- } -- } else { -- ++pending_commands; -- } -- -- // We made some progress; go back to the main loop. -- continue; -+ } else { -+ ++pending_commands; - } -+ -+ // We made some progress; go back to the main loop. -+ continue; - } - + // See if we can start any more commands. +- if (failures_allowed) { ++ bool can_run_more = failures_allowed && plan_.more_ready(); ++ if (can_run_more) { + size_t capacity = command_runner_->CanRunMore(); + while (capacity > 0) { + Edge* edge = plan_.FindWork(); +@@ -833,7 +887,7 @@ bool Builder::Build(string* err) { // See if we can reap any finished commands. if (pending_commands) { CommandRunner::Result result; @@ -286,7 +242,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 result.status == ExitInterrupted) { Cleanup(); status_->BuildFinished(); -@@ -659,6 +713,10 @@ bool Builder::Build(string* err) { +@@ -841,6 +895,10 @@ bool Builder::Build(string* err) { return false; } @@ -299,7 +255,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 Cleanup(); --- a/src/build.h +++ b/src/build.h -@@ -52,6 +52,9 @@ struct Plan { +@@ -51,6 +51,9 @@ struct Plan { /// Returns true if there's more work to be done. bool more_to_do() const { return wanted_edges_ > 0 && command_edges_ > 0; } @@ -309,15 +265,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 /// Dumps the current state of the plan. void Dump() const; -@@ -136,6 +139,7 @@ private: +@@ -145,7 +148,8 @@ private: + /// RealCommandRunner is an implementation that actually runs commands. struct CommandRunner { virtual ~CommandRunner() {} - virtual bool CanRunMore() const = 0; +- virtual size_t CanRunMore() const = 0; ++ virtual size_t CanRunMore() = 0; + virtual bool AcquireToken() = 0; virtual bool StartCommand(Edge* edge) = 0; /// The result of waiting for a command. -@@ -147,7 +151,9 @@ struct CommandRunner { +@@ -157,7 +161,9 @@ struct CommandRunner { bool success() const { return status == ExitSuccess; } }; /// Wait for a command to complete, or return false if interrupted. @@ -328,7 +286,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 virtual std::vector GetActiveEdges() { return std::vector(); } virtual void Abort() {} -@@ -155,7 +161,8 @@ struct CommandRunner { +@@ -165,7 +171,8 @@ struct CommandRunner { /// Options (e.g. verbosity, parallelism) passed to a build. struct BuildConfig { @@ -338,7 +296,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 failures_allowed(1), max_load_average(-0.0f) {} enum Verbosity { -@@ -167,6 +174,7 @@ struct BuildConfig { +@@ -177,6 +184,7 @@ struct BuildConfig { Verbosity verbosity; bool dry_run; int parallelism; @@ -509,13 +467,15 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 #include +#include + #include + #include - #include "build_log.h" - #include "deps_log.h" -@@ -474,8 +475,9 @@ struct FakeCommandRunner : public Comman +@@ -521,9 +522,10 @@ struct FakeCommandRunner : public Comman + max_active_edges_(1), fs_(fs) {} // CommandRunner impl - virtual bool CanRunMore() const; +- virtual size_t CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -523,8 +483,16 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 virtual vector GetActiveEdges(); virtual void Abort(); -@@ -578,6 +580,10 @@ bool FakeCommandRunner::CanRunMore() con - return active_edges_.size() < max_active_edges_; +@@ -622,13 +624,17 @@ void BuildTest::RebuildTarget(const stri + builder.command_runner_.release(); + } + +-size_t FakeCommandRunner::CanRunMore() const { ++size_t FakeCommandRunner::CanRunMore() { + if (active_edges_.size() < max_active_edges_) + return SIZE_MAX; + + return 0; } +bool FakeCommandRunner::AcquireToken() { @@ -534,7 +502,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 bool FakeCommandRunner::StartCommand(Edge* edge) { assert(active_edges_.size() < max_active_edges_); assert(find(active_edges_.begin(), active_edges_.end(), edge) -@@ -649,7 +655,7 @@ bool FakeCommandRunner::StartCommand(Edg +@@ -720,7 +726,7 @@ bool FakeCommandRunner::StartCommand(Edg return true; } @@ -543,7 +511,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if (active_edges_.empty()) return false; -@@ -3985,3 +3991,356 @@ TEST_F(BuildTest, ValidationWithCircular +@@ -4380,3 +4386,355 @@ TEST_F(BuildTest, ValidationWithCircular EXPECT_FALSE(builder_.AddTarget("out", &err)); EXPECT_EQ("dependency cycle: validate -> validate_in -> validate", err); } @@ -557,7 +525,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + explicit FakeTokenCommandRunner() {} + + // CommandRunner impl -+ virtual bool CanRunMore() const; ++ virtual bool CanRunMore(); + virtual bool AcquireToken(); + virtual bool StartCommand(Edge* edge); + virtual bool WaitForCommand(Result* result, bool more_ready); @@ -572,7 +540,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + vector wait_for_command_; +}; + -+bool FakeTokenCommandRunner::CanRunMore() const { ++bool FakeTokenCommandRunner::CanRunMore() { + if (can_run_more_.size() == 0) { + EXPECT_FALSE("unexpected call to CommandRunner::CanRunMore()"); + return false; @@ -580,9 +548,8 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + + bool result = can_run_more_[0]; + -+ // Unfortunately CanRunMore() isn't "const" for tests -+ const_cast(this)->can_run_more_.erase( -+ const_cast(this)->can_run_more_.begin() ++ can_run_more_.erase( ++ can_run_more_.begin() + ); + + return result; @@ -1345,7 +1312,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 +} --- a/src/ninja.cc +++ b/src/ninja.cc -@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, +@@ -1466,6 +1466,7 @@ int ReadFlags(int* argc, char*** argv, // We want to run N jobs in parallel. For N = 0, INT_MAX // is close enough to infinite for most sane builds. config->parallelism = value > 0 ? value : INT_MAX; @@ -2139,7 +2106,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 +}; --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -112,6 +112,7 @@ add_library(libninja OBJECT +@@ -142,6 +142,7 @@ add_library(libninja OBJECT src/state.cc src/status.cc src/string_piece_util.cc @@ -2147,22 +2114,26 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 src/util.cc src/version.cc ) -@@ -123,9 +124,14 @@ if(WIN32) +@@ -153,13 +154,17 @@ if(WIN32) src/msvc_helper_main-win32.cc src/getopt.c src/minidump-win32.cc + src/tokenpool-gnu-make-win32.cc ) + # Build getopt.c, which can be compiled as either C or C++, as C++ + # so that build environments which lack a C compiler, but have a C++ + # compiler may build ninja. + set_source_files_properties(src/getopt.c PROPERTIES LANGUAGE CXX) else() - target_sources(libninja PRIVATE src/subprocess-posix.cc) +- target_sources(libninja PRIVATE src/subprocess-posix.cc) + target_sources(libninja PRIVATE + src/subprocess-posix.cc + src/tokenpool-gnu-make-posix.cc + ) if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX") target_sources(libninja PRIVATE src/getopt.c) - endif() -@@ -204,6 +210,7 @@ if(BUILD_TESTING) + # Build getopt.c, which can be compiled as either C or C++, as C++ +@@ -286,6 +291,7 @@ if(BUILD_TESTING) src/string_piece_util_test.cc src/subprocess_test.cc src/test.cc diff --git a/tools/patch/Makefile b/tools/patch/Makefile index 957fe6e30..f4cf58862 100644 --- a/tools/patch/Makefile +++ b/tools/patch/Makefile @@ -11,9 +11,9 @@ PKG_VERSION:=2.7.6 PKG_RELEASE:=7 PKG_CPE_ID:=cpe:/a:gnu:patch -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/patch -PKG_HASH:=ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd +PKG_HASH:=8cf86e00ad3aaa6d26aca30640e86b0e3e1f395ed99f189b06d4c9f74bc58a4e HOST_BUILD_PARALLEL := 1 diff --git a/tools/patch/patches/050-CVE-2019-13636.patch b/tools/patch/patches/050-CVE-2019-13636.patch index e62c3d417..d819838bb 100644 --- a/tools/patch/patches/050-CVE-2019-13636.patch +++ b/tools/patch/patches/050-CVE-2019-13636.patch @@ -14,8 +14,6 @@ with O_CREAT | O_EXCL to avoid following symlinks in that case as well. src/util.c | 14 +++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) -diff --git a/src/inp.c b/src/inp.c -index 32d0919..22d7473 100644 --- a/src/inp.c +++ b/src/inp.c @@ -238,8 +238,13 @@ plan_a (char const *filename) @@ -52,11 +50,9 @@ index 32d0919..22d7473 100644 || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r"))) pfatal ("Can't open file %s", quotearg (filename)); if (TMPINNAME_needs_removal) -diff --git a/src/util.c b/src/util.c -index 1cc08ba..fb38307 100644 --- a/src/util.c +++ b/src/util.c -@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original) +@@ -388,7 +388,7 @@ create_backup (char const *to, const str try_makedirs_errno = ENOENT; safe_unlink (bakname); @@ -65,7 +61,7 @@ index 1cc08ba..fb38307 100644 { if (errno != try_makedirs_errno) pfatal ("Can't create file %s", quotearg (bakname)); -@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode, +@@ -579,10 +579,13 @@ create_file (char const *file, int open_ static void copy_to_fd (const char *from, int tofd) { @@ -80,7 +76,7 @@ index 1cc08ba..fb38307 100644 pfatal ("Can't reopen file %s", quotearg (from)); while ((i = read (fromfd, buf, bufsize)) != 0) { -@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost, +@@ -625,6 +628,8 @@ copy_file (char const *from, char const else { assert (S_ISREG (mode)); @@ -89,7 +85,7 @@ index 1cc08ba..fb38307 100644 tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode, to_dir_known_to_exist); copy_to_fd (from, tofd); -@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost, +@@ -640,9 +645,12 @@ copy_file (char const *from, char const void append_to_file (char const *from, char const *to) { @@ -103,6 +99,3 @@ index 1cc08ba..fb38307 100644 pfatal ("Can't reopen file %s", quotearg (to)); copy_to_fd (from, tofd); if (close (tofd) != 0) --- -cgit v1.0-41-gc330 - diff --git a/tools/patch/patches/060-CVE-2019-13638.patch b/tools/patch/patches/060-CVE-2019-13638.patch index 38caff628..590cf186e 100644 --- a/tools/patch/patches/060-CVE-2019-13638.patch +++ b/tools/patch/patches/060-CVE-2019-13638.patch @@ -9,11 +9,9 @@ command to avoid quoting vulnerabilities. src/pch.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -diff --git a/src/pch.c b/src/pch.c -index 4fd5a05..16e001a 100644 --- a/src/pch.c +++ b/src/pch.c -@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname, +@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char c *outname_needs_removal = true; copy_file (inname, outname, 0, exclusive, instat.st_mode, true); } @@ -23,7 +21,7 @@ index 4fd5a05..16e001a 100644 fflush (stdout); pid = fork(); -@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname, +@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char c else if (pid == 0) { dup2 (tmpfd, 0); @@ -33,6 +31,3 @@ index 4fd5a05..16e001a 100644 _exit (2); } else --- -cgit v1.0-41-gc330 - diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index 3ddd611cd..bbda3a9e4 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patchelf -PKG_VERSION:=0.17.2 +PKG_VERSION:=0.18.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/NixOS/patchelf/releases/download/$(PKG_VERSION) -PKG_HASH:=bae2ea376072e422c196218dd9bdef0548ccc08da4de9f36b4672df84ea2d8e2 +PKG_HASH:=1952b2a782ba576279c211ee942e341748fdb44997f704dd53def46cd055470b HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/pkgconf/Makefile b/tools/pkgconf/Makefile index b5f241b7d..533af502e 100644 --- a/tools/pkgconf/Makefile +++ b/tools/pkgconf/Makefile @@ -7,11 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=pkgconf -PKG_VERSION:=1.9.3 +PKG_VERSION:=2.2.0 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://distfiles.dereferenced.org/pkgconf -PKG_HASH:=5fb355b487d54fb6d341e4f18d4e2f7e813a6622cf03a9e87affa6a40565699d +PKG_HASH:=28f8dfc279a10ef66148befa3f6eb266e5f3570316600208ed50e9781c7269d8 + +PKG_CPE_ID:=cpe:/a:pkgconf:pkgconf include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/meson.mk @@ -22,7 +24,7 @@ HOSTCC := $(HOSTCC_NOCACHE) MESON_HOST_ARGS += \ -Ddefault_library=static \ - -Dtests=false + -Dtests=disabled define Host/Install $(call Host/Install/Meson) diff --git a/tools/pkgconf/files/pkg-config b/tools/pkgconf/files/pkg-config index 65e0fb09f..2e4dac907 100755 --- a/tools/pkgconf/files/pkg-config +++ b/tools/pkgconf/files/pkg-config @@ -4,6 +4,8 @@ ${STAGING_DIR_HOST}/bin/pkg-config.real \ --keep-system-cflags \ --keep-system-libs \ --define-variable=prefix="${STAGING_PREFIX}" \ +--define-variable=prefix_host="${STAGING_DIR_HOST}" \ +--define-variable=prefix_hostpkg="${STAGING_DIR_HOSTPKG}" \ --define-variable=exec_prefix="${STAGING_PREFIX}" \ --define-variable=bindir="${STAGING_PREFIX}/bin" \ $PKG_CONFIG_EXTRAARGS "$@" diff --git a/tools/quilt/Makefile b/tools/quilt/Makefile index c16f989b5..73d1db983 100644 --- a/tools/quilt/Makefile +++ b/tools/quilt/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=quilt -PKG_VERSION:=0.67 +PKG_VERSION:=0.68 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SAVANNAH/quilt -PKG_HASH:=3be3be0987e72a6c364678bb827e3e1fcc10322b56bc5f02b576698f55013cc2 +PKG_HASH:=fe8c09de03c106e85b3737c8f03ade147c956b79ed7af485a1c8a3858db38426 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/sdimage/Makefile b/tools/sdimage/Makefile index 532bc481a..e09b1e01f 100644 --- a/tools/sdimage/Makefile +++ b/tools/sdimage/Makefile @@ -13,7 +13,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/mhei/fsl-imx-uuc.git PKG_SOURCE_DATE:=2018-11-18 PKG_SOURCE_VERSION:=c6536ac5b4388b33c217bde2c3a76a4e96d64176 -PKG_MIRROR_HASH:=747fb640a0596cab7d516979188e1f85be58c470df85cf1f7e3dcf8a4c1b36e5 +PKG_MIRROR_HASH:=c4487635ea06ea6311a28739c58f7f889b888c91b7ccc0398d225b4bcdeb76a3 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=LICENSE diff --git a/tools/sed/Makefile b/tools/sed/Makefile index 5cc15a339..f6bb61e22 100644 --- a/tools/sed/Makefile +++ b/tools/sed/Makefile @@ -9,9 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sed PKG_VERSION:=4.9 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181 +PKG_HASH:=d1478a18f033a73ac16822901f6533d30b6be561bcbce46ffd7abce93602282e +PKG_CPE_ID:=cpe:/a:gnu:sed + export SED:= HOST_BUILD_PARALLEL:=1 diff --git a/tools/sparse/Makefile b/tools/sparse/Makefile index e08bd1d05..a46e49567 100644 --- a/tools/sparse/Makefile +++ b/tools/sparse/Makefile @@ -7,10 +7,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sparse PKG_VERSION:=0.6.4 -PKG_HASH:=6ab28b4991bc6aedbd73550291360aa6ab3df41f59206a9bde9690208a6e387c -PKG_RELEASE:=1 +PKG_HASH:=8b907c007459a66db110496f0a02fcff1c3c8b67ddff37b959fb102a28424209 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@KERNEL/software/devel/sparse/dist/ PKG_BUILD_PARALLEL:=1 diff --git a/tools/sparse/patches/010-llvm15.patch b/tools/sparse/patches/010-llvm15.patch new file mode 100644 index 000000000..54fddc7a9 --- /dev/null +++ b/tools/sparse/patches/010-llvm15.patch @@ -0,0 +1,128 @@ +From 0544c547682b878758eea731ef4b8e64e5ec91fb Mon Sep 17 00:00:00 2001 +From: Luc Van Oostenryck +Date: Sat, 20 Jan 2024 01:24:12 +0100 +Subject: llvm: fix LLVM 15 deprecation warnings + +LLVM 15 switched to opaque pointers by default and no longer supports typed pointers. +Remove deprecated LLVM calls and update test. + +Original-patch-by: Vladimir Petko +Signed-off-by: Luc Van Oostenryck +--- + sparse-llvm.c | 35 ++++++++++++++++++++++++++++++++++- + validation/backend/call-variadic.c | 16 ++++------------ + 2 files changed, 38 insertions(+), 13 deletions(-) + +--- a/sparse-llvm.c ++++ b/sparse-llvm.c +@@ -32,6 +32,20 @@ static LLVMTypeRef func_return_type(stru + return symbol_type(sym->ctype.base_type); + } + ++#if LLVM_VERSION_MAJOR > 14 ++// A call can be done either with a SYM_FN or a SYM_PTR (pointing to a SYM_FN). ++// Return the type corresponding to the SYM_FN. ++static LLVMTypeRef func_full_type(struct symbol *type) ++{ ++ if (type->type == SYM_NODE) { ++ struct symbol *btype = type->ctype.base_type; ++ if (btype->type == SYM_PTR) ++ type = btype->ctype.base_type; ++ } ++ return symbol_type(type); ++} ++#endif ++ + static LLVMTypeRef sym_func_type(struct symbol *sym) + { + int n_arg = symbol_list_size(sym->arguments); +@@ -302,7 +316,11 @@ static LLVMValueRef get_sym_value(LLVMMo + LLVMSetGlobalConstant(data, 1); + LLVMSetInitializer(data, LLVMConstString(strdup(s), strlen(s) + 1, true)); + ++#if LLVM_VERSION_MAJOR > 14 ++ result = LLVMConstGEP2(LLVMTypeOf(data), data, indices, ARRAY_SIZE(indices)); ++#else + result = LLVMConstGEP(data, indices, ARRAY_SIZE(indices)); ++#endif + return result; + } + default: +@@ -485,7 +503,11 @@ static LLVMValueRef calc_gep(LLVMBuilder + /* convert base to char* type */ + base = LLVMBuildPointerCast(builder, base, bytep, name); + /* addr = base + off */ ++#if LLVM_VERSION_MAJOR > 14 ++ addr = LLVMBuildInBoundsGEP2(builder, LLVMTypeOf(base), base, &off, 1, name); ++#else + addr = LLVMBuildInBoundsGEP(builder, base, &off, 1, name); ++#endif + /* convert back to the actual pointer type */ + addr = LLVMBuildPointerCast(builder, addr, type, name); + return addr; +@@ -711,7 +733,11 @@ static void output_op_load(struct functi + + /* perform load */ + pseudo_name(insn->target, name); ++#if LLVM_VERSION_MAJOR > 14 ++ target = LLVMBuildLoad2(fn->builder, symbol_type(insn->type), addr, name); ++#else + target = LLVMBuildLoad(fn->builder, addr, name); ++#endif + + insn->target->priv = target; + } +@@ -797,6 +823,7 @@ static void output_op_switch(struct func + static void output_op_call(struct function *fn, struct instruction *insn) + { + LLVMValueRef target, func; ++ struct symbol *fntype; + struct symbol *ctype; + int n_arg = 0, i; + struct pseudo *arg; +@@ -812,14 +839,20 @@ static void output_op_call(struct functi + else + func = pseudo_to_value(fn, ctype, insn->func); + i = 0; ++ fntype = ctype; // first symbol in the list is the function 'true' type + FOR_EACH_PTR(insn->arguments, arg) { +- NEXT_PTR_LIST(ctype); ++ NEXT_PTR_LIST(ctype); // the remaining ones are the arguments' type + args[i++] = pseudo_to_rvalue(fn, ctype, arg); + } END_FOR_EACH_PTR(arg); + FINISH_PTR_LIST(ctype); + + pseudo_name(insn->target, name); ++#if LLVM_VERSION_MAJOR > 14 ++ target = LLVMBuildCall2(fn->builder, func_full_type(fntype), func, args, n_arg, name); ++#else ++ (void) fntype; + target = LLVMBuildCall(fn->builder, func, args, n_arg, name); ++#endif + + insn->target->priv = target; + } +--- a/validation/backend/call-variadic.c ++++ b/validation/backend/call-variadic.c +@@ -11,17 +11,9 @@ int foo(const char *fmt, int a, long l, + /* + * check-name: call-variadic + * check-command: sparse-llvm-dis -m64 $file ++ * check-output-ignore ++ * check-output-contains: , ...) @print(\\(i8\\*\\|ptr\\) %ARG1., i32 120, i32 %ARG2., i32 8, i64 %ARG3., i64 0, \\(i32\\*\\|ptr\\) %ARG4., \\(i8\\*\\|ptr\\) null) ++ * check-output-contains: define i32 @foo( ++ * check-output-contains: declare i32 @print( + * +- * check-output-start +-; ModuleID = '' +-source_filename = "sparse" +- +-define i32 @foo(i8* %ARG1., i32 %ARG2., i64 %ARG3., i32* %ARG4.) { +-L0: +- %R5. = call i32 (i8*, ...) @print(i8* %ARG1., i32 120, i32 %ARG2., i32 8, i64 %ARG3., i64 0, i32* %ARG4., i8* null) +- ret i32 %R5. +-} +- +-declare i32 @print(i8*, ...) +- * check-output-end + */ diff --git a/tools/squashfs/Makefile b/tools/squashfs3-lzma/Makefile similarity index 60% rename from tools/squashfs/Makefile rename to tools/squashfs3-lzma/Makefile index 385cf69d9..b02018629 100644 --- a/tools/squashfs/Makefile +++ b/tools/squashfs3-lzma/Makefile @@ -6,16 +6,21 @@ # include $(TOPDIR)/rules.mk -PKG_NAME:=squashfs +PKG_NAME:=squashfs3-lzma PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs PKG_VERSION:=3.0 -PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.gz +PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/squashfs PKG_HASH:=39dbda43cf118536deb746c7730b468702d514a19f4cfab73b710e32908ddf20 -PKG_CAT:=zcat -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)$(PKG_VERSION) +# Tar directory is squashfs3.0 that conflict with any pattern +# currently using for host tools. (PKG_NAME-PKG_VERSION) +# Also this got renamed to a more correct name +# from squashfs to squashfs3-lzma. +# Use tar transform to rename the root directory to this new +# name. +TAR_OPTIONS+=--transform=s/^squashfs/$(PKG_NAME)-/ include $(INCLUDE_DIR)/host-build.mk @@ -29,13 +34,13 @@ define Host/Compile endef define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR_HOST)/bin/ - $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/unsquashfs-lzma $(STAGING_DIR_HOST)/bin/ + $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma + $(INSTALL_BIN) $(HOST_BUILD_DIR)/squashfs-tools/unsquashfs-lzma $(STAGING_DIR_HOST)/bin/unsquashfs3-lzma endef define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/mksquashfs-lzma - rm -f $(STAGING_DIR_HOST)/bin/unsquashfs-lzma + rm -f $(STAGING_DIR_HOST)/bin/mksquashfs3-lzma + rm -f $(STAGING_DIR_HOST)/bin/unsquashfs3-lzma endef $(eval $(call HostBuild)) diff --git a/tools/squashfs/patches/100-lzma.patch b/tools/squashfs3-lzma/patches/100-lzma.patch similarity index 100% rename from tools/squashfs/patches/100-lzma.patch rename to tools/squashfs3-lzma/patches/100-lzma.patch diff --git a/tools/squashfs/patches/110-no_nonstatic_inline.patch b/tools/squashfs3-lzma/patches/110-no_nonstatic_inline.patch similarity index 100% rename from tools/squashfs/patches/110-no_nonstatic_inline.patch rename to tools/squashfs3-lzma/patches/110-no_nonstatic_inline.patch diff --git a/tools/squashfs/patches/120-add-fixed-timestamp-support.patch b/tools/squashfs3-lzma/patches/120-add-fixed-timestamp-support.patch similarity index 100% rename from tools/squashfs/patches/120-add-fixed-timestamp-support.patch rename to tools/squashfs3-lzma/patches/120-add-fixed-timestamp-support.patch diff --git a/tools/squashfs/patches/130-include_sysmacros.patch b/tools/squashfs3-lzma/patches/130-include_sysmacros.patch similarity index 100% rename from tools/squashfs/patches/130-include_sysmacros.patch rename to tools/squashfs3-lzma/patches/130-include_sysmacros.patch diff --git a/tools/squashfs/patches/140-gcc-10-fix.patch b/tools/squashfs3-lzma/patches/140-gcc-10-fix.patch similarity index 100% rename from tools/squashfs/patches/140-gcc-10-fix.patch rename to tools/squashfs3-lzma/patches/140-gcc-10-fix.patch diff --git a/tools/squashfs3-lzma/patches/150-fix-unitialized-memory.patch b/tools/squashfs3-lzma/patches/150-fix-unitialized-memory.patch new file mode 100644 index 000000000..ad3b82089 --- /dev/null +++ b/tools/squashfs3-lzma/patches/150-fix-unitialized-memory.patch @@ -0,0 +1,11 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -1822,7 +1822,7 @@ int main(int argc, char *argv[]) + { + struct stat buf, source_buf; + int i; +- squashfs_super_block sBlk; ++ squashfs_super_block sBlk = {}; + char *b, *root_name = NULL; + int be, nopad = FALSE, keep_as_directory = FALSE, orig_be; + squashfs_inode inode; diff --git a/tools/squashfskit4/Makefile b/tools/squashfs4/Makefile similarity index 58% rename from tools/squashfskit4/Makefile rename to tools/squashfs4/Makefile index 1800306d3..38c3e5233 100644 --- a/tools/squashfskit4/Makefile +++ b/tools/squashfs4/Makefile @@ -1,29 +1,32 @@ # -# Copyright (C) 2009-2012 OpenWrt.org +# Copyright (C) 2006-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -PKG_NAME:=squashfskit4 -PKG_VERSION:=4.14 -PKG_RELEASE:=3 -PKG_SOURCE:=squashfskit-v$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://github.com/squashfskit/squashfskit/releases/download/v$(PKG_VERSION)/ -PKG_HASH:=5761aaa3aedc4f7112b708367d891c9abdc1ffea972e3fe47923ddba23984d95 +PKG_NAME:=squashfs4 +PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs +PKG_VERSION:=4.6.1 +PKG_RELEASE=3 -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfskit-v$(PKG_VERSION) +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/plougher/squashfs-tools +PKG_SOURCE_DATE:=2023-03-26 +PKG_SOURCE_VERSION:=d8cb82d9840330f9344ec37b992595b5d7b44184 +PKG_MIRROR_HASH:=e84026de1ab187f3f76d1b781a29259d818f887e1651225f850a62d6f90b1b9e + +HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk define Host/Compile +$(HOST_MAKE_VARS) \ - $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ + $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/squashfs-tools \ XZ_SUPPORT=1 \ LZMA_XZ_SUPPORT=1 \ - XATTR_SUPPORT=1 \ - LZMA_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \ + XZ_EXTENDED_OPTIONS=1 \ EXTRA_CFLAGS="-I$(STAGING_DIR_HOST)/include" \ mksquashfs unsquashfs endef diff --git a/tools/squashfs4/patches/001-xz_wrapper-support-multiple-lzma-configuration-optio.patch b/tools/squashfs4/patches/001-xz_wrapper-support-multiple-lzma-configuration-optio.patch new file mode 100644 index 000000000..bcc962a9d --- /dev/null +++ b/tools/squashfs4/patches/001-xz_wrapper-support-multiple-lzma-configuration-optio.patch @@ -0,0 +1,187 @@ +From dcb976fe4ee40e4bac8ae0dcc836629c625a6fd4 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Fri, 14 Oct 2022 15:59:16 +0200 +Subject: [PATCH] xz_wrapper: support multiple lzma configuration options + +Add option to configure preset, lc, lp and pb lzma parameters. +-Xpreset can be used to set the compression level. +-Xe can be used to set the 'EXTREME' flag to use the lzma compression +options tweaking additional settings on top of the compression level set. + +New option added: + -Xpreset + -Xe + -Xlc + -Xlp + -Xpb + +Signed-off-by: Christian Marangi +--- + squashfs-tools/xz_wrapper.c | 119 ++++++++++++++++++++++++++++++++++-- + 1 file changed, 115 insertions(+), 4 deletions(-) + +--- a/squashfs-tools/xz_wrapper.c ++++ b/squashfs-tools/xz_wrapper.c +@@ -44,7 +44,10 @@ static struct bcj bcj[] = { + static int filter_count = 1; + static int dictionary_size = 0; + static float dictionary_percent = 0; +- ++static int preset = LZMA_PRESET_DEFAULT; ++static int lc = -1; ++static int lp = -1; ++static int pb = -1; + + /* + * This function is called by the options parsing code in mksquashfs.c +@@ -53,6 +56,11 @@ static float dictionary_percent = 0; + * Two specific options are supported: + * -Xbcj + * -Xdict-size ++ * -Xpreset ++ * -Xe ++ * -Xlc ++ * -Xlp ++ * -Xpb + * + * This function returns: + * >=0 (number of additional args parsed) on success +@@ -141,6 +149,85 @@ static int xz_options(char *argv[], int + } + + return 1; ++ } else if(strcmp(argv[0], "-Xpreset") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xpreset missing preset-level " ++ "(valid value 0-9)\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < 0 || (int) val & ~LZMA_PRESET_LEVEL_MASK) { ++ fprintf(stderr, "xz: -Xpreset can't be " ++ "negative or more than the max preset\n"); ++ goto failed; ++ } ++ ++ preset &= ~LZMA_PRESET_LEVEL_MASK; ++ preset |= (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xe") == 0) { ++ preset |= LZMA_PRESET_EXTREME; ++ ++ return 0; ++ } else if(strcmp(argv[0], "-Xlc") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xlc missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { ++ fprintf(stderr, "xz: -Xlc invalid value\n"); ++ goto failed; ++ } ++ ++ lc = (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xlp") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xlp missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { ++ fprintf(stderr, "xz: -Xlp invalid value\n"); ++ goto failed; ++ } ++ ++ lp = (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xpb") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xpb missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_PB_MIN || (int) val > LZMA_PB_MAX) { ++ fprintf(stderr, "xz: -Xpb invalid value\n"); ++ goto failed; ++ } ++ ++ pb = (int) val; ++ ++ return 1; + } + + return -1; +@@ -446,11 +533,20 @@ static int xz_compress(void *strm, void + for(i = 0; i < stream->filters; i++) { + struct filter *filter = &stream->filter[i]; + +- if(lzma_lzma_preset(&stream->opt, LZMA_PRESET_DEFAULT)) +- goto failed; ++ if(lzma_lzma_preset(&stream->opt, preset)) ++ goto failed; + + stream->opt.dict_size = stream->dictionary_size; + ++ if (lc >= 0) ++ stream->opt.lc = lc; ++ ++ if (lp >= 0) ++ stream->opt.lp = lp; ++ ++ if (pb >= 0) ++ stream->opt.pb = pb; ++ + filter->length = 0; + res = lzma_stream_buffer_encode(filter->filter, + LZMA_CHECK_CRC32, NULL, src, size, filter->buffer, +@@ -521,13 +617,28 @@ static void xz_usage(FILE *stream) + fprintf(stream, " header as either 2^n or as 2^n+2^(n+1).\n\t\t"); + fprintf(stream, "Example dict-sizes are 75%%, 50%%, 37.5%%, 25%%, or"); + fprintf(stream, " 32K, 16K, 8K\n\t\tetc.\n"); ++ fprintf(stream, "\t -Xpreset \n"); ++ fprintf(stream, "\t\tUse as the custom preset to use"); ++ fprintf(stream, " on compress.\n\t\t should be 0 .. 9"); ++ fprintf(stream, " (default 6)\n"); ++ fprintf(stream, "\t -Xe\n"); ++ fprintf(stream, "\t\tEnable additional compression settings by passing"); ++ fprintf(stream, " the EXTREME\n\t\tflag to the compression flags.\n"); ++ fprintf(stream, "\t -Xlc \n"); ++ fprintf(stream, "\t -Xlp \n"); ++ fprintf(stream, "\t -Xpb \n"); + } + + + static int option_args(char *option) + { + if(strcmp(option, "-Xbcj") == 0 || +- strcmp(option, "-Xdict-size") == 0) ++ strcmp(option, "-Xdict-size") == 0 || ++ strcmp(option, "-Xpreset") == 0 || ++ strcmp(option, "-Xe") == 0 || ++ strcmp(option, "-Xlc") == 0 || ++ strcmp(option, "-Xlp") == 0 || ++ strcmp(option, "-Xpb") == 0) + return 1; + + return 0; diff --git a/tools/squashfs4/patches/002-xz_wrapper-make-new-OpenWrt-extended-options-non-def.patch b/tools/squashfs4/patches/002-xz_wrapper-make-new-OpenWrt-extended-options-non-def.patch new file mode 100644 index 000000000..92b6a1aa9 --- /dev/null +++ b/tools/squashfs4/patches/002-xz_wrapper-make-new-OpenWrt-extended-options-non-def.patch @@ -0,0 +1,898 @@ +From 5fb9fdfb8757fc9afb6318a3dcf9dce0a97de352 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 19 Apr 2023 18:35:53 +0100 +Subject: [PATCH] xz_wrapper: make new OpenWrt extended options non-default + +The reason why these options are being made non-default are +described here: + +https://github.com/plougher/squashfs-tools/pull/218#issuecomment-1515197256 + +The new options can be enabled by editing the Makefile or by defining +XZ_EXTENDED_OPTIONS on the Make command line, e.g. + +% CONFIG=1 XZ_SUPPORT=1 XZ_EXTENDED_OPTIONS=1 make + +Signed-off-by: Phillip Lougher +--- + squashfs-tools/Makefile | 12 + + squashfs-tools/xz_wrapper.c | 117 +---- + squashfs-tools/xz_wrapper_extended.c | 664 +++++++++++++++++++++++++++ + 3 files changed, 679 insertions(+), 114 deletions(-) + create mode 100644 squashfs-tools/xz_wrapper_extended.c + +--- a/squashfs-tools/Makefile ++++ b/squashfs-tools/Makefile +@@ -39,6 +39,10 @@ GZIP_SUPPORT = 1 + # + #XZ_SUPPORT = 1 + ++# Enable support for OpenWrt extended compression options by uncommenting ++# next line. Do not do this unless you understand the implications. ++#XZ_EXTENDED_OPTIONS = 1 ++ + + ############ Building LZO support ############## + # +@@ -197,6 +201,7 @@ INSTALL_MANPAGES_DIR ?= $(INSTALL_PREFIX + LZMA_XZ_SUPPORT ?= 0 + LZMA_SUPPORT ?= 0 + LZMA_DIR ?= ../../../../LZMA/lzma465 ++XZ_EXTENDED_OPTIONS ?= 0 + endif + + +@@ -248,8 +253,13 @@ endif + + ifeq ($(XZ_SUPPORT),1) + CFLAGS += -DXZ_SUPPORT ++ifeq ($(XZ_EXTENDED_OPTIONS),1) ++MKSQUASHFS_OBJS += xz_wrapper_extended.o ++UNSQUASHFS_OBJS += xz_wrapper_extended.o ++else + MKSQUASHFS_OBJS += xz_wrapper.o + UNSQUASHFS_OBJS += xz_wrapper.o ++endif + LIBS += -llzma + COMPRESSORS += xz + endif +@@ -428,6 +438,8 @@ lz4_wrapper.o: lz4_wrapper.c squashfs_fs + + xz_wrapper.o: xz_wrapper.c squashfs_fs.h xz_wrapper.h compressor.h + ++xz_wrapper_extended.o: xz_wrapper_extended.c squashfs_fs.h xz_wrapper.h compressor.h ++ + unsquashfs: $(UNSQUASHFS_OBJS) + $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(UNSQUASHFS_OBJS) $(LIBS) -o $@ + ln -sf unsquashfs sqfscat +--- a/squashfs-tools/xz_wrapper.c ++++ b/squashfs-tools/xz_wrapper.c +@@ -44,10 +44,7 @@ static struct bcj bcj[] = { + static int filter_count = 1; + static int dictionary_size = 0; + static float dictionary_percent = 0; +-static int preset = LZMA_PRESET_DEFAULT; +-static int lc = -1; +-static int lp = -1; +-static int pb = -1; ++ + + /* + * This function is called by the options parsing code in mksquashfs.c +@@ -56,11 +53,6 @@ static int pb = -1; + * Two specific options are supported: + * -Xbcj + * -Xdict-size +- * -Xpreset +- * -Xe +- * -Xlc +- * -Xlp +- * -Xpb + * + * This function returns: + * >=0 (number of additional args parsed) on success +@@ -149,85 +141,6 @@ static int xz_options(char *argv[], int + } + + return 1; +- } else if(strcmp(argv[0], "-Xpreset") == 0) { +- char *b; +- long val; +- +- if(argc < 2) { +- fprintf(stderr, "xz: -Xpreset missing preset-level " +- "(valid value 0-9)\n"); +- goto failed; +- } +- +- val = strtol(argv[1], &b, 10); +- if (*b != '\0' || (int) val < 0 || (int) val & ~LZMA_PRESET_LEVEL_MASK) { +- fprintf(stderr, "xz: -Xpreset can't be " +- "negative or more than the max preset\n"); +- goto failed; +- } +- +- preset &= ~LZMA_PRESET_LEVEL_MASK; +- preset |= (int) val; +- +- return 1; +- } else if(strcmp(argv[0], "-Xe") == 0) { +- preset |= LZMA_PRESET_EXTREME; +- +- return 0; +- } else if(strcmp(argv[0], "-Xlc") == 0) { +- char *b; +- long val; +- +- if(argc < 2) { +- fprintf(stderr, "xz: -Xlc missing value\n"); +- goto failed; +- } +- +- val = strtol(argv[1], &b, 10); +- if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { +- fprintf(stderr, "xz: -Xlc invalid value\n"); +- goto failed; +- } +- +- lc = (int) val; +- +- return 1; +- } else if(strcmp(argv[0], "-Xlp") == 0) { +- char *b; +- long val; +- +- if(argc < 2) { +- fprintf(stderr, "xz: -Xlp missing value\n"); +- goto failed; +- } +- +- val = strtol(argv[1], &b, 10); +- if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { +- fprintf(stderr, "xz: -Xlp invalid value\n"); +- goto failed; +- } +- +- lp = (int) val; +- +- return 1; +- } else if(strcmp(argv[0], "-Xpb") == 0) { +- char *b; +- long val; +- +- if(argc < 2) { +- fprintf(stderr, "xz: -Xpb missing value\n"); +- goto failed; +- } +- +- val = strtol(argv[1], &b, 10); +- if (*b != '\0' || (int) val < LZMA_PB_MIN || (int) val > LZMA_PB_MAX) { +- fprintf(stderr, "xz: -Xpb invalid value\n"); +- goto failed; +- } +- +- pb = (int) val; +- +- return 1; + } + + return -1; +@@ -533,20 +446,11 @@ static int xz_compress(void *strm, void + for(i = 0; i < stream->filters; i++) { + struct filter *filter = &stream->filter[i]; + +- if(lzma_lzma_preset(&stream->opt, preset)) ++ if(lzma_lzma_preset(&stream->opt, LZMA_PRESET_DEFAULT)) + goto failed; + + stream->opt.dict_size = stream->dictionary_size; + +- if (lc >= 0) +- stream->opt.lc = lc; +- +- if (lp >= 0) +- stream->opt.lp = lp; +- +- if (pb >= 0) +- stream->opt.pb = pb; +- + filter->length = 0; + res = lzma_stream_buffer_encode(filter->filter, + LZMA_CHECK_CRC32, NULL, src, size, filter->buffer, +@@ -617,28 +521,13 @@ static void xz_usage(FILE *stream) + fprintf(stream, " header as either 2^n or as 2^n+2^(n+1).\n\t\t"); + fprintf(stream, "Example dict-sizes are 75%%, 50%%, 37.5%%, 25%%, or"); + fprintf(stream, " 32K, 16K, 8K\n\t\tetc.\n"); +- fprintf(stream, "\t -Xpreset \n"); +- fprintf(stream, "\t\tUse as the custom preset to use"); +- fprintf(stream, " on compress.\n\t\t should be 0 .. 9"); +- fprintf(stream, " (default 6)\n"); +- fprintf(stream, "\t -Xe\n"); +- fprintf(stream, "\t\tEnable additional compression settings by passing"); +- fprintf(stream, " the EXTREME\n\t\tflag to the compression flags.\n"); +- fprintf(stream, "\t -Xlc \n"); +- fprintf(stream, "\t -Xlp \n"); +- fprintf(stream, "\t -Xpb \n"); + } + + + static int option_args(char *option) + { + if(strcmp(option, "-Xbcj") == 0 || +- strcmp(option, "-Xdict-size") == 0 || +- strcmp(option, "-Xpreset") == 0 || +- strcmp(option, "-Xe") == 0 || +- strcmp(option, "-Xlc") == 0 || +- strcmp(option, "-Xlp") == 0 || +- strcmp(option, "-Xpb") == 0) ++ strcmp(option, "-Xdict-size") == 0) + return 1; + + return 0; +--- /dev/null ++++ b/squashfs-tools/xz_wrapper_extended.c +@@ -0,0 +1,664 @@ ++/* ++ * Copyright (c) 2010, 2011, 2012, 2013, 2021, 2022 ++ * Phillip Lougher ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * xz_wrapper_extended.c ++ * ++ * Support for XZ (LZMA2) compression using XZ Utils liblzma ++ * http://tukaani.org/xz/ ++ * ++ * This file supports OpenWrt extended XZ compression options. ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "xz_wrapper.h" ++#include "compressor.h" ++ ++static struct bcj bcj[] = { ++ { "x86", LZMA_FILTER_X86, 0 }, ++ { "powerpc", LZMA_FILTER_POWERPC, 0 }, ++ { "ia64", LZMA_FILTER_IA64, 0 }, ++ { "arm", LZMA_FILTER_ARM, 0 }, ++ { "armthumb", LZMA_FILTER_ARMTHUMB, 0 }, ++ { "sparc", LZMA_FILTER_SPARC, 0 }, ++ { NULL, LZMA_VLI_UNKNOWN, 0 } ++}; ++ ++static int filter_count = 1; ++static int dictionary_size = 0; ++static float dictionary_percent = 0; ++static int preset = LZMA_PRESET_DEFAULT; ++static int lc = -1; ++static int lp = -1; ++static int pb = -1; ++ ++/* ++ * This function is called by the options parsing code in mksquashfs.c ++ * to parse any -X compressor option. ++ * ++ * Two specific options are supported: ++ * -Xbcj ++ * -Xdict-size ++ * -Xpreset ++ * -Xe ++ * -Xlc ++ * -Xlp ++ * -Xpb ++ * ++ * This function returns: ++ * >=0 (number of additional args parsed) on success ++ * -1 if the option was unrecognised, or ++ * -2 if the option was recognised, but otherwise bad in ++ * some way (e.g. invalid parameter) ++ * ++ * Note: this function sets internal compressor state, but does not ++ * pass back the results of the parsing other than success/failure. ++ * The xz_dump_options() function is called later to get the options in ++ * a format suitable for writing to the filesystem. ++ */ ++static int xz_options(char *argv[], int argc) ++{ ++ int i; ++ char *name; ++ ++ if(strcmp(argv[0], "-Xbcj") == 0) { ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xbcj missing filter\n"); ++ goto failed; ++ } ++ ++ name = argv[1]; ++ while(name[0] != '\0') { ++ for(i = 0; bcj[i].name; i++) { ++ int n = strlen(bcj[i].name); ++ if((strncmp(name, bcj[i].name, n) == 0) && ++ (name[n] == '\0' || ++ name[n] == ',')) { ++ if(bcj[i].selected == 0) { ++ bcj[i].selected = 1; ++ filter_count++; ++ } ++ name += name[n] == ',' ? n + 1 : n; ++ break; ++ } ++ } ++ if(bcj[i].name == NULL) { ++ fprintf(stderr, "xz: -Xbcj unrecognised " ++ "filter\n"); ++ goto failed; ++ } ++ } ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xdict-size") == 0) { ++ char *b; ++ float size; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xdict-size missing dict-size\n"); ++ goto failed; ++ } ++ ++ size = strtof(argv[1], &b); ++ if(*b == '%') { ++ if(size <= 0 || size > 100) { ++ fprintf(stderr, "xz: -Xdict-size percentage " ++ "should be 0 < dict-size <= 100\n"); ++ goto failed; ++ } ++ ++ dictionary_percent = size; ++ dictionary_size = 0; ++ } else { ++ if((float) ((int) size) != size) { ++ fprintf(stderr, "xz: -Xdict-size can't be " ++ "fractional unless a percentage of the" ++ " block size\n"); ++ goto failed; ++ } ++ ++ dictionary_percent = 0; ++ dictionary_size = (int) size; ++ ++ if(*b == 'k' || *b == 'K') ++ dictionary_size *= 1024; ++ else if(*b == 'm' || *b == 'M') ++ dictionary_size *= 1024 * 1024; ++ else if(*b != '\0') { ++ fprintf(stderr, "xz: -Xdict-size invalid " ++ "dict-size\n"); ++ goto failed; ++ } ++ } ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xpreset") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xpreset missing preset-level " ++ "(valid value 0-9)\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < 0 || (int) val & ~LZMA_PRESET_LEVEL_MASK) { ++ fprintf(stderr, "xz: -Xpreset can't be " ++ "negative or more than the max preset\n"); ++ goto failed; ++ } ++ ++ preset &= ~LZMA_PRESET_LEVEL_MASK; ++ preset |= (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xe") == 0) { ++ preset |= LZMA_PRESET_EXTREME; ++ ++ return 0; ++ } else if(strcmp(argv[0], "-Xlc") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xlc missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { ++ fprintf(stderr, "xz: -Xlc invalid value\n"); ++ goto failed; ++ } ++ ++ lc = (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xlp") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xlp missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_LCLP_MIN || (int) val > LZMA_LCLP_MAX) { ++ fprintf(stderr, "xz: -Xlp invalid value\n"); ++ goto failed; ++ } ++ ++ lp = (int) val; ++ ++ return 1; ++ } else if(strcmp(argv[0], "-Xpb") == 0) { ++ char *b; ++ long val; ++ ++ if(argc < 2) { ++ fprintf(stderr, "xz: -Xpb missing value\n"); ++ goto failed; ++ } ++ ++ val = strtol(argv[1], &b, 10); ++ if (*b != '\0' || (int) val < LZMA_PB_MIN || (int) val > LZMA_PB_MAX) { ++ fprintf(stderr, "xz: -Xpb invalid value\n"); ++ goto failed; ++ } ++ ++ pb = (int) val; ++ ++ return 1; ++ } ++ ++ return -1; ++ ++failed: ++ return -2; ++} ++ ++ ++/* ++ * This function is called after all options have been parsed. ++ * It is used to do post-processing on the compressor options using ++ * values that were not expected to be known at option parse time. ++ * ++ * In this case block_size may not be known until after -Xdict-size has ++ * been processed (in the case where -b is specified after -Xdict-size) ++ * ++ * This function returns 0 on successful post processing, or ++ * -1 on error ++ */ ++static int xz_options_post(int block_size) ++{ ++ /* ++ * if -Xdict-size has been specified use this to compute the datablock ++ * dictionary size ++ */ ++ if(dictionary_size || dictionary_percent) { ++ int n; ++ ++ if(dictionary_size) { ++ if(dictionary_size > block_size) { ++ fprintf(stderr, "xz: -Xdict-size is larger than" ++ " block_size\n"); ++ goto failed; ++ } ++ } else ++ dictionary_size = block_size * dictionary_percent / 100; ++ ++ if(dictionary_size < 8192) { ++ fprintf(stderr, "xz: -Xdict-size should be 8192 bytes " ++ "or larger\n"); ++ goto failed; ++ } ++ ++ /* ++ * dictionary_size must be storable in xz header as either ++ * 2^n or as 2^n+2^(n+1) ++ */ ++ n = ffs(dictionary_size) - 1; ++ if(dictionary_size != (1 << n) && ++ dictionary_size != ((1 << n) + (1 << (n + 1)))) { ++ fprintf(stderr, "xz: -Xdict-size is an unsupported " ++ "value, dict-size must be storable in xz " ++ "header\n"); ++ fprintf(stderr, "as either 2^n or as 2^n+2^(n+1). " ++ "Example dict-sizes are 75%%, 50%%, 37.5%%, " ++ "25%%,\n"); ++ fprintf(stderr, "or 32K, 16K, 8K etc.\n"); ++ goto failed; ++ } ++ ++ } else ++ /* No -Xdict-size specified, use defaults */ ++ dictionary_size = block_size; ++ ++ return 0; ++ ++failed: ++ return -1; ++} ++ ++ ++/* ++ * This function is called by mksquashfs to dump the parsed ++ * compressor options in a format suitable for writing to the ++ * compressor options field in the filesystem (stored immediately ++ * after the superblock). ++ * ++ * This function returns a pointer to the compression options structure ++ * to be stored (and the size), or NULL if there are no compression ++ * options ++ */ ++static void *xz_dump_options(int block_size, int *size) ++{ ++ static struct comp_opts comp_opts; ++ int flags = 0, i; ++ ++ /* ++ * don't store compressor specific options in file system if the ++ * default options are being used - no compressor options in the ++ * file system means the default options are always assumed ++ * ++ * Defaults are: ++ * metadata dictionary size: SQUASHFS_METADATA_SIZE ++ * datablock dictionary size: block_size ++ * 1 filter ++ */ ++ if(dictionary_size == block_size && filter_count == 1) ++ return NULL; ++ ++ for(i = 0; bcj[i].name; i++) ++ flags |= bcj[i].selected << i; ++ ++ comp_opts.dictionary_size = dictionary_size; ++ comp_opts.flags = flags; ++ ++ SQUASHFS_INSWAP_COMP_OPTS(&comp_opts); ++ ++ *size = sizeof(comp_opts); ++ return &comp_opts; ++} ++ ++ ++/* ++ * This function is a helper specifically for the append mode of ++ * mksquashfs. Its purpose is to set the internal compressor state ++ * to the stored compressor options in the passed compressor options ++ * structure. ++ * ++ * In effect this function sets up the compressor options ++ * to the same state they were when the filesystem was originally ++ * generated, this is to ensure on appending, the compressor uses ++ * the same compression options that were used to generate the ++ * original filesystem. ++ * ++ * Note, even if there are no compressor options, this function is still ++ * called with an empty compressor structure (size == 0), to explicitly ++ * set the default options, this is to ensure any user supplied ++ * -X options on the appending mksquashfs command line are over-ridden ++ * ++ * This function returns 0 on sucessful extraction of options, and ++ * -1 on error ++ */ ++static int xz_extract_options(int block_size, void *buffer, int size) ++{ ++ struct comp_opts *comp_opts = buffer; ++ int flags, i, n; ++ ++ if(size == 0) { ++ /* set defaults */ ++ dictionary_size = block_size; ++ flags = 0; ++ } else { ++ /* check passed comp opts struct is of the correct length */ ++ if(size != sizeof(struct comp_opts)) ++ goto failed; ++ ++ SQUASHFS_INSWAP_COMP_OPTS(comp_opts); ++ ++ dictionary_size = comp_opts->dictionary_size; ++ flags = comp_opts->flags; ++ ++ /* ++ * check that the dictionary size seems correct - the dictionary ++ * size should 2^n or 2^n+2^(n+1) ++ */ ++ n = ffs(dictionary_size) - 1; ++ if(dictionary_size != (1 << n) && ++ dictionary_size != ((1 << n) + (1 << (n + 1)))) ++ goto failed; ++ } ++ ++ filter_count = 1; ++ for(i = 0; bcj[i].name; i++) { ++ if((flags >> i) & 1) { ++ bcj[i].selected = 1; ++ filter_count ++; ++ } else ++ bcj[i].selected = 0; ++ } ++ ++ return 0; ++ ++failed: ++ fprintf(stderr, "xz: error reading stored compressor options from " ++ "filesystem!\n"); ++ ++ return -1; ++} ++ ++ ++static void xz_display_options(void *buffer, int size) ++{ ++ struct comp_opts *comp_opts = buffer; ++ int dictionary_size, flags, printed; ++ int i, n; ++ ++ /* check passed comp opts struct is of the correct length */ ++ if(size != sizeof(struct comp_opts)) ++ goto failed; ++ ++ SQUASHFS_INSWAP_COMP_OPTS(comp_opts); ++ ++ dictionary_size = comp_opts->dictionary_size; ++ flags = comp_opts->flags; ++ ++ /* ++ * check that the dictionary size seems correct - the dictionary ++ * size should 2^n or 2^n+2^(n+1) ++ */ ++ n = ffs(dictionary_size) - 1; ++ if(dictionary_size != (1 << n) && ++ dictionary_size != ((1 << n) + (1 << (n + 1)))) ++ goto failed; ++ ++ printf("\tDictionary size %d\n", dictionary_size); ++ ++ printed = 0; ++ for(i = 0; bcj[i].name; i++) { ++ if((flags >> i) & 1) { ++ if(printed) ++ printf(", "); ++ else ++ printf("\tFilters selected: "); ++ printf("%s", bcj[i].name); ++ printed = 1; ++ } ++ } ++ ++ if(!printed) ++ printf("\tNo filters specified\n"); ++ else ++ printf("\n"); ++ ++ return; ++ ++failed: ++ fprintf(stderr, "xz: error reading stored compressor options from " ++ "filesystem!\n"); ++} ++ ++ ++/* ++ * This function is called by mksquashfs to initialise the ++ * compressor, before compress() is called. ++ * ++ * This function returns 0 on success, and ++ * -1 on error ++ */ ++static int xz_init(void **strm, int block_size, int datablock) ++{ ++ int i, j, filters = datablock ? filter_count : 1; ++ struct filter *filter = malloc(filters * sizeof(struct filter)); ++ struct xz_stream *stream; ++ ++ if(filter == NULL) ++ goto failed; ++ ++ stream = *strm = malloc(sizeof(struct xz_stream)); ++ if(stream == NULL) ++ goto failed2; ++ ++ stream->filter = filter; ++ stream->filters = filters; ++ ++ memset(filter, 0, filters * sizeof(struct filter)); ++ ++ stream->dictionary_size = datablock ? dictionary_size : ++ SQUASHFS_METADATA_SIZE; ++ ++ filter[0].filter[0].id = LZMA_FILTER_LZMA2; ++ filter[0].filter[0].options = &stream->opt; ++ filter[0].filter[1].id = LZMA_VLI_UNKNOWN; ++ ++ for(i = 0, j = 1; datablock && bcj[i].name; i++) { ++ if(bcj[i].selected) { ++ filter[j].buffer = malloc(block_size); ++ if(filter[j].buffer == NULL) ++ goto failed3; ++ filter[j].filter[0].id = bcj[i].id; ++ filter[j].filter[1].id = LZMA_FILTER_LZMA2; ++ filter[j].filter[1].options = &stream->opt; ++ filter[j].filter[2].id = LZMA_VLI_UNKNOWN; ++ j++; ++ } ++ } ++ ++ return 0; ++ ++failed3: ++ for(i = 1; i < filters; i++) ++ free(filter[i].buffer); ++ free(stream); ++ ++failed2: ++ free(filter); ++ ++failed: ++ return -1; ++} ++ ++ ++static int xz_compress(void *strm, void *dest, void *src, int size, ++ int block_size, int *error) ++{ ++ int i; ++ lzma_ret res = 0; ++ struct xz_stream *stream = strm; ++ struct filter *selected = NULL; ++ ++ stream->filter[0].buffer = dest; ++ ++ for(i = 0; i < stream->filters; i++) { ++ struct filter *filter = &stream->filter[i]; ++ ++ if(lzma_lzma_preset(&stream->opt, preset)) ++ goto failed; ++ ++ stream->opt.dict_size = stream->dictionary_size; ++ ++ if (lc >= 0) ++ stream->opt.lc = lc; ++ ++ if (lp >= 0) ++ stream->opt.lp = lp; ++ ++ if (pb >= 0) ++ stream->opt.pb = pb; ++ ++ filter->length = 0; ++ res = lzma_stream_buffer_encode(filter->filter, ++ LZMA_CHECK_CRC32, NULL, src, size, filter->buffer, ++ &filter->length, block_size); ++ ++ if(res == LZMA_OK) { ++ if(!selected || selected->length > filter->length) ++ selected = filter; ++ } else if(res != LZMA_BUF_ERROR) ++ goto failed; ++ } ++ ++ if(!selected) ++ /* ++ * Output buffer overflow. Return out of buffer space ++ */ ++ return 0; ++ ++ if(selected->buffer != dest) ++ memcpy(dest, selected->buffer, selected->length); ++ ++ return (int) selected->length; ++ ++failed: ++ /* ++ * All other errors return failure, with the compressor ++ * specific error code in *error ++ */ ++ *error = res; ++ return -1; ++} ++ ++ ++static int xz_uncompress(void *dest, void *src, int size, int outsize, ++ int *error) ++{ ++ size_t src_pos = 0; ++ size_t dest_pos = 0; ++ uint64_t memlimit = MEMLIMIT; ++ ++ lzma_ret res = lzma_stream_buffer_decode(&memlimit, 0, NULL, ++ src, &src_pos, size, dest, &dest_pos, outsize); ++ ++ if(res == LZMA_OK && size == (int) src_pos) ++ return (int) dest_pos; ++ else { ++ *error = res; ++ return -1; ++ } ++} ++ ++ ++static void xz_usage(FILE *stream) ++{ ++ fprintf(stream, "\t -Xbcj filter1,filter2,...,filterN\n"); ++ fprintf(stream, "\t\tCompress using filter1,filter2,...,filterN in"); ++ fprintf(stream, " turn\n\t\t(in addition to no filter), and choose"); ++ fprintf(stream, " the best compression.\n"); ++ fprintf(stream, "\t\tAvailable filters: x86, arm, armthumb,"); ++ fprintf(stream, " powerpc, sparc, ia64\n"); ++ fprintf(stream, "\t -Xdict-size \n"); ++ fprintf(stream, "\t\tUse as the XZ dictionary size. The"); ++ fprintf(stream, " dictionary size\n\t\tcan be specified as a"); ++ fprintf(stream, " percentage of the block size, or as an\n\t\t"); ++ fprintf(stream, "absolute value. The dictionary size must be less"); ++ fprintf(stream, " than or equal\n\t\tto the block size and 8192 bytes"); ++ fprintf(stream, " or larger. It must also be\n\t\tstorable in the xz"); ++ fprintf(stream, " header as either 2^n or as 2^n+2^(n+1).\n\t\t"); ++ fprintf(stream, "Example dict-sizes are 75%%, 50%%, 37.5%%, 25%%, or"); ++ fprintf(stream, " 32K, 16K, 8K\n\t\tetc.\n"); ++ fprintf(stream, "\t -Xpreset \n"); ++ fprintf(stream, "\t\tUse as the custom preset to use"); ++ fprintf(stream, " on compress.\n\t\t should be 0 .. 9"); ++ fprintf(stream, " (default 6)\n"); ++ fprintf(stream, "\t -Xe\n"); ++ fprintf(stream, "\t\tEnable additional compression settings by passing"); ++ fprintf(stream, " the EXTREME\n\t\tflag to the compression flags.\n"); ++ fprintf(stream, "\t -Xlc \n"); ++ fprintf(stream, "\t -Xlp \n"); ++ fprintf(stream, "\t -Xpb \n"); ++} ++ ++ ++static int option_args(char *option) ++{ ++ if(strcmp(option, "-Xbcj") == 0 || ++ strcmp(option, "-Xdict-size") == 0 || ++ strcmp(option, "-Xpreset") == 0 || ++ strcmp(option, "-Xe") == 0 || ++ strcmp(option, "-Xlc") == 0 || ++ strcmp(option, "-Xlp") == 0 || ++ strcmp(option, "-Xpb") == 0) ++ return 1; ++ ++ return 0; ++} ++ ++ ++struct compressor xz_comp_ops = { ++ .init = xz_init, ++ .compress = xz_compress, ++ .uncompress = xz_uncompress, ++ .options = xz_options, ++ .options_post = xz_options_post, ++ .dump_options = xz_dump_options, ++ .extract_options = xz_extract_options, ++ .display_options = xz_display_options, ++ .usage = xz_usage, ++ .option_args = option_args, ++ .id = XZ_COMPRESSION, ++ .name = "xz", ++ .supported = 1 ++}; diff --git a/tools/squashfskit4/patches/0001-fix-version.sh.patch b/tools/squashfskit4/patches/0001-fix-version.sh.patch deleted file mode 100644 index 5f0894bc1..000000000 --- a/tools/squashfskit4/patches/0001-fix-version.sh.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/squashfs-tools/version.sh -+++ b/squashfs-tools/version.sh -@@ -27,13 +27,11 @@ if [ -z "$OUTPUT" ] ; then - fi - - our_date() { --case $(uname) in --NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin) -- date -r "$1" "$2" -- ;; --*) -- date -d "@$1" "$2" --esac -+ if date --version 2>&1 | grep -q "GNU coreutils"; then -+ date -d "@$1" "$2" -+ else -+ date -r "$1" "$2" -+ fi - } - - try_version() { diff --git a/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch b/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch deleted file mode 100644 index de7729997..000000000 --- a/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch +++ /dev/null @@ -1,41 +0,0 @@ -From fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5 Mon Sep 17 00:00:00 2001 -From: Sergei Trofimovich -Date: Sun, 26 Jan 2020 18:35:13 +0000 -Subject: [PATCH] squashfs-tools: fix build failure against gcc-10 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On gcc-10 (and gcc-9 -fno-common) build fails as: - -``` -cc ... -o mksquashfs -ld: read_fs.o:(.bss+0x0): - multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here -ld: read_fs.o:(.bss+0x8): - multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here -``` - -gcc-10 will change the default from -fcommon to fno-common: -https://gcc.gnu.org/PR85678. - -The error also happens if CFLAGS=-fno-common passed explicitly. - -Reported-by: Toralf Förster -Bug: https://bugs.gentoo.org/706456 -Signed-off-by: Sergei Trofimovich ---- - squashfs-tools/mksquashfs.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/squashfs-tools/mksquashfs.h -+++ b/squashfs-tools/mksquashfs.h -@@ -133,7 +133,7 @@ struct append_file { - #define BLOCK_OFFSET 2 - - extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache; --struct cache *bwriter_buffer, *fwriter_buffer; -+extern struct cache *bwriter_buffer, *fwriter_buffer; - extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer, - *locked_fragment, *to_process_frag; - extern struct append_file **file_mapping; diff --git a/tools/squashfskit4/patches/0010-portability.patch b/tools/squashfskit4/patches/0010-portability.patch deleted file mode 100644 index 2cc50ae8f..000000000 --- a/tools/squashfskit4/patches/0010-portability.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/squashfs-tools/xattr.c -+++ b/squashfs-tools/xattr.c -@@ -113,6 +113,7 @@ static int get_prefix(struct xattr_list - - static int read_xattrs_from_system(char *filename, struct xattr_list **xattrs) - { -+#if defined(linux) - ssize_t size, vsize; - char *xattr_names, *p; - int i; -@@ -222,6 +223,10 @@ failed: - free(xattr_list); - free(xattr_names); - return 0; -+#else -+ *xattrs = NULL; -+ return 0; -+#endif - } - - ---- a/squashfs-tools/unsquashfs_xattr.c -+++ b/squashfs-tools/unsquashfs_xattr.c -@@ -34,6 +34,7 @@ extern int user_xattrs; - - void write_xattr(char *pathname, unsigned int xattr) - { -+#if defined(linux) - unsigned int count; - struct xattr_list *xattr_list; - int i; -@@ -136,4 +137,5 @@ void write_xattr(char *pathname, unsigne - } - - free_xattr(xattr_list, count); -+#endif - } diff --git a/tools/squashfskit4/patches/0020-big-endian.patch b/tools/squashfskit4/patches/0020-big-endian.patch deleted file mode 100644 index b388cb4d1..000000000 --- a/tools/squashfskit4/patches/0020-big-endian.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/squashfs-tools/xz_wrapper.c -+++ b/squashfs-tools/xz_wrapper.c -@@ -192,7 +192,10 @@ static void xz_display_options(void *buf - if(size != sizeof(struct comp_opts)) - goto failed; - -- SQUASHFS_INSWAP_LZMA_COMP_OPTS(comp_opts); -+#if __BYTE_ORDER == __BIG_ENDIAN -+ comp_opts->dictionary_size = inswap_le32(comp_opts->dictionary_size); -+ comp_opts->flags = inswap_le32(comp_opts->flags); -+#endif - - dictionary_size = comp_opts->dictionary_size; - flags = comp_opts->flags; diff --git a/tools/tar/Makefile b/tools/tar/Makefile index 47aad9ec6..8bedb8eb1 100644 --- a/tools/tar/Makefile +++ b/tools/tar/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tar PKG_CPE_ID:=cpe:/a:gnu:tar -PKG_VERSION:=1.34 +PKG_VERSION:=1.35 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/tar -PKG_HASH:=63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28 +PKG_HASH:=14d55e32063ea9526e057fbf35fcabd53378e769787eff7919c3755b02d2b57e HOST_BUILD_PARALLEL:=1 diff --git a/tools/tar/patches/0001-Fix-savannah-bug-64441.patch b/tools/tar/patches/0001-Fix-savannah-bug-64441.patch new file mode 100644 index 000000000..1c10e5452 --- /dev/null +++ b/tools/tar/patches/0001-Fix-savannah-bug-64441.patch @@ -0,0 +1,35 @@ +From 6bec1e7e7fe0ae5bbeb66fc9f32b0b1dd156957d Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Tue, 18 Jun 2024 14:31:17 +0200 +Subject: [PATCH] Fix savannah bug #64441 + +* src/Makefile.am (tar_LDADD): Add libiconv libraries. + +Adapted upstream commit 8632df398b2f548465ebe68b8f494c0d6f8d913d to patch +the pregenerated Makefile.in instead of Makefile.am to avoid invoking +automake which requires m4. + +This is required for macOS, as otherwise it will fail with: +Undefined symbols for architecture arm64: + "_iconv", referenced from: + _utf8_convert in utf8.o + "_iconv_open", referenced from: + _utf8_convert in utf8.o +ld: symbol(s) not found for architecture arm64 +clang: error: linker command failed with exit code 1 (use -v to see invocation) +--- + src/Makefile.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -1793,7 +1793,8 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLA + tar_LDADD = $(LIBS) ../lib/libtar.a ../gnu/libgnu.a\ + $(LIB_ACL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)\ + $(LIB_GETRANDOM) $(LIB_HARD_LOCALE) $(FILE_HAS_ACL_LIB) $(LIB_MBRTOWC)\ +- $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) ++ $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) \ ++ $(LIBINTL) $(LIBICONV) + + all: all-am + diff --git a/tools/tar/patches/100-symlink-force-root-name.patch b/tools/tar/patches/100-symlink-force-root-name.patch index 8a8ebc0c4..93f889761 100644 --- a/tools/tar/patches/100-symlink-force-root-name.patch +++ b/tools/tar/patches/100-symlink-force-root-name.patch @@ -5,7 +5,7 @@ Signed-off-by: Felix Fietkau --- --- a/src/create.c +++ b/src/create.c -@@ -543,17 +543,8 @@ write_gnu_long_link (struct tar_stat_inf +@@ -544,17 +544,8 @@ write_gnu_long_link (struct tar_stat_inf union block *header; header = start_private_header ("././@LongLink", size, 0); diff --git a/tools/tar/patches/110-symlink-force-permissions.patch b/tools/tar/patches/110-symlink-force-permissions.patch index 4a80de6ef..ec64afe7f 100644 --- a/tools/tar/patches/110-symlink-force-permissions.patch +++ b/tools/tar/patches/110-symlink-force-permissions.patch @@ -1,6 +1,6 @@ --- a/src/create.c +++ b/src/create.c -@@ -1844,6 +1844,7 @@ dump_file0 (struct tar_stat_info *st, ch +@@ -1855,6 +1855,7 @@ dump_file0 (struct tar_stat_info *st, ch #ifdef HAVE_READLINK else if (S_ISLNK (st->stat.st_mode)) { diff --git a/tools/util-linux/Makefile b/tools/util-linux/Makefile index acd819e38..55fdf9ba6 100644 --- a/tools/util-linux/Makefile +++ b/tools/util-linux/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.39.3 +PKG_VERSION:=2.40.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.39 -PKG_HASH:=7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f +PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.40 +PKG_HASH:=d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3 PKG_CPE_ID:=cpe:/a:kernel:util-linux HOST_BUILD_PARALLEL:=1 @@ -19,87 +19,8 @@ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_ARGS += \ - --disable-poman \ - --disable-nls \ - --disable-asciidoc \ - --disable-poman \ - --disable-libuuid \ - --disable-libblkid \ - --disable-libmount \ - --disable-libsmartcols \ - --disable-libfdisk \ - --disable-fdisks \ - --disable-mount \ - --disable-losetup \ - --disable-zramctl \ - --disable-fsck \ - --disable-partx \ - --disable-uuidd \ - --disable-uuidgen \ - --disable-blkid \ - --disable-wipefs \ - --disable-mountpoint \ - --disable-fallocate \ - --disable-unshare \ - --disable-nsenter \ - --disable-setpriv \ - --disable-hardlink \ - --disable-eject \ - --disable-agetty \ - --disable-cramfs \ - --disable-bfs \ - --disable-minix \ - --disable-hwclock \ - --disable-mkfs \ - --disable-fstrim \ - --disable-swapon \ - --disable-lscpu \ - --disable-lsfd \ - --disable-lslogins \ - --disable-wdctl \ - --disable-cal \ - --disable-logger \ - --disable-whereis \ - --disable-pipesz \ - --disable-waitpid \ - --disable-switch_root \ - --disable-pivot_root \ - --disable-lsmem \ - --disable-chmem \ - --disable-ipcmk \ - --disable-ipcrm \ - --disable-ipcs \ - --disable-irqtop \ - --disable-lsirq \ - --disable-lsns \ - --disable-rfkill \ - --disable-scriptutils \ - --disable-tunelp \ - --disable-kill \ - --disable-last \ - --disable-utmpdump \ - --disable-line \ - --disable-mesg \ - --disable-raw \ - --disable-rename \ - --disable-vipw \ - --disable-newgrp \ - --disable-chfn-chsh \ - --disable-login \ - --disable-nologin \ - --disable-sulogin \ - --disable-su \ - --disable-runuser \ - --disable-ul \ - --disable-more \ - --disable-pg \ - --disable-setterm \ - --disable-schedutils \ - --disable-wall \ - --disable-write \ - --disable-bash-completion \ - --disable-pylibmount \ - --disable-pg-bell \ + --disable-all-programs \ + --enable-hexdump \ --without-util \ --without-selinux \ --without-audit \ diff --git a/tools/util-linux/patches/0001-hexdump-allow-enabling-with-disable-all-programs.patch b/tools/util-linux/patches/0001-hexdump-allow-enabling-with-disable-all-programs.patch new file mode 100644 index 000000000..a8f1b5eb2 --- /dev/null +++ b/tools/util-linux/patches/0001-hexdump-allow-enabling-with-disable-all-programs.patch @@ -0,0 +1,28 @@ +From 37641f246ee9df7289b4e3054b3ded3912773722 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Tue, 25 Jun 2024 17:32:08 +0200 +Subject: [PATCH] hexdump: allow enabling with --disable-all-programs + +Currently, if --disable-all-programs is used hexdump cannot be built +as --enable-hexdump is not recognized, so lets add support for it. + +Signed-off-by: Robert Marko +--- + configure.ac | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -2240,7 +2240,11 @@ UL_BUILD_INIT([column], [check]) + UL_REQUIRES_BUILD([column], [libsmartcols]) + AM_CONDITIONAL([BUILD_COLUMN], [test "x$build_column" = xyes]) + +-UL_BUILD_INIT([hexdump], [yes]) ++AC_ARG_ENABLE([hexdump], ++ AS_HELP_STRING([--disable-hexdump], [do not build hexdump]), ++ [], [UL_DEFAULT_ENABLE([hexdump], [check])] ++) ++UL_BUILD_INIT([hexdump]) + AM_CONDITIONAL([BUILD_HEXDUMP], [test "x$build_hexdump" = xyes]) + + UL_BUILD_INIT([rev], [yes]) diff --git a/tools/util-linux/patches/101-macos-weak-aliases.patch b/tools/util-linux/patches/101-macos-weak-aliases.patch new file mode 100644 index 000000000..e5d0f9d0b --- /dev/null +++ b/tools/util-linux/patches/101-macos-weak-aliases.patch @@ -0,0 +1,26 @@ +From 9445f477cfcfb3615ffde8f93b1b98c809ee4eca Mon Sep 17 00:00:00 2001 +From: Eugene Gershnik +Date: Mon, 6 May 2024 09:29:39 -0700 +Subject: [PATCH] This re-enables build on macOS. + +Weak aliases are not supported by clang on Darwin. +Instead this fix uses inline asm to make `_uuid_time` and alias to `___uuid_time` + +Fixes util-linux/util-linux#2873 +--- + libuuid/src/uuid_time.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/libuuid/src/uuid_time.c ++++ b/libuuid/src/uuid_time.c +@@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, stru + } + #if defined(__USE_TIME_BITS64) && defined(__GLIBC__) + extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); ++#elif defined(__clang__) && defined(__APPLE__) ++__asm__(".globl _uuid_time"); ++__asm__(".set _uuid_time, ___uuid_time"); ++extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); + #else + extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); + #endif diff --git a/tools/util-linux/patches/110-pkgconfig-static.patch b/tools/util-linux/patches/110-pkgconfig-static.patch new file mode 100644 index 000000000..d61ae313b --- /dev/null +++ b/tools/util-linux/patches/110-pkgconfig-static.patch @@ -0,0 +1,24 @@ +From 81ea117e0396274808a77d40bf11af44ea047285 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 23 Sep 2024 12:01:40 +0200 +Subject: [PATCH] pkgconfig: adjust for static libraries + +OpenWrt builds only static libuuid for tools. Adjust the pkgconfig file +accordingly. + +Addresses: https://github.com/util-linux/util-linux/issues/3210 +Signed-off-by: Rosen Penev +--- + libuuid/uuid.pc.in | 2 +- + 1 file changed, 1 insertions(+), 2 deletions(-) + +--- a/libuuid/uuid.pc.in ++++ b/libuuid/uuid.pc.in +@@ -6,6 +6,5 @@ includedir=@includedir@ + Name: uuid + Description: Universally unique id library + Version: @LIBUUID_VERSION@ +-Requires: + Cflags: -I${includedir}/uuid +-Libs: -L${libdir} -luuid ++Libs: -L${libdir} -luuid -lpthread diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 9084cb08f..a90cec86b 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.4.1 +PKG_VERSION:=5.4.6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=dd172acb53867a68012f94c17389401b2f274a1aa5ae8f84cbfb8b7e383ea8d3 +PKG_HASH:=913851b274e8e1d31781ec949f1c23e8dbcf0ecf6e73a2436dc21769dd3e6f49 PKG_CPE_ID:=cpe:/a:tukaani:xz HOST_BUILD_PARALLEL:=1 diff --git a/tools/yafut/Makefile b/tools/yafut/Makefile new file mode 100644 index 000000000..a7e36e517 --- /dev/null +++ b/tools/yafut/Makefile @@ -0,0 +1,20 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=yafut +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/kempniu/yafut.git +PKG_MIRROR_HASH:=9cc6b4c485ce16d44b67ebf79e8bee1e07aecde112da739cf33e8714ac3842e7 +PKG_SOURCE_DATE:=2024-05-13 +PKG_SOURCE_VERSION:=2b45baaf1cced47af8f22dd3acbf1df2f04c7510 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_INSTALL:=1 + +$(eval $(call HostBuild)) diff --git a/tools/yafut/patches/100-portability.patch b/tools/yafut/patches/100-portability.patch new file mode 100644 index 000000000..18fda407a --- /dev/null +++ b/tools/yafut/patches/100-portability.patch @@ -0,0 +1,289 @@ +--- a/lib/yaffs2/direct/yportenv.h ++++ b/lib/yaffs2/direct/yportenv.h +@@ -32,10 +32,13 @@ + #define CONFIG_YAFFS_DEFINES_TYPES 1 + #define CONFIG_YAFFS_USE_32_BIT_TIME_T 1 + #define NO_Y_INLINE 1 +-#define loff_t off_t + + #endif /* __rtems__ */ + ++#ifndef linux ++#define loff_t off_t ++#endif ++ + /* Definition of types */ + #ifdef CONFIG_YAFFS_DEFINES_TYPES + typedef unsigned char u8; +--- a/src/ioctl.c ++++ b/src/ioctl.c +@@ -21,5 +21,9 @@ + * integer overflow when building against e.g. musl. + */ + int linux_ioctl(int fd, unsigned long request, void *ptr) { ++#ifdef linux + return syscall(SYS_ioctl, fd, request, ptr); ++#else ++ return -1; ++#endif + } +--- a/src/ioctl.h ++++ b/src/ioctl.h +@@ -12,7 +12,9 @@ int linux_ioctl(int fd, unsigned long re + * time, as the definition of the MEMREAD ioctl trickles down into kernel + * headers distributed out there. + */ ++#ifdef linux + #include ++ + #ifndef MEMREAD + #include + +@@ -35,3 +37,4 @@ struct mtd_read_req { + + #define MEMREAD _IOWR('M', 26, struct mtd_read_req) + #endif /* MEMREAD */ ++#endif +--- a/src/mtd.c ++++ b/src/mtd.c +@@ -4,7 +4,9 @@ + + #include + #include ++#ifdef linux + #include ++#endif + #include + #include + #include +@@ -82,6 +84,7 @@ static void mtd_debug_location(const cha + va_end(args); + } + ++#ifdef linux + /* + * Read the raw contents of the sysfs attribute at the provided 'sysfs_path' + * into 'buf', which is 'buf_len' bytes large. The given sysfs attribute is +@@ -179,6 +182,7 @@ static int discover_mtd_parameters(const + + return 0; + } ++#endif + + /* + * Initialize 'geometry' with 'chunk_size' and 'block_size' set to the default +@@ -203,6 +207,7 @@ static void init_yaffs_geometry_default( + * Initialize 'geometry' with 'chunk_size' and 'block_size' set to the relevant + * MTD parameters provided in 'mtd' and 'mtd_type' set to the provided value. + */ ++#ifdef linux + static void init_yaffs_geometry_autodetected(const struct mtd_ctx *ctx, + const struct mtd_info_user *mtd, + struct mtd_geometry *geometry, +@@ -217,6 +222,7 @@ static void init_yaffs_geometry_autodete + .block_size = mtd->erasesize, + }; + } ++#endif + + /* + * Update 'chunk_size' and 'block_size' in 'geometry' to the values provided in +@@ -280,6 +286,7 @@ static int init_yaffs_geometry_file(cons + * 2. If -C and/or -B were used, override any default values with those + * provided on the command line. + */ ++#ifdef linux + static void init_yaffs_geometry_nand_or_nor(const struct mtd_ctx *ctx, + const struct mtd_info_user *mtd, + const struct opts *opts, +@@ -297,6 +304,7 @@ static void init_yaffs_geometry_nand_or_ + + geometry->block_count = mtd->size / geometry->block_size; + } ++#endif + + /* + * Determine the type of the provided MTD (which can be either NAND/NOR flash +@@ -317,6 +325,7 @@ static int init_yaffs_geometry(const str + geometry->oob_size = 0; + geometry->oobavail = 0; + } else { ++#ifdef linux + struct mtd_info_user mtd; + unsigned int oobavail; + +@@ -329,6 +338,9 @@ static int init_yaffs_geometry(const str + + geometry->oob_size = mtd.oobsize; + geometry->oobavail = oobavail; ++#else ++ return -1; ++#endif + } + + return 0; +--- a/src/ydrv.c ++++ b/src/ydrv.c +@@ -3,7 +3,9 @@ + // SPDX-License-Identifier: GPL-2.0-only + + #include ++#ifdef linux + #include ++#endif + #include + #include + #include +@@ -122,6 +124,7 @@ static long long ydrv_get_data_offset_fo + /* + * Check whether the given MTD block is a bad one on NAND or NOR flash. + */ ++#ifdef linux + static int ydrv_check_bad_nand_or_nor(const struct ydrv_ctx *ctx, + int block_no) { + long long offset = block_no * ctx->block_size; +@@ -139,6 +142,7 @@ static int ydrv_check_bad_nand_or_nor(co + + return (ret == 0 ? YAFFS_OK : YAFFS_FAIL); + } ++#endif + + /* + * Check whether the given MTD block is a bad one. +@@ -154,9 +158,11 @@ static int ydrv_check_bad(struct yaffs_d + } + + switch (ctx->mtd_type) { ++#ifdef linux + case MTD_TYPE_NAND: + case MTD_TYPE_NOR: + return ydrv_check_bad_nand_or_nor(ctx, block_no); ++#endif + case MTD_TYPE_FILE: + ydrv_debug("file is assumed to only contain good blocks"); + return YAFFS_OK; +@@ -169,6 +175,7 @@ static int ydrv_check_bad(struct yaffs_d + /* + * Erase the given MTD block on NAND or NOR flash. + */ ++#ifdef linux + static int ydrv_erase_block_nand_or_nor(const struct ydrv_ctx *ctx, + int block_no) { + long long offset = block_no * ctx->block_size; +@@ -196,6 +203,7 @@ static int ydrv_erase_block_nand_or_nor( + + return YAFFS_OK; + } ++#endif + + /* + * Erase the given MTD block in a file. +@@ -247,9 +255,11 @@ static int ydrv_erase_block(struct yaffs + } + + switch (ctx->mtd_type) { ++#ifdef linux + case MTD_TYPE_NAND: + case MTD_TYPE_NOR: + return ydrv_erase_block_nand_or_nor(ctx, block_no); ++#endif + case MTD_TYPE_FILE: + return ydrv_erase_block_file(ctx, block_no); + default: +@@ -261,6 +271,7 @@ static int ydrv_erase_block(struct yaffs + /* + * Mark the given MTD block as bad on NAND or NOR flash. + */ ++#ifdef linux + static int ydrv_mark_bad_nand_or_nor(const struct ydrv_ctx *ctx, int block_no) { + long long offset = block_no * ctx->block_size; + int err = 0; +@@ -281,6 +292,7 @@ static int ydrv_mark_bad_nand_or_nor(con + + return YAFFS_OK; + } ++#endif + + /* + * Mark the given MTD block as bad. +@@ -296,9 +308,11 @@ static int ydrv_mark_bad(struct yaffs_de + } + + switch (ctx->mtd_type) { ++#ifdef linux + case MTD_TYPE_NAND: + case MTD_TYPE_NOR: + return ydrv_mark_bad_nand_or_nor(ctx, block_no); ++#endif + case MTD_TYPE_FILE: + ydrv_debug("file is assumed to only contain good blocks"); + return YAFFS_FAIL; +@@ -315,9 +329,11 @@ static int ydrv_mark_bad(struct yaffs_de + */ + static int ydrv_ecc_result(int read_result, enum yaffs_ecc_result *ecc_result) { + switch (read_result) { ++#ifdef linux + case -EUCLEAN: + *ecc_result = YAFFS_ECC_RESULT_FIXED; + return YAFFS_OK; ++#endif + case -EBADMSG: + *ecc_result = YAFFS_ECC_RESULT_UNFIXED; + return YAFFS_FAIL; +@@ -333,6 +349,7 @@ static int ydrv_ecc_result(int read_resu + /* + * Read a data+OOB chunk from NAND flash. + */ ++#ifdef linux + static int ydrv_read_chunk_nand(const struct ydrv_ctx *ctx, int chunk, u8 *data, + int data_len, u8 *oob, int oob_len, + enum yaffs_ecc_result *ecc_result_out, +@@ -371,6 +388,7 @@ static int ydrv_read_chunk_nand(const st + + return ret; + } ++#endif + + /* + * Read a data chunk from NOR flash. +@@ -420,10 +438,12 @@ static int ydrv_read_chunk(struct yaffs_ + } + + switch (ctx->mtd_type) { ++#ifdef linux + case MTD_TYPE_NAND: + return ydrv_read_chunk_nand(ctx, chunk, data, data_len, oob, + oob_len, ecc_result_out, + dev->param.is_yaffs2); ++#endif + case MTD_TYPE_NOR: + case MTD_TYPE_FILE: + return ydrv_read_chunk_nor_or_file(ctx, chunk, data, data_len, +@@ -438,6 +458,7 @@ static int ydrv_read_chunk(struct yaffs_ + /* + * Write a data+OOB chunk to NAND flash. + */ ++#ifdef linux + static int ydrv_write_chunk_nand(const struct ydrv_ctx *ctx, int chunk, + const u8 *data, int data_len, const u8 *oob, + int oob_len, bool is_yaffs2) { +@@ -472,6 +493,7 @@ static int ydrv_write_chunk_nand(const s + + return YAFFS_OK; + } ++#endif + + /* + * Write a data chunk to NOR flash. +@@ -516,9 +538,11 @@ static int ydrv_write_chunk(struct yaffs + } + + switch (ctx->mtd_type) { ++#ifdef linux + case MTD_TYPE_NAND: + return ydrv_write_chunk_nand(ctx, chunk, data, data_len, oob, + oob_len, dev->param.is_yaffs2); ++#endif + case MTD_TYPE_NOR: + case MTD_TYPE_FILE: + return ydrv_write_chunk_nor_or_file(ctx, chunk, data, data_len); diff --git a/tools/zip/Makefile b/tools/zip/Makefile index 6e83dafb4..5ad124d1c 100644 --- a/tools/zip/Makefile +++ b/tools/zip/Makefile @@ -17,6 +17,7 @@ PKG_HASH:=f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369 PKG_LICENSE:=BSD-4-Clause PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:zip_project:zip HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)/zip$(PKG_REV) HOST_BUILD_PARALLEL:=1 diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile index 17fe9fa23..b1307ef2a 100644 --- a/tools/zlib/Makefile +++ b/tools/zlib/Makefile @@ -8,16 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zlib -PKG_VERSION:=1.2.13 +PKG_VERSION:=1.3.1 PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/madler/zlib/releases/download/v$(PKG_VERSION) -PKG_HASH:=d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98 +PKG_HASH:=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 PKG_LICENSE:=Zlib PKG_LICENSE_FILES:=README -PKG_CPE_ID:=cpe:/a:gnu:zlib +PKG_CPE_ID:=cpe:/a:zlib:zlib HOST_BUILD_PARALLEL:=1 diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index 4d46a5f95..e1d36c59c 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -1,35 +1,45 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zstd -PKG_VERSION:=1.5.5 +PKG_VERSION:=1.5.6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION) -PKG_HASH:=9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 +PKG_HASH:=8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:facebook:zstandard -include $(INCLUDE_DIR)/host-build.mk -include $(INCLUDE_DIR)/meson.mk +HOST_BUILD_PARALLEL:=1 -MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/build/meson/openwrt-build +include $(INCLUDE_DIR)/host-build.mk HOSTCC:= $(HOSTCC_NOCACHE) -MESON_HOST_ARGS += \ - -Ddefault_library=static \ - -Dlegacy_level=7 \ - -Ddebug_level=0 \ - -Dbacktrace=disabled \ - -Dstatic_runtime=false \ - -Dbin_programs=true \ - -Dbin_tests=false \ - -Dbin_contrib=false \ - -Dmulti_thread=enabled \ - -Dzlib=disabled \ - -Dlzma=disabled \ - -Dlz4=disabled +HOST_CFLAGS += $(HOST_FPIC) + +HOST_MAKE_FLAGS += \ + BACKTRACE=0 \ + HAVE_THREAD=1 \ + HAVE_ZLIB=0 \ + HAVE_LZMA=0 \ + HAVE_LZ4=0 \ + PREFIX=$(HOST_BUILD_PREFIX) + +define Host/Compile + $(call Host/Compile/Default,lib-mt) + $(call Host/Compile/Default,zstd) +endef + +define Host/Install + +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib install-static install-includes PREFIX=$(HOST_BUILD_PREFIX) + +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib install-pc MT=1 PREFIX=$(HOST_BUILD_PREFIX) + +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/programs install PREFIX=$(HOST_BUILD_PREFIX) +endef + +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef $(eval $(call HostBuild)) diff --git a/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch b/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch new file mode 100644 index 000000000..1bbcaf4c8 --- /dev/null +++ b/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch @@ -0,0 +1,126 @@ +From f1f1ae369a4cefd3474b3528e8d1847b18750605 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 6 Apr 2024 14:41:54 +0200 +Subject: [PATCH] Provide variant pkg-config file for multi-threaded static lib + +Multi-threaded static library require -pthread to correctly link and works. +The pkg-config we provide tho only works with dynamic multi-threaded library +and won't provide the correct libs and cflags values if lib-mt is used. + +To handle this, introduce an env variable MT to permit advanced user to +install and generate a correct pkg-config file for lib-mt or detect if +lib-mt target is called. + +With MT env set on calling make install-pc, libzstd.pc.in is a +pkg-config file for a multi-threaded static library. + +On calling make lib-mt, a libzstd.pc is generated for a multi-threaded +static library as it's what asked by the user by forcing it. + +libzstd.pc is changed to PHONY to force regeneration of it on calling +lib targets or install-pc to handle case where the same directory is +used for mixed compilation. + +This was notice while migrating from meson to make build system where +meson generates a correct .pc file while make doesn't. + +Signed-off-by: Christian Marangi +--- + lib/Makefile | 20 +++++++++++++++++++- + lib/README.md | 4 ++++ + lib/libzstd.pc.in | 4 ++-- + 3 files changed, 25 insertions(+), 3 deletions(-) + +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -63,6 +63,8 @@ CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # + LDFLAGS_DYNLIB += -pthread + CPPFLAGS_STATICLIB += # static library build defaults to single-threaded + ++# pkg-config Libs.private points to LDFLAGS_DYNLIB ++PCLIB := $(LDFLAGS_DYNLIB) + + ifeq ($(findstring GCC,$(CCVER)),GCC) + decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize +@@ -186,12 +188,15 @@ lib : libzstd.a libzstd + %-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD + %-mt : CPPFLAGS_STATICLIB := -DZSTD_MULTITHREAD + %-mt : LDFLAGS_DYNLIB := -pthread ++%-mt : PCLIB := ++%-mt : PCMTLIB := $(LDFLAGS_DYNLIB) + %-mt : % + @echo multi-threaded build completed + + %-nomt : CPPFLAGS_DYNLIB := + %-nomt : LDFLAGS_DYNLIB := + %-nomt : CPPFLAGS_STATICLIB := ++%-nomt : PCLIB := + %-nomt : % + @echo single-threaded build completed + +@@ -292,6 +297,14 @@ PCLIBPREFIX := $(if $(findstring $(LIBDI + # to PREFIX, rather than as a resolved value. + PCEXEC_PREFIX := $(if $(HAS_EXPLICIT_EXEC_PREFIX),$(EXEC_PREFIX),$${prefix}) + ++ ++ifneq ($(MT),) ++ PCLIB := ++ PCMTLIB := $(LDFLAGS_DYNLIB) ++else ++ PCLIB := $(LDFLAGS_DYNLIB) ++endif ++ + ifneq (,$(filter $(UNAME),FreeBSD NetBSD DragonFly)) + PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig + else +@@ -308,6 +321,10 @@ INSTALL_PROGRAM ?= $(INSTALL) + INSTALL_DATA ?= $(INSTALL) -m 644 + + ++# pkg-config library define. ++# For static single-threaded library declare -pthread in Libs.private ++# For static multi-threaded library declare -pthread in Libs and Cflags ++.PHONY: libzstd.pc + libzstd.pc: libzstd.pc.in + @echo creating pkgconfig + @sed \ +@@ -316,7 +333,8 @@ libzstd.pc: libzstd.pc.in + -e 's|@INCLUDEDIR@|$(PCINCPREFIX)$(PCINCDIR)|' \ + -e 's|@LIBDIR@|$(PCLIBPREFIX)$(PCLIBDIR)|' \ + -e 's|@VERSION@|$(VERSION)|' \ +- -e 's|@LIBS_PRIVATE@|$(LDFLAGS_DYNLIB)|' \ ++ -e 's|@LIBS_MT@|$(PCMTLIB)|' \ ++ -e 's|@LIBS_PRIVATE@|$(PCLIB)|' \ + $< >$@ + + .PHONY: install +--- a/lib/README.md ++++ b/lib/README.md +@@ -27,12 +27,16 @@ Enabling multithreading requires 2 condi + + For convenience, we provide a build target to generate multi and single threaded libraries: + - Force enable multithreading on both dynamic and static libraries by appending `-mt` to the target, e.g. `make lib-mt`. ++ Note that the `.pc` generated on calling `make lib-mt` will already include the require Libs and Cflags. + - Force disable multithreading on both dynamic and static libraries by appending `-nomt` to the target, e.g. `make lib-nomt`. + - By default, as mentioned before, dynamic library is multithreaded, and static library is single-threaded, e.g. `make lib`. + + When linking a POSIX program with a multithreaded version of `libzstd`, + note that it's necessary to invoke the `-pthread` flag during link stage. + ++The `.pc` generated from `make install` or `make install-pc` always assume a single-threaded static library ++is compiled. To correctly generate a `.pc` for the multi-threaded static library, set `MT=1` as ENV variable. ++ + Multithreading capabilities are exposed + via the [advanced API defined in `lib/zstd.h`](https://github.com/facebook/zstd/blob/v1.4.3/lib/zstd.h#L351). + +--- a/lib/libzstd.pc.in ++++ b/lib/libzstd.pc.in +@@ -11,6 +11,6 @@ Name: zstd + Description: fast lossless compression algorithm library + URL: https://facebook.github.io/zstd/ + Version: @VERSION@ +-Libs: -L${libdir} -lzstd ++Libs: -L${libdir} -lzstd @LIBS_MT@ + Libs.private: @LIBS_PRIVATE@ +-Cflags: -I${includedir} ++Cflags: -I${includedir} @LIBS_MT@