Files

224 lines
7.2 KiB
Makefile
Raw Permalink Normal View History

2002-05-11 21:35:13 +00:00
# IMPORTANT! If you make any changes to the Python ports, be sure
# to also update files/CHANGES.OpenBSD for your change. This is a
# requirement of the PSF license, if it constitutes a change to
# Python itself.
2002-02-15 19:42:18 +00:00
COMMENT-main = interpreted object-oriented programming language
COMMENT-bsddb = Berkeley db module for Python
COMMENT-gdbm = GNU dbm module for Python
COMMENT-idle = IDE for Python
COMMENT-tests = Python test suite
2022-06-09 14:49:29 +00:00
COMMENT-tkinter = Python interface to the Tk graphical toolkit
COMMENT-tools = extra tools for Python
2002-02-15 19:42:18 +00:00
VERSION = ${FULL_VERSION:R}
DISTNAME = Python-${FULL_VERSION}
PKGNAME-main = python-${FULL_VERSION}
PKGSPEC-main = python-${VERSION_SPEC}
PKGNAME-bsddb = python-bsddb-${FULL_VERSION}
PKGSPEC-bsddb = python-bsddb-${VERSION_SPEC}
PKGNAME-gdbm = python-gdbm-${FULL_VERSION}
PKGSPEC-gdbm = python-gdbm-${VERSION_SPEC}
PKGNAME-idle = python-idle-${FULL_VERSION}
PKGSPEC-idle = python-idle-${VERSION_SPEC}
PKGNAME-tests = python-tests-${FULL_VERSION}
PKGSPEC-tests = python-tests-${VERSION_SPEC}
PKGNAME-tkinter = python-tkinter-${FULL_VERSION}
PKGSPEC-tkinter = python-tkinter-${VERSION_SPEC}
PKGNAME-tools = python-tools-${FULL_VERSION}
PKGSPEC-tools = python-tools-${VERSION_SPEC}
CATEGORIES = lang
2023-09-26 12:02:00 +00:00
SITES = https://www.python.org/ftp/${PSUBDIR}/
PSUBDIR ?= python/${FULL_VERSION}
EXTRACT_SUFX = .tgz
2002-02-15 19:42:18 +00:00
2018-09-18 16:43:12 +00:00
HOMEPAGE = https://www.python.org/
2002-02-15 19:42:18 +00:00
MAINTAINER = Kurt Mosiejczuk <kmos@openbsd.org>
2002-05-11 21:35:13 +00:00
# PSF license <http://www.python.org/${VERSION}/license.html>
# A summary of changes to Python is required to be distributed
PERMIT_PACKAGE = Yes
2002-02-15 19:42:18 +00:00
# XXX on archs with DEBUG_PACKAGES, -g in CFLAGS is carried through to
# CFLAGS/OPT/PY_CFLAGS/etc in _sysconfigdata*.py, which means that it is
# picked up when compiling Python extensions. it might be helpful to
# sanitize these.
.if ${VERSION} == "2.7"
2024-05-06 12:20:20 +00:00
V_SUBDIR = ${VERSION}
MULTI_PACKAGES = -main -tests -tools -gdbm -idle -tkinter -bsddb
2019-11-11 17:47:41 +00:00
DEBUG_PACKAGES ?= -main -gdbm -tkinter -bsddb
# Python 2.7 lists BSD db 4.6.x as unstable on most architectures (see
# setup.py:allow_db_version). XXX revisit if databases/db/v4 is updated to 4.7
ONLY_FOR_ARCHS-bsddb= amd64 i386
.else
2024-05-06 12:20:20 +00:00
V_SUBDIR = 3
MULTI_PACKAGES = -main -tests -gdbm -idle -tkinter
DEBUG_PACKAGES ?= -main -gdbm -tkinter
2008-10-18 11:55:57 +00:00
.endif
COMPILER = base-clang ports-gcc base-gcc
COMPILER_LANGS = c
2002-03-23 04:34:22 +00:00
# All subpackages depend on the main python package.
2024-05-06 12:20:20 +00:00
RUN_DEPENDS = ${FULLPKGNAME-main}:lang/python/${V_SUBDIR},-main
LIB_DEPENDS =
2006-11-24 20:48:23 +00:00
LIB_DEPENDS-main += archivers/bzip2 \
2016-09-23 09:16:52 +00:00
databases/sqlite3 \
devel/libffi \
2019-05-20 22:15:00 +00:00
devel/gettext,-runtime
2010-11-07 19:12:42 +00:00
RUN_DEPENDS-main =
WANTLIB-main += bz2 c crypto expat ffi intl m curses panel pthread \
2019-04-21 09:32:19 +00:00
readline sqlite3 ssl util z
.if ${VERSION} != "2.7"
2024-05-06 12:20:20 +00:00
LIB_DEPENDS-main += archivers/xz \
archivers/zstd
WANTLIB-main += lzma zstd
.endif
2013-05-18 04:13:16 +00:00
2013-05-22 12:36:03 +00:00
WANTLIB-tests =
WANTLIB-tools =
2024-05-06 12:20:20 +00:00
LIB_DEPENDS-bsddb = lang/python/${V_SUBDIR},-main
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
# XXX recursion: if we have java, then db/v4 depends on libxml
LIB_DEPENDS-bsddb += databases/db/v4,no_tcl,no_java,bootstrap
.else
LIB_DEPENDS-bsddb += databases/db/v4
.endif
2020-12-29 23:59:06 +00:00
WANTLIB-bsddb = lib/db4/db>=4 pthread python${VERSION}
LIB_DEPENDS-gdbm = databases/gdbm \
2024-05-06 12:20:20 +00:00
lang/python/${V_SUBDIR},-main
2020-12-29 23:59:06 +00:00
WANTLIB-gdbm = gdbm>=3 pthread python${VERSION}
2013-05-22 12:36:03 +00:00
2024-05-06 12:20:20 +00:00
RUN_DEPENDS-idle = lang/python/${V_SUBDIR},-tkinter \
2013-05-22 12:36:03 +00:00
${RUN_DEPENDS}
WANTLIB-idle =
MODULES += x11/tk
2022-06-09 14:49:29 +00:00
.if ${VERSION} == "2.7"
2013-04-28 00:49:11 +00:00
MODTK_VERSION = 8.5
2022-06-09 14:49:29 +00:00
.else
MODTK_VERSION = 8.6
.endif
2024-05-06 12:20:20 +00:00
LIB_DEPENDS-tkinter = lang/python/${V_SUBDIR},-main \
2013-05-22 12:36:03 +00:00
${MODTK_LIB_DEPENDS}
2022-06-09 14:49:29 +00:00
WANTLIB-tkinter = pthread python${VERSION} \
2013-05-22 12:36:03 +00:00
${MODTK_WANTLIB}
2002-03-23 04:34:22 +00:00
CONFIGURE_STYLE = autoconf
2016-03-10 11:50:13 +00:00
CONFIGURE_ARGS += --enable-shared
CONFIGURE_ARGS += --enable-ipv6 \
--with-system-expat \
--with-system-ffi
.if ${VERSION} == "2.7"
CONFIGURE_ARGS += --with-fpectl \
--with-threads \
2022-06-09 14:49:29 +00:00
--with-tcltk-includes='-I${MODTCL_INCDIR} -I${MODTK_INCDIR} -I${X11BASE}/include' \
--with-tcltk-libs='-L${X11BASE}/lib -l${MODTCL_LIB} -l${MODTK_LIB}'
.else
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
. if ${PROPERTIES:Mlld} && ${MACHINE_ARCH} != "arm"
2022-08-07 17:00:43 +00:00
CONFIGURE_ARGS += --with-lto
. else
CONFIGURE_ARGS += --without-lto
. endif
# also available is "--enable-optimizations" to use profile-guided
# optimisation; supposedly quite a good performance improvement,
# but fails with our clang toolchain as of v16 (and still the case
# with 19). if it can be enabled again, it needs testing per-arch
# and only adding where working.
TEST_IS_INTERACTIVE = Yes
.endif
2014-03-09 20:23:44 +00:00
CONFIGURE_ENV += OPT='${CFLAGS} -fPIC' CPPFLAGS='-I${LOCALBASE}/include' \
LDFLAGS='-L${LOCALBASE}/lib/' SVNVERSION=no \
LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
MAKE_ENV += LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
MAKE_FLAGS += LD_LIBRARY_PATH=${WRKSRC} PATH="${WRKDIST}:${PORTPATH}"
MAKE_FLAGS += CFLAGS_NODIST='-I${LOCALBASE}/include' LDFLAGS_NODIST='-L${WRKSRC} -L${LOCALBASE}/lib/'
2016-08-18 12:50:42 +00:00
FAKE_FLAGS += RANLIB=:
2021-07-30 20:01:19 +00:00
PY_PLATFORM = openbsd${OSMAJOR}
PY_VERSION = python${VERSION}
PYC_MAGIC_TAG = cpython-${VERSION:S/.//}
SUBST_VARS += FULL_VERSION PY_PLATFORM PY_VERSION PYC_MAGIC_TAG VERSION VERSION_SPEC
# Python itself is clean, but some dlopen()'d extensions e.g. QtWebKit
# require W|X mappings and/or don't have the required landing pads for
# branch-tracking control flow integrity.
2016-08-18 12:50:42 +00:00
USE_WXNEEDED = Yes
USE_NOBTCFI = Yes
2002-02-15 19:42:18 +00:00
2019-04-21 09:32:19 +00:00
.if ${VERSION} == "2.7"
2021-07-30 20:01:19 +00:00
ALL_TARGET = all ./Lib/plat-${PY_PLATFORM}
2019-04-21 09:32:19 +00:00
.else
ALL_TARGET = all
2016-12-26 19:41:45 +00:00
.endif
2002-02-15 19:42:18 +00:00
2010-10-28 08:22:11 +00:00
post-extract:
rm -r ${WRKDIST}/Modules/expat
2019-04-21 09:32:19 +00:00
do-gen:
2013-04-28 00:49:11 +00:00
${SUBST_CMD} ${WRKSRC}/configure.ac
2019-04-21 09:32:19 +00:00
${MODGNU_gen}
2002-02-15 19:42:18 +00:00
post-configure:
@cd ${WRKSRC} && ${MAKE_PROGRAM} Makefile
ADJ_FILES = ${WRKSRC}/python-gdb.py
2011-09-21 14:37:28 +00:00
.if ${VERSION} == "2.7"
ADJ_FILES += ${WRKSRC}/Tools/scripts/pydoc*
ADJ_FILES += ${WRKSRC}/Tools/scripts/2to3
.endif
post-build:
perl -pi -e \
's@#! */usr/bin/(env +)?python@#!${PREFIX}/bin/python${VERSION}@' \
${ADJ_FILES}
2002-02-15 19:42:18 +00:00
post-install:
.if ${VERSION} == "2.7"
${INSTALL_SCRIPT} ${WRKSRC}/Tools/scripts/pydoc \
${PREFIX}/bin/pydoc${VERSION}
@sed -e "s,@VERSION@,${VERSION},g" -e "s,@LOCALBASE@,${LOCALBASE},g" \
${FILESDIR}/idle > ${WRKSRC}/idle
${INSTALL_SCRIPT} ${WRKSRC}/idle ${PREFIX}/bin/idle${VERSION}
cd ${PREFIX}/bin && ln -sf idle${VERSION} idle${VERSION:R}
mv ${PREFIX}/bin/pydoc ${PREFIX}/bin/pydoc2
2002-02-15 19:42:18 +00:00
@cd ${WRKSRC}; tar -cf - Tools | (cd ${PREFIX}/lib/python${VERSION}; \
tar -xf -)
${INSTALL_SCRIPT} ${WRKSRC}/Tools/scripts/2to3 \
${PREFIX}/bin/python${VERSION}-2to3
.else
cd ${PREFIX}/bin && ln -sf python3 python
rm -f ${PREFIX}/bin/pip3 # in devel/py-pip
2011-09-21 14:37:28 +00:00
.endif
if [ -e ${FILESDIR}/EXTERNALLY-MANAGED ]; then \
${INSTALL_DATA} ${FILESDIR}/EXTERNALLY-MANAGED \
${PREFIX}/lib/python${VERSION}/EXTERNALLY-MANAGED; fi # PEP-668
2002-05-11 21:35:13 +00:00
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/python${VERSION}
${INSTALL_DATA} ${FILESDIR}/CHANGES.OpenBSD \
${PREFIX}/share/doc/python${VERSION}/CHANGES.OpenBSD
${INSTALL_DATA_DIR} ${PREFIX}/share/gdb/auto-load/usr/local/bin
${INSTALL_SCRIPT} ${WRKSRC}/python-gdb.py \
${PREFIX}/share/gdb/auto-load/usr/local/bin/python${VERSION}-gdb.py
@for i in _hashlib _ssl; do \
if ! [ -r ${PREFIX}/lib/python*/lib-dynload/$$i*.so ]; then echo; \
echo "*** check logs - $$i was not built!"; echo; exit 1; fi; done
2008-05-10 17:10:24 +00:00
2013-03-11 11:20:26 +00:00
TEST_TARGET= test
TEST_FLAGS= "EXTRATESTOPTS=-w"
# Some regress tests write to $HOME
PORTHOME= ${WRKDIR}