[Mod] First commit

This commit is contained in:
2022-10-31 22:18:58 +08:00
commit 1c8a3d9709
13090 changed files with 526733 additions and 0 deletions

View File

@ -0,0 +1,58 @@
Fix cross-compilation
Patch was backported from Apache httpd:
http://svn.apache.org/viewvc?view=revision&revision=1327907
http://svn.apache.org/viewvc?view=revision&revision=1328390
http://svn.apache.org/viewvc?view=revision&revision=1328714
Patch submitted upstream:
https://issues.apache.org/bugzilla/show_bug.cgi?id=57058
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
diff -uNr apr-1.5.1.org/configure.in apr-1.5.1/configure.in
--- apr-1.5.1.org/configure.in 2014-01-25 16:17:29.000000000 +0100
+++ apr-1.5.1/configure.in 2014-10-05 11:20:40.080746760 +0200
@@ -118,6 +118,16 @@
echo "Configuring APR library"
echo "Platform: $host"
+dnl In case of cross compilation we set CC_FOR_BUILD to cc unless
+dnl we got already CC_FOR_BUILD from environment.
+if test "x${build_alias}" != "x${host_alias}"; then
+ if test "x${CC_FOR_BUILD}" = "x"; then
+ CC_FOR_BUILD=cc
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CFLAGS_FOR_BUILD)
+
dnl Some initial steps for configuration. We setup the default directory
dnl and which files are to be configured.
diff -uNr apr-1.5.1.org/Makefile.in apr-1.5.1/Makefile.in
--- apr-1.5.1.org/Makefile.in 2014-03-17 16:10:26.000000000 +0100
+++ apr-1.5.1/Makefile.in 2014-10-05 11:22:53.031070519 +0200
@@ -8,6 +8,8 @@
# APR (Apache Portable Runtime) library Makefile.
#
CPP = @CPP@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
# get substituted into some targets
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
@@ -134,8 +134,13 @@
$(APR_MKDIR) tools
$(LT_COMPILE)
+ifdef CC_FOR_BUILD
+tools/gen_test_char@EXEEXT@: tools/gen_test_char.c $(LOCAL_LIBS)
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $<
+else
tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
$(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
+endif
include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
$(APR_MKDIR) include/private

View File

@ -0,0 +1,39 @@
Fix PATH_MAX detection by including sys/param.h if available
Patch sent upstream:
https://bz.apache.org/bugzilla/show_bug.cgi?id=63782
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
diff -uNr apr-1.7.0.orig/configure.in apr-1.7.0/configure.in
--- apr-1.7.0.orig/configure.in 2019-04-01 19:40:46.000000000 +0200
+++ apr-1.7.0/configure.in 2019-09-29 17:03:41.803326791 +0200
@@ -1586,6 +1586,7 @@
AC_SUBST(stringh)
AC_SUBST(stringsh)
AC_SUBST(sys_ioctlh)
+AC_SUBST(sys_paramh)
AC_SUBST(sys_sendfileh)
AC_SUBST(sys_signalh)
AC_SUBST(sys_socketh)
diff -uNr apr-1.7.0.orig/include/apr.h.in apr-1.7.0/include/apr.h.in
--- apr-1.7.0.orig/include/apr.h.in 2019-03-22 14:30:31.000000000 +0100
+++ apr-1.7.0/include/apr.h.in 2019-09-29 17:04:54.203815469 +0200
@@ -95,6 +95,7 @@
#define APR_HAVE_STRINGS_H @stringsh@
#define APR_HAVE_INTTYPES_H @inttypesh@
#define APR_HAVE_SYS_IOCTL_H @sys_ioctlh@
+#define APR_HAVE_SYS_PARAM_H @sys_paramh@
#define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@
#define APR_HAVE_SYS_SIGNAL_H @sys_signalh@
#define APR_HAVE_SYS_SOCKET_H @sys_socketh@
@@ -206,6 +207,9 @@
#include <sys/syslimits.h>
#endif
#endif
+#if APR_HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
/* __APPLE__ is now the official pre-defined macro for macOS */
#ifdef __APPLE__

View File

@ -0,0 +1,69 @@
From a15958a37a06f71c42c690278f9c958b93b7ee20 Mon Sep 17 00:00:00 2001
From: Yann Ylavic <ylavic@apache.org>
Date: Thu, 11 Mar 2021 14:10:21 +0000
Subject: [PATCH] Merge r1887279 from trunk:
build/apr_common.m4: avoid explicit inclusion of "confdefs.h"
The failure is observed on `autoconf-2.69d` (soon to be released
as `autoconf-2.70`). There `int64_t` detection fails as:
$ autoreconf && ./configure
checking whether int64_t and int use fmt %d... no
checking whether int64_t and long use fmt %ld... no
checking whether int64_t and long long use fmt %lld... no
configure: error: could not determine the string function for int64_t
```
This happens because `./configure` always stumbles on warning:
configure:3350: gcc -c -g -O2 -Werror conftest.c >&5
In file included from conftest.c:31:
confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
|
It's triggered by double inclusion of `"confdefs.h"` contents:
explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
via `AC_LANG_SOURCE` use.
To fix it and avoid having to define `main()` declaration the change
uses `AC_LANG_PROGRAM` instead.
Tested on both `autoconf-2.69` and `autoconf-2.69d`.
Github: closes #25
Submitted by: Sergei Trofimovich <slyfox gentoo.org>
Reviewed by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887485 13f79535-47bb-0310-9956-ffa450edef68
[Retrieved from:
https://github.com/apache/apr/commit/0a763c5e500f4304b7c534fae0fad430d64982e8]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
build/apr_common.m4 | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/build/apr_common.m4 b/build/apr_common.m4
index 297dd32cf75..b67a8608abe 100644
--- a/build/apr_common.m4
+++ b/build/apr_common.m4
@@ -467,13 +467,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
CFLAGS="$CFLAGS -Werror"
fi
AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [#include "confdefs.h"
- ]
- [[$1]]
- [int main(int argc, const char *const *argv) {]
+ [AC_LANG_PROGRAM(
+ [[$1]],
[[$2]]
- [ return 0; }]
)], [CFLAGS=$apr_save_CFLAGS
$3], [CFLAGS=$apr_save_CFLAGS
$4])

View File

@ -0,0 +1,57 @@
SECURITY: CVE-2021-35940 (cve.mitre.org)
Restore fix for CVE-2017-12613 which was missing in 1.7.x branch, though
was addressed in 1.6.x in 1.6.3 and later via r1807976.
The fix was merged back to 1.7.x in r1891198.
Since this was a regression in 1.7.0, a new CVE name has been assigned
to track this, CVE-2021-35940.
Thanks to Iveta Cesalova <icesalov redhat.com> for reporting this issue.
https://svn.apache.org/viewvc?view=revision&revision=1891198
[Retrieved from:
https://dist.apache.org/repos/dist/release/apr/patches/apr-1.7.0-CVE-2021-35940.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Index: ./time/unix/time.c
===================================================================
--- ./time/unix/time.c (revision 1891197)
+++ ./time/unix/time.c (revision 1891198)
@@ -142,6 +142,9 @@
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)
Index: ./time/win32/time.c
===================================================================
--- ./time/win32/time.c (revision 1891197)
+++ ./time/win32/time.c (revision 1891198)
@@ -54,6 +54,9 @@
static const int dayoffset[12] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
+ if (tm->wMonth < 1 || tm->wMonth > 12)
+ return APR_EBADDATE;
+
/* Note; the caller is responsible for filling in detailed tm_usec,
* tm_gmtoff and tm_isdst data when applicable.
*/
@@ -228,6 +231,9 @@
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)

16
package/apr/Config.in Normal file
View File

@ -0,0 +1,16 @@
config BR2_PACKAGE_APR
bool "apr"
# apr really needs shared library support
depends on !BR2_STATIC_LIBS
depends on BR2_USE_MMU # fork() in apr_proc_fork()
help
The mission of the Apache Portable Runtime (APR) project is to
create and maintain software libraries that provide a
predictable and consistent interface to underlying
platform-specific implementations
https://apr.apache.org
comment "apr needs a toolchain w/ dynamic library"
depends on BR2_USE_MMU
depends on BR2_STATIC_LIBS

4
package/apr/apr.hash Normal file
View File

@ -0,0 +1,4 @@
# From http://archive.apache.org/dist/apr/apr-1.7.0.tar.bz2.sha256
sha256 e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7ea apr-1.7.0.tar.bz2
# Locally calculated
sha256 f854aeef66ecd55a126226e82b3f26793fc3b1c584647f6a0edc5639974c38ad LICENSE

91
package/apr/apr.mk Normal file
View File

@ -0,0 +1,91 @@
################################################################################
#
# apr
#
################################################################################
APR_VERSION = 1.7.0
APR_SOURCE = apr-$(APR_VERSION).tar.bz2
APR_SITE = https://archive.apache.org/dist/apr
APR_LICENSE = Apache-2.0
APR_LICENSE_FILES = LICENSE
APR_CPE_ID_VENDOR = apache
APR_CPE_ID_PRODUCT = portable_runtime
APR_INSTALL_STAGING = YES
# We have a patch touching configure.in and Makefile.in,
# so we need to autoreconf:
APR_AUTORECONF = YES
# 0004-apr-1.7.0-CVE-2021-35940.patch
APR_IGNORE_CVES += CVE-2021-35940
# avoid apr_hints.m4 by setting apr_preload_done=yes and set
# the needed CFLAGS on our own (avoids '-D_REENTRANT' in case
# not supported by toolchain and subsequent configure failure)
APR_CFLAGS = $(TARGET_CFLAGS) -DLINUX -D_GNU_SOURCE
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
APR_CFLAGS += -D_REENTRANT
endif
APR_CONF_ENV = \
CC_FOR_BUILD="$(HOSTCC)" \
CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
CFLAGS="$(APR_CFLAGS)" \
ac_cv_file__dev_zero=yes \
ac_cv_func_setpgrp_void=yes \
apr_cv_process_shared_works=yes \
apr_cv_mutex_robust_shared=no \
apr_cv_tcp_nodelay_with_cork=yes \
ac_cv_sizeof_struct_iovec=8 \
ac_cv_sizeof_pid_t=4 \
ac_cv_struct_rlimit=yes \
ac_cv_o_nonblock_inherited=no \
apr_cv_mutex_recursive=yes \
apr_cv_epoll=yes \
apr_cv_epoll_create1=yes \
apr_cv_dup3=yes \
apr_cv_sock_cloexec=yes \
apr_cv_accept4=yes \
apr_preload_done=yes
APR_CONFIG_SCRIPTS = apr-1-config
# Doesn't even try to guess when cross compiling
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
APR_CONF_ENV += apr_cv_pthreads_lib="-lpthread"
endif
# Fix lfs detection when cross compiling
APR_CONF_ENV += apr_cv_use_lfs64=yes
# Use non-portable atomics when available. We have to override
# ap_cv_atomic_builtins because the test used to check for atomic
# builtins uses AC_TRY_RUN, which doesn't work when cross-compiling.
ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_8),y)
APR_CONF_OPTS += --enable-nonportable-atomics
APR_CONF_ENV += ap_cv_atomic_builtins=yes
else
APR_CONF_OPTS += --disable-nonportable-atomics
endif
ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
APR_DEPENDENCIES += util-linux
endif
define APR_CLEANUP_UNNEEDED_FILES
$(RM) -rf $(TARGET_DIR)/usr/build-1/
endef
APR_POST_INSTALL_TARGET_HOOKS += APR_CLEANUP_UNNEEDED_FILES
define APR_FIXUP_RULES_MK
$(SED) 's%apr_builddir=%apr_builddir=$(STAGING_DIR)%' \
$(STAGING_DIR)/usr/build-1/apr_rules.mk
$(SED) 's%apr_builders=%apr_builders=$(STAGING_DIR)%' \
$(STAGING_DIR)/usr/build-1/apr_rules.mk
$(SED) 's%top_builddir=%top_builddir=$(STAGING_DIR)%' \
$(STAGING_DIR)/usr/build-1/apr_rules.mk
endef
APR_POST_INSTALL_STAGING_HOOKS += APR_FIXUP_RULES_MK
$(eval $(autotools-package))