On Wed, Nov 21, 2018 at 01:19:27PM +0100, Otto Moerbeek wrote: > Hi, > > I am playing with boost contexts which is configured out by the current port. > I am able to make execution_context and fcontext work on amd64. The first > using a simple test program and the second using a non-trival program. > > The only actual change in boost itself is to use a mmap(... > MMAP_STACK ...) for stack allocation. So I like to enable the > disabled parts. They are not extensivly tested and some other parts > might need a patch too (there are several classes creating stacks). > > At the moment I just like to know if I am taking the right approach > port-wise. So, any comments or advise?
Total silence.... remember I'm a total ports newbie, I really could use some guidance here. Is this the right approach for a port having arch specific features and plist? -Otto > > -Otto > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/devel/boost/Makefile,v > retrieving revision 1.75 > diff -u -p -r1.75 Makefile > --- Makefile 11 Sep 2018 19:26:14 -0000 1.75 > +++ Makefile 21 Nov 2018 12:17:35 -0000 > @@ -7,7 +7,7 @@ COMMENT= free peer-reviewed portable C++ > VERSION= 1.66.0 > DISTNAME= boost_${VERSION:S/./_/g} > PKGNAME= boost-${VERSION} > -REVISION= 0 > +REVISION= 2 > CATEGORIES= devel > MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=boost/} > EXTRACT_SUFX= .tar.bz2 > @@ -45,11 +45,7 @@ BOOST_LIBS= boost_atomic-mt \ > boost_unit_test_framework-mt boost_unit_test_framework \ > boost_wserialization-mt boost_wserialization \ > boost_wave-mt \ > - boost_type_erasure-mt boost_type_erasure \ > - > -.for _lib in ${BOOST_LIBS} > -SHARED_LIBS+= ${_lib} ${SO_VERSION} > -.endfor > + boost_type_erasure-mt boost_type_erasure > > HOMEPAGE= http://www.boost.org/ > > @@ -63,6 +59,12 @@ WANTLIB += ${COMPILER_LIBCXX} bz2 c icud > > COMPILER= base-clang ports-gcc > > +.if ${MACHINE_ARCH} == "amd64" > +PKG_ARGS+=-Damd64=1 > +.else > +PKG_ARGS+=-Damd64=0 > +.endif > + > MODULES= lang/python > MODPY_RUNDEP= No > > @@ -102,7 +104,24 @@ BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \ > # 'context' and 'coroutine' use MD bits and miss support for Alpha, > # PA-RISC, SPARC and SuperH. The author does not care > # about adding support for Alpha and PA-RISC. > + > +.if ${MACHINE_ARCH} == "amd64" > +BOOST_LIBS+= boost_context-mt \ > + boost_coroutine boost_coroutine-mt \ > + boost_fiber-mt \ > + boost_stacktrace_basic \ > + boost_stacktrace_basic-mt \ > + boost_stacktrace_addr2line \ > + boost_stacktrace_addr2line-mt \ > + boost_stacktrace_noop \ > + boost_stacktrace_noop-mt > +.else > BOOTSTRAP+= --without-libraries=context,coroutine,fiber,stacktrace > +.endif > + > +.for _lib in ${BOOST_LIBS} > +SHARED_LIBS+= ${_lib} ${SO_VERSION} > +.endfor > > PY2_BOOTSTRAP= > --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} \ > --with-python-version=${MODPY_DEFAULT_VERSION_2} \ > Index: patches/patch-boost_context_fixedsize_stack_hpp > =================================================================== > RCS file: patches/patch-boost_context_fixedsize_stack_hpp > diff -N patches/patch-boost_context_fixedsize_stack_hpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-boost_context_fixedsize_stack_hpp 21 Nov 2018 12:17:35 > -0000 > @@ -0,0 +1,34 @@ > +$OpenBSD$ > + > +Index: boost/context/fixedsize_stack.hpp > +--- boost/context/fixedsize_stack.hpp.orig > ++++ boost/context/fixedsize_stack.hpp > +@@ -26,6 +26,8 @@ > + # include BOOST_ABI_PREFIX > + #endif > + > ++#include <sys/mman.h> > ++ > + namespace boost { > + namespace context { > + > +@@ -42,8 +44,8 @@ class basic_fixedsize_stack { (public) > + } > + > + stack_context allocate() { > +- void * vp = std::malloc( size_); > +- if ( ! vp) { > ++ void * vp = mmap(NULL, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | > MAP_ANON | MAP_STACK, -1, 0); > ++ if ( vp == MAP_FAILED ) { > + throw std::bad_alloc(); > + } > + stack_context sctx; > +@@ -62,7 +64,7 @@ class basic_fixedsize_stack { (public) > + VALGRIND_STACK_DEREGISTER( sctx.valgrind_stack_id); > + #endif > + void * vp = static_cast< char * >( sctx.sp) - sctx.size; > +- std::free( vp); > ++ munmap(vp, sctx.size); > + } > + }; > + > Index: pkg/PFRAG.amd64 > =================================================================== > RCS file: pkg/PFRAG.amd64 > diff -N pkg/PFRAG.amd64 > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ pkg/PFRAG.amd64 21 Nov 2018 12:17:35 -0000 > @@ -0,0 +1,20 @@ > +lib/libboost_context-mt.a > +@lib lib/libboost_context-mt.so.${LIBboost_context-mt_VERSION} > +lib/libboost_coroutine-mt.a > +@lib lib/libboost_coroutine-mt.so.${LIBboost_coroutine-mt_VERSION} > +lib/libboost_coroutine.a > +@lib lib/libboost_coroutine.so.${LIBboost_coroutine_VERSION} > +lib/libboost_fiber-mt.a > +@lib lib/libboost_fiber-mt.so.${LIBboost_fiber-mt_VERSION} > +lib/libboost_stacktrace_addr2line-mt.a > +@lib > lib/libboost_stacktrace_addr2line-mt.so.${LIBboost_stacktrace_addr2line-mt_VERSION} > +lib/libboost_stacktrace_addr2line.a > +@lib > lib/libboost_stacktrace_addr2line.so.${LIBboost_stacktrace_addr2line_VERSION} > +lib/libboost_stacktrace_basic-mt.a > +@lib > lib/libboost_stacktrace_basic-mt.so.${LIBboost_stacktrace_basic-mt_VERSION} > +lib/libboost_stacktrace_basic.a > +@lib lib/libboost_stacktrace_basic.so.${LIBboost_stacktrace_basic_VERSION} > +lib/libboost_stacktrace_noop-mt.a > +@lib > lib/libboost_stacktrace_noop-mt.so.${LIBboost_stacktrace_noop-mt_VERSION} > +lib/libboost_stacktrace_noop.a > +@lib lib/libboost_stacktrace_noop.so.${LIBboost_stacktrace_noop_VERSION} > Index: pkg/PLIST > =================================================================== > RCS file: /cvs/ports/devel/boost/pkg/PLIST,v > retrieving revision 1.19 > diff -u -p -r1.19 PLIST > --- pkg/PLIST 23 Aug 2018 16:38:10 -0000 1.19 > +++ pkg/PLIST 21 Nov 2018 12:17:35 -0000 > @@ -1,6 +1,7 @@ > @comment $OpenBSD: PLIST,v 1.19 2018/08/23 16:38:10 kirby Exp $ > @bin bin/b2 > @bin bin/bjam > +%%amd64%% > include/boost/ > include/boost/accumulators/ > include/boost/accumulators/accumulators.hpp >