1PORTNAME= python 2DISTVERSION= ${PYTHON_DISTVERSION} 3PORTREVISION= 1 4CATEGORIES= lang python 5MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//} 6PKGNAMESUFFIX= ${PYTHON_SUFFIX} 7DISTNAME= Python-${DISTVERSION} 8DIST_SUBDIR= python 9 10PATCH_SITES= https://github.com/python/cpython/commit/ 11PATCHFILES= c97e87593063d84a2bd9fe7068b30eb44de23dc0.patch:-p1 \ 12 5dc101675fd22918facbbe0fecdc821502beaaf0.patch:-p1 13 14MAINTAINER= ports@MidnightBSD.org 15COMMENT= Interpreted object-oriented programming language 16WWW= https://www.python.org/ 17 18LICENSE= python 19 20DEPRECATED= Python 3.10 is an old version in the last year of security support, see to it that your favorite ports get updated for newer Python releases in due time 21EXPIRATION_DATE=2026-09-30 22 23LIB_DEPENDS= libffi.so:devel/libffi 24 25USES= compiler:c11 cpe ncurses pathfix pkgconfig \ 26 python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz 27PATHFIX_MAKEFILEIN= Makefile.pre.in 28USE_LDCONFIG= yes 29GNU_CONFIGURE= yes 30python_CMD= ${PREFIX}/bin/python${PYTHON_DISTVERSION:R} 31SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py 32SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \ 33 Lib/test/ziptestdata/exe_with_zip \ 34 Lib/test/ziptestdata/header.sh 35 36DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm 37CONFIGURE_ARGS+= --enable-shared --without-ensurepip \ 38 --with-system-ffi 39CONFIGURE_ENV+= OPT="" # Null out OPT to respect user CFLAGS and remove optimizations 40 41INSTALL_TARGET= altinstall # Don't want cloberring of unprefixed files 42 43TEST_TARGET= buildbottest 44TEST_ARGS= TESTOPTS=-j${MAKE_JOBS_NUMBER} 45 46MAKE_ARGS+= INSTALL_SHARED="${INSTALL_LIB}" # Strip shared library 47 48SUB_FILES= pkg-message 49SUB_LIST= PYTHON_SUFFIX=${PYTHON_SUFFIX} 50 51PLIST_SUB= ABI=${ABIFLAGS} \ 52 XY=${PYTHON_SUFFIX} \ 53 XYDOT=${PYTHON_VER} \ 54 XYZDOT=${DISTVERSION} \ 55 DISTVERSION=${DISTVERSION} \ 56 OSMAJOR=${OSVERSION:C/([0-9]*)[0-9]{5}/\1/} # For plat-midnightbsd* in pkg-plist. https://bugs.python.org/issue19554 57 58OPTIONS_DEFINE= DEBUG IPV6 LIBMPDEC LTO NLS PYMALLOC 59OPTIONS_DEFAULT= LIBMPDEC PYMALLOC 60OPTIONS_EXCLUDE_riscv64= LTO 61OPTIONS_RADIO= HASH 62OPTIONS_RADIO_HASH= FNV SIPHASH 63OPTIONS_SUB= yes 64 65LIBMPDEC_DESC= Use libmpdec from ports instead of bundled version 66NLS_DESC= Enable gettext support for the locale module 67PYMALLOC_DESC= Enable specialized mallocs 68 69HASH_DESC= Hash Algorithm (PEP-456) 70FNV_DESC= Modified Fowler-Noll-Vo Algorithm 71SIPHASH_DESC= SipHash24 Algorithm 72 73FNV_CONFIGURE_ON= --with-hash-algorithm=fnv 74SIPHASH_CONFIGURE_ON= --with-hash-algorithm=siphash24 75 76DEBUG_CONFIGURE_WITH= pydebug 77IPV6_CONFIGURE_ENABLE= ipv6 78 79LIBMPDEC_CONFIGURE_ON= --with-system-libmpdec 80LIBMPDEC_LIB_DEPENDS= libmpdec.so:math/mpdecimal 81 82LTO_CONFIGURE_ON= --with-lto 83 84# Use CPPFLAGS over CFLAGS due to -I ordering, causing elementtree and pyexpat 85# to break in Python 2.7, or preprocessor complaints in Python >= 3.3 86# Upstream Issue: https://bugs.python.org/issue6299 87NLS_USES= gettext 88NLS_CPPFLAGS= -I${LOCALBASE}/include 89NLS_LIBS= -L${LOCALBASE}/lib -lintl 90NLS_CONFIGURE_ENV_OFF= ac_cv_lib_intl_textdomain=no ac_cv_header_libintl_h=no 91 92PYMALLOC_CONFIGURE_WITH= pymalloc 93 94NO_TEST= yes 95 96.include "${.CURDIR}/Makefile.version" 97.include <bsd.mport.options.mk> 98 99.if ${PORT_OPTIONS:MDEBUG} 100ABIFLAGS:= d${ABIFLAGS} 101.endif 102 103.if !empty(ABIFLAGS) 104PLIST_FILES+= bin/python${PYTHON_VER}${ABIFLAGS} \ 105 bin/python${PYTHON_VER}${ABIFLAGS}-config \ 106 libdata/pkgconfig/python-${PYTHON_VER}${ABIFLAGS}.pc \ 107 libdata/pkgconfig/python-${PYTHON_VER}${ABIFLAGS}-embed.pc 108.endif 109 110# See https://bugs.freebsd.org/115940 and https://bugs.freebsd.org/193650 111.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS) 112PLIST_SUB+= NO_NIS="@comment " 113DISABLED_EXTENSIONS+= nis 114.else 115PLIST_SUB+= NO_NIS="" 116.endif 117 118.if ${SSL_DEFAULT:Mlibressl*} 119EXTRA_PATCHES+= ${PATCHDIR}/libressl 120.endif 121 122post-patch: 123# disable the detection of includes and library from e2fsprogs-libuuid, 124# which introduces hidden dependency and breaks build 125 @${REINPLACE_CMD} -e 's|uuid/uuid.h|ignore_&|' ${WRKSRC}/configure 126 @${REINPLACE_CMD} -e '/find_library_file/ s|uuid|ignore_&|' ${WRKSRC}/setup.py 127# disable detection of multiarch as it breaks with clang >= 13, which adds a 128# major.minor version number in -print-multiarch output, confusing Python 129 @${REINPLACE_CMD} -e 's|^\( *MULTIARCH=\).*--print-multiarch.*|\1|' ${WRKSRC}/configure 130# Apply DISABLED_EXTENSIONS 131 @${ECHO_CMD} '*disabled*' > ${WRKSRC}/Modules/Setup.local 132. for _module in ${DISABLED_EXTENSIONS} 133 @${ECHO_CMD} ${_module} >> ${WRKSRC}/Modules/Setup.local 134. endfor 135 136post-install: 137.if ! ${PORT_OPTIONS:MDEBUG} 138 ${RM} ${PREFIX}/lib/libpython3.so # Upstream Issue: https://bugs.python.org/issue17975 139.endif 140 ${LN} -sf libpython${PYTHON_VER}${ABIFLAGS}.so.1.0 ${PREFIX}/lib/libpython${PYTHON_VER}${ABIFLAGS}.so.1 141# This code block exists for the qemu-user enabled cross build environment. 142# When using this environment in poudriere, CC is not set to the default 143# of /usr/bin/cc and a cross-compile toolchain is used. We need to hand 144# edit this so that the run time configuration for python matches what the 145# FreeBSD base system provides. sbruno 02Aug2017 146.if ${CC} == /nxb-bin/usr/bin/cc 147 @${REINPLACE_CMD} -e 's=/nxb-bin==' \ 148 ${PREFIX}/lib/python${PYTHON_VER}/_sysconfigdata_${ABIFLAGS}_midnightbsd${OSREL:R}_.py 149 @cd ${WRKSRC} && ${SETENV} LD_LIBRARY_PATH=${WRKSRC} \ 150 ./python -E -m compileall -d ${PREFIX}/lib/python${PYTHON_VER} \ 151 ${PREFIX}/lib/python${PYTHON_VER}/_sysconfigdata_${ABIFLAGS}_midnightbsd${OSREL:R}_.py 152 @cd ${WRKSRC} && ${SETENV} LD_LIBRARY_PATH=${WRKSRC} \ 153 ./python -E -O -m compileall -d ${PREFIX}/lib/python${PYTHON_VER} \ 154 ${PREFIX}/lib/python${PYTHON_VER}/_sysconfigdata_${ABIFLAGS}_midnightbsd${OSREL:R}_.py 155 @${REINPLACE_CMD} -e 's=/nxb-bin==' \ 156 ${PREFIX}/lib/python${PYTHON_VER}/config-${PYTHON_VER}${ABIFLAGS}/Makefile 157.endif 158 for i in ${PREFIX}/lib/python${PYTHON_VER}/lib-dynload/*.so; do \ 159 ${STRIP_CMD} $$i; done # Strip shared extensions 160 ${INSTALL_DATA} ${WRKSRC}/Tools/gdb/libpython.py \ 161 ${PREFIX}/lib/libpython${PYTHON_VER}${ABIFLAGS}.so.1.0-gdb.py 162 -${CP} ${FAKE_DESTDIR}${PREFIX}/libdata/pkgconfig/*.pc ${PREFIX}/libdata/pkgconfig/ 163 164.include <bsd.port.mk> 165