community/yadifa: use patch for musl and rebuild against libressl-2.7

This commit is contained in:
Natanael Copa 2018-04-05 09:04:30 +00:00
parent 6ac8991035
commit 1e7370bfac
4 changed files with 134 additions and 103 deletions

View File

@ -3,7 +3,7 @@
pkgname=yadifa
pkgver=2.3.8
_buildnr=7713
pkgrel=0
pkgrel=1
pkgdesc="Lightweight authoritative Name Server with DNSSEC capabilities"
url="http://www.yadifa.eu"
arch="all"
@ -13,18 +13,13 @@ install="$pkgname.post-install"
options="!libtool"
subpackages="$pkgname-dev $pkgname-doc"
source="http://cdn.yadifa.eu/sites/default/files/releases/$pkgname-$pkgver-$_buildnr.tar.gz
musl-fixes.patch
libressl-2.7.patch
$pkgname.initd
$pkgname.confd"
builddir="$srcdir"/$pkgname-$pkgver-$_buildnr
prepare() {
cd "$builddir"
sed -i -e "s/__linux__/__GLIBC__/g" lib/dnscore/src/debug.c
sed -i -e "s/__linux__/__GLIBC__/g" sbin/yadifad/signals.c
default_prepare
}
build() {
cd "$builddir"
./configure \
@ -57,5 +52,7 @@ package() {
}
sha512sums="4eec9cf0f0d5fba2d38f08d28e59fcb4968b7fc2759c823932781d133e7b81531fec3b81632ebe3c742fe1f8ac117c7ada48eccf3e51b0a48d7cd0c9ceb204a8 yadifa-2.3.8-7713.tar.gz
dec2505a3d2f722a5d90cac94f29e01c91f29e8e6fc07d8ef3ff0ee070920164c72fc86b5ce578a5d016d1dade0b8540faded84a817caa4995a06333fd51f3f5 musl-fixes.patch
41ce4dc505a59925b565b4de3e5acbf816eeafdebc7f723b9534b49f2e30fd854b59d2d0434d80f5770aa84a8785c6480d2bf4e5c8be2651ec1ed421b398a014 libressl-2.7.patch
a3a65bf13f41838d9493facc2903d955aafd107a29d8a73d4ed021690e1e2c511f48915360a9490ccbf8d9573f8e9c3fca988cb6dd5e57546787384e2b2d075d yadifa.initd
eac74148b58d3b7472602542622616bd0ef441b191356a5b7fd06d17284c579139c1fde9b35fbb30a8214394863e31bed4c8521aff7b3f7ea831f14c2a3ccf01 yadifa.confd"

View File

@ -0,0 +1,13 @@
diff --git a/lib/dnscore/include/dnscore/dnskey.h b/lib/dnscore/include/dnscore/dnskey.h
index 98d4347..af7705b 100644
--- a/lib/dnscore/include/dnscore/dnskey.h
+++ b/lib/dnscore/include/dnscore/dnskey.h
@@ -95,8 +95,6 @@
//
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define SSL_API_LT_110 1
-#elif defined(LIBRESSL_VERSION_NUMBER)
-#define SSL_API_LT_110 1
#else
#define SSL_API_LT_110 0
#endif

View File

@ -1,95 +0,0 @@
From 553b9d7d2a3c7cf56d1f02d73eb37cbd5a29e9df Mon Sep 17 00:00:00 2001
From: Bernard Spil <brnrd@FreeBSD.org>
Date: Sat, 25 Feb 2017 12:32:24 +0100
Subject: [PATCH] Fix build issues with LibreSSL
- Check LIBRESSL_VERSION_NUMBER in addition to OpenSSL > 1.1
LibreSSL forked from OpenSSL 1.0.1f and does not have all features
from 1.1.0.
---
lib/dnscore/src/dnskey_dsa.c | 4 ++--
lib/dnscore/src/dnskey_ecdsa.c | 2 +-
lib/dnscore/src/dnskey_rsa.c | 2 +-
lib/dnscore/src/tsig.c | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/dnscore/src/dnskey_dsa.c b/lib/dnscore/src/dnskey_dsa.c
index 43fe450..54b93f0 100644
--- a/lib/dnscore/src/dnskey_dsa.c
+++ b/lib/dnscore/src/dnskey_dsa.c
@@ -70,7 +70,7 @@
#error "OPENSSL_VERSION_NUMBER not defined"
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
/*
* Backward-compatible interface for 0.9.x
@@ -226,7 +226,7 @@ dnskey_dsa_genkey(u32 size)
int err;
DSA* dsa;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
dsa = DSA_generate_parameters(size, NULL,0, NULL, NULL, NULL, NULL);
#else
dsa = DSA_new();
diff --git a/lib/dnscore/src/dnskey_ecdsa.c b/lib/dnscore/src/dnskey_ecdsa.c
index 1638c3b..1ed19d4 100644
--- a/lib/dnscore/src/dnskey_ecdsa.c
+++ b/lib/dnscore/src/dnskey_ecdsa.c
@@ -79,7 +79,7 @@
#define DNSKEY_ALGORITHM_ECDSAP256SHA256_NID NID_X9_62_prime256v1
#define DNSKEY_ALGORITHM_ECDSAP384SHA384_NID NID_secp384r1
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define SSL_FIELD_GET(st_,f_) if(f_ != NULL) { *f_ = st_->f_; }
#define SSL_FIELD_SET(st_,f_) if(f_ != NULL) { BN_free(st_->f_); st_->f_ = f_; }
diff --git a/lib/dnscore/src/dnskey_rsa.c b/lib/dnscore/src/dnskey_rsa.c
index f52f84f..00529ea 100644
--- a/lib/dnscore/src/dnskey_rsa.c
+++ b/lib/dnscore/src/dnskey_rsa.c
@@ -64,7 +64,7 @@
#define MODULE_MSG_HANDLE g_system_logger
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define SSL_FIELD_GET(st_,f_) if(f_ != NULL) { *f_ = st_->f_; }
#define SSL_FIELD_SET(st_,f_) if(f_ != NULL) { BN_free(st_->f_); st_->f_ = f_; }
diff --git a/lib/dnscore/src/tsig.c b/lib/dnscore/src/tsig.c
index 21d7e9d..391e72a 100644
--- a/lib/dnscore/src/tsig.c
+++ b/lib/dnscore/src/tsig.c
@@ -233,7 +233,7 @@
tsig_hmac_t
tsig_hmac_allocate()
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L // ie: 0.9.x
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) // ie: 0.9.x
HMAC_CTX *hmac;
ZALLOC_OR_DIE(HMAC_CTX*, hmac, HMAC_CTX, GENERIC_TAG);
HMAC_CTX_init(hmac);
@@ -257,7 +257,7 @@ tsig_hmac_free(tsig_hmac_t t)
{
HMAC_CTX *hmac = (HMAC_CTX*)t;
yassert(hmac != NULL);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
HMAC_CTX_cleanup(hmac);
ZFREE(t, HMAC_CTX);
#else
@@ -268,7 +268,7 @@ tsig_hmac_free(tsig_hmac_t t)
void tsig_hmac_reset(tsig_hmac_t t)
{
HMAC_CTX *hmac = (HMAC_CTX*)t;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
HMAC_CTX_cleanup(hmac);
HMAC_CTX_init(hmac);
#else

View File

@ -0,0 +1,116 @@
diff --git a/lib/dnscore/src/debug.c b/lib/dnscore/src/debug.c
index e3b6f8f..c52692a 100644
--- a/lib/dnscore/src/debug.c
+++ b/lib/dnscore/src/debug.c
@@ -52,7 +52,7 @@
#include "dnscore/dnscore-config.h"
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__GLIBC__) || defined(__APPLE__)
#include <execinfo.h>
#if HAS_BFD_DEBUG_SUPPORT
#include <bfd.h>
@@ -80,7 +80,7 @@
#undef debug_stat
#undef debug_mallocated
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__GLIBC__) || defined(__APPLE__)
#define ZDB_DEBUG_STACKTRACE 1
#else /* __FreeBSD__ or unknown */
#define ZDB_DEBUG_STACKTRACE 0
@@ -596,7 +596,7 @@ debug_stacktraces_list_set_search(void* data, void* parm)
stacktrace
debug_stacktrace_get()
{
-#ifdef __linux__
+#ifdef __GLIBC__
void* buffer_[1024];
int n = backtrace(buffer_, sizeof(buffer_) / sizeof(void*));
@@ -693,7 +693,7 @@ debug_stacktrace_clear()
void
debug_stacktrace_log(logger_handle* handle, u32 level, stacktrace trace)
{
-#ifdef __linux__
+#ifdef __GLIBC__
int n = 0;
if(trace != NULL)
@@ -753,7 +753,7 @@ debug_stacktrace_log(logger_handle* handle, u32 level, stacktrace trace)
void
debug_stacktrace_try_log(logger_handle* handle, u32 level, stacktrace trace)
{
-#ifdef __linux__
+#ifdef __GLIBC__
int n = 0;
if(trace != NULL)
@@ -819,7 +819,7 @@ debug_stacktrace_print(output_stream *os, stacktrace trace)
return;
}
-#ifdef __linux__
+#ifdef __GLIBC__
int n = 0;
while(trace[n] != 0)
@@ -911,7 +911,7 @@ debug_dump_ex(void* data_pointer_, size_t size_, size_t line_size, bool hex, boo
/****************************************************************************/
-#if defined(__linux__)
+#if defined(__GLIBC__)
bool
debug_log_stacktrace(logger_handle *handle, u32 level, const char *prefix)
@@ -921,7 +921,7 @@ debug_log_stacktrace(logger_handle *handle, u32 level, const char *prefix)
char binary[PATH_MAX];
#endif
-#if defined(__linux__)
+#if defined(__GLIBC__)
int n = backtrace(addresses, sizeof(addresses) / sizeof(void*));
diff --git a/sbin/yadifad/signals.c b/sbin/yadifad/signals.c
index bc83eaf..a4a5546 100644
--- a/sbin/yadifad/signals.c
+++ b/sbin/yadifad/signals.c
@@ -54,7 +54,7 @@
#include <sys/stat.h>
#include <fcntl.h>
-#if defined(__linux__) || defined(__gnu_hurd__)
+#if defined(__GLIBC__) || defined(__gnu_hurd__)
#define _GNU_SOURCE 1
#include <execinfo.h>
#include <sys/mman.h>
@@ -587,7 +587,7 @@ signal_handler(int signo, siginfo_t* info, void* context)
log_err(filepath);
}
-#if defined(__linux__) || defined(__gnu_hurd__)
+#if defined(__GLIBC__) || defined(__gnu_hurd__)
void* buffer[MAXTRACE];
char** strings;
int n = backtrace(buffer, MAXTRACE);
@@ -617,7 +617,7 @@ signal_handler(int signo, siginfo_t* info, void* context)
log_err(filepath);
}
-#if __linux__
+#if __GLIBC__
ucontext_t* ucontext = (ucontext_t*)context;
/*
filepath[0] = '\0';
@@ -811,7 +811,7 @@ signal_handler(int signo, siginfo_t* info, void* context)
log_err(filepath);
}
-#if __linux__ && (defined(__x86_64__) || defined(__i386__)) && (_BSD_SOURCE || _SVID_SOURCE || _DEFAULT_SOURCE)
+#if __GLIBC__ && (defined(__x86_64__) || defined(__i386__)) && (_BSD_SOURCE || _SVID_SOURCE || _DEFAULT_SOURCE)
// dump more information about the memory address of the error
#define PAGESIZE 4096
#define LINESIZE 32