* Switch to running autoconf.

* Use arc4random instead of a random device.

ok stsp@
This commit is contained in:
naddy 2017-10-25 19:36:46 +00:00
parent b058533a83
commit 2068e861ae
6 changed files with 81 additions and 40 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.41 2017/10/23 21:24:37 stsp Exp $
# $OpenBSD: Makefile,v 1.42 2017/10/25 19:36:46 naddy Exp $
COMMENT= Apache Portable Runtime
V= 1.6.3
DISTNAME= apr-$V
REVISION= 0
SHARED_LIBS += apr-1 6.0 # .6.2
CATEGORIES= devel
@ -19,13 +20,18 @@ WANTLIB += pthread
MASTER_SITES= ${MASTER_SITE_APACHE:=apr/}
CONFIGURE_STYLE=gnu
AUTOCONF_VERSION=2.69
CONFIGURE_STYLE=autoconf autoheader
CONFIGURE_ARGS= --includedir=${LOCALBASE}/include/apr-1/ \
--with-installbuilddir=${LOCALBASE}/lib/apr-1/ \
--enable-other-child \
--enable-threads \
--enable-pool-debug=yes \
ac_cv_prog_AWK=awk
MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/build
post-configure:
sed -i 's@$${LIBTOOL}@${LIBTOOL}@' ${WRKBUILD}/apr-1-config
pre-install:
rm -f ${WRKSRC}/libtool

View File

@ -1,6 +1,7 @@
$OpenBSD: patch-apr-config_in,v 1.2 2012/04/28 09:48:20 stsp Exp $
--- apr-config.in.orig Fri Jun 20 17:46:02 2008
+++ apr-config.in Fri Apr 27 09:51:08 2012
$OpenBSD: patch-apr-config_in,v 1.3 2017/10/25 19:36:46 naddy Exp $
Index: apr-config.in
--- apr-config.in.orig
+++ apr-config.in
@@ -223,11 +223,7 @@ while test $# -gt 0; do
exit 0
;;
@ -10,7 +11,7 @@ $OpenBSD: patch-apr-config_in,v 1.2 2012/04/28 09:48:20 stsp Exp $
- else
- echo "$APR_BUILD_DIR/libtool"
- fi
+ echo "@LIBTOOL@"
+ echo "${LIBTOOL}"
exit 0
;;
--help)

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-build_apr_hints_m4,v 1.1 2017/10/25 19:36:46 naddy Exp $
Index: build/apr_hints.m4
--- build/apr_hints.m4.orig
+++ build/apr_hints.m4
@@ -135,6 +135,7 @@ dnl # Not a problem in 10.20. Otherwise, who k
esac
;;
*-openbsd*)
+ APR_SETIFNULL(apr_lock_method, [USE_FLOCK_SERIALIZE])
APR_ADDTO(CPPFLAGS, [-D_POSIX_THREADS])
# binding to an ephemeral port fails on OpenBSD so override
# the test for O_NONBLOCK inheritance across accept().

View File

@ -1,34 +0,0 @@
$OpenBSD: patch-configure,v 1.11 2017/08/11 14:23:18 danj Exp $
Index: configure
--- configure.orig
+++ configure
@@ -6609,6 +6609,11 @@ if test "x$apr_preload_done" != "xyes" ; then
;;
*-openbsd*)
+ if test -z "$apr_lock_method"; then
+ test "x$silent" != "xyes" && echo " setting apr_lock_method to \"USE_FLOCK_SERIALIZE\""
+ apr_lock_method="USE_FLOCK_SERIALIZE"
+ fi
+
if test "x$CPPFLAGS" = "x"; then
test "x$silent" != "xyes" && echo " setting CPPFLAGS to \"-D_POSIX_THREADS\""
CPPFLAGS="-D_POSIX_THREADS"
@@ -14176,7 +14181,7 @@ esac
LIBTOOL_DEPS=$ltmain
# Always use our own libtool.
-LIBTOOL='$(SHELL) $(apr_builddir)/libtool'
+#LIBTOOL='$(SHELL) $(apr_builddir)/libtool'
@@ -26265,7 +26270,7 @@ for ac_spec in func:semget func:semctl define:SEM_UNDO
done
if test ".$ac_rc" = .yes; then
:
- hassysvser="1"
+ hassysvser="0"
else
:
hassysvser="0"

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-configure_in,v 1.1 2017/10/25 19:36:46 naddy Exp $
Index: configure.in
--- configure.in.orig
+++ configure.in
@@ -2281,7 +2281,7 @@ fi
APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
func:sem_unlink func:sem_post func:sem_wait,
hasposixser="1", hasposixser="0")
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1",
+APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="0",
hassysvser="0")
APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
@@ -2470,6 +2470,8 @@ else
fi
dnl ----------------------------- Checking for /dev/random
+AC_CHECK_FUNCS(arc4random_buf)
+
AC_MSG_CHECKING(for entropy source)
why_no_rand=""
@@ -2486,6 +2488,13 @@ AC_ARG_WITH(egd,
AC_MSG_RESULT(EGD-compatible daemon)
rand="1"
])
+
+if test "$rand" != "1"; then
+ if test "$ac_cv_func_arc4random_buf" = yes; then
+ AC_MSG_RESULT(arc4random)
+ rand="1"
+ fi
+fi
if test "$rand" != "1"; then
AC_ARG_WITH(devrandom,

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-misc_unix_rand_c,v 1.1 2017/10/25 19:36:46 naddy Exp $
Index: misc/unix/rand.c
--- misc/unix/rand.c.orig
+++ misc/unix/rand.c
@@ -87,7 +87,11 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned cha
APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf,
apr_size_t length)
{
-#ifdef DEV_RANDOM
+#ifdef HAVE_ARC4RANDOM
+
+ arc4random_buf(buf, length);
+
+#elif defined(DEV_RANDOM)
int fd = -1;