Welcome Python 3.4 to the FreeBSD Ports Tree!

The FreeBSD Python Team warmly welcomes Python 3.4 to the Ports tree:

- Add lang/python34
- Add devel/py-setuptools34
- Add Python 3.4.0 docs to lang/python-doc

Release Announcement and Major Features:

  https://www.python.org/download/releases/3.4.0/

This also marks the next stage of a cleaner, much-closer-to-upstream
approach to Python on FreeBSD, that builds upon the hard work of the
entire FreeBSD Python team over the last year.

This port is built "entirely" from scratch, retiring as much of the
legacy, workarounds, patches and hacks from the existing Python
ports as possible.

Of particular note: static + shared dual-build is gone, as it was flaky
at best, grossly untested upstream and caused more issues than it
solved. It is replaced by a shared build by default. The static python
library remains installed and usable.

Major changes in this structure are:

- Replace dual static and shared in-tree build with shared-only.
- Use options helpers
- Replace plat-freebsd* hacks with a lighter weight alternative
- Strip all libraries and shared extensions
- Only retain patches that are absolutely necessary
- Replace static disabled_module_list with one from upstream
- Retain NIS and sparc64 workarounds from python33
- Deprecate SEM option, no longer optional.
- Deprecate PTH option, no longer maintained or supported upstream
- Deprecate FPECTL option, no longer maintained or supported upstream
- Add upstream issue references & breadcrumb annotations where possible

Tested by:	many (Special thanks to Andrew Berg)
Reviewed by:	xmj, nemysis, antoine
This commit is contained in:
Kubilay Kocak 2014-04-08 13:10:25 +00:00
parent 39fff6230b
commit 51bf49a441
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=350610
16 changed files with 5378 additions and 3 deletions

View File

@ -194,7 +194,7 @@ Python_Include_MAINTAINER= python@FreeBSD.org
# default: ${LOCALBASE}/bin/easy_install-${PYTHON_VER}
_PYTHON_PORTBRANCH= 2.7
_PYTHON_ALLBRANCHES= 2.7 3.3 3.2 3.1 # preferred first
_PYTHON_ALLBRANCHES= 2.7 3.4 3.3 3.2 3.1 # preferred first
# Determine version number of Python to use
.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
@ -333,8 +333,19 @@ PYTHON_PORTVERSION= ${PYTHON_DEFAULT_PORTVERSION}
# Propagate the chosen python version to submakes.
.MAKEFLAGS: PYTHON_VERSION=python${_PYTHON_VERSION}
# Python-3.4
.if ${PYTHON_VERSION} == "python3.4"
PYTHON_PORTVERSION?= 3.4.0
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python34
PYTHON_REL= 340
PYTHON_SUFFIX= 34
PYTHON_VER= 3.4
.if exists(${PYTHON_CMD}-config) && ${PORTNAME} != python34
PYTHON_ABIVER!= ${PYTHON_CMD}-config --abiflags
.endif
# Python-3.3
.if ${PYTHON_VERSION} == "python3.3"
.elif ${PYTHON_VERSION} == "python3.3"
PYTHON_PORTVERSION?= 3.3.5
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python33
PYTHON_REL= 335
@ -389,6 +400,7 @@ check-makevars::
@${ECHO} " python3.1"
@${ECHO} " python3.2"
@${ECHO} " python3.3"
@${ECHO} " python3.4"
@${FALSE}
.endif

View File

@ -3812,6 +3812,7 @@
SUBDIR += py-setuptools27
SUBDIR += py-setuptools32
SUBDIR += py-setuptools33
SUBDIR += py-setuptools34
SUBDIR += py-setuptools_darcs
SUBDIR += py-setuptools_hg
SUBDIR += py-shapely

View File

@ -0,0 +1,10 @@
# Created by: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
# $FreeBSD$
PKGNAMESUFFIX= ${PYTHON_SUFFIX}
PYTHON_VERSION= 3.4
MASTERDIR= ${.CURDIR}/../py-setuptools
.include "${MASTERDIR}/Makefile"

View File

@ -272,6 +272,7 @@
SUBDIR += python31
SUBDIR += python32
SUBDIR += python33
SUBDIR += python34
SUBDIR += qore
SUBDIR += qscheme
SUBDIR += qt5-qml

View File

@ -16,7 +16,7 @@ COMMENT= Documentation for the Python programming language
PORTSCOUT= ignore:1
NO_BUILD= yes
USE_BZIP2= yes
USES= tar:bzip2
USE_PYTHON_BUILD= yes
DOCSDIR= ${PREFIX}/share/doc/${PYTHON_VERSION}

View File

@ -30,3 +30,11 @@ SHA256 (python/python-3.3.4-docs-pdf-letter.tar.bz2) = 21aabe30ad03ef4c78e57b14f
SIZE (python/python-3.3.4-docs-pdf-letter.tar.bz2) = 11337167
SHA256 (python/python-3.3.4-docs-text.tar.bz2) = 82c98238d9df22650d27f3bff40b31888306aaf5f7636bbb145f94266365f273
SIZE (python/python-3.3.4-docs-text.tar.bz2) = 1783407
SHA256 (python/python-3.4.0-docs-html.tar.bz2) = 445037818f15c4b622212db9e8182e322eb16de3959718dbd339229ed39044fc
SIZE (python/python-3.4.0-docs-html.tar.bz2) = 5355183
SHA256 (python/python-3.4.0-docs-pdf-a4.tar.bz2) = 0a0ae03e19e413444a2031bd72bbdf73efbb7b31582f3773025450f612d13bc9
SIZE (python/python-3.4.0-docs-pdf-a4.tar.bz2) = 11684652
SHA256 (python/python-3.4.0-docs-pdf-letter.tar.bz2) = fbd9d276fb1bdcba66b539fa6c53cb7caf89671d5029fa9972c70a7fb7dd6713
SIZE (python/python-3.4.0-docs-pdf-letter.tar.bz2) = 11754877
SHA256 (python/python-3.4.0-docs-text.tar.bz2) = b3369796187a54c8da0f76355eeadef930b7ce175ebbf6108c08c7aca793fc09
SIZE (python/python-3.4.0-docs-text.tar.bz2) = 1918697

108
lang/python34/Makefile Normal file
View File

@ -0,0 +1,108 @@
# Created by: Kubilay Kocak <koobs@FreeBSD.org>
# $FreeBSD$
PORTNAME= python34
DISTVERSION= 3.4.0
CATEGORIES= lang python ipv6
MASTER_SITES= PYTHON
MASTER_SITE_SUBDIR= ${PYTHON_MASTER_SITE_SUBDIR}
DISTNAME= Python-${DISTVERSION}
DIST_SUBDIR= python
MAINTAINER= python@FreeBSD.org
COMMENT= Interpreted object-oriented programming language
LICENSE= PSFL
USES= ncurses pkgconfig readline tar:xz
USE_LDCONFIG= yes
USE_PYTHON= yes
GNU_CONFIGURE= yes
PYTHON_VERSION= python3.4
PYTHON_NO_DEPENDS= yes
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --without-ensurepip
CONFIGURE_ENV+= OPT="" DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS}" # Null out OPT to respect user CFLAGS and remove optimizations
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_SUB= VER=${PYTHON_VER} ABI=${ABIFLAGS} XY=${PYTHON_SUFFIX} \
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 THREADS TSC
OPTIONS_DEFAULT= IPV6 NLS PYMALLOC THREADS
OPTIONS_RADIO= HASH
OPTIONS_RADIO_HASH= FNV SIPHASH
OPTIONS_SUB= yes
NLS_DESC= Enable gettext support for the locale module
PYMALLOC_DESC= Enable specialized mallocs
TSC_DESC= Enable processor timestamp counter profiling
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
# 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: http://bugs.python.org/issue6299
NLS_USES= gettext
NLS_LDFLAGS= -L${LOCALBASE}/lib
NLS_CPPFLAGS= -I${LOCALBASE}/include
NLS_CONFIGURE_ENV_OFF= ac_cv_lib_intl_textdomain=no ac_cv_header_libintl_h=no
PYMALLOC_CONFIGURE_WITH= pymalloc
THREADS_CONFIGURE_WITH= threads
THREADS_CFLAGS= ${PTHREAD_CFLAGS}
THREADS_LDFLAGS= ${PTHREAD_LIBS}
TSC_CONFIGURE_WITH= tsc
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MPYMALLOC}
ABIFLAGS:= m${ABIFLAGS}
.endif
.if ${PORT_OPTIONS:MDEBUG}
ABIFLAGS:= d${ABIFLAGS}
.endif
.if !empty(ABIFLAGS)
PLIST_FILES+= bin/python%%VER%%%%ABI%%
.endif
.if ${ARCH} == sparc64
CFLAGS+= -DPYTHON_DEFAULT_RECURSION_LIMIT=900
.endif
# See http://bugs.freebsd.org/115940
.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS) # the world with NO_NIS
PLIST_SUB+= NO_NIS="@comment "
DISABLED_EXTENSIONS+= nis
.else
PLIST_SUB+= NO_NIS=""
.endif
post-install:
.if ! ${PORT_OPTIONS:MDEBUG}
${RM} -f ${STAGEDIR}${PREFIX}/lib/libpython3.so # Upstream Issue: http://bugs.python.org/issue17975
.endif
for i in ${STAGEDIR}${PREFIX}/lib/python3.4/lib-dynload/*.so; do \
${STRIP_CMD} $$i; done # Strip shared extensions
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libpython3.4${ABIFLAGS}.so.1 # Strip shared library
regression-test: build
@cd ${WRKSRC} && ${MAKE} TESTOPTS=-j${MAKE_JOBS_NUMBER} test
.include <bsd.port.mk>

2
lang/python34/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (python/Python-3.4.0.tar.xz) = f13686c0a2d45e7146759e9d5d1cbd8097a0606483c0cf7730e1e13f58b14cbe
SIZE (python/Python-3.4.0.tar.xz) = 14084912

View File

@ -0,0 +1,15 @@
# Description: Some python extensions can't be compiled with clang 3.4
# Issue ID: http://bugs.python.org/issue20767
# Submitted by: antoine
--- ./Lib/distutils/unixccompiler.py.orig 2014-03-09 15:25:15.921204441 +1100
+++ ./Lib/distutils/unixccompiler.py 2014-03-09 15:25:50.643809649 +1100
@@ -225,6 +225,8 @@
if sys.platform[:6] == "darwin":
# MacOSX's linker doesn't understand the -R flag at all
return "-L" + dir
+ elif sys.platform[:7] == "freebsd":
+ return "-Wl,-rpath=" + dir
elif sys.platform[:5] == "hp-ux":
if self._is_gcc(compiler):
return ["-Wl,+s", "-L" + dir]

View File

@ -0,0 +1,44 @@
# Description: Remove duplicate CFLAGS, CPPFLAGS, LDFLAGS by stripping CONFIGURE_*
# Changeset: https://svnweb.freebsd.org/ports?view=revision&revision=326729
# Submitted by: koobs@
# TODO: Upstream
# Description: Run ranlib before installing the library read-only
# Changeset: https://svnweb.freebsd.org/ports?view=revision&revision=350207
# Submitted by: antoine@
# TODO: Upstream
--- ./Makefile.pre.in.orig 2014-03-17 13:31:30.000000000 +1100
+++ ./Makefile.pre.in 2014-04-06 18:21:28.147616242 +1000
@@ -70,18 +70,15 @@
OPT= @OPT@
BASECFLAGS= @BASECFLAGS@
BASECPPFLAGS= @BASECPPFLAGS@
-CONFIGURE_CFLAGS= @CFLAGS@
-CONFIGURE_CPPFLAGS= @CPPFLAGS@
-CONFIGURE_LDFLAGS= @LDFLAGS@
# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
# command line to append to these values without stomping the pre-set
# values.
-PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
+PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CFLAGS) $(EXTRA_CFLAGS)
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the
# environment variables
-PY_CPPFLAGS= $(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
-PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
+PY_CPPFLAGS= $(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CPPFLAGS)
+PY_LDFLAGS= $(LDFLAGS)
NO_AS_NEEDED= @NO_AS_NEEDED@
LDLAST= @LDLAST@
SGI_ABI= @SGI_ABI@
@@ -1314,8 +1311,8 @@
if test "$(SHLIB_SUFFIX)" = .dll; then \
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
else \
+ $(RANLIB) $(LIBRARY) ; \
$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
fi; \
else \
echo Skip install of $(LIBRARY) - use make frameworkinstall; \

View File

@ -0,0 +1,11 @@
--- ./Modules/_ctypes/libffi/configure.orig 2013-05-15 20:32:57.000000000 +0400
+++ ./Modules/_ctypes/libffi/configure 2013-05-18 10:56:03.000000000 +0400
@@ -6889,7 +6889,7 @@
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext

View File

@ -0,0 +1,36 @@
# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
# for anything !apple that is using the libcompiler_rt provided by clang on arm
# PR: ports/149167 ports/184517
# Patch by: cognet@ (to be upstreamed @ LLVM)
--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig 2013-11-17 18:22:57.000000000 +1100
+++ ./Modules/_ctypes/libffi/src/arm/ffi.c 2013-12-03 19:23:24.521993369 +1100
@@ -33,6 +33,11 @@
#include <stdlib.h>
+#if defined(__FreeBSD__) && defined(__arm__)
+#include <sys/types.h>
+#include <machine/sysarch.h>
+#endif
+
/* Forward declares. */
static int vfp_type_p (ffi_type *);
static void layout_vfp_args (ffi_cif *);
@@ -582,6 +587,16 @@
#else
+#if defined(__FreeBSD__) && defined(__arm__)
+#define __clear_cache(start, end) do { \
+ struct arm_sync_icache_args ua; \
+ \
+ ua.addr = (uintptr_t)(start); \
+ ua.len = (char *)(end) - (char *)start; \
+ sysarch(ARM_SYNC_ICACHE, &ua); \
+ } while (0);
+#endif
+
#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
unsigned int __fun = (unsigned int)(FUN); \

View File

@ -0,0 +1,53 @@
--- ./Modules/fcntlmodule.c.orig 2014-03-04 20:15:17.641117835 +1100
+++ ./Modules/fcntlmodule.c 2014-03-04 20:19:36.141145958 +1100
@@ -98,20 +98,15 @@
{
#define IOCTL_BUFSZ 1024
int fd;
- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
format for the 'code' parameter because Python turns 0x8000000
into either a large positive number (PyLong or PyInt on 64-bit
platforms) or a negative number on others (32-bit PyInt)
whereas the system expects it to be a 32bit bit field value
regardless of it being passed as an int or unsigned long on
- various platforms. See the termios.TIOCSWINSZ constant across
- platforms for an example of this.
-
- If any of the 64bit platforms ever decide to use more than 32bits
- in their unsigned long ioctl codes this will break and need
- special casing based on the platform being built on.
+ various platforms.
*/
- unsigned int code;
+ unsigned long code;
int arg;
int ret;
Py_buffer pstr;
@@ -120,7 +115,7 @@
int mutate_arg = 1;
char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
- if (PyArg_ParseTuple(args, "O&Iw*|i:ioctl",
+ if (PyArg_ParseTuple(args, "O&kw*|i:ioctl",
conv_descriptor, &fd, &code,
&pstr, &mutate_arg)) {
char *arg;
@@ -175,7 +170,7 @@
}
PyErr_Clear();
- if (PyArg_ParseTuple(args, "O&Is*:ioctl",
+ if (PyArg_ParseTuple(args, "O&ks*:ioctl",
conv_descriptor, &fd, &code, &pstr)) {
str = pstr.buf;
len = pstr.len;
@@ -202,7 +197,7 @@
PyErr_Clear();
arg = 0;
if (!PyArg_ParseTuple(args,
- "O&I|i;ioctl requires a file or file descriptor,"
+ "O&k|i;ioctl requires a file or file descriptor,"
" an integer and optionally an integer or buffer argument",
conv_descriptor, &fd, &code, &arg)) {
return NULL;

View File

@ -0,0 +1,58 @@
# Backport patch 0001 from Issue #20210
# Issue: http://bugs.python.org/issue20210
# By: Thomas Petazzoni
--- ./Makefile.pre.in.orig 2014-03-24 22:45:17.908886504 +1100
+++ ./Makefile.pre.in 2014-03-24 22:47:55.503779805 +1100
@@ -172,6 +172,8 @@
# configure script arguments
CONFIG_ARGS= @CONFIG_ARGS@
+# disabled extensions
+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
# Subdirectories with code
SRCDIRS= @SRCDIRS@
@@ -555,6 +557,7 @@
esac; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
# Build static library
@@ -1352,7 +1355,8 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
--- ./configure.ac.orig 2014-03-24 22:48:10.442551831 +1100
+++ ./configure.ac 2014-03-24 22:48:42.059827384 +1100
@@ -2331,6 +2331,8 @@
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+AC_SUBST(DISABLED_EXTENSIONS)
+
# Check for use of the system expat library
AC_MSG_CHECKING(for --with-system-expat)
AC_ARG_WITH(system_expat,
--- ./setup.py.orig 2014-03-24 22:48:48.495472513 +1100
+++ ./setup.py 2014-03-24 22:49:20.076122201 +1100
@@ -33,7 +33,10 @@
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.
-disabled_module_list = []
+try:
+ disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
+except KeyError:
+ disabled_module_list = list()
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (after any relative

4
lang/python34/pkg-descr Normal file
View File

@ -0,0 +1,4 @@
Python is an interpreted object-oriented programming language, and is
often compared to Tcl, Perl or Scheme.
WWW: http://www.python.org/

5012
lang/python34/pkg-plist Normal file

File diff suppressed because it is too large Load Diff