2020-10-12 13:52:42 +00:00
PORTNAME = python
2021-04-09 16:28:59 +03:00
DISTVERSION = ${ PYTHON_DISTVERSION }
2020-10-12 13:52:42 +00:00
CATEGORIES = lang python
2021-04-09 16:28:59 +03:00
MASTER_SITES = PYTHON/ftp/python/${ DISTVERSION }
2020-10-12 13:52:42 +00:00
PKGNAMESUFFIX = ${ PYTHON_SUFFIX }
2021-04-09 16:28:59 +03:00
DISTNAME = Python-${ DISTVERSION }
2020-10-12 13:52:42 +00:00
DIST_SUBDIR = python
MAINTAINER = python@FreeBSD.org
COMMENT = Interpreted object-oriented programming language
2022-09-07 23:06:12 +02:00
WWW = https://www.python.org/
2020-10-12 13:52:42 +00:00
LICENSE = PSFL
2025-02-14 07:15:08 +01:00
DEPRECATED = Upgrade to a newer Python version. 3.9 is in maintenance status and gets security fixes only. End-of-Life: 2025-10. See https://devguide.python.org/versions/
EXPIRATION_DATE = 2025-10-31
2021-06-04 17:18:37 +03:00
LIB_DEPENDS = libffi.so:devel/libffi
2023-02-27 18:56:41 -05:00
USES = compiler:c11 cpe ncurses pathfix pkgconfig \
python:${ PYTHON_DISTVERSION : R } ,env readline shebangfix ssl tar:xz
2020-10-12 13:52:42 +00:00
PATHFIX_MAKEFILEIN = Makefile.pre.in
USE_LDCONFIG = yes
GNU_CONFIGURE = yes
2021-04-09 16:28:59 +03:00
python_CMD = ${ PREFIX } /bin/python${ PYTHON_DISTVERSION : R }
2020-10-12 13:52:42 +00:00
SHEBANG_FILES = Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py
SHEBANG_FILES += Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
2023-02-27 22:01:32 +01:00
2020-10-12 13:52:42 +00:00
DISABLED_EXTENSIONS = _sqlite3 _tkinter _gdbm
2021-06-04 17:18:37 +03:00
CONFIGURE_ARGS += --enable-shared --without-ensurepip \
--with-system-ffi
2021-07-06 23:04:38 -03:00
CONFIGURE_ENV += OPT = "" # Null out OPT to respect user CFLAGS and remove optimizations
2020-10-12 13:52:42 +00:00
INSTALL_TARGET = altinstall # Don't want cloberring of unprefixed files
TEST_TARGET = buildbottest
TEST_ARGS = TESTOPTS = -j${ MAKE_JOBS_NUMBER }
MAKE_ARGS += INSTALL_SHARED = " ${ INSTALL_LIB } " # Strip shared library
SUB_FILES = pkg-message
SUB_LIST = PYTHON_SUFFIX = ${ PYTHON_SUFFIX }
PLIST_SUB = ABI = ${ ABIFLAGS } \
2023-10-05 09:58:16 +08:00
DISTVERSION = ${ DISTVERSION } \
2020-10-12 13:52:42 +00:00
OSMAJOR = ${ OSVERSION : C /([0-9]*)[0-9]{5 } /\1 /} # For plat-freebsd* in pkg-plist. https://bugs.python.org/issue19554
2022-03-09 17:30:00 +00:00
OPTIONS_DEFINE = DEBUG IPV6 LIBMPDEC LTO NLS PYMALLOC
2022-04-27 09:22:45 +00:00
OPTIONS_DEFAULT = LIBMPDEC PYMALLOC
2022-03-09 17:30:00 +00:00
OPTIONS_EXCLUDE_riscv64 = LTO
2020-10-12 13:52:42 +00:00
OPTIONS_RADIO = HASH
OPTIONS_RADIO_HASH = FNV SIPHASH
OPTIONS_SUB = yes
2021-05-12 05:44:39 +08:00
LIBMPDEC_DESC = Use libmpdec from ports instead of bundled version
2020-10-12 13:52:42 +00:00
NLS_DESC = Enable gettext support for the locale module
PYMALLOC_DESC = Enable specialized mallocs
HASH_DESC = Hash Algorithm ( PEP-456)
FNV_DESC = Modified Fowler-Noll-Vo Algorithm
SIPHASH_DESC = SipHash24 Algorithm
FNV_CONFIGURE_ON = --with-hash-algorithm= fnv
SIPHASH_CONFIGURE_ON = --with-hash-algorithm= siphash24
DEBUG_CONFIGURE_WITH = pydebug
IPV6_CONFIGURE_ENABLE = ipv6
2021-05-12 05:44:39 +08:00
LIBMPDEC_CONFIGURE_ON = --with-system-libmpdec
LIBMPDEC_LIB_DEPENDS = libmpdec.so:math/mpdecimal
2022-03-09 17:30:00 +00:00
LTO_CONFIGURE_ON = --with-lto
2020-10-12 13:52:42 +00:00
# Use CPPFLAGS over CFLAGS due to -I ordering, causing elementtree and pyexpat
# to break in Python 2.7, or preprocessor complaints in Python >= 3.3
# Upstream Issue: https://bugs.python.org/issue6299
NLS_USES = gettext
NLS_CPPFLAGS = -I${ LOCALBASE } /include
NLS_LIBS = -L${ LOCALBASE } /lib -lintl
NLS_CONFIGURE_ENV_OFF = ac_cv_lib_intl_textdomain = no ac_cv_header_libintl_h = no
PYMALLOC_CONFIGURE_WITH = pymalloc
.include "${.CURDIR}/Makefile.version"
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS : MDEBUG }
ABIFLAGS := d${ ABIFLAGS }
.endif
.if !empty(ABIFLAGS)
PLIST_FILES += bin/python${ PYTHON_VER }${ ABIFLAGS } \
bin/python${ PYTHON_VER }${ ABIFLAGS } -config \
libdata/pkgconfig/python-${ PYTHON_VER }${ ABIFLAGS } .pc \
libdata/pkgconfig/python-${ PYTHON_VER }${ ABIFLAGS } -embed.pc
.endif
# See https://bugs.freebsd.org/115940 and https://bugs.freebsd.org/193650
.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS)
PLIST_SUB += NO_NIS = "@comment "
DISABLED_EXTENSIONS += nis
.else
PLIST_SUB += NO_NIS = ""
.endif
post-patch :
# disable the detection of includes and library from e2fsprogs-libuuid,
# 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
2021-09-27 19:39:05 +02:00
# disable detection of multiarch as it breaks with clang >= 13, which adds a
# major.minor version number in -print-multiarch output, confusing Python
2021-11-26 17:02:16 +01:00
@${ REINPLACE_CMD } -e 's|^\( *MULTIARCH=\).*--print-multiarch.*|\1|' ${ WRKSRC } /configure
2021-07-06 23:04:38 -03:00
# Apply DISABLED_EXTENSIONS
2021-07-19 01:54:21 +08:00
@${ ECHO_CMD } '*disabled*' > ${ WRKSRC } /Modules/Setup.local
2021-07-06 23:04:38 -03:00
. for _module in ${DISABLED_EXTENSIONS}
2021-07-19 01:54:21 +08:00
@${ECHO_CMD} ${_module} >> ${WRKSRC}/Modules/Setup.local
2021-07-06 23:04:38 -03:00
. endfor
2020-10-12 13:52:42 +00:00
post-install :
.if ! ${PORT_OPTIONS : MDEBUG }
${ RM } ${ STAGEDIR }${ PREFIX } /lib/libpython3.so # Upstream Issue: https://bugs.python.org/issue17975
.endif
2021-10-13 18:48:56 +02:00
${LN} -sf libpython${PYTHON_VER}${ABIFLAGS}.so.1.0 ${STAGEDIR}${PREFIX}/lib/libpython${PYTHON_VER}${ABIFLAGS}.so.1
2020-10-12 13:52:42 +00:00
# This code block exists for the qemu-user enabled cross build environment.
# When using this environment in poudriere, CC is not set to the default
# of /usr/bin/cc and a cross-compile toolchain is used. We need to hand
# edit this so that the run time configuration for python matches what the
# FreeBSD base system provides. sbruno 02Aug2017
.if ${CC} == /nxb-bin/usr/bin/cc
@${ REINPLACE_CMD } -e 's=/nxb-bin==' \
${ STAGEDIR }${ PREFIX } /lib/python${ PYTHON_VER } /_sysconfigdata_${ ABIFLAGS } _freebsd${ OSREL : R } _.py
@cd ${ WRKSRC } && ${ SETENV } LD_LIBRARY_PATH = ${ WRKSRC } \
./python -E -m compileall -d ${ PREFIX } /lib/python${ PYTHON_VER } \
${ STAGEDIR }${ PREFIX } /lib/python${ PYTHON_VER } /_sysconfigdata_${ ABIFLAGS } _freebsd${ OSREL : R } _.py
@cd ${ WRKSRC } && ${ SETENV } LD_LIBRARY_PATH = ${ WRKSRC } \
./python -E -O -m compileall -d ${ PREFIX } /lib/python${ PYTHON_VER } \
${ STAGEDIR }${ PREFIX } /lib/python${ PYTHON_VER } /_sysconfigdata_${ ABIFLAGS } _freebsd${ OSREL : R } _.py
@${ REINPLACE_CMD } -e 's=/nxb-bin==' \
${ STAGEDIR }${ PREFIX } /lib/python${ PYTHON_VER } /config-${ PYTHON_VER }${ ABIFLAGS } /Makefile
.endif
for i in ${STAGEDIR}${PREFIX}/lib/python${PYTHON_VER}/lib-dynload/*.so; do \
${STRIP_CMD} $$ i; done # Strip shared extensions
${ INSTALL_DATA } ${ WRKSRC } /Tools/gdb/libpython.py \
${ STAGEDIR }${ PREFIX } /lib/libpython${ PYTHON_VER }${ ABIFLAGS } .so.1.0-gdb.py
.include <bsd.port.mk>