-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #4030 - str4d:freebsd-build, r=str4d
Add FreeBSD build support Usage on FreeBSD: > $ pkg install autoconf automake bash cmake gcc gmake libtool pkgconf > $ MAKE=gmake ./zcutil/build.sh Closes #4023.
- Loading branch information
Showing
12 changed files
with
173 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build_freebsd_SHA256SUM = shasum -a 256 | ||
build_freebsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
freebsd_CFLAGS=-pipe | ||
freebsd_CXXFLAGS=$(freebsd_CFLAGS) | ||
|
||
freebsd_release_CFLAGS=-O1 | ||
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) | ||
|
||
freebsd_debug_CFLAGS=-O1 | ||
freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS) | ||
|
||
freebsd_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC | ||
|
||
ifeq (86,$(findstring 86,$(build_arch))) | ||
i686_freebsd_CC=gcc -m32 | ||
i686_freebsd_CXX=g++ -m32 | ||
i686_freebsd_AR=ar | ||
i686_freebsd_RANLIB=ranlib | ||
i686_freebsd_NM=nm | ||
i686_freebsd_STRIP=strip | ||
|
||
x86_64_freebsd_CC=gcc -m64 | ||
x86_64_freebsd_CXX=g++ -m64 | ||
x86_64_freebsd_AR=ar | ||
x86_64_freebsd_RANLIB=ranlib | ||
x86_64_freebsd_NM=nm | ||
x86_64_freebsd_STRIP=strip | ||
else | ||
i686_freebsd_CC=$(default_host_CC) -m32 | ||
i686_freebsd_CXX=$(default_host_CXX) -m32 | ||
x86_64_freebsd_CC=$(default_host_CC) -m64 | ||
x86_64_freebsd_CXX=$(default_host_CXX) -m64 | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
depends/patches/libevent/detect-arch4random_addrandom-fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From 266f43af7798befa3d27bfabaa9ae699259c3924 Mon Sep 17 00:00:00 2001 | ||
From: Azat Khuzhin <a3at.mail@gmail.com> | ||
Date: Mon, 27 Mar 2017 15:50:23 +0300 | ||
Subject: [PATCH] Fix arc4random_addrandom() detecting and fallback | ||
(regression) | ||
|
||
But this is kind of hot-fix, we definitelly need more sane arc4random | ||
compat layer. | ||
|
||
Fixes: #488 | ||
Introduced-in: 6541168 ("Detect arch4random_addrandom() existence") | ||
--- | ||
event-config.h.cmake | 3 +++ | ||
include/event2/util.h | 2 +- | ||
2 files changed, 4 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/event-config.h.cmake b/event-config.h.cmake | ||
index b7f0be57c..5c233a3d9 100644 | ||
--- a/event-config.h.cmake | ||
+++ b/event-config.h.cmake | ||
@@ -53,6 +53,9 @@ | ||
/* Define to 1 if you have the `arc4random_buf' function. */ | ||
#cmakedefine EVENT__HAVE_ARC4RANDOM_BUF 1 | ||
|
||
+/* Define to 1 if you have the `arc4random_addrandom' function. */ | ||
+#cmakedefine EVENT__HAVE_ARC4RANDOM_ADDRANDOM 1 | ||
+ | ||
/* Define if clock_gettime is available in libc */ | ||
#cmakedefine EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1 | ||
|
||
diff --git a/include/event2/util.h b/include/event2/util.h | ||
index c4af2bd60..ca4048944 100644 | ||
--- a/include/event2/util.h | ||
+++ b/include/event2/util.h | ||
@@ -842,7 +842,7 @@ int evutil_secure_rng_init(void); | ||
EVENT2_EXPORT_SYMBOL | ||
int evutil_secure_rng_set_urandom_device_file(char *fname); | ||
|
||
-#ifdef EVENT__HAVE_ARC4RANDOM_ADDRANDOM | ||
+#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM) | ||
/** Seed the random number generator with extra random bytes. | ||
|
||
You should almost never need to call this function; it should be |
77 changes: 77 additions & 0 deletions
77
depends/patches/libevent/detect-arch4random_addrandom.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
From 6541168d7037457b8e5c51cc354f11bd94e618b6 Mon Sep 17 00:00:00 2001 | ||
From: Marek Sebera <marek.sebera@gmail.com> | ||
Date: Mon, 6 Mar 2017 00:55:16 +0300 | ||
Subject: [PATCH] Detect arch4random_addrandom() existence | ||
|
||
Refs: #370 | ||
Refs: #475 | ||
--- | ||
CMakeLists.txt | 1 + | ||
configure.ac | 1 + | ||
evutil_rand.c | 2 ++ | ||
include/event2/util.h | 2 ++ | ||
4 files changed, 6 insertions(+) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index a861e7d96..f609d02d0 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -338,6 +338,7 @@ CHECK_FUNCTION_EXISTS_EX(sysctl EVENT__HAVE_SYSCTL) | ||
CHECK_FUNCTION_EXISTS_EX(accept4 EVENT__HAVE_ACCEPT4) | ||
CHECK_FUNCTION_EXISTS_EX(arc4random EVENT__HAVE_ARC4RANDOM) | ||
CHECK_FUNCTION_EXISTS_EX(arc4random_buf EVENT__HAVE_ARC4RANDOM_BUF) | ||
+CHECK_FUNCTION_EXISTS_EX(arc4random_addrandom EVENT__HAVE_ARC4RANDOM_ADDRANDOM) | ||
CHECK_FUNCTION_EXISTS_EX(epoll_create1 EVENT__HAVE_EPOLL_CREATE1) | ||
CHECK_FUNCTION_EXISTS_EX(getegid EVENT__HAVE_GETEGID) | ||
CHECK_FUNCTION_EXISTS_EX(geteuid EVENT__HAVE_GETEUID) | ||
diff --git a/configure.ac b/configure.ac | ||
index a127bbc91..e73c29b14 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -342,6 +342,7 @@ AC_CHECK_FUNCS([ \ | ||
accept4 \ | ||
arc4random \ | ||
arc4random_buf \ | ||
+ arc4random_addrandom \ | ||
eventfd \ | ||
epoll_create1 \ | ||
fcntl \ | ||
diff --git a/evutil_rand.c b/evutil_rand.c | ||
index 046a14b07..4be0b1c5e 100644 | ||
--- a/evutil_rand.c | ||
+++ b/evutil_rand.c | ||
@@ -192,12 +192,14 @@ evutil_secure_rng_get_bytes(void *buf, size_t n) | ||
ev_arc4random_buf(buf, n); | ||
} | ||
|
||
+#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM) | ||
void | ||
evutil_secure_rng_add_bytes(const char *buf, size_t n) | ||
{ | ||
arc4random_addrandom((unsigned char*)buf, | ||
n>(size_t)INT_MAX ? INT_MAX : (int)n); | ||
} | ||
+#endif | ||
|
||
void | ||
evutil_free_secure_rng_globals_(void) | ||
diff --git a/include/event2/util.h b/include/event2/util.h | ||
index dd4bbb69d..c4af2bd60 100644 | ||
--- a/include/event2/util.h | ||
+++ b/include/event2/util.h | ||
@@ -842,6 +842,7 @@ int evutil_secure_rng_init(void); | ||
EVENT2_EXPORT_SYMBOL | ||
int evutil_secure_rng_set_urandom_device_file(char *fname); | ||
|
||
+#ifdef EVENT__HAVE_ARC4RANDOM_ADDRANDOM | ||
/** Seed the random number generator with extra random bytes. | ||
|
||
You should almost never need to call this function; it should be | ||
@@ -858,6 +859,7 @@ int evutil_secure_rng_set_urandom_device_file(char *fname); | ||
*/ | ||
EVENT2_EXPORT_SYMBOL | ||
void evutil_secure_rng_add_bytes(const char *dat, size_t datlen); | ||
+#endif | ||
|
||
#ifdef __cplusplus | ||
} |