Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
31
tools/7z/Makefile
Normal file
31
tools/7z/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=7z
|
||||
PKG_VERSION:=24.05
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)$(subst .,,$(PKG_VERSION))-src.tar.xz
|
||||
PKG_SOURCE_URL:=https://7-zip.org/a/
|
||||
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_MAKE_PATH:=CPP/7zip/Bundles/Alone7z
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
TAR_OPTIONS := -C $(HOST_BUILD_DIR) $(TAR_OPTIONS)
|
||||
HOST_MAKE_FLAGS += -f makefile.gcc
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/$(HOST_MAKE_PATH)/_o/7zr $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/7zr
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
20
tools/7z/patches/7-zip-flags.patch
Normal file
20
tools/7z/patches/7-zip-flags.patch
Normal file
@@ -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
|
||||
|
||||
36
tools/7z/patches/7-zip-musl.patch
Normal file
36
tools/7z/patches/7-zip-musl.patch
Normal file
@@ -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 <pthread.h>
|
||||
+#include <sched.h>
|
||||
|
||||
#endif
|
||||
|
||||
229
tools/Makefile
Normal file
229
tools/Makefile
Normal file
@@ -0,0 +1,229 @@
|
||||
#
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# Main makefile for the host tools
|
||||
#
|
||||
curdir:=tools
|
||||
|
||||
# subdirectories to descend into
|
||||
tools-y :=
|
||||
|
||||
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
|
||||
BUILD_TOOLCHAIN := y
|
||||
ifdef CONFIG_GCC_USE_GRAPHITE
|
||||
BUILD_ISL = y
|
||||
endif
|
||||
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
|
||||
ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
|
||||
BUILD_LZO_TOOLS = y
|
||||
endif
|
||||
|
||||
tools-y += autoconf
|
||||
tools-y += autoconf-archive
|
||||
tools-y += automake
|
||||
tools-y += bc
|
||||
tools-y += bison
|
||||
tools-y += cmake
|
||||
tools-y += cpio
|
||||
tools-y += dosfstools
|
||||
tools-y += e2fsprogs
|
||||
tools-y += elfutils
|
||||
tools-y += expat
|
||||
tools-y += fakeroot
|
||||
tools-y += findutils
|
||||
tools-y += firmware-utils
|
||||
tools-y += flex
|
||||
tools-y += gengetopt
|
||||
tools-y += gnulib
|
||||
tools-y += libressl
|
||||
tools-y += libtool
|
||||
tools-y += lzma
|
||||
tools-y += m4
|
||||
tools-y += make-ext4fs
|
||||
tools-y += meson
|
||||
tools-y += missing-macros
|
||||
tools-y += mkimage
|
||||
tools-y += mklibs
|
||||
tools-y += mtd-utils
|
||||
tools-y += mtools
|
||||
tools-y += ninja
|
||||
tools-y += padjffs2
|
||||
tools-y += patch-image
|
||||
tools-y += patchelf
|
||||
tools-y += pkgconf
|
||||
tools-y += quilt
|
||||
tools-y += squashfs4
|
||||
tools-y += sstrip
|
||||
tools-y += util-linux
|
||||
tools-y += xz
|
||||
tools-y += zip
|
||||
tools-y += zlib
|
||||
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 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) += 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
|
||||
$(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)/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)/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
|
||||
$(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)/liblzo/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/libressl/compile := $(curdir)/pkgconf/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
|
||||
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
|
||||
$(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)/zlib/compile $(curdir)/util-linux/compile
|
||||
$(curdir)/padjffs2/compile := $(curdir)/findutils/compile
|
||||
$(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)/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)/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
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
|
||||
$(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)/cmake/compile
|
||||
endif
|
||||
|
||||
# in case there is no patch tool on the host we need to make patch tool a
|
||||
# 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 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 += zstd
|
||||
|
||||
$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/compile,$(tools-core))))
|
||||
tools-y += $(tools-core)
|
||||
|
||||
# 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)/zstd/compile
|
||||
tools-y += flock sed
|
||||
|
||||
$(curdir)/autoremove := 1
|
||||
$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
|
||||
$(curdir)/builddirs-default := $(tools-y)
|
||||
|
||||
ifdef CHECK_ALL
|
||||
$(curdir)/builddirs-check:=$($(curdir)/builddirs)
|
||||
$(curdir)/builddirs-download:=$($(curdir)/builddirs)
|
||||
endif
|
||||
|
||||
ifndef DUMP_TARGET_DB
|
||||
define PrepareStaging
|
||||
@for dir in $(1); do ( \
|
||||
$(if $(QUIET),,set -x;) \
|
||||
mkdir -p "$$dir"; \
|
||||
cd "$$dir"; \
|
||||
mkdir -p bin lib stamp usr/include usr/lib; \
|
||||
); done
|
||||
endef
|
||||
|
||||
$(BIN_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
# preparatory work
|
||||
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
|
||||
$(call PrepareStaging,$(STAGING_DIR))
|
||||
mkdir -p $(BUILD_DIR)/stamp
|
||||
touch $@
|
||||
|
||||
$(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
|
||||
$(call PrepareStaging,$(STAGING_DIR_HOST))
|
||||
mkdir -p $(BUILD_DIR_HOST)/stamp $(STAGING_DIR_HOST)/include/sys
|
||||
$(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
|
||||
$(INSTALL_DATA) $(TOPDIR)/tools/include/sys/*.h $(STAGING_DIR_HOST)/include/sys/
|
||||
ifneq ($(HOST_OS),Linux)
|
||||
mkdir -p $(STAGING_DIR_HOST)/include/asm
|
||||
$(INSTALL_DATA) $(TOPDIR)/tools/include/asm/*.h $(STAGING_DIR_HOST)/include/asm/
|
||||
endif
|
||||
ln -snf lib $(STAGING_DIR_HOST)/lib64
|
||||
touch $@
|
||||
|
||||
endif
|
||||
|
||||
$(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_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)))
|
||||
16
tools/autoconf-archive/Makefile
Normal file
16
tools/autoconf-archive/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autoconf-archive
|
||||
PKG_VERSION:=2023.02.20
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@GNU/autoconf-archive
|
||||
PKG_HASH:=71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
31
tools/autoconf/Makefile
Normal file
31
tools/autoconf/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autoconf
|
||||
PKG_VERSION:=2.71
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/autoconf
|
||||
PKG_HASH:=431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_VARS += \
|
||||
EMACS="no" \
|
||||
PERL="/usr/bin/env perl"
|
||||
|
||||
define Host/Compile
|
||||
-$(call Host/Compile/Default,--touch install-man1) # disable building of man pages
|
||||
$(call Host/Compile/Default)
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
195
tools/autoconf/patches/000-relocatable.patch
Normal file
195
tools/autoconf/patches/000-relocatable.patch
Normal file
@@ -0,0 +1,195 @@
|
||||
--- a/bin/autoheader.in
|
||||
+++ b/bin/autoheader.in
|
||||
@@ -30,9 +30,12 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($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
|
||||
@@ -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@');
|
||||
my $config_h_in;
|
||||
my @prepend_include;
|
||||
my @include;
|
||||
--- a/bin/autom4te.in
|
||||
+++ b/bin/autom4te.in
|
||||
@@ -26,9 +26,12 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($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
|
||||
@@ -48,7 +51,8 @@ use Autom4te::General;
|
||||
use Autom4te::XFile;
|
||||
|
||||
# Data directory.
|
||||
-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
|
||||
+my $pkgdatadir = $ENV{'AC_MACRODIR'} ||
|
||||
+ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@');
|
||||
|
||||
# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
|
||||
my %language;
|
||||
@@ -91,7 +95,7 @@ my @include;
|
||||
my $freeze = 0;
|
||||
|
||||
# $M4.
|
||||
-my $m4 = $ENV{"M4"} || '@M4@';
|
||||
+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/m4' : '@M4@');
|
||||
# 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 </dev/null 2>&1 | grep reload-state >/dev/null";
|
||||
@@ -272,6 +276,12 @@ sub load_configuration ($)
|
||||
|
||||
my @words = shellwords ($_);
|
||||
my $type = shift @words;
|
||||
+
|
||||
+ if ($ENV{'STAGING_DIR_HOST'})
|
||||
+ {
|
||||
+ @words = map { s!^@pkgdatadir@!$ENV{'STAGING_DIR_HOST'}/share/autoconf!; $_ } @words;
|
||||
+ }
|
||||
+
|
||||
if ($type eq 'begin-language:')
|
||||
{
|
||||
fatal "$file:$.: end-language missing for: $lang"
|
||||
--- a/bin/autoreconf.in
|
||||
+++ b/bin/autoreconf.in
|
||||
@@ -29,10 +29,13 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
my $buildauxdir;
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@');
|
||||
unshift @INC, $pkgdatadir;
|
||||
|
||||
$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';
|
||||
--- a/bin/autoscan.in
|
||||
+++ b/bin/autoscan.in
|
||||
@@ -28,9 +28,12 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($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
|
||||
@@ -95,10 +98,10 @@ my %needed_macros =
|
||||
my $log;
|
||||
|
||||
# Autoconf and 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@');
|
||||
my $autoconf = "$autom4te --language=autoconf";
|
||||
my @prepend_include;
|
||||
-my @include = ('@pkgdatadir@');
|
||||
+my @include = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@');
|
||||
|
||||
# $help
|
||||
# -----
|
||||
--- a/bin/autoupdate.in
|
||||
+++ b/bin/autoupdate.in
|
||||
@@ -29,9 +29,12 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($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
|
||||
@@ -55,10 +58,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin
|
||||
my $autoconf = "$autom4te --language=autoconf";
|
||||
# We need to find m4sugar.
|
||||
my @prepend_include;
|
||||
-my @include = ('@pkgdatadir@');
|
||||
+my @include = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@');
|
||||
my $force = 0;
|
||||
# m4.
|
||||
-my $m4 = $ENV{"M4"} || '@M4@';
|
||||
+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/m4' : '@M4@');
|
||||
|
||||
|
||||
# $HELP
|
||||
--- a/bin/ifnames.in
|
||||
+++ b/bin/ifnames.in
|
||||
@@ -33,9 +33,12 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
|
||||
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
|
||||
+ ($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
|
||||
--- a/bin/autoconf.as
|
||||
+++ b/bin/autoconf.as
|
||||
@@ -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=
|
||||
verbose=false
|
||||
53
tools/automake/Makefile
Normal file
53
tools/automake/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=automake
|
||||
PKG_CPE_ID:=cpe:/a:gnu:automake
|
||||
PKG_VERSION:=1.16.5
|
||||
PKG_API_VERSION:=$(word 2,$(subst ., ,$(PKG_VERSION)))
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/automake
|
||||
PKG_HASH:=07bd24ad08a64bc17250ce09ec56e921d6343903943e99ccf63bbf0705e34605
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--disable-silent-rules
|
||||
|
||||
HOST_CONFIGURE_VARS += \
|
||||
PERL="/usr/bin/env perl" \
|
||||
am_cv_prog_PERL_ithreads=no
|
||||
|
||||
define Host/Configure
|
||||
(cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR_HOST="" ./bootstrap)
|
||||
$(call Host/Configure/Default)
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
# remove old automake resources to avoid version conflicts
|
||||
$(call Host/Uninstall)
|
||||
$(call Host/Compile/Default,install)
|
||||
mv $(STAGING_DIR_HOST)/bin/aclocal $(STAGING_DIR_HOST)/bin/aclocal.real
|
||||
$(INSTALL_BIN) ./files/aclocal $(STAGING_DIR_HOST)/bin
|
||||
( \
|
||||
api=$(PKG_API_VERSION); \
|
||||
while [ "$$$$api" -ge 11 ]; do \
|
||||
ln -sf aclocal "$(STAGING_DIR_HOST)/bin/aclocal-1.$$$$api"; \
|
||||
api=$$$$(($$$$api - 1)); \
|
||||
done; \
|
||||
)
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
rm -rf $(STAGING_DIR_HOST)/share/aclocal-[0-9]*
|
||||
rm -rf $(STAGING_DIR_HOST)/share/automake-[0-9]*
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
2
tools/automake/files/aclocal
Executable file
2
tools/automake/files/aclocal
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
${STAGING_DIR_HOST}/bin/aclocal.real $ACLOCAL_INCLUDE $@
|
||||
52
tools/automake/patches/000-relocatable.patch
Normal file
52
tools/automake/patches/000-relocatable.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
--- a/lib/Automake/Config.in
|
||||
+++ b/lib/Automake/Config.in
|
||||
@@ -34,7 +34,7 @@ our $PACKAGE = '@PACKAGE@';
|
||||
our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@';
|
||||
our $VERSION = '@VERSION@';
|
||||
our $RELEASE_YEAR = '@RELEASE_YEAR@';
|
||||
-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@';
|
||||
+our $libdir = $ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@';
|
||||
|
||||
our $perl_threads = 0;
|
||||
# We need at least this version for CLONE support.
|
||||
--- a/bin/aclocal.in
|
||||
+++ b/bin/aclocal.in
|
||||
@@ -23,9 +23,11 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@')
|
||||
+ unshift (@INC, ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'))
|
||||
unless $ENV{AUTOMAKE_UNINSTALLED};
|
||||
}
|
||||
|
||||
@@ -65,8 +67,8 @@ $perl_threads = 0;
|
||||
# ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
|
||||
# option.
|
||||
my @user_includes = ();
|
||||
-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION);
|
||||
-my @system_includes = ('@datadir@/aclocal');
|
||||
+my @automake_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . "/share/aclocal-$APIVERSION" : "@datadir@/aclocal-$APIVERSION");
|
||||
+my @system_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/aclocal' : '@datadir@/aclocal');
|
||||
|
||||
# Whether we should copy M4 file in $user_includes[0].
|
||||
my $install = 0;
|
||||
--- a/bin/automake.in
|
||||
+++ b/bin/automake.in
|
||||
@@ -26,9 +26,11 @@ use 5.006;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
+$^W = 1;
|
||||
+
|
||||
BEGIN
|
||||
{
|
||||
- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@')
|
||||
+ unshift (@INC, ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'))
|
||||
unless $ENV{AUTOMAKE_UNINSTALLED};
|
||||
|
||||
# Override SHELL. This is required on DJGPP so that system() uses
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/bin/aclocal.in
|
||||
+++ b/bin/aclocal.in
|
||||
@@ -371,6 +371,12 @@ sub scan_m4_dirs ($$@)
|
||||
|
||||
foreach my $m4dir (@dirlist)
|
||||
{
|
||||
+ if (! -d $m4dir)
|
||||
+ {
|
||||
+ msg ('override', "warning: skipping not existing directory `$m4dir'");
|
||||
+ next;
|
||||
+ }
|
||||
+
|
||||
if (! opendir (DIR, $m4dir))
|
||||
{
|
||||
# TODO: maybe avoid complaining only if errno == ENONENT?
|
||||
29
tools/automake/patches/101-do-not-require-files.patch
Normal file
29
tools/automake/patches/101-do-not-require-files.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
--- a/bin/automake.in
|
||||
+++ b/bin/automake.in
|
||||
@@ -4513,7 +4513,7 @@ sub handle_gettext ()
|
||||
&& grep ($_ eq 'intl', @subdirs));
|
||||
}
|
||||
|
||||
- require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
|
||||
+ require_file ($ac_gettext_location, GNITS, 'ABOUT-NLS');
|
||||
}
|
||||
|
||||
# Emit makefile footer.
|
||||
@@ -5641,7 +5641,7 @@ sub check_gnu_standards ()
|
||||
# otherwise require non-.md.
|
||||
my $required
|
||||
= (! -f $file && -f "$file.md") ? "$file.md" : $file;
|
||||
- require_file ("$am_file.am", GNU, $required);
|
||||
+ require_file ("$am_file.am", GNITS, $required);
|
||||
}
|
||||
|
||||
# Accept one of these three licenses; default to COPYING.
|
||||
@@ -5655,7 +5655,7 @@ sub check_gnu_standards ()
|
||||
last;
|
||||
}
|
||||
}
|
||||
- require_file ("$am_file.am", GNU, 'COPYING')
|
||||
+ require_file ("$am_file.am", GNITS, 'COPYING')
|
||||
unless $license;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From: Bogdan Drozdowski <bogdandr AT op.pl>
|
||||
Date: Sat, 31 Dec 2022 20:17:35 +0100
|
||||
Subject: [PATCH] Allow other V values for verbosity
|
||||
|
||||
---
|
||||
m4/silent.m4 | 2 +-
|
||||
t/silent-gen.sh | 24 ++++++++++++++++++++++++
|
||||
2 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/m4/silent.m4
|
||||
+++ b/m4/silent.m4
|
||||
@@ -43,7 +43,7 @@ else
|
||||
fi])
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
- AM_V='$(V)'
|
||||
+ AM_V='$(shell if ( test "x$(V)" = "x0" ); then echo 0; elif ( test "x$(V)" = "x" ); then echo $(AM_DEFAULT_VERBOSITY); else echo 1; fi)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
--- a/t/silent-gen.sh
|
||||
+++ b/t/silent-gen.sh
|
||||
@@ -54,6 +54,18 @@ grep 'cp ' stdout
|
||||
grep 'echo ' stdout
|
||||
|
||||
$MAKE clean
|
||||
+run_make -O V=99
|
||||
+grep 'GEN ' stdout && exit 1
|
||||
+grep 'cp ' stdout
|
||||
+grep 'echo ' stdout
|
||||
+
|
||||
+$MAKE clean
|
||||
+run_make -O V=vvv
|
||||
+grep 'GEN ' stdout && exit 1
|
||||
+grep 'cp ' stdout
|
||||
+grep 'echo ' stdout
|
||||
+
|
||||
+$MAKE clean
|
||||
run_make -O V=0
|
||||
grep 'GEN .*foo' stdout
|
||||
grep 'cp ' stdout && exit 1
|
||||
@@ -78,5 +90,17 @@ run_make -O V=1
|
||||
grep 'GEN ' stdout && exit 1
|
||||
grep 'cp ' stdout
|
||||
grep 'echo ' stdout
|
||||
+
|
||||
+$MAKE clean
|
||||
+run_make -O V=99
|
||||
+grep 'GEN ' stdout && exit 1
|
||||
+grep 'cp ' stdout
|
||||
+grep 'echo ' stdout
|
||||
+
|
||||
+$MAKE clean
|
||||
+run_make -O V=v
|
||||
+grep 'GEN ' stdout && exit 1
|
||||
+grep 'cp ' stdout
|
||||
+grep 'echo ' stdout
|
||||
|
||||
:
|
||||
47
tools/b43-tools/Makefile
Normal file
47
tools/b43-tools/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Copyright (C) 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:=b43-tools
|
||||
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:=4009d6c1f9ede43102897d6ebf4bd954331f3c4e2a94d4e61c0e5f303f929914
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Compile
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/fwcutter \
|
||||
CFLAGS="$(HOST_CFLAGS) -include endian.h" \
|
||||
$(HOST_MAKE_FLAGS) \
|
||||
$(1) QUIET_SPARSE=:
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/assembler \
|
||||
CFLAGS="$(HOST_CFLAGS) -include endian.h -Wno-error=int-conversion" \
|
||||
$(HOST_MAKE_FLAGS) \
|
||||
LDFLAGS= \
|
||||
$(1) QUIET_SPARSE=:
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/fwcutter/b43-fwcutter $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/assembler/b43-asm $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/assembler/b43-asm.bin $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) ./files/b43-fwsquash.py $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-fwcutter
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-asm
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-asm.bin
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-fwsquash.py
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
149
tools/b43-tools/files/b43-fwsquash.py
Executable file
149
tools/b43-tools/files/b43-fwsquash.py
Executable file
@@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# b43 firmware file squasher
|
||||
# Removes unnecessary firmware files
|
||||
#
|
||||
# Copyright (c) 2009 Michael Buesch <mb@bu3sch.de>
|
||||
#
|
||||
# Licensed under the GNU/GPL version 2 or (at your option) any later version.
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
def usage():
|
||||
print("Usage: %s PHYTYPES COREREVS /path/to/extracted/firmware" % sys.argv[0])
|
||||
print("")
|
||||
print("PHYTYPES is a comma separated list of:")
|
||||
print("A => A-PHY")
|
||||
print("AG => Dual A-PHY G-PHY")
|
||||
print("G => G-PHY")
|
||||
print("LP => LP-PHY")
|
||||
print("N => N-PHY")
|
||||
print("HT => HT-PHY")
|
||||
print("LCN => LCN-PHY")
|
||||
print("LCN40 => LCN40-PHY")
|
||||
print("AC => AC-PHY")
|
||||
print("")
|
||||
print("COREREVS is a comma separated list of core revision numbers.")
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
phytypes = sys.argv[1]
|
||||
corerevs = sys.argv[2]
|
||||
fwpath = sys.argv[3]
|
||||
|
||||
phytypes = phytypes.split(',')
|
||||
try:
|
||||
corerevs = [int(r) for r in corerevs.split(',')]
|
||||
except ValueError:
|
||||
print("ERROR: \"%s\" is not a valid COREREVS string\n" % corerevs)
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
fwfiles = os.listdir(fwpath)
|
||||
fwfiles = [str for str in fwfiles if str.endswith(".fw")]
|
||||
if not fwfiles:
|
||||
print("ERROR: No firmware files found in %s" % fwpath)
|
||||
sys.exit(1)
|
||||
|
||||
required_fwfiles = []
|
||||
|
||||
def revs_match(revs_a, revs_b):
|
||||
for rev in revs_a:
|
||||
if rev in revs_b:
|
||||
return True
|
||||
return False
|
||||
|
||||
def phytypes_match(types_a, types_b):
|
||||
for type in types_a:
|
||||
type = type.strip().upper()
|
||||
if type in types_b:
|
||||
return True
|
||||
return False
|
||||
|
||||
revmapping = {
|
||||
"ucode2.fw" : ( (2,3,), ("G",), ),
|
||||
"ucode4.fw" : ( (4,), ("G",), ),
|
||||
"ucode5.fw" : ( (5,6,7,8,9,10,), ("G","A","AG",), ),
|
||||
"ucode11.fw" : ( (11,12,), ("N",), ),
|
||||
"ucode13.fw" : ( (13,), ("LP","G",), ),
|
||||
"ucode14.fw" : ( (14,), ("LP",), ),
|
||||
"ucode15.fw" : ( (15,), ("LP",), ),
|
||||
"ucode16_mimo.fw" : ( (16,17,18,19,23,), ("N",), ),
|
||||
# "ucode16_lp.fw" : ( (16,17,18,19,), ("LP",), ),
|
||||
"ucode24_lcn.fw" : ( (24,), ("LCN",), ),
|
||||
"ucode25_mimo.fw" : ( (25,28,), ("N",), ),
|
||||
"ucode25_lcn.fw" : ( (25,28,), ("LCN",), ),
|
||||
"ucode26_mimo.fw" : ( (26,), ("HT",), ),
|
||||
"ucode29_mimo.fw" : ( (29,), ("HT",), ),
|
||||
"ucode30_mimo.fw" : ( (30,), ("N",), ),
|
||||
"ucode33_lcn40.fw" : ( (33,), ("LCN40",), ),
|
||||
"ucode40.fw" : ( (40,), ("AC",), ),
|
||||
"ucode42.fw" : ( (42,), ("AC",), ),
|
||||
"pcm4.fw" : ( (1,2,3,4,), ("G",), ),
|
||||
"pcm5.fw" : ( (5,6,7,8,9,10,), ("G","A","AG",), ),
|
||||
}
|
||||
|
||||
initvalmapping = {
|
||||
"a0g1initvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
|
||||
"a0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG",), ),
|
||||
"b0g0initvals2.fw" : ( (2,4,), ("G",), ),
|
||||
"b0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
|
||||
"b0g0initvals13.fw" : ( (13,), ("G",), ),
|
||||
"n0initvals11.fw" : ( (11,12,), ("N",), ),
|
||||
"n0initvals16.fw" : ( (16,17,18,23,), ("N",), ),
|
||||
"n0initvals24.fw" : ( (24,), ("N",), ),
|
||||
"n0initvals25.fw" : ( (25,28,), ("N",), ),
|
||||
"n16initvals30.fw" : ( (30,), ("N",), ),
|
||||
"lp0initvals13.fw" : ( (13,), ("LP",), ),
|
||||
"lp0initvals14.fw" : ( (14,), ("LP",), ),
|
||||
"lp0initvals15.fw" : ( (15,), ("LP",), ),
|
||||
# "lp0initvals16.fw" : ( (16,17,18,), ("LP",), ),
|
||||
"lcn0initvals24.fw" : ( (24,), ("LCN",), ),
|
||||
"ht0initvals26.fw" : ( (26,), ("HT",), ),
|
||||
"ht0initvals29.fw" : ( (29,), ("HT",), ),
|
||||
"lcn400initvals33.fw" : ( (33,), ("LCN40",), ),
|
||||
"ac0initvals40.fw" : ( (40,), ("AC",), ),
|
||||
"ac1initvals42.fw" : ( (42,), ("AC",), ),
|
||||
"a0g1bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
|
||||
"a0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG"), ),
|
||||
"b0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
|
||||
"n0bsinitvals11.fw" : ( (11,12,), ("N",), ),
|
||||
"n0bsinitvals16.fw" : ( (16,17,18,23,), ("N",), ),
|
||||
"n0bsinitvals24.fw" : ( (24,), ("N",), ),
|
||||
"n0bsinitvals25.fw" : ( (25,28,), ("N",), ),
|
||||
"n16bsinitvals30.fw" : ( (30,), ("N",), ),
|
||||
"lp0bsinitvals13.fw" : ( (13,), ("LP",), ),
|
||||
"lp0bsinitvals14.fw" : ( (14,), ("LP",), ),
|
||||
"lp0bsinitvals15.fw" : ( (15,), ("LP",), ),
|
||||
# "lp0bsinitvals16.fw" : ( (16,17,18,), ("LP",), ),
|
||||
"lcn0bsinitvals24.fw" : ( (24,), ("LCN",), ),
|
||||
"ht0bsinitvals26.fw" : ( (26,), ("HT",), ),
|
||||
"ht0bsinitvals29.fw" : ( (29,), ("HT",), ),
|
||||
"lcn400bsinitvals33.fw" : ( (33,), ("LCN40",), ),
|
||||
"ac0bsinitvals40.fw" : ( (40,), ("AC",), ),
|
||||
"ac1bsinitvals42.fw" : ( (42,), ("AC",), ),
|
||||
}
|
||||
|
||||
for f in fwfiles:
|
||||
if f in revmapping:
|
||||
if revs_match(corerevs, revmapping[f][0]) and\
|
||||
phytypes_match(phytypes, revmapping[f][1]):
|
||||
required_fwfiles += [f]
|
||||
continue
|
||||
if f in initvalmapping:
|
||||
if revs_match(corerevs, initvalmapping[f][0]) and\
|
||||
phytypes_match(phytypes, initvalmapping[f][1]):
|
||||
required_fwfiles += [f]
|
||||
continue
|
||||
print("WARNING: Firmware file %s not found in the mapping lists" % f)
|
||||
|
||||
for f in fwfiles:
|
||||
if f not in required_fwfiles:
|
||||
print("Deleting %s" % f)
|
||||
os.unlink(fwpath + '/' + f)
|
||||
|
||||
16
tools/b43-tools/patches/001-fw-dirname.patch
Normal file
16
tools/b43-tools/patches/001-fw-dirname.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
--- a/fwcutter/fwcutter.c
|
||||
+++ b/fwcutter/fwcutter.c
|
||||
@@ -50,13 +50,8 @@
|
||||
#include "fwcutter.h"
|
||||
#include "fwcutter_list.h"
|
||||
|
||||
-#if defined(__DragonFly__) || defined(__FreeBSD__)
|
||||
-#define V3_FW_DIRNAME "v3"
|
||||
-#define V4_FW_DIRNAME "v4"
|
||||
-#else
|
||||
#define V3_FW_DIRNAME "b43legacy"
|
||||
#define V4_FW_DIRNAME "b43"
|
||||
-#endif
|
||||
|
||||
static struct cmdline_args cmdargs;
|
||||
|
||||
14
tools/b43-tools/patches/002-no_libfl.patch
Normal file
14
tools/b43-tools/patches/002-no_libfl.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/assembler/main.c
|
||||
+++ b/assembler/main.c
|
||||
@@ -1268,6 +1268,11 @@ static void initialize(void)
|
||||
#endif /* YYDEBUG */
|
||||
}
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err, res = 1;
|
||||
25
tools/bash/Makefile
Normal file
25
tools/bash/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bash
|
||||
PKG_CPE_ID:=cpe:/a:gnu:bash
|
||||
PKG_VERSION:=5.2.21
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/bash
|
||||
PKG_HASH:=c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8
|
||||
|
||||
HOST_BUILD_PARALLEL := 1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
25
tools/bc/Makefile
Normal file
25
tools/bc/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (C) 2013-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:=bc
|
||||
PKG_VERSION:=1.07.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/bc
|
||||
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))
|
||||
21
tools/bc/patches/001-no_doc.patch
Normal file
21
tools/bc/patches/001-no_doc.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
-SUBDIRS = lib bc dc doc
|
||||
+SUBDIRS = lib bc dc
|
||||
|
||||
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
|
||||
stamp-h $(distdir).tar.gz h/number.h depcomp missing \
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -288,7 +288,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
-SUBDIRS = lib bc dc doc
|
||||
+SUBDIRS = lib bc dc
|
||||
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
|
||||
stamp-h $(distdir).tar.gz h/number.h depcomp missing \
|
||||
bc/libmath.h
|
||||
32
tools/bc/patches/002-fix-libmath.patch
Normal file
32
tools/bc/patches/002-fix-libmath.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
--- a/bc/fix-libmath_h
|
||||
+++ b/bc/fix-libmath_h
|
||||
@@ -1,9 +1,9 @@
|
||||
-ed libmath.h <<EOS-EOS
|
||||
-1,1s/^/{"/
|
||||
-1,\$s/\$/",/
|
||||
-2,\$s/^/"/
|
||||
-\$,\$d
|
||||
-\$,\$s/,\$/,0}/
|
||||
-w
|
||||
-q
|
||||
-EOS-EOS
|
||||
+#!/usr/bin/env bash
|
||||
+sed -e '1 s/^/{"/' \
|
||||
+ -e 's/$/",/' \
|
||||
+ -e '2,$ s/^/"/' \
|
||||
+ -e '$ d' \
|
||||
+ -i libmath.h
|
||||
+
|
||||
+sed -e '$ s/$/0}/' \
|
||||
+ -i libmath.h
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5288,7 +5288,7 @@ case $bcle-$bcrl-$LEX in
|
||||
?-?-flex)
|
||||
LEX="flex -I -8" ;;
|
||||
?-y-*)
|
||||
- as_fn_error $? "readline works only with flex." "$LINENO" 5 ;;
|
||||
+ : ;; # as_fn_error $? "readline works only with flex." "$LINENO" 5 ;;
|
||||
esac
|
||||
|
||||
case $LEX-`uname -s` in
|
||||
33
tools/bison/Makefile
Normal file
33
tools/bison/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright (C) 2008-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bison
|
||||
PKG_VERSION:=3.8.2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
|
||||
PKG_HASH:=06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb
|
||||
PKG_CPE_ID:=cpe:/a:gnu:bison
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS += --enable-threads=posix --disable-nls
|
||||
|
||||
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))
|
||||
43
tools/bison/patches/000-relocatable.patch
Normal file
43
tools/bison/patches/000-relocatable.patch
Normal file
@@ -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);
|
||||
2
tools/bison/scripts/yacc
Executable file
2
tools/bison/scripts/yacc
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec bison -y "$@"
|
||||
32
tools/bzip2/Makefile
Normal file
32
tools/bzip2/Makefile
Normal file
@@ -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))
|
||||
27
tools/bzip2/patches/020-no-utime.patch
Normal file
27
tools/bzip2/patches/020-no-utime.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
--- a/bzip2.c
|
||||
+++ b/bzip2.c
|
||||
@@ -69,7 +69,6 @@
|
||||
#if BZ_UNIX
|
||||
# include <fcntl.h>
|
||||
# include <sys/types.h>
|
||||
-# include <utime.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/times.h>
|
||||
@@ -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
|
||||
}
|
||||
382
tools/bzip2/patches/100-cmake.patch
Normal file
382
tools/bzip2/patches/100-cmake.patch
Normal file
@@ -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} $<TARGET_FILE_NAME:${original}> ${symlink}
|
||||
+ WORKING_DIRECTORY $<TARGET_FILE_DIR:${original}>
|
||||
+ COMMENT "Generating symbolic link (or copy) ${symlink} of ${original}")
|
||||
+ install(PROGRAMS $<TARGET_FILE_DIR:${original}>/${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)
|
||||
32
tools/cbootimage-configs/Makefile
Normal file
32
tools/cbootimage-configs/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright (c) 2017-2019 Tomasz Maciej Nowak <tmn505@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME := cbootimage-configs
|
||||
|
||||
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 := 6ba2dde907d3cc403720954738a92431b1f40d562db5815c08971c39374d72a1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Compile
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/share/$(PKG_NAME)
|
||||
$(CP) $(HOST_BUILD_DIR)/* \
|
||||
$(STAGING_DIR_HOST)/share/$(PKG_NAME)
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -fR $(STAGING_DIR_HOST)/share/$(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
31
tools/cbootimage/Makefile
Normal file
31
tools/cbootimage/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (c) 2017-2019 Tomasz Maciej Nowak <tmn505@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME := cbootimage
|
||||
PKG_VERSION := 1.8
|
||||
|
||||
PKG_SOURCE_PROTO := git
|
||||
PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage.git
|
||||
PKG_SOURCE_VERSION := 7c9db585d06cce9efffa2a82245f233233680060
|
||||
PKG_MIRROR_HASH := e38b1e9581524fcabc7b24fff1c18d13f7e3a93accf73c55caf33832249bfd03
|
||||
|
||||
HOST_BUILD_PARALLEL := 1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Configure
|
||||
(cd $(HOST_BUILD_DIR); autoreconf --install --symlink)
|
||||
$(call Host/Configure/Default)
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/$(PKG_NAME) \
|
||||
$(STAGING_DIR_HOST)/share/man/man1/$(PKG_NAME).1
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
27
tools/ccache/Makefile
Normal file
27
tools/ccache/Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ccache
|
||||
PKG_VERSION:=4.10.2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=108100960bb7e64573ea925af2ee7611701241abb36ce0aae3354528403a7d87
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_HOST_OPTIONS += \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="" \
|
||||
-DCMAKE_SKIP_RPATH=FALSE \
|
||||
-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \
|
||||
-DENABLE_DOCUMENTATION=OFF \
|
||||
-DREDIS_STORAGE_BACKEND=OFF
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
10
tools/ccache/patches/100-honour-copts.patch
Normal file
10
tools/ccache/patches/100-honour-copts.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
--- 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) {
|
||||
58
tools/cmake/Makefile
Normal file
58
tools/cmake/Makefile
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 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:=cmake
|
||||
PKG_VERSION:=3.31.2
|
||||
PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION)))
|
||||
PKG_RELEASE:=1
|
||||
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:=42abb3f48f37dbd739cdfeb19d3712db0c5935ed5c2aef6c340f9ae9114238a2
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
HOST_CONFIGURE_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_VARS += \
|
||||
CC="$(HOSTCC_NOCACHE)" \
|
||||
CXX="$(HOSTCXX_NOCACHE)" \
|
||||
MAKEFLAGS="$(HOST_JOBS)" \
|
||||
CXXFLAGS="$(HOST_CFLAGS)" \
|
||||
MAKE="$(STAGING_DIR_HOST)/bin/ninja"
|
||||
|
||||
HOST_CONFIGURE_ARGS := \
|
||||
--no-debugger \
|
||||
$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
|
||||
--prefix="$(STAGING_DIR_HOST)" \
|
||||
--system-expat \
|
||||
--system-liblzma \
|
||||
--system-zlib \
|
||||
--system-zstd \
|
||||
--generator=Ninja
|
||||
|
||||
define Host/Compile/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Host/Install/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) install
|
||||
endef
|
||||
|
||||
define Host/Uninstall/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) uninstall
|
||||
endef
|
||||
|
||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||
HOST_MAKE_FLAGS += VERBOSE=1
|
||||
endif
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
33
tools/cmake/patches/100-no-testing.patch
Normal file
33
tools/cmake/patches/100-no-testing.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
--- a/Modules/CTest.cmake
|
||||
+++ b/Modules/CTest.cmake
|
||||
@@ -47,7 +47,7 @@ the :variable:`CTEST_USE_LAUNCHERS` vari
|
||||
in the ``CTestConfig.cmake`` file.
|
||||
#]=======================================================================]
|
||||
|
||||
-option(BUILD_TESTING "Build the testing tree." ON)
|
||||
+option(BUILD_TESTING "Build the testing tree." OFF)
|
||||
|
||||
# function to turn generator name into a version string
|
||||
# like vs9 or vs10
|
||||
--- a/Modules/Dart.cmake
|
||||
+++ b/Modules/Dart.cmake
|
||||
@@ -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)
|
||||
# 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
|
||||
|
||||
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
|
||||
VTK_BUILD_EXAMPLES:BOOL=ON
|
||||
- VTK_BUILD_TESTING:STRING=WANT
|
||||
+ VTK_BUILD_TESTING:STRING=OFF
|
||||
VTK_WRAP_PYTHON:BOOL=ON
|
||||
ExternalData_OBJECT_STORES:FILEPATH=@base_dir@/ExternalData
|
||||
")
|
||||
17
tools/cmake/patches/110-liblzma.patch
Normal file
17
tools/cmake/patches/110-liblzma.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
--- a/Modules/FindLibLZMA.cmake
|
||||
+++ b/Modules/FindLibLZMA.cmake
|
||||
@@ -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_<n>
|
||||
|
||||
-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)
|
||||
38
tools/cmake/patches/120-curl-fix-libressl-linking.patch
Normal file
38
tools/cmake/patches/120-curl-fix-libressl-linking.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From: Jo-Philipp Wich <jo@mein.io>
|
||||
Date: Wed, 11 Jan 2017 03:36:04 +0100
|
||||
Subject: [PATCH] cmcurl: link librt
|
||||
|
||||
When cmake is linked against LibreSSL, there might be an indirect
|
||||
dependency on librt on certain systems if LibreSSL's libcrypto uses
|
||||
clock_gettime() from librt:
|
||||
|
||||
[ 28%] Linking C executable LIBCURL
|
||||
.../lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
|
||||
getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime'
|
||||
getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime'
|
||||
collect2: error: ld returned 1 exit status
|
||||
make[5]: *** [Utilities/cmcurl/LIBCURL] Error 1
|
||||
|
||||
Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt
|
||||
and unconditionally link the rt library when the symbol is found.
|
||||
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
---
|
||||
--- a/Utilities/cmcurl/CMakeLists.txt
|
||||
+++ b/Utilities/cmcurl/CMakeLists.txt
|
||||
@@ -775,7 +775,14 @@ if(CURL_USE_OPENSSL)
|
||||
endif()
|
||||
set(_ssl_enabled ON)
|
||||
set(USE_OPENSSL ON)
|
||||
-
|
||||
+ check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
|
||||
+ if(HAVE_LIBRT)
|
||||
+ list(APPEND OPENSSL_LIBRARIES rt)
|
||||
+ endif()
|
||||
+ check_library_exists("pthread" pthread_once "" HAVE_PTHREAD)
|
||||
+ if(HAVE_PTHREAD)
|
||||
+ list(APPEND OPENSSL_LIBRARIES pthread)
|
||||
+ endif()
|
||||
list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "openssl")
|
||||
14
tools/cmake/patches/130-bootstrap_parallel_make_flag.patch
Normal file
14
tools/cmake/patches/130-bootstrap_parallel_make_flag.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -1514,7 +1514,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
|
||||
- cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
|
||||
+ case "$cmake_parallel_make" in
|
||||
+ [0-9]*) cmake_parallel_make="-j ${cmake_parallel_make}";;
|
||||
+ esac
|
||||
+ cmake_make_flags="${cmake_make_flags} ${cmake_parallel_make}"
|
||||
fi
|
||||
for a in ${cmake_make_processors}; do
|
||||
if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
|
||||
20
tools/cmake/patches/140-zlib.patch
Normal file
20
tools/cmake/patches/140-zlib.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
--- a/Modules/FindZLIB.cmake
|
||||
+++ b/Modules/FindZLIB.cmake
|
||||
@@ -120,10 +120,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)
|
||||
11
tools/cmake/patches/150-zstd-libarchive.patch
Normal file
11
tools/cmake/patches/150-zstd-libarchive.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Utilities/cmlibarchive/CMakeLists.txt
|
||||
+++ b/Utilities/cmlibarchive/CMakeLists.txt
|
||||
@@ -680,7 +680,7 @@ IF(ENABLE_ZSTD)
|
||||
SET(ZSTD_FIND_QUIETLY TRUE)
|
||||
ENDIF (ZSTD_INCLUDE_DIR)
|
||||
|
||||
- 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)
|
||||
22
tools/cmake/patches/160-disable_xcode_generator.patch
Normal file
22
tools/cmake/patches/160-disable_xcode_generator.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
--- a/Source/CMakeLists.txt
|
||||
+++ b/Source/CMakeLists.txt
|
||||
@@ -888,7 +888,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
|
||||
@@ -133,7 +133,7 @@
|
||||
# include "cmGlobalGhsMultiGenerator.h"
|
||||
#endif
|
||||
|
||||
-#if defined(__APPLE__)
|
||||
+#if defined(__APPLE_DISABLED__)
|
||||
# if !defined(CMAKE_BOOTSTRAP)
|
||||
# include "cmGlobalXCodeGenerator.h"
|
||||
|
||||
74
tools/coreutils/Makefile
Normal file
74
tools/coreutils/Makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=coreutils
|
||||
PKG_CPE_ID:=cpe:/a:gnu:coreutils
|
||||
PKG_VERSION:=9.5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/coreutils
|
||||
PKG_HASH:=767ae6a22950ec42f3ba5f7c1de79dd27800ee8e9b8642da5dedb5974a1741e5
|
||||
|
||||
HOST_BUILD_PARALLEL := 1
|
||||
|
||||
PKG_PROGRAMS:=date readlink touch ln chown ginstall
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
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 $(PKG_PROGRAMS)))
|
||||
|
||||
HOST_MAKE_FLAGS += \
|
||||
$(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)/src/%,$(PKG_PROGRAMS)) $(1)/bin/
|
||||
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))
|
||||
45
tools/coreutils/patches/000-bootstrap.patch
Normal file
45
tools/coreutils/patches/000-bootstrap.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -244,7 +244,7 @@ check_exists() {
|
||||
($2 --version </dev/null)
|
||||
fi
|
||||
else
|
||||
- ($1 --version </dev/null) >/dev/null 2>&1
|
||||
+ ($@ --version </dev/null) >/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
|
||||
|
||||
18
tools/cpio/Makefile
Normal file
18
tools/cpio/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cpio
|
||||
PKG_CPE_ID:=cpe:/a:gnu:cpio
|
||||
PKG_VERSION:=2.15
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=@GNU/cpio
|
||||
PKG_HASH:=937610b97c329a1ec9268553fb780037bcfff0dcffe9725ebc4fd9c1aa9075db
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
31
tools/dosfstools/Makefile
Normal file
31
tools/dosfstools/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2012-2015 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dosfstools
|
||||
PKG_CPE_ID:=cpe:/a:dosfstools_project:dosfstools
|
||||
PKG_VERSION:=4.2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/dosfstools/dosfstools/releases/download/v$(PKG_VERSION)/ \
|
||||
http://fossies.org/linux/misc
|
||||
PKG_HASH:=64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527
|
||||
|
||||
HOST_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
HOST_CFLAGS += -UHAVE_ENDIAN_H
|
||||
endif
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
150
tools/dosfstools/patches/100-source-date-epoch.patch
Normal file
150
tools/dosfstools/patches/100-source-date-epoch.patch
Normal file
@@ -0,0 +1,150 @@
|
||||
From 8da7bc93315cb0c32ad868f17808468b81fa76ec Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
|
||||
Date: Wed, 5 Dec 2018 19:52:51 +0100
|
||||
Subject: [PATCH] Honor the SOURCE_DATE_EPOCH variable
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Implement the SOURCE_DATE_EPOCH specification[1] for reproducible
|
||||
builds. If SOURCE_DATE_EPOCH is set, use it as timestamp instead of the
|
||||
current time.
|
||||
|
||||
[1] https://reproducible-builds.org/specs/source-date-epoch/
|
||||
|
||||
Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
|
||||
---
|
||||
src/boot.c | 23 +++++++++++++++++++++--
|
||||
src/common.c | 18 ++++++++++++++++--
|
||||
src/mkfs.fat.c | 19 ++++++++++++++++---
|
||||
3 files changed, 53 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/src/boot.c
|
||||
+++ b/src/boot.c
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
+#include <errno.h>
|
||||
+#include <ctype.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "fsck.fat.h"
|
||||
@@ -672,6 +674,7 @@ void write_volume_label(DOS_FS * fs, cha
|
||||
{
|
||||
time_t now;
|
||||
struct tm *mtime;
|
||||
+ char *source_date_epoch = NULL;
|
||||
off_t offset;
|
||||
int created;
|
||||
DIR_ENT de;
|
||||
@@ -687,8 +690,24 @@ void write_volume_label(DOS_FS * fs, cha
|
||||
if (de.name[0] == 0xe5)
|
||||
de.name[0] = 0x05;
|
||||
|
||||
- now = time(NULL);
|
||||
- mtime = (now != (time_t)-1) ? localtime(&now) : NULL;
|
||||
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
||||
+ if (source_date_epoch) {
|
||||
+ char *tmp = NULL;
|
||||
+ long long conversion = 0;
|
||||
+ errno = 0;
|
||||
+ conversion = strtoll(source_date_epoch, &tmp, 10);
|
||||
+ now = conversion;
|
||||
+ if (!isdigit((unsigned char)*source_date_epoch) || *tmp != '\0'
|
||||
+ || errno != 0 || (long long)now != conversion) {
|
||||
+ die("SOURCE_DATE_EPOCH is too big or contains non-digits: \"%s\"",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ mtime = gmtime(&now);
|
||||
+ } else {
|
||||
+ now = time(NULL);
|
||||
+ mtime = (now != (time_t)-1) ? localtime(&now) : NULL;
|
||||
+ }
|
||||
+
|
||||
if (mtime && mtime->tm_year >= 80 && mtime->tm_year <= 207) {
|
||||
de.time = htole16((unsigned short)((mtime->tm_sec >> 1) +
|
||||
(mtime->tm_min << 5) +
|
||||
--- a/src/common.c
|
||||
+++ b/src/common.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
+#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
#include <termios.h>
|
||||
#include <sys/time.h>
|
||||
@@ -298,8 +299,21 @@ void check_atari(void)
|
||||
uint32_t generate_volume_id(void)
|
||||
{
|
||||
struct timeval now;
|
||||
+ char *source_date_epoch = NULL;
|
||||
|
||||
- if (gettimeofday(&now, NULL) != 0 || now.tv_sec == (time_t)-1 || now.tv_sec < 0) {
|
||||
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
||||
+ if (source_date_epoch) {
|
||||
+ char *tmp = NULL;
|
||||
+ long long conversion = 0;
|
||||
+ errno = 0;
|
||||
+ conversion = strtoll(source_date_epoch, &tmp, 10);
|
||||
+ if (!isdigit((unsigned char)*source_date_epoch) || *tmp != '\0'
|
||||
+ || errno != 0) {
|
||||
+ die("SOURCE_DATE_EPOCH is too big or contains non-digits: \"%s\"",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ return (uint32_t)conversion;
|
||||
+ } else if (gettimeofday(&now, NULL) != 0 || now.tv_sec == (time_t)-1 || now.tv_sec < 0) {
|
||||
srand(getpid());
|
||||
/* rand() returns int from [0,RAND_MAX], therefore only 31 bits */
|
||||
return (((uint32_t)(rand() & 0xFFFF)) << 16) | ((uint32_t)(rand() & 0xFFFF));
|
||||
--- a/src/mkfs.fat.c
|
||||
+++ b/src/mkfs.fat.c
|
||||
@@ -1074,7 +1074,7 @@ static void setup_tables(void)
|
||||
}
|
||||
|
||||
/* If is not available then generate random 32 bit disk signature */
|
||||
- if (invariant)
|
||||
+ if (invariant || getenv("SOURCE_DATE_EPOCH"))
|
||||
disk_sig = volume_id;
|
||||
else if (!disk_sig)
|
||||
disk_sig = generate_volume_id();
|
||||
@@ -1287,7 +1287,7 @@ static void setup_tables(void)
|
||||
de->name[0] = 0x05;
|
||||
de->attr = ATTR_VOLUME;
|
||||
if (create_time != (time_t)-1) {
|
||||
- if (!invariant)
|
||||
+ if (!invariant && !getenv("SOURCE_DATE_EPOCH"))
|
||||
ctime = localtime(&create_time);
|
||||
else
|
||||
ctime = gmtime(&create_time);
|
||||
@@ -1477,6 +1477,7 @@ int main(int argc, char **argv)
|
||||
int blocks_specified = 0;
|
||||
struct timeval create_timeval;
|
||||
long long conversion;
|
||||
+ char *source_date_epoch = NULL;
|
||||
|
||||
enum {OPT_HELP=1000, OPT_INVARIANT, OPT_MBR, OPT_VARIANT, OPT_CODEPAGE, OPT_OFFSET};
|
||||
const struct option long_options[] = {
|
||||
@@ -1497,8 +1498,20 @@ int main(int argc, char **argv)
|
||||
program_name = p + 1;
|
||||
}
|
||||
|
||||
- if (gettimeofday(&create_timeval, NULL) == 0 && create_timeval.tv_sec != (time_t)-1)
|
||||
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
||||
+ if (source_date_epoch) {
|
||||
+ errno = 0;
|
||||
+ conversion = strtoll(source_date_epoch, &tmp, 10);
|
||||
+ create_time = conversion;
|
||||
+ if (!isdigit((unsigned char)*source_date_epoch) || *tmp != '\0'
|
||||
+ || errno != 0 || (long long)create_time != conversion) {
|
||||
+ die("SOURCE_DATE_EPOCH is too big or contains non-digits: \"%s\"",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ } else if (gettimeofday(&create_timeval, NULL) == 0 && create_timeval.tv_sec != (time_t)-1) {
|
||||
create_time = create_timeval.tv_sec;
|
||||
+ }
|
||||
+
|
||||
volume_id = generate_volume_id();
|
||||
check_atari();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From e7671c2a3be03d790cbc225cd3e784b5434fb5da Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Mon, 16 Jan 2023 01:29:22 +0100
|
||||
Subject: [PATCH] config: switch to AC_CHECK_LIB
|
||||
|
||||
This fixes spurious build-errors on OpenWrt, where the AM_ICONV macro
|
||||
is undefined while invoking autoconfig. Later in the build, the ICONV
|
||||
LDOPTIONS are set to @LIBICONV@, failing the build.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
configure.ac | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -70,10 +70,7 @@ AC_CHECK_DECLS([getmntent], [], [], [[#i
|
||||
AC_CHECK_DECLS([getmntinfo], [], [], [[#include <sys/mount.h>]])
|
||||
|
||||
# optional iconv support
|
||||
-AC_ARG_WITH([iconv], AS_HELP_STRING([--without-iconv], [build without iconv support]))
|
||||
-if test "x$with_iconv" != "xno"; then
|
||||
- AM_ICONV
|
||||
-fi
|
||||
+AC_CHECK_LIB(iconv, iconv_open)
|
||||
|
||||
# xxd (distributed with vim) is used in the testsuite
|
||||
AC_CHECK_PROG([XXD_FOUND], [xxd], [yes])
|
||||
36
tools/dwarves/Makefile
Normal file
36
tools/dwarves/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dwarves
|
||||
PKG_VERSION:=1.27
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://fedorapeople.org/~acme/dwarves/
|
||||
PKG_HASH:=ef7f21f1c6016896d03a01f05cab225151f9068e19cc8cddc6e754b2b5cbe279
|
||||
|
||||
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_HOST_OPTIONS += \
|
||||
-D__LIB=lib \
|
||||
-DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
|
||||
-DCMAKE_SKIP_RPATH=FALSE
|
||||
|
||||
define Host/Clean
|
||||
$(RM) $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags}
|
||||
$(RM) $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse}
|
||||
$(RM) $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle}
|
||||
$(RM) $(STAGING_DIR_HOST)/lib/libdwarves*.so*
|
||||
$(RM) $(STAGING_DIR_HOST)/share/man/man1/pahole.1
|
||||
rm -rf $(STAGING_DIR_HOST)/include/dwarves
|
||||
rm -rf $(STAGING_DIR_HOST)/share/dwarves
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
12
tools/dwarves/patches/100-reproducible-builds.patch
Normal file
12
tools/dwarves/patches/100-reproducible-builds.patch
Normal file
@@ -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;
|
||||
55
tools/e2fsprogs/Makefile
Normal file
55
tools/e2fsprogs/Makefile
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# Copyright (C) 2010-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=e2fsprogs
|
||||
PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs
|
||||
PKG_VERSION:=1.47.0
|
||||
PKG_HASH:=0b4fe723d779b0927fb83c9ae709bc7b40f66d7df36433bef143e41c54257084
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
ifneq ($(shell $(HOSTCC) --version | grep clang),)
|
||||
HOST_CFLAGS += -D__GNUC_PREREQ\(...\)=0 -Dloff_t=off_t
|
||||
endif
|
||||
HOST_CFLAGS += $(HOST_FPIC)
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--disable-elf-shlibs \
|
||||
--disable-libuuid \
|
||||
--disable-tls \
|
||||
--disable-nls \
|
||||
--enable-threads=pth \
|
||||
--disable-fuse2fs \
|
||||
--with-crond-dir=no
|
||||
|
||||
# The following uses pkg-config the wrong way around. Just override it.
|
||||
HOST_CONFIGURE_VARS += \
|
||||
ac_cv_lib_uuid_uuid_generate=yes
|
||||
|
||||
define Host/Prepare
|
||||
$(call Host/Prepare/Default)
|
||||
rm -rf $(HOST_BUILD_DIR)/doc
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(call Host/Install/Default)
|
||||
$(SED) 's|^DIR=.*|DIR=$$$${STAGING_DIR_HOST}/share/et|' $(STAGING_DIR_HOST)/bin/compile_et
|
||||
$(SED) 's|^DIR=.*|DIR=$$$${STAGING_DIR_HOST}/share/ss|' $(STAGING_DIR_HOST)/bin/mk_cmds
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
26
tools/elftosb/Makefile
Normal file
26
tools/elftosb/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (C) 2013 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:=elftosb
|
||||
PKG_VERSION:=10.12.01
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/
|
||||
PKG_HASH:=77bb6981620f7575b87d136d94c7daa88dd09195959cc75fc18b138369ecd42b
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) LDFLAGS="$(HOST_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/bld/linux/elftosb $(STAGING_DIR_HOST)/bin/elftosb
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
11
tools/elftosb/patches/001-libm.patch
Normal file
11
tools/elftosb/patches/001-libm.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/makefile.rules
|
||||
+++ b/makefile.rules
|
||||
@@ -101,7 +101,7 @@ OBJ_FILES_KEYGEN = \
|
||||
keygen.o
|
||||
|
||||
|
||||
-LIBS = -lstdc++
|
||||
+LIBS = -lstdc++ -lm
|
||||
|
||||
|
||||
ifeq ("${UNAMES}", "Linux")
|
||||
18
tools/elftosb/patches/002-fix-header-path.patch
Normal file
18
tools/elftosb/patches/002-fix-header-path.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
This package had an absolute path for sys/types.h, which doesn't
|
||||
make much sense. It breaks on newer Ubuntu systems, and probably many
|
||||
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.
|
||||
|
||||
--- 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.
|
||||
// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
|
||||
-#include "/usr/include/sys/types.h"
|
||||
+#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
//typedef unsigned long uint32_t;
|
||||
//typedef unsigned short uint16_t;
|
||||
26
tools/elftosb/patches/003-use-ldflags.patch
Normal file
26
tools/elftosb/patches/003-use-ldflags.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
--- a/makefile.rules
|
||||
+++ b/makefile.rules
|
||||
@@ -131,19 +131,20 @@ exec_always:
|
||||
@echo "LIBS = ${LIBS}"
|
||||
@echo "EXEC_FILE = ${EXEC_FILE}"
|
||||
@echo "BUILD_DIR = ${BUILD_DIR}"
|
||||
+ @echo "LDFLAGS = ${LDFLAGS}"
|
||||
|
||||
clean:
|
||||
rm -f ${OBJ_FILES_ELFTOSB2} ${OBJ_FILES_SBTOOL} ${OBJ_FILES_KEYGEN} \
|
||||
${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
|
||||
|
||||
elftosb: ${OBJ_FILES_ELFTOSB2}
|
||||
- gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
|
||||
+ gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} ${LDFLAGS} -o ${EXEC_FILE_ELFTOSB2}
|
||||
|
||||
sbtool: ${OBJ_FILES_SBTOOL}
|
||||
- gcc ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
|
||||
+ gcc ${OBJ_FILES_SBTOOL} ${LIBS} ${LDFLAGS} -o ${EXEC_FILE_SBTOOL}
|
||||
|
||||
keygen: ${OBJ_FILES_KEYGEN}
|
||||
- gcc ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
|
||||
+ gcc ${OBJ_FILES_KEYGEN} ${LIBS} ${LDFLAGS} -o ${EXEC_FILE_KEYGEN}
|
||||
|
||||
|
||||
#ifeq ("${UNAMES}", "Linux")
|
||||
103
tools/elfutils/Makefile
Normal file
103
tools/elfutils/Makefile
Normal file
@@ -0,0 +1,103 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=elfutils
|
||||
PKG_VERSION:=0.191
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
|
||||
PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_PROGRAMS:=elflint findtextrel elfcmp unstrip stack elfcompress elfclassify srcfiles
|
||||
|
||||
PKG_SUBDIRS := \
|
||||
config \
|
||||
lib \
|
||||
libelf \
|
||||
libcpu \
|
||||
backends \
|
||||
libebl \
|
||||
libdwelf \
|
||||
libdwfl \
|
||||
libdw \
|
||||
src
|
||||
|
||||
PKG_GNULIB_BASE:=libgnu
|
||||
|
||||
PKG_GNULIB_ARGS = \
|
||||
--dir=$(HOST_BUILD_DIR) \
|
||||
--libtool \
|
||||
--avoid=reallocarray \
|
||||
--import
|
||||
|
||||
PKG_GNULIB_MODS = \
|
||||
argp \
|
||||
fallocate-posix \
|
||||
fnmatch-gnu \
|
||||
fts \
|
||||
obstack \
|
||||
progname \
|
||||
strchrnul \
|
||||
tsearch
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
export $(PKG_GNULIB_BASE)=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/.libs/$(PKG_GNULIB_BASE).a
|
||||
export $(PKG_GNULIB_BASE)_fallocate-posix=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-posix_fallocate.o
|
||||
export $(PKG_GNULIB_BASE)_tsearch=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-tsearch.o
|
||||
|
||||
HOST_MAKE_FLAGS += \
|
||||
DEFAULT_INCLUDES='-I. -I$$$$(top_builddir) -I$$$$(top_srcdir)/$(PKG_GNULIB_BASE)' \
|
||||
AM_LDFLAGS='$$$$(STACK_USAGE_NO_ERROR)' \
|
||||
LIBS+='$$$$(if $$$$(findstring $(lastword $(PKG_SUBDIRS)),$$$$(subdir)), $$$$($(PKG_GNULIB_BASE)))' \
|
||||
LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_fallocate-posix))' \
|
||||
LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_tsearch))' \
|
||||
REPLACE_FCNTL=0 REPLACE_FREE=0 REPLACE_FSTAT=0 REPLACE_OPEN=0 \
|
||||
bin_PROGRAMS='$(PKG_PROGRAMS)' EXEEXT=
|
||||
|
||||
HOST_CPPFLAGS += "'-I$$$$(top_srcdir)/lib'"
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
HOST_CFLAGS += -I/opt/homebrew/include
|
||||
endif
|
||||
|
||||
HOST_CFLAGS += -Wno-error -fPIC
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--without-libintl-prefix \
|
||||
--without-libiconv-prefix \
|
||||
--disable-debuginfod \
|
||||
--disable-libdebuginfod \
|
||||
--disable-nls \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
--without-lzma \
|
||||
--without-bzlib \
|
||||
--without-zstd
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
HOST_CONFIGURE_ARGS += --disable-symbol-versioning
|
||||
endif
|
||||
|
||||
HOST_CONFIGURE_VARS += \
|
||||
ac_cv_search_argp_parse=yes \
|
||||
ac_cv_search_fts_close=yes \
|
||||
ac_cv_search__obstack_free=yes \
|
||||
ac_cv_buildid=yes
|
||||
|
||||
Hooks/HostConfigure/Pre := Host/Gnulib/Prepare $(Hooks/HostConfigure/Pre)
|
||||
Hooks/HostCompile/Pre := Host/Gnulib/Compile $(Hooks/HostCompile/Pre)
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
2525
tools/elfutils/patches/010-backport-mips-support-reloc.patch
Normal file
2525
tools/elfutils/patches/010-backport-mips-support-reloc.patch
Normal file
File diff suppressed because it is too large
Load Diff
300
tools/elfutils/patches/100-portability.patch
Normal file
300
tools/elfutils/patches/100-portability.patch
Normal file
@@ -0,0 +1,300 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -44,6 +44,7 @@ fi
|
||||
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_FILES([config/Makefile])
|
||||
+AC_CONFIG_FILES([libgnu/Makefile])
|
||||
|
||||
AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.])
|
||||
AC_PREREQ(2.63) dnl Minimum Autoconf version required.
|
||||
@@ -88,11 +89,14 @@ AS_IF([test "$use_locks" = yes],
|
||||
|
||||
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
|
||||
|
||||
+AC_USE_SYSTEM_EXTENSIONS()
|
||||
+
|
||||
m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
|
||||
AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_YACC
|
||||
AC_PROG_LEX([noyywrap])
|
||||
+gl_EARLY
|
||||
# Only available since automake 1.12
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_CHECK_TOOL([READELF], [readelf])
|
||||
@@ -635,6 +639,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
CFLAGS="$old_CFLAGS"])
|
||||
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
|
||||
|
||||
+gl_INIT
|
||||
+
|
||||
saved_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([argp_parse], [argp])
|
||||
LIBS="$saved_LIBS"
|
||||
--- a/lib/eu-config.h
|
||||
+++ b/lib/eu-config.h
|
||||
@@ -59,14 +59,19 @@
|
||||
# define once(once_control, init_routine) init_routine()
|
||||
#endif /* USE_LOCKS */
|
||||
|
||||
-#include <libintl.h>
|
||||
+#include <gettext.h>
|
||||
/* gettext helper macros. */
|
||||
#define N_(Str) Str
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
|
||||
/* Compiler-specific definitions. */
|
||||
+#define __PRAGMA(str) _Pragma (#str)
|
||||
+#ifdef __APPLE__
|
||||
+#define strong_alias(name, aliasname) __PRAGMA(weak aliasname = name)
|
||||
+#else
|
||||
#define strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
||||
+#endif
|
||||
|
||||
#ifdef __i386__
|
||||
# define internal_function __attribute__ ((regparm (3), stdcall))
|
||||
@@ -77,7 +82,7 @@
|
||||
#define internal_strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
|
||||
|
||||
-#ifdef HAVE_VISIBILITY
|
||||
+#if defined(HAVE_VISIBILITY) && !defined(__APPLE__)
|
||||
#define attribute_hidden \
|
||||
__attribute__ ((visibility ("hidden")))
|
||||
#else
|
||||
@@ -166,7 +171,7 @@ asm (".section predict_data, \"aw\"; .pr
|
||||
#endif
|
||||
|
||||
/* Avoid PLT entries. */
|
||||
-#ifdef PIC
|
||||
+#if defined(PIC) && !defined(__APPLE__)
|
||||
# define INTUSE(name) _INTUSE(name)
|
||||
# define _INTUSE(name) __##name##_internal
|
||||
# define INTDEF(name) _INTDEF(name)
|
||||
--- a/backends/i386_auxv.c
|
||||
+++ b/backends/i386_auxv.c
|
||||
@@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
-__typeof (i386_auxv_info) x86_64_auxv_info
|
||||
- __attribute__ ((alias ("i386_auxv_info")));
|
||||
+auxv_info_alias(x86_64)
|
||||
--- a/backends/ppc_regs.c
|
||||
+++ b/backends/ppc_regs.c
|
||||
@@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_
|
||||
return namelen;
|
||||
}
|
||||
|
||||
-__typeof (ppc_register_info)
|
||||
- ppc64_register_info __attribute__ ((alias ("ppc_register_info")));
|
||||
+ssize_t
|
||||
+ppc64_register_info (Ebl *ebl,
|
||||
+ int regno, char *name, size_t namelen,
|
||||
+ const char **prefix, const char **setname,
|
||||
+ int *bits, int *type)
|
||||
+{
|
||||
+ return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type);
|
||||
+}
|
||||
--- a/backends/libebl_CPU.h
|
||||
+++ b/backends/libebl_CPU.h
|
||||
@@ -97,4 +97,10 @@ dwarf_is_pointer (int tag)
|
||||
case DW_TAG_reference_type: \
|
||||
case DW_TAG_rvalue_reference_type
|
||||
|
||||
+#define auxv_info_alias(arch) \
|
||||
+ int EBLHOOK_1(arch ## _, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
|
||||
+ { \
|
||||
+ return EBLHOOK(auxv_info)(a_type, name, format); \
|
||||
+ }
|
||||
+
|
||||
#endif /* libebl_CPU.h */
|
||||
--- a/backends/ppc_auxv.c
|
||||
+++ b/backends/ppc_auxv.c
|
||||
@@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
-__typeof (ppc_auxv_info) ppc64_auxv_info
|
||||
- __attribute__ ((alias ("ppc_auxv_info")));
|
||||
+auxv_info_alias(ppc64)
|
||||
--- a/backends/ppc_cfi.c
|
||||
+++ b/backends/ppc_cfi.c
|
||||
@@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un
|
||||
return 0;
|
||||
}
|
||||
|
||||
-__typeof (ppc_abi_cfi)
|
||||
- ppc64_abi_cfi
|
||||
- __attribute__ ((alias ("ppc_abi_cfi")));
|
||||
+int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info)
|
||||
+{
|
||||
+ return ppc_abi_cfi(ebl, abi_info);
|
||||
+}
|
||||
--- a/backends/ppc_initreg.c
|
||||
+++ b/backends/ppc_initreg.c
|
||||
@@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute
|
||||
abort ();
|
||||
}
|
||||
|
||||
-__typeof (ppc_dwarf_to_regno)
|
||||
- ppc64_dwarf_to_regno
|
||||
- __attribute__ ((alias ("ppc_dwarf_to_regno")));
|
||||
+bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno)
|
||||
+{
|
||||
+ return ppc_dwarf_to_regno(ebl, regno);
|
||||
+}
|
||||
|
||||
bool
|
||||
ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
@@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid
|
||||
#endif /* __powerpc__ */
|
||||
}
|
||||
|
||||
-__typeof (ppc_set_initial_registers_tid)
|
||||
- ppc64_set_initial_registers_tid
|
||||
- __attribute__ ((alias ("ppc_set_initial_registers_tid")));
|
||||
+bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg)
|
||||
+{
|
||||
+ return ppc_set_initial_registers_tid(tid, setfunc, arg);
|
||||
+}
|
||||
--- a/backends/ppc_attrs.c
|
||||
+++ b/backends/ppc_attrs.c
|
||||
@@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a
|
||||
return false;
|
||||
}
|
||||
|
||||
-__typeof (ppc_check_object_attribute)
|
||||
- ppc64_check_object_attribute
|
||||
- __attribute__ ((alias ("ppc_check_object_attribute")));
|
||||
+bool ppc64_check_object_attribute(Ebl *ebl,
|
||||
+ const char *vendor, int tag, uint64_t value,
|
||||
+ const char **tag_name, const char **value_name)
|
||||
+{
|
||||
+ return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name);
|
||||
+}
|
||||
--- a/libdwfl/libdwflP.h
|
||||
+++ b/libdwfl/libdwflP.h
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <libdwfl.h>
|
||||
#include <libebl.h>
|
||||
+#include <libeu.h>
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
--- /dev/null
|
||||
+++ b/lib/stdio_ext.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#include <stdio.h>
|
||||
+#ifndef __APPLE__
|
||||
+#include_next <stdio_ext.h>
|
||||
+#else
|
||||
+#define __fsetlocking(...) 0
|
||||
+#endif
|
||||
--- a/libdw/libdwP.h
|
||||
+++ b/libdw/libdwP.h
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <pthread.h>
|
||||
|
||||
+#include <libeu.h>
|
||||
#include <libdw.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
--- a/config/libdebuginfod.pc.in
|
||||
+++ b/config/libdebuginfod.pc.in
|
||||
@@ -8,5 +8,5 @@ Description: elfutils library to query d
|
||||
Version: @VERSION@
|
||||
URL: http://elfutils.org/
|
||||
|
||||
-Libs: -L${libdir} -ldebuginfod
|
||||
+Libs: -L${libdir} -ldebuginfod -lpthread
|
||||
Cflags: -I${includedir}
|
||||
--- a/config/libdw.pc.in
|
||||
+++ b/config/libdw.pc.in
|
||||
@@ -8,7 +8,7 @@ Description: elfutils library for DWARF
|
||||
Version: @VERSION@
|
||||
URL: http://elfutils.org/
|
||||
|
||||
-Libs: -L${libdir} -ldw
|
||||
+Libs: -L${libdir} -ldw -lz -lelf -lz -ldl -lpthread
|
||||
Cflags: -I${includedir}
|
||||
|
||||
# We need the exact matching elfutils libelf version since internal data
|
||||
--- a/config/libelf.pc.in
|
||||
+++ b/config/libelf.pc.in
|
||||
@@ -8,7 +8,7 @@ Description: elfutils libelf library to
|
||||
Version: @VERSION@
|
||||
URL: http://elfutils.org/
|
||||
|
||||
-Libs: -L${libdir} -lelf
|
||||
+Libs: -L${libdir} -lelf -lz
|
||||
Cflags: -I${includedir}
|
||||
|
||||
Requires.private: zlib @LIBZSTD@
|
||||
--- a/lib/next_prime.c
|
||||
+++ b/lib/next_prime.c
|
||||
@@ -27,6 +27,7 @@
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
+#include <config.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
--- a/libebl/eblopenbackend.c
|
||||
+++ b/libebl/eblopenbackend.c
|
||||
@@ -200,8 +200,6 @@ static bool default_object_note (const c
|
||||
uint32_t descsz, const char *desc);
|
||||
static bool default_debugscn_p (const char *name);
|
||||
static bool default_copy_reloc_p (int reloc);
|
||||
-static bool default_none_reloc_p (int reloc);
|
||||
-static bool default_relative_reloc_p (int reloc);
|
||||
static bool default_check_special_symbol (Elf *elf,
|
||||
const GElf_Sym *sym,
|
||||
const char *name,
|
||||
@@ -253,8 +251,8 @@ fill_defaults (Ebl *result)
|
||||
result->object_note = default_object_note;
|
||||
result->debugscn_p = default_debugscn_p;
|
||||
result->copy_reloc_p = default_copy_reloc_p;
|
||||
- result->none_reloc_p = default_none_reloc_p;
|
||||
- result->relative_reloc_p = default_relative_reloc_p;
|
||||
+ result->none_reloc_p = default_copy_reloc_p;
|
||||
+ result->relative_reloc_p = default_copy_reloc_p;
|
||||
result->check_special_symbol = default_check_special_symbol;
|
||||
result->data_marker_symbol = default_data_marker_symbol;
|
||||
result->check_st_other_bits = default_check_st_other_bits;
|
||||
@@ -636,8 +634,6 @@ default_copy_reloc_p (int reloc __attrib
|
||||
{
|
||||
return false;
|
||||
}
|
||||
-strong_alias (default_copy_reloc_p, default_none_reloc_p)
|
||||
-strong_alias (default_copy_reloc_p, default_relative_reloc_p)
|
||||
|
||||
static bool
|
||||
default_check_special_symbol (Elf *elf __attribute__ ((unused)),
|
||||
--- a/src/srcfiles.cxx
|
||||
+++ b/src/srcfiles.cxx
|
||||
@@ -78,7 +78,9 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = print_ve
|
||||
/* Bug report address. */
|
||||
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
|
||||
|
||||
+#ifdef HAVE_LIBARCHIVE
|
||||
constexpr size_t BUFFER_SIZE = 8192;
|
||||
+#endif
|
||||
|
||||
/* Definitions of arguments for argp functions. */
|
||||
static const struct argp_option options[] =
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -92,6 +92,7 @@ strings_LDADD = $(libelf) $(libeu) $(arg
|
||||
ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
|
||||
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
|
||||
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
|
||||
+EXTRA_stack_DEPENDENCIES = $(if $(findstring srcfiles,$(bin_PROGRAMS)),$(srcfiles_OBJECTS))
|
||||
elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
|
||||
elfclassify_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD)
|
||||
srcfiles_SOURCES = srcfiles.cxx
|
||||
183
tools/elfutils/patches/101-shared-conditional.patch
Normal file
183
tools/elfutils/patches/101-shared-conditional.patch
Normal file
@@ -0,0 +1,183 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -102,6 +102,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_CHECK_TOOL([READELF], [readelf])
|
||||
AC_CHECK_TOOL([NM], [nm])
|
||||
|
||||
+LT_INIT([shared disable-static])
|
||||
+
|
||||
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
|
||||
ac_cv_visibility, [dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
@@ -419,7 +421,10 @@ AS_HELP_STRING([--enable-install-elfh],[
|
||||
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
|
||||
|
||||
AM_CONDITIONAL(BUILD_STATIC, [dnl
|
||||
-test "$use_gprof" = yes -o "$use_gcov" = yes])
|
||||
+test "$use_gprof" = yes -o "$use_gcov" = yes -o "$enable_static" = yes])
|
||||
+
|
||||
+AM_CONDITIONAL(BUILD_SHARED, [dnl
|
||||
+test "$enable_shared" = yes])
|
||||
|
||||
AC_ARG_ENABLE([tests-rpath],
|
||||
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -35,8 +35,11 @@ endif
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libelf.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libelf_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
include_HEADERS = libelf.h gelf.h nlist.h
|
||||
|
||||
noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
|
||||
@@ -122,11 +125,15 @@ libelf.so: $(srcdir)/libelf.map $(libelf
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libelf.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
|
||||
ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
|
||||
+else
|
||||
+libelf_a_LIBADD = $(foreach dep,$(libelf_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -35,8 +35,10 @@ AM_CPPFLAGS += -I$(srcdir)/../libebl -I$
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libdw.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libdw_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
|
||||
include_HEADERS = dwarf.h
|
||||
pkginclude_HEADERS = libdw.h known-dwarf.h
|
||||
@@ -121,11 +123,13 @@ libdw.so: $(srcdir)/libdw.map $(libdw_so
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdw.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
|
||||
ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
@@ -148,6 +152,10 @@ libdw_a_LIBADD += $(addprefix ../backend
|
||||
libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
|
||||
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
|
||||
|
||||
+if !BUILD_SHARED
|
||||
+libdw_a_LIBADD += $(foreach dep,$(libdw_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
+
|
||||
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
|
||||
dwarf_sig8_hash.h cfi.h encoded-value.h
|
||||
|
||||
--- a/libasm/Makefile.am
|
||||
+++ b/libasm/Makefile.am
|
||||
@@ -33,8 +33,11 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libasm.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libasm_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
pkginclude_HEADERS = libasm.h
|
||||
|
||||
libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
|
||||
@@ -71,11 +74,15 @@ libasm.so: $(srcdir)/libasm.map $(libasm
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libasm.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
|
||||
ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
|
||||
+else
|
||||
+libasm_a_LIBADD = $(foreach dep,$(libasm_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
--- a/debuginfod/Makefile.am
|
||||
+++ b/debuginfod/Makefile.am
|
||||
@@ -77,8 +77,10 @@ debuginfod_find_LDADD = $(libdw) $(libel
|
||||
|
||||
if LIBDEBUGINFOD
|
||||
noinst_LIBRARIES = libdebuginfod.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES += libdebuginfod_pic.a
|
||||
endif
|
||||
+endif
|
||||
|
||||
libdebuginfod_a_SOURCES = debuginfod-client.c
|
||||
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
|
||||
@@ -111,12 +113,16 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
|
||||
libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs $< $@
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdebuginfod.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
|
||||
$(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
|
||||
+else
|
||||
+libdebuginfod_a_LIBADD = $(foreach dep,$(wildcard $(libdebuginfod_so_LDLIBS:.so=.a)) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -50,7 +50,7 @@ check_PROGRAMS = arextract arsymtest new
|
||||
dwfl-report-offline-memory \
|
||||
varlocs backtrace backtrace-child \
|
||||
backtrace-data backtrace-dwarf debuglink debugaltlink \
|
||||
- buildid deleted deleted-lib.so aggregate_size peel_type \
|
||||
+ buildid aggregate_size peel_type \
|
||||
vdsosyms \
|
||||
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
|
||||
elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr \
|
||||
@@ -180,7 +180,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
run-readelf-addr.sh run-readelf-str.sh \
|
||||
run-readelf-multi-noline.sh \
|
||||
run-readelf-types.sh \
|
||||
- run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
|
||||
+ run-readelf-dwz-multi.sh run-allfcts-multi.sh \
|
||||
run-linkmap-cut.sh run-aggregate-size.sh run-peel-type.sh \
|
||||
vdsosyms run-readelf-A.sh \
|
||||
run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
|
||||
@@ -284,6 +284,11 @@ funcretval_test__11_SOURCES = funcretval
|
||||
TESTS += run-funcretval++11.sh
|
||||
endif
|
||||
|
||||
+if BUILD_SHARED
|
||||
+check_PROGRAMS += deleted deleted-lib.so
|
||||
+TESTS += run-deleted.sh
|
||||
+endif
|
||||
+
|
||||
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
|
||||
run-ar-N.sh \
|
||||
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
|
||||
161
tools/elfutils/patches/110-objects-manifest.patch
Normal file
161
tools/elfutils/patches/110-objects-manifest.patch
Normal file
@@ -0,0 +1,161 @@
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -137,19 +137,19 @@ uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw.so
|
||||
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
|
||||
|
||||
-libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
|
||||
+libdwfl_objects = $(shell cat ../libdwfl/libdwfl.manifest)
|
||||
libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
|
||||
|
||||
-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
|
||||
+libdwelf_objects = $(shell cat ../libdwelf/libdwelf.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
|
||||
|
||||
-libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
|
||||
+libebl_objects = $(shell cat ../libebl/libebl.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
|
||||
|
||||
-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
|
||||
+backends_objects = $(shell cat ../backends/libebl_backends.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
|
||||
|
||||
-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
|
||||
+libcpu_objects = $(shell cat ../libcpu/libcpu.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
|
||||
|
||||
if !BUILD_SHARED
|
||||
@@ -161,4 +161,9 @@ noinst_HEADERS = libdwP.h memory-access.
|
||||
|
||||
EXTRA_DIST = libdw.map
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so libdw.so.$(VERSION)
|
||||
+EXTRA_libdw_a_DEPENDENCIES = libdw.manifest
|
||||
+
|
||||
+libdw.manifest: $(libdw_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) $(EXTRA_libdw_a_DEPENDENCIES) libdw.so libdw.so.$(VERSION)
|
||||
--- a/libdwfl/Makefile.am
|
||||
+++ b/libdwfl/Makefile.am
|
||||
@@ -93,4 +93,10 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_S
|
||||
|
||||
noinst_HEADERS = libdwflP.h
|
||||
|
||||
+EXTRA_libdwfl_a_DEPENDENCIES = libdwfl.manifest
|
||||
+
|
||||
+libdwfl.manifest: $(libdwfl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwfl_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
|
||||
--- a/libdwelf/Makefile.am
|
||||
+++ b/libdwelf/Makefile.am
|
||||
@@ -54,4 +54,10 @@ libeu = ../lib/libeu.a
|
||||
libdwelf_pic_a_SOURCES =
|
||||
am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
|
||||
|
||||
+EXTRA_libdwelf_a_DEPENDENCIES = libdwelf.manifest
|
||||
+
|
||||
+libdwelf.manifest: $(libdwelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
|
||||
--- a/libebl/Makefile.am
|
||||
+++ b/libebl/Makefile.am
|
||||
@@ -61,4 +61,9 @@ am_libebl_pic_a_OBJECTS = $(libebl_a_SOU
|
||||
|
||||
noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_a_DEPENDENCIES = libebl.manifest
|
||||
+
|
||||
+libebl.manifest: $(libebl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS) $(EXTRA_libebl_a_DEPENDENCIES)
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -119,4 +119,9 @@ am_libebl_backends_pic_a_OBJECTS = $(lib
|
||||
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
||||
EXTRA_DIST = $(modules:=_reloc.def)
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_backends_a_DEPENDENCIES = libebl_backends.manifest
|
||||
+
|
||||
+libebl_backends.manifest: $(libebl_backends_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS) $(EXTRA_libebl_backends_a_DEPENDENCIES)
|
||||
--- a/libcpu/Makefile.am
|
||||
+++ b/libcpu/Makefile.am
|
||||
@@ -101,6 +101,11 @@ bpf_disasm_CFLAGS = -Wno-format-nonliter
|
||||
|
||||
EXTRA_DIST = defs/i386
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
|
||||
+EXTRA_libcpu_a_DEPENDENCIES = libcpu.manifest
|
||||
+
|
||||
+libcpu.manifest: $(libcpu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS) $(EXTRA_libcpu_a_DEPENDENCIES)
|
||||
CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
|
||||
MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -142,4 +142,10 @@ uninstall: uninstall-am
|
||||
|
||||
EXTRA_DIST = libelf.map
|
||||
|
||||
+EXTRA_libelf_a_DEPENDENCIES = libelf.manifest
|
||||
+
|
||||
+libelf.manifest: $(libelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -41,3 +41,10 @@ noinst_HEADERS = fixedsizehash.h libeu.h
|
||||
eu-config.h color.h printversion.h bpf.h \
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h
|
||||
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
|
||||
+
|
||||
+EXTRA_libeu_a_DEPENDENCIES = libeu.manifest
|
||||
+
|
||||
+libeu.manifest: $(libeu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libeu_a_DEPENDENCIES)
|
||||
--- a/libasm/Makefile.am
|
||||
+++ b/libasm/Makefile.am
|
||||
@@ -93,4 +93,10 @@ uninstall: uninstall-am
|
||||
noinst_HEADERS = libasmP.h symbolhash.h
|
||||
EXTRA_DIST = libasm.map
|
||||
|
||||
+EXTRA_libasm_a_DEPENDENCIES = libasm.manifest
|
||||
+
|
||||
+libasm.manifest: $(libasm_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libasm_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so libasm.so.$(VERSION)
|
||||
--- a/debuginfod/Makefile.am
|
||||
+++ b/debuginfod/Makefile.am
|
||||
@@ -132,7 +132,13 @@ uninstall: uninstall-am
|
||||
endif
|
||||
|
||||
EXTRA_DIST = libdebuginfod.map
|
||||
-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
|
||||
+
|
||||
+EXTRA_libdebuginfod_a_DEPENDENCIES = libdebuginfod.manifest
|
||||
+
|
||||
+libdebuginfod.manifest: $(libdebuginfod_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME) $(EXTRA_libdebuginfod_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
|
||||
|
||||
# automake std-options override: arrange to pass LD_LIBRARY_PATH
|
||||
34
tools/expat/Makefile
Normal file
34
tools/expat/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 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:=expat
|
||||
PKG_CPE_ID:=cpe:/a:libexpat:libexpat
|
||||
PKG_VERSION:=2.6.3
|
||||
|
||||
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
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--disable-shared \
|
||||
--without-docbook \
|
||||
--without-tests \
|
||||
--with-pic
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
32
tools/fakeroot/Makefile
Normal file
32
tools/fakeroot/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fakeroot
|
||||
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:=7fe3cf3daf95ee93b47e568e85f4d341a1f9ae91766b4f9a9cdc29737dea4988
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_VARS += \
|
||||
ac_cv_header_sys_capability_h=no \
|
||||
ac_cv_func_capset=no \
|
||||
CPP="$(HOSTCC) -E"
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--with-ipc=tcp
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
29
tools/fakeroot/patches/000-relocatable.patch
Normal file
29
tools/fakeroot/patches/000-relocatable.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
--- a/scripts/fakeroot.in
|
||||
+++ b/scripts/fakeroot.in
|
||||
@@ -30,13 +30,20 @@ fatal ()
|
||||
}
|
||||
|
||||
# strip /bin/fakeroot to find install prefix
|
||||
-FAKEROOT_PREFIX=@prefix@
|
||||
-FAKEROOT_BINDIR=@bindir@
|
||||
+if [ -n "$STAGING_DIR_HOST" ]; then
|
||||
+ USEABSLIBPATH=1
|
||||
+ FAKEROOT_LIB=${STAGING_DIR_HOST}/lib/lib@fakeroot_transformed@@DLSUFFIX@
|
||||
+ FAKED=${STAGING_DIR_HOST}/bin/faked
|
||||
+ PATHS=
|
||||
+else
|
||||
+ FAKEROOT_PREFIX=@prefix@
|
||||
+ FAKEROOT_BINDIR=@bindir@
|
||||
|
||||
-USEABSLIBPATH=@LDPRELOADABS@
|
||||
-FAKEROOT_LIB=lib@fakeroot_transformed@@DLSUFFIX@
|
||||
-PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot
|
||||
-FAKED=${FAKEROOT_BINDIR}/@faked_transformed@
|
||||
+ USEABSLIBPATH=@LDPRELOADABS@
|
||||
+ FAKEROOT_LIB=lib@fakeroot_transformed@@DLSUFFIX@
|
||||
+ PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot
|
||||
+ FAKED=${FAKEROOT_BINDIR}/@faked_transformed@
|
||||
+fi
|
||||
|
||||
FAKED_MODE="unknown-is-root"
|
||||
export FAKED_MODE
|
||||
10
tools/fakeroot/patches/200-disable-doc.patch
Normal file
10
tools/fakeroot/patches/200-disable-doc.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -1,6 +1,6 @@
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
ACLOCAL_AMFLAGS = -I build-aux
|
||||
-SUBDIRS=doc scripts test
|
||||
+SUBDIRS=scripts test
|
||||
|
||||
noinst_LTLIBRARIES = libcommunicate.la libmacosx.la libfakeroot_time64.la
|
||||
libcommunicate_la_SOURCES = communicate.c
|
||||
11
tools/fakeroot/patches/300-time64-hack.patch
Normal file
11
tools/fakeroot/patches/300-time64-hack.patch
Normal file
@@ -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 <bits/wordsize.h>
|
||||
#if __WORDSIZE == 32
|
||||
#define __USE_TIME_BITS64 1
|
||||
23
tools/fakeroot/patches/400-alpine-libc.musl-fix.patch
Normal file
23
tools/fakeroot/patches/400-alpine-libc.musl-fix.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
Alpine linux libc.musl build error fix
|
||||
|
||||
Prevent build error on Alpine Linux host:
|
||||
libfakeroot.c error: conflicting types for 'id_t'
|
||||
Error relocating openwrt/staging_dir/host/lib/libfakeroot.so: SEND_GET_XATTR: symbol not found
|
||||
|
||||
--- a/libfakeroot.c
|
||||
+++ b/libfakeroot.c
|
||||
@@ -86,12 +86,14 @@
|
||||
#define SEND_STAT64(a,b,c) send_stat64(a,b,c)
|
||||
#define SEND_GET_STAT(a,b) send_get_stat(a,b)
|
||||
#define SEND_GET_STAT64(a,b) send_get_stat64(a,b)
|
||||
+#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b,c)
|
||||
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b,c)
|
||||
#else
|
||||
#define SEND_STAT(a,b,c) send_stat(a,b)
|
||||
#define SEND_STAT64(a,b,c) send_stat64(a,b)
|
||||
#define SEND_GET_STAT(a,b) send_get_stat(a)
|
||||
#define SEND_GET_STAT64(a,b) send_get_stat64(a)
|
||||
+#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b)
|
||||
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
|
||||
#endif
|
||||
|
||||
56
tools/fakeroot/patches/600-macOS.patch
Normal file
56
tools/fakeroot/patches/600-macOS.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
--- a/communicate.c
|
||||
+++ b/communicate.c
|
||||
@@ -441,6 +441,10 @@ void semaphore_down(){
|
||||
|
||||
#else /* FAKEROOT_FAKENET */
|
||||
|
||||
+#ifndef SOL_TCP
|
||||
+# define SOL_TCP 6 /* this should probably be done with getprotoent */
|
||||
+#endif
|
||||
+
|
||||
static struct sockaddr *get_addr(void)
|
||||
{
|
||||
static struct sockaddr_in addr = { 0, 0, { 0 } };
|
||||
--- a/libfakeroot_inode64.c
|
||||
+++ b/libfakeroot_inode64.c
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "config.h"
|
||||
#include "communicate.h"
|
||||
|
||||
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T
|
||||
|
||||
#include <stdio.h>
|
||||
#include <spawn.h>
|
||||
--- a/wrapfunc.inp
|
||||
+++ b/wrapfunc.inp
|
||||
@@ -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 <spawn.h>
|
||||
+#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)
|
||||
fstat$INODE64;int;(int fd, struct stat *buf);(fd, buf)
|
||||
+#endif
|
||||
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
|
||||
@@ -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__
|
||||
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T
|
||||
fts_read$INODE64;FTSENT *;(FTS *ftsp);(ftsp)
|
||||
#endif
|
||||
#endif /* ifdef __APPLE__ */
|
||||
@@ -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__
|
||||
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T
|
||||
fts_children$INODE64;FTSENT *;(FTS *ftsp, int options);(ftsp, options)
|
||||
#endif
|
||||
#endif /* ifdef __APPLE__ */
|
||||
37
tools/findutils/Makefile
Normal file
37
tools/findutils/Makefile
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 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:=findutils
|
||||
PKG_CPE_ID:=cpe:/a:gnu:findutils
|
||||
PKG_VERSION:=4.10.0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
|
||||
PKG_HASH:=1387e0b67ff247d2abde998f90dfbf70c1491391a59ddfecb8ae698789f0a4f5
|
||||
|
||||
PKG_PROGRAMS:=find locate updatedb xargs
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
HOST_CFLAGS +=-D__nonnull\\(params\\)=
|
||||
endif
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--enable-threads=pth \
|
||||
--disable-rpath \
|
||||
--disable-nls \
|
||||
--without-selinux
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
21
tools/firmware-utils/Makefile
Normal file
21
tools/firmware-utils/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright (C) 2006-2020 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:=firmware-utils
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git
|
||||
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
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
42
tools/flex/Makefile
Normal file
42
tools/flex/Makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Copyright (C) 2008-2016 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:=flex
|
||||
PKG_CPE_ID:=cpe:/a:westes:flex
|
||||
PKG_VERSION:=2.6.4
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/westes/flex/releases/download/v$(PKG_VERSION)/
|
||||
PKG_HASH:=e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995
|
||||
|
||||
HOST_FIXUP:=autoreconf
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
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/Compile/Default,install SUBDIRS='src tools')
|
||||
$(LN) flex $(STAGING_DIR_HOST)/bin/lex
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall SUBDIRS='src tools')
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/lex
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
@@ -0,0 +1,27 @@
|
||||
From 24fd0551333e7eded87b64dd36062da3df2f6380 Mon Sep 17 00:00:00 2001
|
||||
From: Explorer09 <explorer09@gmail.com>
|
||||
Date: Mon, 4 Sep 2017 10:47:33 +0800
|
||||
Subject: [PATCH] build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
|
||||
|
||||
This would, e.g. define _GNU_SOURCE in config.h, enabling the
|
||||
reallocarray() prototype in glibc 2.26+ on Linux systems with that
|
||||
version of glibc.
|
||||
|
||||
Fixes #241.
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -25,8 +25,10 @@
|
||||
# autoconf requirements and initialization
|
||||
|
||||
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
|
||||
+AC_PREREQ([2.60])
|
||||
AC_CONFIG_SRCDIR([src/scan.l])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
+AC_USE_SYSTEM_EXTENSIONS
|
||||
LT_INIT
|
||||
AM_INIT_AUTOMAKE([1.11.3 -Wno-portability foreign check-news std-options dist-lzip parallel-tests subdir-objects])
|
||||
AC_CONFIG_HEADER([src/config.h])
|
||||
23
tools/flex/patches/300-m4-path.patch
Normal file
23
tools/flex/patches/300-m4-path.patch
Normal file
@@ -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) {
|
||||
31
tools/flock/Makefile
Normal file
31
tools/flock/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# 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 := flock
|
||||
PKG_VERSION := 2.18
|
||||
PKG_RELEASE := 1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
HOSTCXX := $(HOSTCXX_NOCACHE)
|
||||
|
||||
define Host/Compile
|
||||
mkdir -p $(HOST_BUILD_DIR)
|
||||
$(HOSTCC) $(HOST_CFLAGS) -o $(HOST_BUILD_DIR)/flock src/flock.c
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/flock $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/flock
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
342
tools/flock/src/flock.c
Normal file
342
tools/flock/src/flock.c
Normal file
@@ -0,0 +1,342 @@
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall
|
||||
* be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include <sysexits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define PACKAGE_STRING "util-linux-ng 2.18"
|
||||
#define _(x) (x)
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{ "shared", 0, NULL, 's' },
|
||||
{ "exclusive", 0, NULL, 'x' },
|
||||
{ "unlock", 0, NULL, 'u' },
|
||||
{ "nonblocking", 0, NULL, 'n' },
|
||||
{ "nb", 0, NULL, 'n' },
|
||||
{ "timeout", 1, NULL, 'w' },
|
||||
{ "wait", 1, NULL, 'w' },
|
||||
{ "close", 0, NULL, 'o' },
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
const char *program;
|
||||
|
||||
static void usage(int ex)
|
||||
{
|
||||
fputs("flock (" PACKAGE_STRING ")\n", stderr);
|
||||
fprintf(stderr,
|
||||
_("Usage: %1$s [-sxun][-w #] fd#\n"
|
||||
" %1$s [-sxon][-w #] file [-c] command...\n"
|
||||
" %1$s [-sxon][-w #] directory [-c] command...\n"
|
||||
" -s --shared Get a shared lock\n"
|
||||
" -x --exclusive Get an exclusive lock\n"
|
||||
" -u --unlock Remove a lock\n"
|
||||
" -n --nonblock Fail rather than wait\n"
|
||||
" -w --timeout Wait for a limited amount of time\n"
|
||||
" -o --close Close file descriptor before running command\n"
|
||||
" -c --command Run a single command string through the shell\n"
|
||||
" -h --help Display this text\n"
|
||||
" -V --version Display version\n"),
|
||||
program);
|
||||
exit(ex);
|
||||
}
|
||||
|
||||
|
||||
static sig_atomic_t timeout_expired = 0;
|
||||
|
||||
static void timeout_handler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
|
||||
timeout_expired = 1;
|
||||
}
|
||||
|
||||
|
||||
static char * strtotimeval(const char *str, struct timeval *tv)
|
||||
{
|
||||
char *s;
|
||||
long fs; /* Fractional seconds */
|
||||
int i;
|
||||
|
||||
tv->tv_sec = strtol(str, &s, 10);
|
||||
fs = 0;
|
||||
|
||||
if ( *s == '.' ) {
|
||||
s++;
|
||||
|
||||
for ( i = 0 ; i < 6 ; i++ ) {
|
||||
if ( !isdigit(*s) )
|
||||
break;
|
||||
|
||||
fs *= 10;
|
||||
fs += *s++ - '0';
|
||||
}
|
||||
|
||||
for ( ; i < 6; i++ )
|
||||
fs *= 10;
|
||||
|
||||
while ( isdigit(*s) )
|
||||
s++;
|
||||
}
|
||||
|
||||
tv->tv_usec = fs;
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct itimerval timeout, old_timer;
|
||||
int have_timeout = 0;
|
||||
int type = LOCK_EX;
|
||||
int block = 0;
|
||||
int fd = -1;
|
||||
int opt, ix;
|
||||
int do_close = 0;
|
||||
int err;
|
||||
int status;
|
||||
int open_flags = 0;
|
||||
char *eon;
|
||||
char **cmd_argv = NULL, *sh_c_argv[4];
|
||||
const char *filename = NULL;
|
||||
struct sigaction sa, old_sa;
|
||||
|
||||
program = argv[0];
|
||||
|
||||
if ( argc < 2 )
|
||||
usage(EX_USAGE);
|
||||
|
||||
memset(&timeout, 0, sizeof timeout);
|
||||
|
||||
optopt = 0;
|
||||
while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) {
|
||||
switch(opt) {
|
||||
case 's':
|
||||
type = LOCK_SH;
|
||||
break;
|
||||
case 'e':
|
||||
case 'x':
|
||||
type = LOCK_EX;
|
||||
break;
|
||||
case 'u':
|
||||
type = LOCK_UN;
|
||||
break;
|
||||
case 'o':
|
||||
do_close = 1;
|
||||
break;
|
||||
case 'n':
|
||||
block = LOCK_NB;
|
||||
break;
|
||||
case 'w':
|
||||
have_timeout = 1;
|
||||
eon = strtotimeval(optarg, &timeout.it_value);
|
||||
if ( *eon )
|
||||
usage(EX_USAGE);
|
||||
break;
|
||||
case 'V':
|
||||
printf("flock (%s)\n", PACKAGE_STRING);
|
||||
exit(0);
|
||||
default:
|
||||
/* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */
|
||||
usage(optopt ? EX_USAGE : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( argc > optind+1 ) {
|
||||
/* Run command */
|
||||
|
||||
if ( !strcmp(argv[optind+1], "-c") ||
|
||||
!strcmp(argv[optind+1], "--command") ) {
|
||||
|
||||
if ( argc != optind+3 ) {
|
||||
fprintf(stderr, _("%s: %s requires exactly one command argument\n"),
|
||||
program, argv[optind+1]);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
cmd_argv = sh_c_argv;
|
||||
|
||||
cmd_argv[0] = getenv("SHELL");
|
||||
if ( !cmd_argv[0] || !*cmd_argv[0] )
|
||||
cmd_argv[0] = _PATH_BSHELL;
|
||||
|
||||
cmd_argv[1] = "-c";
|
||||
cmd_argv[2] = argv[optind+2];
|
||||
cmd_argv[3] = 0;
|
||||
} else {
|
||||
cmd_argv = &argv[optind+1];
|
||||
}
|
||||
|
||||
filename = argv[optind];
|
||||
fd = open(filename, O_RDONLY|O_NOCTTY|O_CREAT, 0666);
|
||||
/* Linux doesn't like O_CREAT on a directory, even though it should be a
|
||||
no-op */
|
||||
if (fd < 0 && errno == EISDIR)
|
||||
fd = open(filename, O_RDONLY|O_NOCTTY);
|
||||
|
||||
if ( fd < 0 ) {
|
||||
err = errno;
|
||||
fprintf(stderr, _("%s: cannot open lock file %s: %s\n"),
|
||||
program, argv[optind], strerror(err));
|
||||
exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR :
|
||||
(err == EROFS||err == ENOSPC) ? EX_CANTCREAT :
|
||||
EX_NOINPUT);
|
||||
}
|
||||
|
||||
} else if (optind < argc) {
|
||||
/* Use provided file descriptor */
|
||||
|
||||
fd = (int)strtol(argv[optind], &eon, 10);
|
||||
if ( *eon || !argv[optind] ) {
|
||||
fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Bad options */
|
||||
|
||||
fprintf(stderr, _("%s: requires file descriptor, file or directory\n"),
|
||||
program);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
|
||||
if ( have_timeout ) {
|
||||
if ( timeout.it_value.tv_sec == 0 &&
|
||||
timeout.it_value.tv_usec == 0 ) {
|
||||
/* -w 0 is equivalent to -n; this has to be special-cased
|
||||
because setting an itimer to zero means disabled! */
|
||||
|
||||
have_timeout = 0;
|
||||
block = LOCK_NB;
|
||||
} else {
|
||||
memset(&sa, 0, sizeof sa);
|
||||
|
||||
sa.sa_handler = timeout_handler;
|
||||
sa.sa_flags = SA_RESETHAND;
|
||||
sigaction(SIGALRM, &sa, &old_sa);
|
||||
|
||||
setitimer(ITIMER_REAL, &timeout, &old_timer);
|
||||
}
|
||||
}
|
||||
|
||||
while ( flock(fd, type|block) ) {
|
||||
switch( (err = errno) ) {
|
||||
case EWOULDBLOCK: /* -n option set and failed to lock */
|
||||
exit(1);
|
||||
case EINTR: /* Signal received */
|
||||
if ( timeout_expired )
|
||||
exit(1); /* -w option set and failed to lock */
|
||||
continue; /* otherwise try again */
|
||||
case EBADF: /* since Linux 3.4 (commit 55725513) */
|
||||
/* Probably NFSv4 where flock() is emulated by fcntl().
|
||||
* Let's try to reopen in read-write mode.
|
||||
*/
|
||||
if (!(open_flags & O_RDWR) &&
|
||||
type != LOCK_SH &&
|
||||
filename &&
|
||||
access(filename, R_OK | W_OK) == 0) {
|
||||
|
||||
close(fd);
|
||||
open_flags = O_RDWR;
|
||||
fd = open(filename, open_flags);
|
||||
break;
|
||||
}
|
||||
/* go through */
|
||||
default: /* Other errors */
|
||||
if ( filename )
|
||||
fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err));
|
||||
else
|
||||
fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err));
|
||||
exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR);
|
||||
}
|
||||
}
|
||||
|
||||
if ( have_timeout ) {
|
||||
setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */
|
||||
sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */
|
||||
}
|
||||
|
||||
status = 0;
|
||||
|
||||
if ( cmd_argv ) {
|
||||
pid_t w, f;
|
||||
|
||||
/* Clear any inherited settings */
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
f = fork();
|
||||
|
||||
if ( f < 0 ) {
|
||||
err = errno;
|
||||
fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err));
|
||||
exit(EX_OSERR);
|
||||
} else if ( f == 0 ) {
|
||||
if ( do_close )
|
||||
close(fd);
|
||||
err = errno;
|
||||
execvp(cmd_argv[0], cmd_argv);
|
||||
/* execvp() failed */
|
||||
fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
|
||||
_exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
|
||||
} else {
|
||||
do {
|
||||
w = waitpid(f, &status, 0);
|
||||
if (w == -1 && errno != EINTR)
|
||||
break;
|
||||
} while ( w != f );
|
||||
|
||||
if (w == -1) {
|
||||
err = errno;
|
||||
status = EXIT_FAILURE;
|
||||
fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
|
||||
} else if ( WIFEXITED(status) )
|
||||
status = WEXITSTATUS(status);
|
||||
else if ( WIFSIGNALED(status) )
|
||||
status = WTERMSIG(status) + 128;
|
||||
else
|
||||
status = EX_OSERR; /* WTF? */
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
58
tools/genext2fs/Makefile
Normal file
58
tools/genext2fs/Makefile
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) 2006 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:=genext2fs
|
||||
PKG_VERSION:=1.5.0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/bestouff/$(PKG_NAME)/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=d3861e4fe89131bd21fbd25cf0b683b727b5c030c4c336fadcd738ada830aab0
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS = \
|
||||
--target=$(GNU_HOST_NAME) \
|
||||
--host=$(GNU_HOST_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--program-prefix="" \
|
||||
--program-suffix="" \
|
||||
--prefix=/usr \
|
||||
--exec-prefix=/usr \
|
||||
--bindir=/usr/bin \
|
||||
--sbindir=/usr/sbin \
|
||||
--libexecdir=/usr/lib \
|
||||
--sysconfdir=/etc \
|
||||
--datadir=/usr/share \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--infodir=/usr/info \
|
||||
|
||||
define Host/Configure
|
||||
(cd $(HOST_BUILD_DIR); \
|
||||
./autogen.sh \
|
||||
);
|
||||
$(call Host/Configure/Default)
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
all
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
install -m0755 $(HOST_BUILD_DIR)/genext2fs $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/genext2fs
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
34
tools/gengetopt/Makefile
Normal file
34
tools/gengetopt/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2014 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:=gengetopt
|
||||
PKG_VERSION:=2.23
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
|
||||
PKG_HASH:=b941aec9011864978dd7fdeb052b1943535824169d2aa2b0e7eae9ab807584ac
|
||||
|
||||
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
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/gengetopt
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
@@ -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 );
|
||||
|
||||
@@ -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<class T>
|
||||
-struct print_f : public std::unary_function<T, void>
|
||||
+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<class T>
|
||||
-struct pair_print_f : public std::unary_function<T, void>
|
||||
+struct pair_print_f
|
||||
{
|
||||
pair_print_f(std::ostream& out1, std::ostream& out2, const string &s = ", ") :
|
||||
os1(out1), os2(out2), sep(s) {}
|
||||
39
tools/gmp/Makefile
Normal file
39
tools/gmp/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright (C) 2009-2016 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:=gmp
|
||||
PKG_VERSION:=6.3.0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/gmp/
|
||||
PKG_HASH:=e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c
|
||||
PKG_CPE_ID:=cpe:/a:gmplib:gmp
|
||||
|
||||
HOST_FIXUP:=autoreconf
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
unexport CFLAGS
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--disable-assembly \
|
||||
--enable-cxx
|
||||
|
||||
ifeq ($(GNU_HOST_NAME),x86_64-linux-gnux32)
|
||||
HOST_CONFIGURE_ARGS += ABI=x32
|
||||
endif
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
28
tools/gnulib/Makefile
Normal file
28
tools/gnulib/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gnulib
|
||||
PKG_CPE_ID:=cpe:/a:gnu:$(PKG_NAME)
|
||||
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:=8e6f4a907d9677b55fd452e1340a3e030a6f530b138d420c11975da33f086b1e
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
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)/bin/gnulib-tool $(STAGING_DIR_HOST)/share/gnulib
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
54
tools/gnulib/patches/000-bootstrap.patch
Normal file
54
tools/gnulib/patches/000-bootstrap.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
--- a/build-aux/bootstrap
|
||||
+++ b/build-aux/bootstrap
|
||||
@@ -237,14 +237,14 @@ test -r "$conffile" && . "$conffile"
|
||||
|
||||
check_exists() {
|
||||
if test "$1" = "--verbose"; then
|
||||
- ($2 --version </dev/null) >/dev/null 2>&1
|
||||
+ ($2 $3 $4 --version </dev/null) >/dev/null 2>&1
|
||||
if test $? -ge 126; then
|
||||
# If not found, run with diagnostics as one may be
|
||||
# presented with env variables to set to find the right version
|
||||
- ($2 --version </dev/null)
|
||||
+ ($2 $3 $4 --version </dev/null)
|
||||
fi
|
||||
else
|
||||
- ($1 --version </dev/null) >/dev/null 2>&1
|
||||
+ ($@ --version </dev/null) >/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
|
||||
|
||||
47
tools/gnulib/patches/010-autoconf-version.patch
Normal file
47
tools/gnulib/patches/010-autoconf-version.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
--- a/gnulib-tool
|
||||
+++ b/gnulib-tool
|
||||
@@ -346,6 +346,34 @@ Options for --import, --add/remove-impor
|
||||
Report bugs to <bug-gnulib@gnu.org>."
|
||||
}
|
||||
|
||||
+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
|
||||
|
||||
19
tools/gnulib/patches/120-unmangle-darwin-fts-h.patch
Normal file
19
tools/gnulib/patches/120-unmangle-darwin-fts-h.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
--- /dev/null
|
||||
+++ b/lib/fts.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifdef __APPLE__
|
||||
+# define _FTS_H_ 1
|
||||
+# include <fts_.h>
|
||||
+#else
|
||||
+# include_next <fts.h>
|
||||
+#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
|
||||
193
tools/gnulib/patches/150-portable-tdestroy.patch
Normal file
193
tools/gnulib/patches/150-portable-tdestroy.patch
Normal file
@@ -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 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/search.h.html>
|
||||
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/tsearch.html>
|
||||
@@ -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 <search.h>
|
||||
- ]], [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 <search.h>]])
|
||||
gl_CHECK_FUNCS_ANDROID([twalk], [[#include <search.h>]])
|
||||
+ gl_CHECK_FUNCS_ANDROID([tdestroy], [[#include <search.h>]])
|
||||
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
|
||||
])
|
||||
115
tools/gnulib/patches/160-flag-reallocarray.patch
Normal file
115
tools/gnulib/patches/160-flag-reallocarray.patch
Normal file
@@ -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
|
||||
56
tools/gnulib/patches/200-force-disable-after-configure.patch
Normal file
56
tools/gnulib/patches/200-force-disable-after-configure.patch
Normal file
@@ -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 <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
+#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) */
|
||||
326
tools/gnulib/patches/320-modules-fallocate-posix.patch
Normal file
326
tools/gnulib/patches/320-modules-fallocate-posix.patch
Normal file
@@ -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:
|
||||
+<fcntl.h>
|
||||
+
|
||||
+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 <fcntl.h>]])
|
||||
+ 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.h>
|
||||
- ]], [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 <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdint.h>
|
||||
+#include <sys/fcntl.h>
|
||||
+#include <sys/stat.h>
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+# include <sys/param.h>
|
||||
+# include <sys/mount.h>
|
||||
+#else
|
||||
+# include <sys/statfs.h>
|
||||
+#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
|
||||
27
tools/include/asm/bitsperlong.h
Normal file
27
tools/include/asm/bitsperlong.h
Normal file
@@ -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 */
|
||||
12
tools/include/asm/byteorder.h
Normal file
12
tools/include/asm/byteorder.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef __ASM_BYTEORDER_H
|
||||
#define __ASM_BYTEORDER_H
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
#else
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
40
tools/include/asm/errno-base.h
Normal file
40
tools/include/asm/errno-base.h
Normal file
@@ -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
|
||||
123
tools/include/asm/errno.h
Normal file
123
tools/include/asm/errno.h
Normal file
@@ -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 <asm/errno-base.h>
|
||||
|
||||
#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
|
||||
100
tools/include/asm/posix_types.h
Normal file
100
tools/include/asm/posix_types.h
Normal file
@@ -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 <asm/bitsperlong.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
19
tools/include/asm/swab.h
Normal file
19
tools/include/asm/swab.h
Normal file
@@ -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 <asm/bitsperlong.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
29
tools/include/asm/types.h
Normal file
29
tools/include/asm/types.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* asm-generic/int-ll64.h
|
||||
*
|
||||
* Integer declarations for architectures which use "long long"
|
||||
* for 64-bit types.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_INT_LL64_H
|
||||
#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 */
|
||||
5
tools/include/byteswap.h
Normal file
5
tools/include/byteswap.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#if defined(__linux__) || defined(__CYGWIN__)
|
||||
#include_next <byteswap.h>
|
||||
#else
|
||||
#include <endian.h>
|
||||
#endif
|
||||
4327
tools/include/elf.h
Normal file
4327
tools/include/elf.h
Normal file
File diff suppressed because it is too large
Load Diff
88
tools/include/endian.h
Normal file
88
tools/include/endian.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#ifndef __endian_compat_h
|
||||
#define __endian_compat_h
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__)
|
||||
#include <byteswap.h>
|
||||
#include_next <endian.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <netinet/in.h>
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define bswap_16(x) OSSwapInt16(x)
|
||||
#define bswap_32(x) OSSwapInt32(x)
|
||||
#define bswap_64(x) OSSwapInt64(x)
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define bswap_16(x) bswap16(x)
|
||||
#define bswap_32(x) bswap32(x)
|
||||
#define bswap_64(x) bswap64(x)
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <sys/types.h>
|
||||
#define bswap_16(x) __swap16(x)
|
||||
#define bswap_32(x) __swap32(x)
|
||||
#define bswap_64(x) __swap64(x)
|
||||
#else
|
||||
#include <machine/endian.h>
|
||||
#define bswap_16(x) swap16(x)
|
||||
#define bswap_32(x) swap32(x)
|
||||
#define bswap_64(x) swap64(x)
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_ORDER
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#endif
|
||||
#ifndef __BIG_ENDIAN
|
||||
#define __BIG_ENDIAN BIG_ENDIAN
|
||||
#endif
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
#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
|
||||
107
tools/include/linux/big_endian.h
Normal file
107
tools/include/linux/big_endian.h
Normal file
@@ -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 <linux/stddef.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/swab.h>
|
||||
|
||||
#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 */
|
||||
1
tools/include/linux/errno.h
Normal file
1
tools/include/linux/errno.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm/errno.h>
|
||||
107
tools/include/linux/little_endian.h
Normal file
107
tools/include/linux/little_endian.h
Normal file
@@ -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 <linux/stddef.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/swab.h>
|
||||
|
||||
#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 */
|
||||
56
tools/include/linux/stddef.h
Normal file
56
tools/include/linux/stddef.h
Normal file
@@ -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 */
|
||||
305
tools/include/linux/swab.h
Normal file
305
tools/include/linux/swab.h
Normal file
@@ -0,0 +1,305 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_SWAB_H
|
||||
#define _LINUX_SWAB_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <asm/bitsperlong.h>
|
||||
#include <asm/swab.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
56
tools/include/sys/sysmacros.h
Normal file
56
tools/include/sys/sysmacros.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Definitions of macros to access `dev_t' values.
|
||||
Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library 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.
|
||||
|
||||
The GNU C Library 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 the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef __SYS_SYSMACROS_H
|
||||
#define __SYS_SYSMACROS_H 1
|
||||
|
||||
static inline unsigned int
|
||||
__gnu_dev_major(unsigned long long int __dev)
|
||||
{
|
||||
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
__gnu_dev_minor(unsigned long long int __dev)
|
||||
{
|
||||
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
|
||||
}
|
||||
|
||||
static inline unsigned long long int
|
||||
__gnu_dev_makedev(unsigned int __major, unsigned int __minor)
|
||||
{
|
||||
return ((__minor & 0xff) | ((__major & 0xfff) << 8)
|
||||
| (((unsigned long long int) (__minor & ~0xff)) << 12)
|
||||
| (((unsigned long long int) (__major & ~0xfff)) << 32));
|
||||
}
|
||||
|
||||
/* Access the functions with their traditional names. */
|
||||
#ifndef major
|
||||
# define major(dev) __gnu_dev_major (dev)
|
||||
#endif
|
||||
|
||||
#ifndef minor
|
||||
# define minor(dev) __gnu_dev_minor (dev)
|
||||
#endif
|
||||
|
||||
#ifndef makedev
|
||||
# define makedev(maj, min) __gnu_dev_makedev (maj, min)
|
||||
#endif
|
||||
|
||||
#endif /* sys/sysmacros.h */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user