On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:
> 
> This diff drops boost_python27 and boost_numpy27.  I switched the
> defaults to python3 but the boost-build .py files aren't ready for that
> (using python3 -m compileall fails with syntax errors). No idea how
> used/useful boost-build actually is or how maintainers want to deal with
> this python2/3 mix.  One possible approach would be to run 2to3 on
> those files, but this doesn't catch all the py2->py3 gotchas.

I also worked on it yesterday and found the same py2->py3 issue.

> 
> Feedback welcome.
> 
> Unrelated, the do-install part has bugged me since some time.  It
> copies ~15000 headers, forking one install(1) process per header file.
> This is expensive, on my builder the diff below moves make fake from
> ~4mn to ~4sec.  I'd like to commit this seperately.  oks?

Nice work! Yes please! OK rsadowski@


> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/boost/Makefile,v
> retrieving revision 1.101
> diff -u -p -r1.101 Makefile
> --- Makefile  5 Nov 2020 11:23:03 -0000       1.101
> +++ Makefile  8 Nov 2020 00:17:38 -0000
> @@ -6,6 +6,7 @@ COMMENT-main= free peer-reviewed portabl
>  COMMENT-md=  machine-dependent libraries for boost
>  
>  VERSION=     1.70.0
> +REVISION=    0
>  DISTNAME=    boost_${VERSION:S/./_/g}
>  PKGNAME-main=        boost-${VERSION}
>  PKGNAME-md=  boost-md-${VERSION}
> @@ -33,9 +34,7 @@ BOOST_LIBS= boost_atomic-mt \
>               boost_math_tr1l-mt boost_math_tr1l \
>               boost_prg_exec_monitor-mt boost_prg_exec_monitor \
>               boost_program_options-mt boost_program_options \
> -             boost_numpy27-mt boost_numpy27 \
>               boost_numpy38-mt boost_numpy38 \
> -             boost_python27-mt boost_python27 \
>               boost_python38-mt boost_python38 \
>               boost_random-mt boost_random \
>               boost_regex-mt boost_regex \
> @@ -79,12 +78,12 @@ COMPILER= base-clang ports-gcc
>  MULTI_PACKAGES=      -main -md
>  
>  MODULES=     lang/python
> +MODPY_VERSION=       ${MODPY_DEFAULT_VERSION_3}
>  MODPY_RUNDEP=        No
>  
> -# extras needed until py2 support can be removed
> -BUILD_DEPENDS+=      math/py-numpy \
> -             math/py-numpy,python3 \
> -             lang/python/${MODPY_DEFAULT_VERSION_3}
> +BUILD_DEPENDS+=      math/py-numpy${MODPY_FLAVOR}
> +# needed for byte-compiling boost-build
> +BUILD_DEPENDS+=      lang/python/${MODPY_DEFAULT_VERSION_2}
>  
>  LIB_DEPENDS= archivers/bzip2 \
>               textproc/icu4c
> @@ -116,11 +115,11 @@ BJAM_CONFIG=    -sICU_PATH=${LOCALBASE} \
>               cxxflags='${CXXFLAGS} -pthread' \
>               variant=release \
>               link=static,shared \
> -             threading=single,multi \
> +             threading=single,multi
>  
>  BOOTSTRAP=   --with-bjam=${WRKSRC}/bjam \
>               --with-toolset=${TOOLSET} \
> -             --with-python-root=${LOCALBASE}
> +             --with-python=${MODPY_BIN}
>  
>  # 'context' and 'coroutine' use MD bits and miss support for Alpha,
>  # PA-RISC, SPARC and SuperH. The author does not care
> @@ -129,18 +128,6 @@ BOOTSTRAP=       --with-bjam=${WRKSRC}/bjam \
>  BOOTSTRAP+=  --without-libraries=context,coroutine,fiber,stacktrace
>  .endif
>  
> -PY2_BOOTSTRAP=       
> --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} \
> -             --with-python-version=${MODPY_DEFAULT_VERSION_2} \
> -
> -PY3_BOOTSTRAP=       
> --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} \
> -             --with-python-version=${MODPY_DEFAULT_VERSION_3} \
> -
> -PY2_INC=     ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_2}
> -PY3_INC=     ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}
> -
> -# temporary dir to stash libs when rebuilding with py2
> -PY3_DIR=     ${WRKDIR}/lib.py3
> -
>  # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
>  CONFIGURE_STYLE= none
>  
> @@ -164,39 +151,20 @@ do-configure:
>       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} && ${SETENV} /bin/sh ./bootstrap.sh ${BOOTSTRAP}
>  
> -# b2 doesn't seem to respect python parameter, we need to run twice with
> -# separate python environments. when we remove py2 support later, bootstrap
> -# can move back to the configure stage and avoid the build/rm/rebuild dance..
>  do-build:
> -     # First run of bootstrap/b2, setup for py3 environment:
> -     sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY3_INC} \;;' \
> -             < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
> -     cd ${WRKSRC} && export ${MAKE_ENV} && \
> -             /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY3_BOOTSTRAP} && \
> -             ./b2 ${BJAM_CONFIG} --with-python 
> python=${MODPY_DEFAULT_VERSION_3}
> -     # Stash py3 libs in temporary dir:
> -     mkdir ${PY3_DIR}
> -     mv ${WRKSRC}/stage/lib/lib*python3* ${PY3_DIR}
> -     mv ${WRKSRC}/stage/lib/lib*numpy3* ${PY3_DIR}
> -     # Remove py3 .o files to force python recompilation:
> -     rm ${WRKSRC}/project-config.jam
> -     find ${WRKSRC}/bin.v2/libs/python -name "*.o" -type f -delete
> -     # Second run of bootstrap/b2, setup for py2 environment:
> -     sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY2_INC} \;;' \
> -             < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
>       cd ${WRKSRC} && export ${MAKE_ENV} && \
> -             /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY2_BOOTSTRAP} && \
> -             ./b2 ${BJAM_CONFIG} python=${MODPY_DEFAULT_VERSION_2}
> +             ./b2 ${BJAM_CONFIG}
>  
>  do-install:
>       # Libs and includes:
>       ${INSTALL_DATA} ${WRKSRC}/stage/lib/lib!(*.so) ${PREFIX}/lib
> -     ${INSTALL_DATA} ${PY3_DIR}/lib!(*.so) ${PREFIX}/lib
> -     cd ${WRKSRC} && \
> -             find boost -type d -exec ${INSTALL_DATA_DIR} 
> ${PREFIX}/include/{} \;
> -     cd ${WRKSRC} && \
> -             find boost ! -name \*.orig -type f -exec ${INSTALL_DATA} {} 
> ${PREFIX}/include/{} \;
> +     ${INSTALL_DATA_DIR} ${PREFIX}/include/boost
> +     cd ${WRKSRC}/boost && \
> +             pax -rw -s ':^.*\.orig$$::' . ${PREFIX}/include/boost
> +     find ${PREFIX}/include/boost -type d -exec chmod ${DIRMODE} {} +
> +     find ${PREFIX}/include/boost -type f -exec chmod ${SHAREMODE} {} +
>       # boost-build:
>       ${INSTALL_PROGRAM} ${WRKSRC}/tools/build/src/engine/bin.*/{b2,bjam} \
>               ${PREFIX}/bin
> @@ -207,7 +175,7 @@ do-install:
>       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/boost-build
>       ${INSTALL_DATA} ${WRKSRC}/tools/build/example/site-config.jam \
>               ${PREFIX}/share/examples/boost-build
> -     ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
> +     ${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} -m compileall \
>               ${PREFIX}/share/boost-build/
>  
>  .include <bsd.port.mk>
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/devel/boost/pkg/PLIST-main,v
> retrieving revision 1.10
> diff -u -p -r1.10 PLIST-main
> --- pkg/PLIST-main    5 Nov 2020 11:23:03 -0000       1.10
> +++ pkg/PLIST-main    8 Nov 2020 00:17:38 -0000
> @@ -15088,10 +15088,6 @@ include/boost/yap/yap.hpp
>  @lib lib/libboost_math_tr1l-mt.so.${LIBboost_math_tr1l-mt_VERSION}
>  @static-lib lib/libboost_math_tr1l.a
>  @lib lib/libboost_math_tr1l.so.${LIBboost_math_tr1l_VERSION}
> -@static-lib lib/libboost_numpy27-mt.a
> -@lib lib/libboost_numpy27-mt.so.${LIBboost_numpy27-mt_VERSION}
> -@static-lib lib/libboost_numpy27.a
> -@lib lib/libboost_numpy27.so.${LIBboost_numpy27_VERSION}
>  @static-lib lib/libboost_numpy38-mt.a
>  @lib lib/libboost_numpy38-mt.so.${LIBboost_numpy38-mt_VERSION}
>  @static-lib lib/libboost_numpy38.a
> @@ -15104,10 +15100,6 @@ include/boost/yap/yap.hpp
>  @lib 
> lib/libboost_program_options-mt.so.${LIBboost_program_options-mt_VERSION}
>  @static-lib lib/libboost_program_options.a
>  @lib lib/libboost_program_options.so.${LIBboost_program_options_VERSION}
> -@static-lib lib/libboost_python27-mt.a
> -@lib lib/libboost_python27-mt.so.${LIBboost_python27-mt_VERSION}
> -@static-lib lib/libboost_python27.a
> -@lib lib/libboost_python27.so.${LIBboost_python27_VERSION}
>  @static-lib lib/libboost_python38-mt.a
>  @lib lib/libboost_python38-mt.so.${LIBboost_python38-mt_VERSION}
>  @static-lib lib/libboost_python38.a
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

Reply via email to