Bug 168767 - [PATCH]: lang/python26+ must not set OPT
[PATCH]: lang/python26+ must not set OPT
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: freebsd-python
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-06 20:50 UTC by Marcus von Appen
Modified: 2012-07-22 10:50 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (2.35 KB, patch)
2012-06-06 20:50 UTC, Marcus von Appen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus von Appen freebsd_committer 2012-06-06 20:50:09 UTC
	Python 2.6 and newer implicitly uses the environment's CFLAGS
        settings for the build of all binaries and modules.

        The CFLAGS are stored in
        ${LOCALBASE}/lib/pythonX.X*/config*/Makefile and picked up by
        distutils for building extension modules.

        Assigning CFLAGS to OPTS in CONFIGURE_ENV leads to the following
        issues:

        * not fully debug clean, since -DNDEBUG is not propagated,
          although OPT= is a user option, but not a full debug build
          either
        * duplicate CFLAGS for extension module, complicating CFLAGS
          debugging for users
        * OPT is not for CFLAGS

        lang/python25- use OPT and other environment variables to
        influence the build for the target platform, so for the time
        being OPT needs to receive ${CFLAGS} on those.

How-To-Repeat: 	Build any of lang/python26+

        # sed -n -e '/^CFLAGS=/p' -e '/^OPT=/p' \
              /usr/local/lib/pythonX.X/config/Makefile
        OPT=		-DNDEBUG -O2 -fno-strict-aliasing -pipe -march=nocona
        CFLAGS=		$(BASECFLAGS) -O2 -fno-strict-aliasing -pipe -march=nocona  $(OPT) $(EXTRA_CFLAGS)
Comment 1 Tilman Keskinoz freebsd_committer 2012-06-08 14:02:52 UTC
Responsible Changed
From-To: freebsd-ports-bugs->python

over to maintainers 

http://www.freebsd.org/cgi/query-pr.cgi?pr=168767 

Date: Wed, 6 Jun 2012 23:46:16 +0200
Comment 2 Mark Linimon freebsd_committer 2012-06-11 08:03:56 UTC
Responsible Changed
From-To: python->freebsd-python

Canonicalize assignment.
Comment 3 dfilter freebsd_committer 2012-07-22 10:45:35 UTC
Author: mva
Date: Sun Jul 22 09:45:24 2012
New Revision: 301311
URL: http://svn.freebsd.org/changeset/ports/301311

Log:
  - Fix Python OPT flags for WITH_PTH knob
  
  PR:		ports/168767
  Submitted by:	Marcus von Appen <mva@freebsd.org>

Modified:
  head/lang/python26/Makefile   (contents, props changed)
  head/lang/python27/Makefile   (contents, props changed)

Modified: head/lang/python26/Makefile
==============================================================================
--- head/lang/python26/Makefile	Sun Jul 22 09:25:07 2012	(r301310)
+++ head/lang/python26/Makefile	Sun Jul 22 09:45:24 2012	(r301311)
@@ -7,7 +7,7 @@
 
 PORTNAME=	python26
 PORTVERSION=	2.6.8
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
@@ -21,7 +21,7 @@ WRKSRC=		${PYTHON_WRKSRC}/portbld.static
 PATCH_WRKSRC=	${PYTHON_WRKSRC}
 GNU_CONFIGURE=	yes
 CONFIGURE_SCRIPT=	../configure # must be relative
-CONFIGURE_ENV=	OPT="${CFLAGS}" SVNVERSION="echo freebsd"
+CONFIGURE_ENV=	SVNVERSION="echo freebsd"
 MAKE_ENV=	VPATH="${PYTHON_WRKSRC}"
 USE_LDCONFIG=	yes
 MAKE_JOBS_SAFE=	yes
@@ -148,6 +148,8 @@ CONFIGURE_ARGS+=	--disable-ipv6
 CONFIGURE_ARGS+=	--with-fpectl
 .endif
 
+CONFIGURE_ENV+=	OPT="${CFLAGS} ${_PTH_CPPFLAGS}"
+
 pre-patch:
 	${CP} -r ${PATCH_WRKSRC}/Lib/plat-freebsd8 \
 		${PATCH_WRKSRC}/Lib/plat-freebsd9
@@ -176,8 +178,10 @@ pre-patch:
 		${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

Modified: head/lang/python27/Makefile
==============================================================================
--- head/lang/python27/Makefile	Sun Jul 22 09:25:07 2012	(r301310)
+++ head/lang/python27/Makefile	Sun Jul 22 09:45:24 2012	(r301311)
@@ -7,7 +7,7 @@
 
 PORTNAME=	python27
 PORTVERSION=	2.7.3
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
@@ -21,7 +21,7 @@ WRKSRC=		${PYTHON_WRKSRC}/portbld.static
 PATCH_WRKSRC=	${PYTHON_WRKSRC}
 GNU_CONFIGURE=	yes
 CONFIGURE_SCRIPT=	../configure # must be relative
-CONFIGURE_ENV=	OPT="${CFLAGS}" SVNVERSION="echo freebsd"
+CONFIGURE_ENV=	SVNVERSION="echo freebsd"
 MAKE_ENV=	VPATH="${PYTHON_WRKSRC}"
 USE_LDCONFIG=	yes
 MAKE_JOBS_SAFE=	yes
@@ -157,6 +157,9 @@ CONFIGURE_ARGS+=	--disable-ipv6
 CONFIGURE_ARGS+=	--with-fpectl
 .endif
 
+
+CONFIGURE_ENV+=	OPT="${CFLAGS} ${_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
@@ -191,8 +194,10 @@ pre-patch:
 		${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
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Marcus von Appen freebsd_committer 2012-07-22 10:46:38 UTC
State Changed
From-To: open->closed

Committed. Thanks!