- Remove everything related to USE_PYTHON and bsd.python.mk. This is a

preparatory step to convert bsd.python.mk into a USES file.
- Remove the shared/static build separation, which is the source of many
  problems and even more hacks. Instead build only the shared version, which
  greatly simplifies the build.
- Remove the FPECTL option to align the build with the clean "template" from
  lang/python34.
- Remove support for GNU pthreads via the PTH option. It is a permanent
  troublemaker for ports using Python and pthread support.
- Remove PORTDATA and EXAMPLES. Those will be made available via separate
  ports.
- Add a new DEBUG option to enable debug builds as for lang/python34.
- Remove bin/smtpd. Only Python2.7 wants to install it, but we'd like to keep
  it consistent with the other lang/pythonXX ports
- Add CPE support.
- Reactivate curses/ncurses support.
- Use buildbottest in the regression-test: target.
- Move pkg-message to the right place.

Phabric:		D488
Exp-run:	192242, 192244
Reviewed by:	koobs
With hat:	python@
This commit is contained in:
Marcus von Appen 2014-08-02 06:54:20 +00:00
parent 24b986e983
commit fc8d424c6b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=363790
7 changed files with 4679 additions and 2681 deletions

View file

@ -1,12 +1,12 @@
# Created by: Hye-Shik Chang <perky@FreeBSD.org>
# $FreeBSD$
PORTNAME= python27
PORTVERSION= 2.7.8
PORTREVISION= 1
CATEGORIES= lang python ipv6
MASTER_SITES= PYTHON
MASTER_SITE_SUBDIR= ${PYTHON_MASTER_SITE_SUBDIR}
DISTNAME= ${PYTHON_DISTNAME}
MASTER_SITE_SUBDIR= ftp/python/${PORTVERSION}
DISTNAME= Python-${PORTVERSION}
DIST_SUBDIR= python
MAINTAINER= python@FreeBSD.org
@ -14,56 +14,39 @@ COMMENT= Interpreted object-oriented programming language
LICENSE= PSFL
GNU_CONFIGURE= yes
CONFIGURE_SCRIPT= ../configure # must be relative
CONFIGURE_ENV= SVNVERSION="echo freebsd" ac_cv_opt_olimit_ok=no
MAKE_ENV= VPATH="${PYTHON_WRKSRC}"
INSTALL_TARGET= altinstall
USES= readline tar:xz cpe
USES= cpe ncurses pkgconfig readline tar:xz
USE_LDCONFIG= yes
USE_PYTHON= yes
GNU_CONFIGURE= yes
CPE_VENDOR= python
CPE_PRODUCT= ${CPE_VENDOR}
CPE_VERSION= ${PORTVERSION}
PYTHON_VERSION= python2.7
PYTHON_NO_DEPENDS= yes
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ENV+= OPT="" # Null out OPT to respect user CFLAGS and remove optimizations
WRKSRC= ${PYTHON_WRKSRC}/portbld.static
SHARED_WRKSRC= ${PYTHON_WRKSRC}/portbld.shared
PATCH_WRKSRC= ${PYTHON_WRKSRC}
INSTALL_TARGET= altinstall # Don't want cloberring of unprefixed files
SHAREMODE= 644 # Match upstream INSTALL_DATA=644, so we can STRIP shared libraries
MAKE_ARGS+= INSTALL_SHARED="${INSTALL_LIB}" # Override read-only for libraries, so we can STRIP them
MAKE_ARGS+= LIBPC="${PREFIX}/libdata/pkgconfig" # Until pathfix gets support for files other than Makefile.in
PLIST= ${WRKDIR}/PLIST
PLIST_TEMPLATE?=${PKGDIR}/pkg-plist
PLIST_SUB= PYVER=${PYTHON_VERSION:S/python//} \
PYMAJOR=${PYTHON_MAJOR_VER} \
PYVER_WITHPAT=${PORTVERSION:S/.c/c/} \
PORTVERSION=${PORTVERSION}
EXAMPLESDIR= ${PREFIX}/share/examples/${PYTHON_VERSION}
DATADIR= ${PREFIX}/share/${PYTHON_VERSION}
BIN_SCRIPTS= 2to3 idle pydoc smtpd.py
BIN_FILES= python python-shared python-config python-shared-config \
${BIN_SCRIPTS}
BINLINKS_SUB_TMPL= -e 's,smtpd,smtpd%%VERSION%%,' \
-e 's,2to3,2to3-%%VERSION%%,' \
-e 's,(idle|pydoc|python-shared|python),\1%%VERSION%%,'
BINLINKS_SUB_PYTHON_VER= ${BINLINKS_SUB_TMPL:S/%%VERSION%%/${PYTHON_VER}/g}
OPTIONS_DEFINE= EXAMPLES FPECTL IPV6 NLS PTH PYMALLOC SEM THREADS
OPTIONS_DEFAULT= IPV6 PYMALLOC SEM THREADS UCS4
PLIST_SUB= ABI=${ABIFLAGS} \
PORTVERSION=${PORTVERSION} \
OSMAJOR=${OSVERSION:C/([0-9]*)[0-9]{5}/\1/} # For plat-freebsd* in pkg-plist. http://bugs.python.org/issue19554
OPTIONS_DEFINE= DEBUG IPV6 NLS PYMALLOC SEM THREADS
OPTIONS_DEFAULT= IPV6 NLS PYMALLOC SEM THREADS UCS4
OPTIONS_SINGLE= UNICODE
OPTIONS_SINGLE_UNICODE= UCS2 UCS4
NLS_DESC= Enable Gettext support for the locale module
OPTIONS_SUB= yes
NLS_DESC= Enable gettext support for the locale module
UCS2_DESC= Enable UCS2 Unicode Strings
UCS4_DESC= Enable UCS4 Unicode Strings
PYMALLOC_DESC= Enable specialized mallocs
FPECTL_CONFIGURE_ON= --with-fpectl
DEBUG_CONFIGURE_WITH= pydebug
IPV6_CONFIGURE_ENABLE= ipv6
# Use CPPFLAGS over CFLAGS due to -I ordering, causing elementtree and pyexpat
@ -79,32 +62,15 @@ PYMALLOC_CONFIGURE_WITH= pymalloc
SEM_CONFIGURE_ENV= ac_cv_posix_semaphores_enabled=yes
SEM_CONFIGURE_ENV_OFF= ac_cv_posix_semaphores_enabled=no
THREADS_CONFIGURE_WITH= threads
THREADS_CFLAGS= ${PTHREAD_CFLAGS}
THREADS_LDFLAGS= ${PTHREAD_LIBS}
UCS2_CONFIGURE_ON= --enable-unicode=ucs2
UCS4_CONFIGURE_ON= --enable-unicode=ucs4
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MTHREADS}
PLIST_SUB+= THREADS=""
.if ${PORT_OPTIONS:MPTH}
CONFIGURE_ARGS+= --with-pth --with-system-ffi
CONFIGURE_ENV+= ac_cv_pthread=no
LIB_DEPENDS+= libpth.so:${PORTSDIR}/devel/pth \
libffi.so:${PORTSDIR}/devel/libffi
_PTH_CPPFLAGS= "-I${LOCALBASE}/include/pth"
_PTH_LDFLAGS= "-L${LOCALBASE}/lib/pth"
CPPFLAGS:= ${_PTH_CPPFLAGS} ${CPPFLAGS}
LDFLAGS+= ${_PTH_LDFLAGS}
.else
CONFIGURE_ARGS+= --with-threads
CFLAGS+= ${PTHREAD_CFLAGS}
LDFLAGS+= ${PTHREAD_LIBS}
.endif
.else
PLIST_SUB+= THREADS="@comment "
CONFIGURE_ARGS+= --without-threads
.endif
.if ${ARCH} == i386
PLIST_SUB+= X86_ONLY=""
.else
@ -125,124 +91,28 @@ CFLAGS+= -DPYTHON_DEFAULT_RECURSION_LIMIT=900
# See http://bugs.freebsd.org/115940
.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS) # the world with NO_NIS
PLIST_SUB+= NO_NIS="@comment "
WITHOUT_NIS?= detected
.else
PLIST_SUB+= NO_NIS=""
.endif
CONFIGURE_ENV+= OPT="${_PTH_CPPFLAGS}"
post-extract:
# The distribution tarball for python 2.7 has permission bits for 'others'
# set to 0. Later during install, we copy Tools and Demo to the installed
# prefix, so set them right here.
${CHMOD} -R og=u-w ${PYTHON_WRKSRC}/Tools ${PYTHON_WRKSRC}/Demo
pre-patch:
${MKDIR} ${WRKSRC} ${SHARED_WRKSRC}/Modules
${LN} ${PATCH_WRKSRC}/Lib/smtpd.py ${PATCH_WRKSRC}/Tools/scripts/
.for script in ${BIN_SCRIPTS}
${SED} -e '1s,^.*$$,#!${PREFIX}/bin/${PYTHON_VERSION},' \
${PATCH_WRKSRC}/Tools/scripts/${script} \
> ${WRKDIR}/`${ECHO_CMD} ${script} | ${SED} -E ${BINLINKS_SUB_PYTHON_VER}`
.endfor
${REINPLACE_CMD} -e \
post-patch:
@${REINPLACE_CMD} -e \
's,/usr/doc/python-docs-,${PREFIX}/share/doc/python,g' \
${PATCH_WRKSRC}/Lib/pydoc.py
${REINPLACE_CMD} -e \
's|^\( *prefixes = .*\)\]$$|\1, "${LOCALBASE}"]|g' \
${PATCH_WRKSRC}/Lib/site.py
${REINPLACE_CMD} -e \
's|^ \(..ASDLGEN.*\)$$| ${TRUE}|g; \
s|[(]LIBDIR[)]/pkgconfig|(prefix)/libdata/pkgconfig|g' \
${PATCH_WRKSRC}/Makefile.pre.in
${REINPLACE_CMD} -e \
's|*\(..INSTALL_SCRIPT.*\)python-config$$|#port \1|' \
${PATCH_WRKSRC}/Makefile.pre.in
${SED} -e 's|^#!.*|#!${PREFIX}/bin/${PYTHON_VERSION}|' \
-e 's|libs = getvar|libs = getvar("LDFLAGS").split() + getvar|' \
${PATCH_WRKSRC}/Misc/python-config.in > ${WRKDIR}/${PYTHON_VERSION}-config
${SED} -e 's|^#!.*|#!${PREFIX}/bin/${PYTHON_VERSION:S/thon/thon-shared/}|' \
-e 's|libs = getvar|libs = getvar("LDFLAGS").split() + getvar|' \
${PATCH_WRKSRC}/Misc/python-config.in > ${WRKDIR}/${PYTHON_VERSION:S/thon/thon-shared/}-config
.if ${PORT_OPTIONS:MFPECTL} && ${ARCH} == i386
${MKDIR} ${WRKSRC}/Modules
${ECHO} "fpectl fpectlmodule.c" >> ${WRKSRC}/Modules/Setup.dist
.endif
post-patch:
.if ${PORT_OPTIONS:MSEM}
@# do not use SEM_EXTRA_PATCHES here, since patch-setup.py overlaps with this one
@cd ${WRKSRC} && ${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-setup.py
.endif
.if defined(WITHOUT_NIS)
${REINPLACE_CMD} -e \
's/disabled_module_list =[^]]*/&, "nis"/' \
${PATCH_WRKSRC}/setup.py
.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS)
@${REINPLACE_CMD} -e 's/disabled_module_list =[^]]*/&, "nis"/' \
${WRKSRC}/setup.py
.endif
post-configure:
${TAR} -C ${WRKSRC} -cf - . | ${TAR} -C ${SHARED_WRKSRC} -xf -
${LN} -sf ${PYTHON_WRKSRC}/Lib ${WRKSRC}/Lib
${SED} -e 's,^\(LDLIBRARY=\).*$$,\1libpython$$(VERSION).so,' \
-e 's,^\(BLDLIBRARY=\).*$$,\1-L. -lpython$$(VERSION),' \
-e 's,^\(CFLAGSFORSHARED=\).*$$,\1$$(CCSHARED),' \
-e 's,^\(Makefile Modules/config.c:.*\)Makefile.pre,\1,' \
-e 's,^\(.(BUILDPYTHON)\: .*\).(LIBRARY),\1,' \
-e 's,^\(.(BUILDPYTHON):.*\).(LIBRARY),\1,' \
${WRKSRC}/Makefile > ${SHARED_WRKSRC}/Makefile
pre-build:
cd ${SHARED_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${MAKE} lib${PYTHON_VERSION}.so python; \
${LN} -f lib${PYTHON_VERSION}.so lib${PYTHON_VERSION}.so.1; \
${LN} -f python ${PYTHON_VERSION:S/thon/thon-shared/}
pre-install:
${CAT} ${PLIST_TEMPLATE} | ${AWK} '{ print $$0; } \
/LIBDIR.*\.py$$/ && \
!/\/bad|tests\/data/ \
{ print $$0 "o"; print $$0 "c"; }' > ${PLIST}
@# if openssl 0.9.8 is detected, _sha{256,512} module won't be installed
([ -f ${WRKSRC}/.without_own_sha ] && \
${GREP} -v 'lib-dynload/_sha' ${PLIST} > ${PLIST}.tmp && \
${CAT} ${PLIST}.tmp > ${PLIST}) || ${TRUE}
post-install:
@# install config providers
${INSTALL_SCRIPT} ${WRKDIR}/${PYTHON_VERSION}-config \
${STAGEDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKDIR}/${PYTHON_VERSION:S/thon/thon-shared/}-config \
${STAGEDIR}${PREFIX}/bin
@# shared version of executable and library
${INSTALL_PROGRAM} ${SHARED_WRKSRC}/lib${PYTHON_VERSION}.so.1 \
${STAGEDIR}${PREFIX}/lib
(cd ${STAGEDIR}${PREFIX}/lib; ${LN} -sf lib${PYTHON_VERSION}.so.1 \
lib${PYTHON_VERSION}.so)
(cd ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION}/config; \
${LN} -sf ../../lib${PYTHON_VERSION}.so)
${INSTALL_PROGRAM} \
${SHARED_WRKSRC}/${PYTHON_VERSION:S/thon/thon-shared/} \
${STAGEDIR}${PREFIX}/bin
@# additional files installing by ports
.for script in ${BIN_SCRIPTS}
${INSTALL_SCRIPT} ${WRKDIR}/`${ECHO_CMD} ${script} | ${SED} -E ${BINLINKS_SUB_PYTHON_VER}` \
${STAGEDIR}${PREFIX}/bin
.endfor
${INSTALL_MAN} ${PYTHON_WRKSRC}/Misc/python.man \
${STAGEDIR}${MAN1PREFIX}/man/man1/${PYTHON_VERSION}.1
@${MKDIR} ${STAGEDIR}${DATADIR}
@(cd ${PYTHON_WRKSRC}; ${TAR} -cf - Tools | (cd ${STAGEDIR}${DATADIR}; ${TAR} --no-same-owner -xf -))
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
@(cd ${PYTHON_WRKSRC}/Demo; ${TAR} -cf - * | \
(cd ${STAGEDIR}${EXAMPLESDIR}; ${TAR} --no-same-owner -xf -))
for i in ${STAGEDIR}${PREFIX}/lib/python2.7/lib-dynload/*.so; do \
${STRIP_CMD} $$i; done # Strip shared extensions
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libpython2.7.so.1 # Strip shared library
regression-test: build
@cd ${WRKSRC} && ${MAKE} TESTOPTS=-j${MAKE_JOBS_NUMBER} buildbottest

View file

@ -1,6 +1,9 @@
# Description: SEM option patch. If SEM is enabled, enable the build properly
# Not upstreamed
--- setup.py.orig 2013-04-07 11:07:43.000000000 +0400
+++ setup.py 2013-04-07 11:16:36.000000000 +0400
@@ -1544,10 +1544,22 @@
@@ -1551,10 +1551,22 @@
macros = dict()
libraries = []

View file

@ -0,0 +1,17 @@
# Description: A non-invasive partial backport of the Python3 distutils behaviour.
# This allows Python's scripts to be properly suffixed (similar to Python 3.x) on
# installation.
# Submitted by: mva
--- Lib/distutils/command/build_scripts.py.orig 2014-07-26 11:52:20.000000000 +0200
+++ Lib/distutils/command/build_scripts.py 2014-07-26 11:52:56.000000000 +0200
@@ -126,6 +126,9 @@
file, oldmode, newmode)
os.chmod(file, newmode)
+ # XXX should we modify self.outfiles?
+ return outfiles
+
# copy_scripts ()
# class build_scripts

View file

@ -1,6 +1,5 @@
# Description: Fix out-of-tree build as a result of upstream #15819
# Submitted by: rm (r318353)
# Issue ID: http://bugs.python.org/issue15819#msg203348
# Description: Link scripts in the same way Python3 does
# Submitted by: mva
# Description: Run pycompile only once
# Submitted by: antoine (r350207)
@ -10,21 +9,22 @@
# Submitted by: antoine@ (r350207)
# TODO: Upstream
--- ./Makefile.pre.in.orig 2013-11-10 07:36:41.000000000 +0000
+++ ./Makefile.pre.in 2014-04-04 09:16:00.000000000 +0000
@@ -285,9 +285,9 @@
--- Makefile.pre.in.orig 2014-06-30 04:05:39.000000000 +0200
+++ Makefile.pre.in 2014-07-26 11:09:46.000000000 +0200
@@ -868,6 +868,12 @@
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
-rm -f $(DESTDIR)$(LIBPC)/python.pc
(cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
+ -rm -f $(DESTDIR)$(BINDIR)/idle
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle2)
+ -rm -f $(DESTDIR)$(BINDIR)/pydoc
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc2)
+ -rm -f $(DESTDIR)$(BINDIR)/2to3
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
##########################################################################
# AST
-AST_H_DIR= Include
+AST_H_DIR= $(srcdir)/Include
AST_H= $(AST_H_DIR)/Python-ast.h
-AST_C_DIR= Python
+AST_C_DIR= $(srcdir)/Python
AST_C= $(AST_C_DIR)/Python-ast.c
AST_ASDL= $(srcdir)/Parser/Python.asdl
@@ -1006,12 +1006,12 @@
# Install the interpreter with $(VERSION) affixed
# This goes into $(exec_prefix)
@@ -1010,12 +1016,12 @@
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
@ -39,7 +39,7 @@
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
@@ -1089,8 +1089,8 @@
@@ -1093,8 +1099,8 @@
if test "$(SO)" = .dll; then \
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
else \

View file

@ -1,6 +1,21 @@
--- ./setup.py.orig 2014-07-04 18:02:21.711919294 +1000
+++ ./setup.py 2014-07-04 18:11:14.642091269 +1000
@@ -33,7 +33,7 @@
# Description: Partial script installation backport from Python3
# Submitted by: mva
# Description: Some modules are installed via other ports
# Description: ossaudiodev detection fix backport
--- setup.py.orig 2014-06-30 04:05:48.000000000 +0200
+++ setup.py 2014-07-26 14:51:29.000000000 +0200
@@ -15,6 +15,7 @@
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.command.install_lib import install_lib
+from distutils.command.build_scripts import build_scripts
from distutils.spawn import find_executable
cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
@@ -33,7 +34,7 @@
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
# This global variable is used to hold the list of modules to be disabled.
@ -9,16 +24,7 @@
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -867,6 +867,8 @@
# OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
exts.append( Extension('_sha256', ['sha256module.c']) )
exts.append( Extension('_sha512', ['sha512module.c']) )
+ else:
+ open('.without_own_sha', 'w')
# Modules that provide persistent dictionary-like semantics. You will
# probably want to arrange for at least one of them to be available on
@@ -1212,7 +1214,7 @@
@@ -1212,7 +1213,7 @@
sysroot = macosx_sdk_root()
f = os.path.join(sysroot, f[1:])
@ -27,7 +33,7 @@
data = open(f).read()
m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
if m is not None:
@@ -1551,7 +1553,7 @@
@@ -1551,7 +1552,7 @@
macros = dict()
libraries = []
@ -36,7 +42,7 @@
# FreeBSD's P1003.1b semaphore support is very experimental
# and has many known problems. (as of June 2008)
macros = dict()
@@ -1602,9 +1604,10 @@
@@ -1602,9 +1603,10 @@
else:
missing.append('linuxaudiodev')
@ -50,14 +56,47 @@
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
else:
missing.append('ossaudiodev')
@@ -2228,9 +2231,7 @@
ext_modules=[Extension('_struct', ['_struct.c'])],
@@ -2176,6 +2178,22 @@
def is_chmod_supported(self):
return hasattr(os, 'chmod')
+class PyBuildScripts(build_scripts):
+ def copy_scripts(self):
+ outfiles = build_scripts.copy_scripts(self)
+ fullversion = '{0[0]}.{0[1]}'.format(sys.version_info)
+ newoutfiles = []
+ for filename in outfiles:
+ if filename.endswith('2to3'):
+ newfilename = filename + '-' + fullversion
+ else:
+ newfilename = filename + fullversion
+ log.info('renaming {} to {}'.format(filename, newfilename))
+ os.rename(filename, newfilename)
+ newoutfiles.append(newfilename)
+ return newoutfiles
+
+
SUMMARY = """
Python is an interpreted, interactive, object-oriented programming
language. It is often compared to Tcl, Perl, Scheme or Java.
@@ -2221,7 +2239,9 @@
platforms = ["Many"],
# Build info
- cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall,
+ cmdclass = {'build_ext':PyBuildExt,
+ 'build_scripts':PyBuildScripts,
+ 'install':PyBuildInstall,
'install_lib':PyBuildInstallLib},
# The struct module is defined here, because build_ext won't be
# called unless there's at least one extension module defined.
@@ -2229,8 +2249,7 @@
# Scripts to install
- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
- 'Tools/scripts/2to3',
- 'Lib/smtpd.py']
+ scripts = []
+ 'Tools/scripts/2to3']
)
# --install-platlib

File diff suppressed because it is too large Load diff