Index: lang/python36/Makefile =================================================================== --- lang/python36/Makefile +++ lang/python36/Makefile @@ -123,6 +123,17 @@ PLIST_SUB+= NO_NIS="" .endif +post-patch: +# Building _lzma extension fails if archivers/lzmalib is installed. +# This way Python will always link with lzma from base (libarchive). +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209355 +# Eventually we can build it against archivers/lzma, but currently +# the port does not provide header and libraries. +.if exists(${LOCALBASE}/lib/liblzma.so) + @${ECHO_CMD} -e '*shared*\n_lzma _lzmamodule.c -I/usr/include -L/usr/lib -l:liblzma.so.5\n' \ + > ${WRKSRC}/Modules/Setup.local +.endif + post-install: .if ! ${PORT_OPTIONS:MDEBUG} ${RM} ${STAGEDIR}${PREFIX}/lib/libpython3.so # Upstream Issue: https://bugs.python.org/issue17975 Index: lang/python37/Makefile =================================================================== --- lang/python37/Makefile +++ lang/python37/Makefile @@ -112,6 +112,16 @@ # which introduces hidden dependency and breaks build @${REINPLACE_CMD} -e 's|uuid/uuid.h|ignore_&|' ${WRKSRC}/configure @${REINPLACE_CMD} -e '/find_library_file/ s|uuid|ignore_&|' ${WRKSRC}/setup.py +# Building _lzma extension fails if archivers/lzmalib is installed. +# This way Python will always link with lzma from base (libarchive). +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209355 +# Eventually we can build it against archivers/lzma, but currently +# the port does not provide header and libraries. +.if exists(${LOCALBASE}/lib/liblzma.so) + @${ECHO_CMD} -e '*shared*\n_lzma _lzmamodule.c -I/usr/include -L/usr/lib -l:liblzma.so.5\n' \ + > ${WRKSRC}/Modules/Setup.local +.endif + post-install: .if ! ${PORT_OPTIONS:MDEBUG} Index: lang/python38/Makefile =================================================================== --- lang/python38/Makefile +++ lang/python38/Makefile @@ -119,6 +119,15 @@ # which introduces hidden dependency and breaks build @${REINPLACE_CMD} -e 's|uuid/uuid.h|ignore_&|' ${WRKSRC}/configure @${REINPLACE_CMD} -e '/find_library_file/ s|uuid|ignore_&|' ${WRKSRC}/setup.py +# Building _lzma extension fails if archivers/lzmalib is installed. +# This way Python will always link with lzma from base (libarchive). +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209355 +# Eventually we can build it against archivers/lzma, but currently +# the port does not provide header and libraries. +.if exists(${LOCALBASE}/lib/liblzma.so) + @${ECHO_CMD} -e '*shared*\n_lzma _lzmamodule.c -I/usr/include -L/usr/lib -l:liblzma.so.5\n' \ + > ${WRKSRC}/Modules/Setup.local +.endif post-install: .if ! ${PORT_OPTIONS:MDEBUG}