cbang: update to 1.5.1

This commit is contained in:
Jürgen Buchmüller 2020-06-30 20:31:39 +02:00
parent f1ad5bf856
commit e0141c590d
5 changed files with 3 additions and 363 deletions

View file

@ -1,40 +0,0 @@
From a25113c30d6ce2e04bb5bab517d109047947647b Mon Sep 17 00:00:00 2001
From: Joseph Coffland <joseph@cauldrondevelopment.com>
Date: Sun, 31 May 2020 15:04:16 -0700
Subject: [PATCH 2/7] OpenSSL version check.
---
config/openssl/__init__.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git config/openssl/__init__.py config/openssl/__init__.py
index 421271cd..3b66738d 100644
--- config/openssl/__init__.py
+++ config/openssl/__init__.py
@@ -6,15 +6,14 @@ def check_version(context, version):
context.Message("Checking for openssl version >= %s..." % version)
version = version.split('.')
- src = '#include <openssl/opensslv.h>\nint main() {\nreturn ('
- src += version[0] + '<= (OPENSSL_VERSION_NUMBER >> 28)'
- if 1 < len(version):
- src += ' && ' + version[1] + \
- '<= ((OPENSSL_VERSION_NUMBER >> 20) & 0xf)'
- if 2 < len(version):
- src += ' && ' + version[2] + \
- '<= ((OPENSSL_VERSION_NUMBER >> 12) & 0xf)'
- src += ') ? 0 : 1;}\n'
+ src = '''
+ #include <openssl/opensslv.h>
+ int main() {
+ int v = (%s << 28) + (%s << 20) + (%s << 12);
+ return OPENSSL_VERSION_NUMBER < v;
+ }
+ ''' % (version[0], version[1] if 1 < len(version) else 0,
+ version[2] if 2 < len(version) else 0)
ret = context.TryRun(src, '.cpp')[0]
--
2.27.0.rc1.5.gae92ac8ae3

View file

@ -1,37 +0,0 @@
From 0e24962ff868340636be7a67d7c7e03d2c4dcf15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Sun, 17 May 2020 22:26:09 +0700
Subject: [PATCH 4/7] config/openssl: check OPENSSL_VERSION in compile time
All of required information are available at compile time, use compile
time check to support cross compiling.
---
config/openssl/__init__.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git config/openssl/__init__.py config/openssl/__init__.py
index 3b66738d..8ab89d9f 100644
--- config/openssl/__init__.py
+++ config/openssl/__init__.py
@@ -9,13 +9,14 @@ def check_version(context, version):
src = '''
#include <openssl/opensslv.h>
int main() {
- int v = (%s << 28) + (%s << 20) + (%s << 12);
- return OPENSSL_VERSION_NUMBER < v;
+ int array[1 - 2 * (OPENSSL_VERSION_NUMBER < (%s << 28) + (%s << 20) + (%s << 12))];
+ array[0] = 0;
+ return *array;
}
''' % (version[0], version[1] if 1 < len(version) else 0,
version[2] if 2 < len(version) else 0)
- ret = context.TryRun(src, '.cpp')[0]
+ ret = context.TryCompile(src, '.cpp')
context.Result(ret)
return ret
--
2.27.0.rc1.5.gae92ac8ae3

View file

@ -1,114 +0,0 @@
From 062c1a54b295b4ff387ebdff84a6a957fccbefd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Sun, 17 May 2020 22:44:25 +0700
Subject: [PATCH 5/7] libevent: use compile time sizeof check
Taken from https://github.com/scons/scons/wiki/AutoconfRecipes#ac_check_sizeof
---
src/libevent/SConscript | 81 +++++++++++++++++++++++++++++++++++++----
1 file changed, 73 insertions(+), 8 deletions(-)
diff --git src/libevent/SConscript src/libevent/SConscript
index 1197b8d3..ab1f72ad 100644
--- src/libevent/SConscript
+++ src/libevent/SConscript
@@ -18,22 +18,87 @@ conf.AddTest('CheckSYS_TIMERFD_H', CheckSYS_TIMERFD_H)
# sizeof
+# https://github.com/scons/scons/wiki/AutoconfRecipes#ac_check_sizeof
+# Sensible default for common types on common platforms.
+_DEFAULTS_SIZEOF = {
+ 'short' : [2],
+ 'int' : [4, 2],
+ 'long' : [4, 8],
+ 'long long' : [8, 4],
+ 'unsigned short' : [2],
+ 'unsigned int' : [4, 2],
+ 'unsigned long' : [4, 8],
+ 'unsigned long long' : [8, 4],
+ 'float' : [4],
+ 'double' : [8],
+ 'long double' : [12],
+ 'size_t' : [4, 8],
+}
+
def CheckSizeOf(ctx, type, includes = None):
+ """This check can be used to get the size of a given type,
+ or to check whether the type is of expected size.
+
+ Arguments:
+ - type : str
+ the type to check
+ - includes : sequence
+ list of headers to include in the test code before testing the type
+ Returns:
+ status : int
+ 0 if the check failed, or the found size of the type
+ if the check succeeded."""
+ minsz = 0
+ maxsz = 16
+
src = '''
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
- int main() {printf("%d", (int)sizeof(''' + type + ''')); return 0;}
+ #include <stdint.h>
'''
+ if includes:
+ src += "\n".join("#include <%s>\n" % i for i in includes)
- if includes is not None:
- for inc in includes:
- src = '#include <%s>\n%s' % (inc, src)
+ ext = '.c'
+ # test code taken from autoconf: this is a pretty clever hack to find that
+ # a type is of a given size using only compilation. This speeds things up
+ # quite a bit compared to straightforward code using TryRun
+ src += r"""
+typedef %s scons_check_type;
- ctx.Message('Checking size of ' + type + '... ')
- ret = ctx.TryRun(src + '\n', '.c')
- ctx.Result(ret[0])
- return ret[1]
+int main()
+{
+ static int test_array[1 - 2 * ((long int) sizeof(scons_check_type) > %d)];
+ test_array[0] = 0;
+
+ return 0;
+}
+"""
+
+ # Only check if the given size is the right one
+ ctx.Message('Checking size of %s ... ' % type)
+
+ # Try sensible defaults first
+ try:
+ szrange = _DEFAULTS_SIZEOF[type]
+ except KeyError:
+ szrange = []
+ szrange.extend(range(minsz, maxsz))
+ st = 0
+
+ # Actual test
+ for sz in szrange:
+ st = ctx.TryCompile(src % (type, sz), ext)
+ if st:
+ break
+
+ if st:
+ ctx.Result('%d' % sz)
+ return sz
+ else:
+ ctx.Result('Failed !')
+ return 0
conf.AddTest('CheckSizeOf', CheckSizeOf)
--
2.27.0.rc1.5.gae92ac8ae3

View file

@ -1,169 +0,0 @@
From d9b5bf87e724bfbbad78fe254e902048f8d7e534 Mon Sep 17 00:00:00 2001
From: Joseph Coffland <joseph@cauldrondevelopment.com>
Date: Mon, 1 Jun 2020 14:55:52 -0700
Subject: [PATCH 6/7] Fixes and clean up of sizeof test
---
src/libevent/SConscript | 115 ++++++++++------------------------------
1 file changed, 28 insertions(+), 87 deletions(-)
diff --git src/libevent/SConscript src/libevent/SConscript
index ab1f72ad..db9884a6 100644
--- src/libevent/SConscript
+++ src/libevent/SConscript
@@ -17,88 +17,25 @@ def CheckSYS_TIMERFD_H(ctx):
conf.AddTest('CheckSYS_TIMERFD_H', CheckSYS_TIMERFD_H)
-# sizeof
-# https://github.com/scons/scons/wiki/AutoconfRecipes#ac_check_sizeof
-# Sensible default for common types on common platforms.
-_DEFAULTS_SIZEOF = {
- 'short' : [2],
- 'int' : [4, 2],
- 'long' : [4, 8],
- 'long long' : [8, 4],
- 'unsigned short' : [2],
- 'unsigned int' : [4, 2],
- 'unsigned long' : [4, 8],
- 'unsigned long long' : [8, 4],
- 'float' : [4],
- 'double' : [8],
- 'long double' : [12],
- 'size_t' : [4, 8],
-}
-
-def CheckSizeOf(ctx, type, includes = None):
- """This check can be used to get the size of a given type,
- or to check whether the type is of expected size.
-
- Arguments:
- - type : str
- the type to check
- - includes : sequence
- list of headers to include in the test code before testing the type
- Returns:
- status : int
- 0 if the check failed, or the found size of the type
- if the check succeeded."""
- minsz = 0
- maxsz = 16
-
+def CheckSizeOf(ctx, type, defaults, includes = None):
src = '''
- #include <sys/types.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <stdint.h>
+ int main() {
+ int a[1 - 2 * (sizeof(%s) != %d)];
+ return a[0] = 0;
+ }
'''
- if includes:
- src += "\n".join("#include <%s>\n" % i for i in includes)
-
- ext = '.c'
- # test code taken from autoconf: this is a pretty clever hack to find that
- # a type is of a given size using only compilation. This speeds things up
- # quite a bit compared to straightforward code using TryRun
- src += r"""
-typedef %s scons_check_type;
-
-int main()
-{
- static int test_array[1 - 2 * ((long int) sizeof(scons_check_type) > %d)];
- test_array[0] = 0;
- return 0;
-}
-"""
+ if includes:
+ src = '\n'.join('#include <%s>' % i for i in includes) + '\n' + src
- # Only check if the given size is the right one
ctx.Message('Checking size of %s ... ' % type)
- # Try sensible defaults first
- try:
- szrange = _DEFAULTS_SIZEOF[type]
- except KeyError:
- szrange = []
- szrange.extend(range(minsz, maxsz))
- st = 0
-
- # Actual test
- for sz in szrange:
- st = ctx.TryCompile(src % (type, sz), ext)
- if st:
- break
-
- if st:
- ctx.Result('%d' % sz)
- return sz
- else:
- ctx.Result('Failed !')
- return 0
+ for sz in defaults + range(1, 16):
+ if ctx.TryCompile(src % (type, sz), '.c'):
+ ctx.Result(str(sz))
+ return sz
+
+ raise Exception('Failed to get the sizeof of ' + type)
conf.AddTest('CheckSizeOf', CheckSizeOf)
@@ -209,7 +146,17 @@ headers = '''arpa/inet.h fcntl.h ifaddrs.h inttypes.h mach/mach_time.h
'''
decls = '''CTL_KERN KERN_ARND KERN_RANDOM RANDOM_UUID'''
structs = 'addrinfo in6_addr sockaddr_in6 sockaddr_storage'
-sizeof = ['int', 'long', 'long long', 'off_t', 'short', 'size_t', 'void *']
+
+sizeof = [
+ ('short', [2], None),
+ ('int', [4, 2], None),
+ ('long', [8, 4], None),
+ ('long long', [8, 4], None),
+ ('void *', [8, 4], None),
+ ('size_t', [8, 4], ['sys/types.h']),
+ ('off_t', [8, 4], ['sys/types.h']),
+ ('pthread_t', [8, 4], ['pthread.h']),
+]
gethostbyname_r_3_arg_src = '''
#ifndef __cplusplus
@@ -284,13 +231,9 @@ def get_event_config_defs():
# Sizes
- for type in sizeof:
- size = conf.CheckSizeOf(type)
- if size:
- defs['SIZEOF_' + to_def(type)] = size
-
- size = conf.CheckSizeOf('pthread_t', ['pthread.h'])
- if size: defs['SIZEOF_PTHREAD_T'] = size
+ for type, defaults, includes in sizeof:
+ size = conf.CheckSizeOf(type, defaults, includes)
+ defs['SIZEOF_' + to_def(type)] = size
# Decls
@@ -380,13 +323,11 @@ def build_function(target, source, env):
f = open(target, 'w')
- f.write('#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_\n')
- f.write('#define EVENT2_EVENT_CONFIG_H_INCLUDED_\n')
+ f.write('#pragma once\n')
for name, value in sorted(defs.items()):
f.write('#define EVENT__%s %s\n' % (name, value))
- f.write('#endif /* EVENT2_EVENT_CONFIG_H_INCLUDED_ */\n')
f.close()
--
2.27.0.rc1.5.gae92ac8ae3

View file

@ -1,7 +1,7 @@
# Template file for 'cbang' # Template file for 'cbang'
pkgname=cbang pkgname=cbang
version=1.5.0 version=1.5.1
revision=3 revision=1
build_style=scons build_style=scons
make_build_args="sharedlib=1 staticlib=1" make_build_args="sharedlib=1 staticlib=1"
make_install_args="${make_build_args}" make_install_args="${make_build_args}"
@ -13,7 +13,7 @@ maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="LGPL-2.1-only" license="LGPL-2.1-only"
homepage="https://github.com/CauldronDevelopmentLLC/cbang" homepage="https://github.com/CauldronDevelopmentLLC/cbang"
distfiles="https://github.com/CauldronDevelopmentLLC/cbang/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz" distfiles="https://github.com/CauldronDevelopmentLLC/cbang/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz"
checksum=6469c9fba9c47b5731a15294550575a4b71851d2eb52df0f20cfb0f03ed943f5 checksum=cff5e9e9280512c49439643465dec9e84f84debaa02fe2473e51b37f6fa50846
pre_build() { pre_build() {
make_build_args+=" prefix=$DESTDIR/usr" make_build_args+=" prefix=$DESTDIR/usr"