Skip to content

Commit

Permalink
Merge pull request #10310 from lovehackintosh/bump-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
aiamadeus authored Oct 23, 2022
2 parents 779ed7d + e95c5bc commit 144c1fb
Show file tree
Hide file tree
Showing 67 changed files with 507 additions and 2,620 deletions.
5 changes: 2 additions & 3 deletions include/meson.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#
# Host packages are built in the same fashion, just use these vars instead:
#
# HOST_BUILD_DEPENDS:=meson/host
# MESON_HOST_ARGS+=-Dfoo -Dbar=baz
# MESON_HOST_VARS+=FOO=bar

Expand Down Expand Up @@ -57,7 +56,7 @@ MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif

define Meson
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1)
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
endef

define Meson/CreateNativeFile
Expand Down Expand Up @@ -101,7 +100,7 @@ define Host/Configure/Meson
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
$(MESON_HOST_ARGS) \
$(MESON_HOST_BUILD_DIR) \
$(HOST_BUILD_DIR), \
$(MESON_HOST_BUILD_DIR)/.., \
$(MESON_HOST_VARS))
endef

Expand Down
61 changes: 31 additions & 30 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,50 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
endif

tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
tools-y += e2fsprogs expat fakeroot findutils firmware-utils flex gengetopt
tools-y += libressl libtool lzma m4 make-ext4fs meson missing-macros mkimage
tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image
tools-y += mklibs mtd-utils mtools ninja padjffs2 patch-image
tools-y += patchelf pkgconf quilt squashfskit4 sstrip ucl upx zip zlib zstd
tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_ISL) += isl
tools-$(BUILD_TOOLCHAIN) += expat gmp mpc mpfr
tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs
tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
tools-$(CONFIG_TARGET_realtek) += 7z
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
tools-$(CONFIG_USES_MINOR) += kernel2minor
tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl
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_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_USE_SPARSE),y) += sparse
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf

# builddir dependencies
$(curdir)/autoconf/compile := $(curdir)/m4/compile
$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile
$(curdir)/automake/compile := $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile
$(curdir)/b43-tools/compile := $(curdir)/bison/compile
$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile
$(curdir)/upx/compile := $(curdir)/ucl/compile
$(curdir)/bison/compile := $(curdir)/flex/compile
$(curdir)/cbootimage/compile += $(curdir)/automake/compile
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile
$(curdir)/dosfstools/compile := $(curdir)/autoconf/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)/fakeroot/compile := $(curdir)/libtool/compile
$(curdir)/findutils/compile := $(curdir)/bison/compile
$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile $(curdir)/zlib/compile
$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile
$(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/genext2fs/compile := $(curdir)/libtool/compile
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
$(curdir)/meson/compile := $(curdir)/ninja/compile
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
$(curdir)/meson/compile := $(curdir)/ninja/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
$(curdir)/mkimage/compile += $(curdir)/bison/compile $(curdir)/libressl/compile
$(curdir)/mklibs/compile := $(curdir)/libtool/compile
$(curdir)/mm-macros/compile := $(curdir)/libtool/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
Expand All @@ -76,8 +76,7 @@ $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compil
$(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
$(curdir)/zlib/compile := $(curdir)/cmake/compile
$(curdir)/zstd/compile := $(curdir)/cmake/compile
$(curdir)/zstd/compile := $(curdir)/meson/compile

ifneq ($(HOST_OS),Linux)
$(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile
Expand All @@ -88,14 +87,14 @@ ifeq ($(HOST_OS),Darwin)
else
$(curdir)/dwarves/compile += $(curdir)/elfutils/compile
$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile
tools-$(CONFIG_DWARVES) += dwarves
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves
tools-y += elfutils
endif

ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
$(foreach tool, $(filter-out xz zstd pkgconf patch ninja meson libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
$(foreach tool, $(filter-out zstd zlib xz pkgconf patch ninja meson libressl expat cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
tools-y += ccache
$(curdir)/ccache/compile := $(curdir)/zstd/compile
$(curdir)/ccache/compile := $(curdir)/cmake/compile
endif

# in case there is no patch tool on the host we need to make patch tool a
Expand Down Expand Up @@ -136,6 +135,9 @@ define PrepareStaging
); done
endef

$(BIN_DIR):
mkdir -p $@

# preparatory work
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR))
Expand All @@ -156,16 +158,15 @@ endif

endif

$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $(BIN_DIR)
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $(BIN_DIR)

# prerequisites for the individual targets
$(curdir)/ := .config prereq

$(curdir)/install: $(curdir)/compile

tools_config = CONFIG_SDK_LLVM_BPF
tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))$(foreach c,$(tools_config),$(if $($(c)),y,n))
tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))
$(eval $(call stampfile,$(curdir),tools,compile,,_$(subst $(space),,$(tools_enabled)),$(STAGING_DIR_HOST)))
$(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build,,$(STAGING_DIR_HOST)))
$(eval $(call subdir,$(curdir)))
5 changes: 2 additions & 3 deletions tools/automake/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ define Host/Install
ln -sf aclocal $(STAGING_DIR_HOST)/bin/aclocal-1.15
endef

define Host/Clean
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
8 changes: 6 additions & 2 deletions tools/bash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=bash
PKG_CPE_ID:=cpe:/a:gnu:bash
PKG_VERSION:=5.1.16
PKG_VERSION:=5.2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/bash
PKG_HASH:=5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558
PKG_HASH:=a139c166df7ff4471c5e0733051642ee5556c1cc8a4a78f145583c5c81ab32fb

HOST_BUILD_PARALLEL := 1

include $(INCLUDE_DIR)/host-build.mk

define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
8 changes: 6 additions & 2 deletions tools/bc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=bc
PKG_VERSION:=1.07
PKG_VERSION:=1.07.1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/bc
PKG_HASH:=55cf1fc33a728d7c3d386cc7b0cb556eb5bacf8e0cb5a3fcca7f109fc61205ad
PKG_HASH:=62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a

PKG_FIXUP := autoreconf
PKG_CPE_ID:=cpe:/a:gnu:bc

include $(INCLUDE_DIR)/host-build.mk

define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
2 changes: 1 addition & 1 deletion tools/bc/patches/002-fix-libmath.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-w
-q
-EOS-EOS
+#! /bin/bash
+#!/usr/bin/env bash
+sed -e '1 s/^/{"/' \
+ -e 's/$/",/' \
+ -e '2,$ s/^/"/' \
Expand Down
11 changes: 0 additions & 11 deletions tools/bc/patches/003-bc-fix-hang.patch

This file was deleted.

10 changes: 5 additions & 5 deletions tools/bison/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ include $(INCLUDE_DIR)/host-build.mk

HOST_CONFIGURE_ARGS += --enable-threads=posix --disable-nls

define Host/Clean
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
endef

define Host/Install
$(call Host/Install/Default)
$(INSTALL_BIN) ./scripts/yacc $(STAGING_DIR_HOST)/bin/yacc
endef

define Host/Uninstall
rm -f $(STAGING_DIR_HOST)/bin/yacc
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
6 changes: 6 additions & 0 deletions tools/cmake/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ HOST_CONFIGURE_VARS += \
HOST_CONFIGURE_ARGS := \
$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
--prefix="$(STAGING_DIR_HOST)" \
--system-expat \
--system-liblzma \
--system-zlib \
--system-zstd \
--generator=Ninja

HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib

define Host/Compile/Default
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
endef
Expand Down
17 changes: 17 additions & 0 deletions tools/cmake/patches/110-liblzma.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- 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")
#]=======================================================================]

-find_path(LIBLZMA_INCLUDE_DIR lzma.h )
+if(UNIX)
+ find_package(PkgConfig QUIET)
+ pkg_search_module(PC_liblzma liblzma)
+endif()
+
+find_path(LIBLZMA_INCLUDE_DIR lzma.h HINTS ${PC_liblzma_INCLUDEDIR} ${PC_liblzma_INCLUDE_DIRS})
+find_library(LIBLZMA_LIBRARY NAMES lzma HINTS ${PC_liblzma_LIBDIR} ${PC_liblzma_LIBRARY_DIRS})
if(NOT LIBLZMA_LIBRARY)
find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
2 changes: 1 addition & 1 deletion tools/cmake/patches/120-curl-fix-libressl-linking.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
---
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -565,6 +565,14 @@ if(CMAKE_USE_OPENSSL)
@@ -594,6 +594,14 @@ if(CURL_USE_OPENSSL)
endif()
set(SSL_ENABLED ON)
set(USE_OPENSSL ON)
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/patches/130-bootstrap_parallel_make_flag.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/bootstrap
+++ b/bootstrap
@@ -1423,7 +1423,10 @@ int main(){ printf("1%c", (char)0x0a); r
@@ -1441,7 +1441,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
Expand Down
20 changes: 20 additions & 0 deletions tools/cmake/patches/140-zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -85,10 +85,13 @@ else()
set(ZLIB_NAMES_DEBUG zd zlibd zdlld zlibd1 zlib1d zlibstaticd zlibwapid zlibvcd zlibstatd)
endif()

-# Try each search configuration.
-foreach(search ${_ZLIB_SEARCHES})
- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
-endforeach()
+if(UNIX)
+ find_package(PkgConfig QUIET)
+ pkg_search_module(PC_zlib zlib)
+endif()
+
+find_path(ZLIB_INCLUDE_DIR zlib.h HINTS ${PC_zlib_INCLUDEDIR} ${PC_zlib_INCLUDE_DIRS})
+find_library(ZLIB_LIBRARY NAMES z HINTS ${PC_zlib_LIBDIR} ${PC_zlib_LIBRARY_DIRS})

# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
if(NOT ZLIB_LIBRARY)
18 changes: 18 additions & 0 deletions tools/cmake/patches/150-zstd-libarchive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -630,8 +630,13 @@ 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)
5 changes: 5 additions & 0 deletions tools/coreutils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ define Host/Install
ln -sf ginstall $(1)/bin/install
endef

define Host/Uninstall
rm -f $(STAGING_DIR_HOST)/bin/install
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
4 changes: 4 additions & 0 deletions tools/cpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ PKG_HASH:=eab5bdc5ae1df285c59f2a4f140a98fc33678a0bf61bdba67d9436ae26b46f6d

include $(INCLUDE_DIR)/host-build.mk

define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
2 changes: 0 additions & 2 deletions tools/cpio/patches/001-duplicate-program-name.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=641d3f489cf6238bb916368d4b

* src/global.c: Remove superfluous declaration of program_name

diff --git a/src/global.c b/src/global.c
index fb3abe9..acf92bc 100644
--- a/src/global.c
+++ b/src/global.c
@@ -184,9 +184,6 @@ unsigned int warn_option = 0;
Expand Down
11 changes: 11 additions & 0 deletions tools/cpio/patches/010-clang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/gnu/xalloc-oversized.h
+++ b/gnu/xalloc-oversized.h
@@ -52,7 +52,7 @@ typedef size_t __xalloc_count_type;
#elif ((5 <= __GNUC__ \
|| (__has_builtin (__builtin_mul_overflow) \
&& __has_builtin (__builtin_constant_p))) \
- && !__STRICT_ANSI__)
+ && !__STRICT_ANSI__) && !defined(__clang__)
# define xalloc_oversized(n, s) \
(__builtin_constant_p (n) && __builtin_constant_p (s) \
? __xalloc_oversized (n, s) \
4 changes: 4 additions & 0 deletions tools/dosfstools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ ifeq ($(HOST_OS),Darwin)
HOST_CFLAGS += -UHAVE_ENDIAN_H
endif

define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef

$(eval $(call HostBuild))
Loading

0 comments on commit 144c1fb

Please sign in to comment.