Here's a patch to make devel/boost honor CC and CXX.  Also CFLAGS
and CXXFLAGS in some invisible places.

There are three parts to this:

(1) Pass CXX and CXXFLAGS to the configure script run in libs/config.

(2) Separate out the build of the bjam tool from the bootstrap
    procedure.  This is necessary, because there is a back and forth
    problem: if we pass --with-toolset="xxx" to the bootstrap.sh
    script, the jam build.sh script will try to execute a compiler
    "xxx".  If conversely we let the build.sh script autodetect the
    compiler, it may pick up a different one than we want, and if
    it falls back to "cc" (which also honors CC), it will return
    this result to bootstrap.sh, which considers it invalid.

(3) Tell the main build to actually use CXX.  This can simply be
    set in user-config.jam.

Although the boost build now honors CXX, it still assumes that the
compiler is some type of GCC.  This may break with clang.  Nominal
support for clang has only been included in later versions of boost.
Adding something along the lines of

    ...
                    --with-toolset=${COMPILER_TYPE}
    ...
            echo "using ${COMPILER_TYPE} : : ${CXX} ;" 
>>${WRKSRC}/tools/build/user-config.jam
    ...
    .include <bsd.port.arch.mk>
    .if ${PROPERTIES:Mclang}
    COMPILER_TYPE=clang
    .else
    COMPILER_TYPE=gcc
    .endif
    ...

should be straightforward then.


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/boost/Makefile,v
retrieving revision 1.59
diff -u -p -r1.59 Makefile
--- Makefile    13 Sep 2016 14:40:29 -0000      1.59
+++ Makefile    6 Mar 2017 17:36:57 -0000
@@ -5,7 +5,7 @@ ONLY_FOR_ARCHS= ${GCC4_ARCHS}
 COMMENT=       free peer-reviewed portable C++ source libraries
 
 VERSION=       1.58.0
-REVISION=      2
+REVISION=      3
 DISTNAME=      boost_${VERSION:S/./_/g}
 PKGNAME=       boost-${VERSION}
 CATEGORIES=    devel
@@ -79,16 +79,19 @@ BJAM_CONFIG=        -sICONV_PATH=${LOCALBASE} \
 
 # 'context' and 'coroutine' use MD bits and miss support for Alpha,
 # PA-RISC, SPARC and SuperH. The author does not care
-# care about adding support for Alpha and PA-RISC.
-BOOTSTRAP=     --with-python=${MODPY_BIN} \
+# about adding support for Alpha and PA-RISC.
+BOOTSTRAP=     --with-bjam=${WRKSRC}/bjam \
+               --with-python=${MODPY_BIN} \
                --with-python-root=${LOCALBASE} \
                --with-python-version=${MODPY_VERSION} \
+               --with-toolset=gcc \
                --without-icu \
                --without-libraries=context,coroutine
 
 # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
 CONFIGURE_STYLE= none
-CONFIGURE_ENV= BJAM_CONFIG="${BJAM_CONFIG}"
+CONFIGURE_ENV= BJAM_CONFIG="${BJAM_CONFIG}" \
+               CXX="${CXX}" CXXFLAGS="${CXXFLAGS}"
 
 DPB_PROPERTIES= parallel
 
@@ -98,10 +101,14 @@ SUBST_VARS+=       SO_VERSION
 
 do-configure:
        echo "using python : ${MODPY_DEFAULT_VERSION_3} : 
${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} : 
${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}$$(python${MODPY_DEFAULT_VERSION_3}-config
 --abiflags) ;" >> ${WRKSRC}/tools/build/user-config.jam
+       echo "using gcc : : ${CXX} ;" >>${WRKSRC}/tools/build/user-config.jam
        @${SUBST_CMD} ${WRKSRC}/Jamroot
        @cd ${WRKSRC}/libs/config && \
            ${SETENV} ${CONFIGURE_ENV} /bin/sh ./configure && \
            cp user.hpp ${WRKSRC}/boost/config
+       @cd ${WRKSRC}/tools/build/src/engine && \
+           ${SETENV} CC="${CC}" CFLAGS="${CFLAGS}" /bin/sh ./build.sh cc && \
+           cp bin.openbsd*/b2 bin.openbsd*/bjam ${WRKSRC}
        @cd ${WRKSRC} && chmod -R a+x ./ && \
            /bin/sh ./bootstrap.sh ${BOOTSTRAP}
 
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to