asterisk: update the description around -fblocks failing on clang arches,

patch and tweak the port Makefile to make it easier to test this
This commit is contained in:
sthen 2020-09-12 19:35:37 +00:00
parent 363d1e1609
commit 5a89463f17
3 changed files with 43 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.324 2020/09/04 21:22:41 sthen Exp $
# $OpenBSD: Makefile,v 1.325 2020/09/12 19:35:37 sthen Exp $
COMMENT-main= open source multi-protocol PBX and telephony toolkit
@ -46,10 +46,12 @@ DPB_PROPERTIES= parallel
# echo 'int main(){return ^{return 42;}();}' | \
# clang -o /tmp/blockstest -fblocks -x c -L/usr/local/lib -lBlocksRuntime -
#
# -> undefined reference to `_NSConcreteGlobalBlock'
# -> undefined reference to `_NSConcreteGlobalBlock' (also can be tested
# on ld.lld arches by adding "-fuse-ld=bfd")
#
# - runtime fails on ld.lld arches: dlopen()ing the .so modules results in
# undefined symbols from the BlocksRuntime lib.
# undefined symbols (same symbols as ld.bfd detects as missing) from the
# BlocksRuntime lib.
#
# So, as things stand, this requires building with gcc.
#
@ -180,10 +182,6 @@ CONFIGURE_ARGS+= --with-imap=no
## multipackages:
.include <bsd.port.arch.mk>
#.if ${PROPERTIES:Mclang}
#BUILD_DEPENDS+= devel/blocksruntime
#.endif
# calendar
COMMENT-calendar= calendar support for Asterisk
WANTLIB-calendar= crypto expat ical iconv intl iksemel lzma
@ -338,3 +336,9 @@ post-install:
@find ${WRKINST}/opt -type d -delete
.include <bsd.port.mk>
.if ${CHOSEN_COMPILER} == ports-gcc
CFLAGS+= -ftrampolines
.else
BUILD_DEPENDS+= devel/blocksruntime
.endif

View File

@ -1,4 +1,10 @@
$OpenBSD: patch-Makefile,v 1.44 2020/03/29 15:42:27 sthen Exp $
$OpenBSD: patch-Makefile,v 1.45 2020/09/12 19:35:37 sthen Exp $
- don't force compiler flags
- don't unconditionally set -ftrampolines, it is gcc-only.
(Blocksruntime isn't working correctly on OpenBSD anyway so clang
is not yet an option, but patched away here to allow for easier
testing, and added-back in the port Makefile).
Index: Makefile
--- Makefile.orig
@ -22,3 +28,12 @@ Index: Makefile
endif
endif
@@ -231,7 +233,7 @@ ifeq ($(OSARCH),NetBSD)
endif
ifeq ($(OSARCH),OpenBSD)
- _ASTCFLAGS+=-pthread -ftrampolines
+ _ASTCFLAGS+=-pthread
endif
ifeq ($(OSARCH),linux-uclibc)

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-autoconf_ast_check_raii_m4,v 1.4 2020/09/12 19:35:37 sthen Exp $
Index: autoconf/ast_check_raii.m4
--- autoconf/ast_check_raii.m4.orig
+++ autoconf/ast_check_raii.m4
@@ -41,6 +41,10 @@ AC_DEFUN([AST_CHECK_RAII], [
AST_CLANG_BLOCKS_LIBS="-lBlocksRuntime"
AST_CLANG_BLOCKS="-fblocks"
AC_MSG_RESULT(yes)
+ elif test "`echo 'int main(){return ^{return 42;}();}' | ${CC} -o /dev/null -L/usr/local/lib -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
+ AST_CLANG_BLOCKS_LIBS="-L/usr/local/lib -lBlocksRuntime"
+ AST_CLANG_BLOCKS="-fblocks"
+ AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([BlocksRuntime is required for clang, please install libblocksruntime])
fi