From mandree@FreeBSD.org  Sun Mar 27 13:58:08 2011
Return-Path: <mandree@FreeBSD.org>
Received: from apollo.emma.line.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id 29D1B1065670;
	Sun, 27 Mar 2011 13:58:08 +0000 (UTC)
	(envelope-from mandree@FreeBSD.org)
Received: from mandree by apollo.emma.line.org with local (Exim 4.74 (FreeBSD))
	(envelope-from <mandree@FreeBSD.org>)
	id 1Q3qRo-000IgZ-EM; Sun, 27 Mar 2011 15:56:04 +0200
Message-Id: <E1Q3qRo-000IgZ-EM@apollo.emma.line.org>
Date: Sun, 27 Mar 2011 15:56:04 +0200
From: Matthias Andree <mandree@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: pavelivolkov@googlemail.com
Subject: [PATCH] databases/sqlite3: always enable EXTENSIONS
X-Send-Pr-Version: 3.113
X-GNATS-Notify: pavelivolkov@googlemail.com

>Number:         155971
>Category:       ports
>Synopsis:       [PATCH] databases/sqlite3: always enable EXTENSIONS
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    mandree
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 27 14:00:20 UTC 2011
>Closed-Date:    Sun Jul 17 14:42:46 UTC 2011
>Last-Modified:  Sun Jul 17 14:42:46 UTC 2011
>Originator:     Matthias Andree
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD apollo.emma.line.org 8.2-RELEASE FreeBSD 8.2-RELEASE #65: Fri Feb 25 01:47:50 CET 2011
>Description:
Unconditionally enable EXTENSIONS (was enabled by default), to avoid
breaking firefox4; bump PORTREVISION.

Port maintainer (pavelivolkov@googlemail.com) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- sqlite3-3.7.5_1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/databases/sqlite3/Makefile,v
retrieving revision 1.55
diff -u -u -r1.55 Makefile
--- Makefile	4 Mar 2011 14:00:56 -0000	1.55
+++ Makefile	27 Mar 2011 13:47:13 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	sqlite3
 PORTVERSION=	3.7.5
+PORTREVISION=	1
 CATEGORIES=	databases
 MASTER_SITES=	http://www.sqlite.org/ http://www2.sqlite.org/
 DISTNAME=	sqlite-src-3070500
@@ -50,7 +51,6 @@
 		SECURE_DELETE	"Overwrite deleted information with zeros" on \
 		UNLOCK_NOTIFY	"Enable notification on unlocking"	on \
 		THREADSAFE	"Build thread-safe library"		on \
-		EXTENSION	"Allow loadable extensions"		on \
 		TCLWRAPPER	"Enable TCL wrapper"			off \
 
 .include <bsd.port.options.mk>
@@ -178,11 +178,7 @@
 CONFIGURE_ARGS+=	--disable-threadsafe
 .endif
 
-.if !defined(WITHOUT_EXTENSION)
 CONFIGURE_ARGS+=	--enable-load-extension
-.else
-CONFIGURE_ARGS+=	--disable-load-extension
-.endif
 
 CONFIGURE_ENV+=		CPPFLAGS="-I. -I./src ${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
 MAKE_ENV+=		CPPFLAGS="-I. -I./src ${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
--- sqlite3-3.7.5_1.patch ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->mandree 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Mar 27 14:00:31 UTC 2011 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=155971 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Sun Mar 27 14:00:38 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

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

From: Edwin Groothuis <edwin@FreeBSD.org>
To: pavelivolkov@googlemail.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Sun, 27 Mar 2011 14:00:35 UT

 Maintainer of databases/sqlite3,
 
 Please note that PR ports/155971 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/155971
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Matthias Andree <mandree@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Sun, 27 Mar 2011 16:49:50 +0200

 Note that this apparently only affects www/firefox builds with PGO 
 (profile-guided optimization) enabled.
 

From: Pan Tsu <inyaoo@gmail.com>
To: Matthias Andree <mandree@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, pavelivolkov@googlemail.com
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 02:16:45 +0400

 Matthias Andree <mandree@FreeBSD.org> writes:
 
 > Unconditionally enable EXTENSIONS (was enabled by default), to avoid
 > breaking firefox4; bump PORTREVISION.
 
 Is it related to --enable-system-sqlite or sqlite bundled with firefox, too?
 www/firefox doesn't use system sqlite.

From: Pavel Volkov <pavelivolkov@googlemail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 11:54:19 +0400

 Hello.
 I am not against this change.
 Although a rather strange relationship between the "ability to
 disable", do not disconnect, and other ports.
 Can I find out the details of an error.
 
 On Sun, Mar 27, 2011 at 18:00, Edwin Groothuis <edwin@freebsd.org> wrote:
 >
 > Maintainer of databases/sqlite3,
 >
 > Please note that PR ports/155971 has just been submitted.
 >
 > If it contains a patch for an upgrade, an enhancement or a bug fix
 > you agree on, reply to this email stating that you approve the patch
 > and a committer will take care of it.
 >
 > The full text of the PR can be found at:
 > =C2=A0 =C2=A0http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dports/155971
 >
 > --
 > Edwin Groothuis via the GNATS Auto Assign Tool
 > edwin@FreeBSD.org

From: Matthias Andree <mandree@FreeBSD.org>
To: Pavel Volkov <pavelivolkov@googlemail.com>
Cc: Pan Tsu <inyaoo@gmail.com>, Beat Gaetzi <beat@FreeBSD.org>, 
 bug-followup@freebsd.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 13:42:06 +0200

 Am 28.03.2011 10:00, schrieb Pavel Volkov:
 > The following reply was made to PR ports/155971; it has been noted by GNATS.
 > 
 > From: Pavel Volkov <pavelivolkov@googlemail.com>
 > To: bug-followup@freebsd.org
 > Cc:  
 > Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
 > Date: Mon, 28 Mar 2011 11:54:19 +0400
 > 
 >  Hello.
 >  I am not against this change.
 >  Although a rather strange relationship between the "ability to
 >  disable", do not disconnect, and other ports.
 >  Can I find out the details of an error.
 
 Hi Pavel, Pan, Beat,
 
 the issue in Firefox is that its "Profile-Guided Optimization" feature
 uses py-sqlite3 (from the system) and breaks if sqlite3 lacks
 EXTENSIONS, because sqlite3_load_extensions() or thereabouts isn't in
 _sqlite.so.
 
 Unfortunately the ports system doesn't offer a standard way to allow
 dependencies on features else I'd just set that.  The defaults are fine
 and I suppose that's what others test with.
 
 In the default settings, everything is fine:
 - www/firefox defaults to PGO = off (so doesn't need py-sqlite3)
 - databases/sqlite3 defaults to EXTENSIONS = on (so even if firefox had
 a different default, it would be OK).
 
 
 I am considering leaving your port alone and creating a slave port that
 forces EXTENSIONS on, if that is possible (haven't checked yet) and
 helps the firefox dependency.
 
 Best regards
 Matthias

From: "Beat Gaetzi" <beat@FreeBSD.org>
To: "Matthias Andree" <mandree@FreeBSD.org>
Cc: "Pavel Volkov" <pavelivolkov@googlemail.com>, "Pan Tsu" <inyaoo@gmail.com>,
        "Beat Gaetzi" <beat@FreeBSD.org>, bug-followup@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 14:09:55 +0200

 > Am 28.03.2011 10:00, schrieb Pavel Volkov:
 >> The following reply was made to PR ports/155971; it has been noted by
 >> GNATS.
 >>
 >> From: Pavel Volkov <pavelivolkov@googlemail.com>
 >> To: bug-followup@freebsd.org
 >> Cc:
 >> Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable
 >> EXTENSIONS
 >> Date: Mon, 28 Mar 2011 11:54:19 +0400
 >>
 >>  Hello.
 >>  I am not against this change.
 >>  Although a rather strange relationship between the "ability to
 >>  disable", do not disconnect, and other ports.
 >>  Can I find out the details of an error.
 >
 > Hi Pavel, Pan, Beat,
 >
 > the issue in Firefox is that its "Profile-Guided Optimization" feature
 > uses py-sqlite3 (from the system) and breaks if sqlite3 lacks
 > EXTENSIONS, because sqlite3_load_extensions() or thereabouts isn't in
 > _sqlite.so.
 >
 > Unfortunately the ports system doesn't offer a standard way to allow
 > dependencies on features else I'd just set that.  The defaults are fine
 > and I suppose that's what others test with.
 >
 > In the default settings, everything is fine:
 > - www/firefox defaults to PGO = off (so doesn't need py-sqlite3)
 > - databases/sqlite3 defaults to EXTENSIONS = on (so even if firefox had
 > a different default, it would be OK).
 
 Thanks for tracking this down.
 
 > I am considering leaving your port alone and creating a slave port that
 > forces EXTENSIONS on, if that is possible (haven't checked yet) and
 > helps the firefox dependency.
 
 Wouldn't that create a conflict between sqlite3 and the new slave port? In
 this case that isn't the solution too.
 Is there a way to query sqlite3 to find out if it was build with loadable
 extensions? If yes, we could query that in the firefox port and set BROKEN
 if this isn't the case.
 
 Thanks,
 Beat

From: Pan Tsu <inyaoo@gmail.com>
To: Matthias Andree <mandree@FreeBSD.org>
Cc: Pavel Volkov <pavelivolkov@googlemail.com>,  Beat Gaetzi <beat@FreeBSD.org>,  bug-followup@freebsd.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 17:34:38 +0400

 Matthias Andree <mandree@FreeBSD.org> writes:
 
 [...]
 > I am considering leaving your port alone and creating a slave port that
 > forces EXTENSIONS on, if that is possible (haven't checked yet) and
 > helps the firefox dependency.
 
 How about FFI one-liner that fails build if EXTENSION is absent?
 
 --- a.diff begins here ---
 Index: databases/py-sqlite3/Makefile
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/py-sqlite3/Makefile,v
 retrieving revision 1.8
 diff -u -p -r1.8 Makefile
 --- databases/py-sqlite3/Makefile	28 Oct 2010 21:00:08 -0000	1.8
 +++ databases/py-sqlite3/Makefile	28 Mar 2011 13:18:25 -0000
 @@ -33,6 +33,10 @@ PYDISTUTILS_NOEGGINFO=	yes
  pre-extract:
  	@${CAT} ${PKGMESSAGE}
  
 +# fail if databases/sqlite3 is built without EXTENSION, cf. ports/149842
 +pre-configure:
 +	@${PYTHON_CMD} -c 'import ctypes; ctypes.CDLL("libsqlite3.so").sqlite3_load_extension'
 +
  post-extract:
  .if ${PYTHON_REL} < 300
  	@${CP} ${FILESDIR}/setup.py ${WRKSRC}
 --- a.diff ends here ---

From: Matthias Andree <mandree@FreeBSD.org>
To: Beat Gaetzi <beat@FreeBSD.org>
Cc: Pan Tsu <inyaoo@gmail.com>, bug-followup@FreeBSD.org, 
 gecko@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 16:41:12 +0200

 This is a multi-part message in MIME format.
 --------------060108060600050004080400
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 8bit
 
 Beat Gtzi:
 
 > Wouldn't that create a conflict between sqlite3 and the new slave port? In
 > this case that isn't the solution too.
 > Is there a way to query sqlite3 to find out if it was build with loadable
 > extensions? If yes, we could query that in the firefox port and set BROKEN
 > if this isn't the case.
 
 Indeed I'd prefer IGNORE or BROKEN, but we can't catch that so early --
 and particularly not without forking processes while the Makefile is
 being parsed.
 
 The test would erroneously fail if py*-sqlite3 and/or sqlite3 is not
 installed before you attempt the build, but got installed only as part
 of firefox's depends - so we cannot do this earlier than post depends,
 f. i. in pre-build.
 
 There's a way that work without python (needed because python may only
 be installed as firefox's dependency), and that is:
 
   objdump -R ${LOCALBASE}/libsqlite3.so | grep -w sqlite3_load_extension
 
 We can additionally try grepping ${PORT_DBDIR}/sqlite3/options and/or
 the libfile, but again, neither is guaranteed to exist when you "make"
 firefox's Makefile - and we don't want != lines.
 
 
 How about the attached patch to www/firefox?  It performs this check in
 pre-everything (in case sqlite3 is already installed) and again in
 pre-build (if it got installed in the 'make depends' stage).
 
 As a side effect, it also removes the != line (for pthread library
 extraction) as per the recent portlint warning URL, so that reading the
 Makefile doesn't fork a new process.
 
 Works for me, but please double-check.
 
 Best
 Matthias
 
 --------------060108060600050004080400
 Content-Type: text/x-patch;
  name="check-www-firefox-PGO.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="check-www-firefox-PGO.patch"
 
 SEND-PR: -*- send-pr -*-
 To: bug-followup@freebsd.org
 From: Matthias Andree <mandree@apollo.emma.line.org>
 Cc: gecko@FreeBSD.org,beat@FreeBSD.org,Pan Tsu <inyaoo@gmail.com>
 X-send-pr-version: 3.113
 X-GNATS-Notify: 
 
 
 >Submitter-Id:	current-users
 >Originator:	Matthias Andree
 >Organization:	
 >Confidential:	no 
 >Synopsis:	ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
 >Severity:	non-critical
 SEND-PR: 	[ non-critical | serious | critical ] 
 >Priority:	low
 SEND-PR: 	[ low | medium | high ]
 >Category:	ports 
 SEND-PR: <choose from the list of categories below (one line)>
 SEND-PR: advocacy  alpha     bin       conf      docs      gnu       
 SEND-PR: i386      ia64      java      kern      misc      ports     
 SEND-PR: powerpc   sparc64   standards www       
 >Class:		change-request
 SEND-PR: [ sw-bug | doc-bug | change-request | update | maintainer-update ]
 >Release:	FreeBSD 8.2-RELEASE amd64
 >Environment:
 System: FreeBSD apollo.emma.line.org 8.2-RELEASE FreeBSD 8.2-RELEASE #65: Fri Feb 25 01:47:50 CET 2011
 >Description:
 [DESCRIBE CHANGES]
 
 Port maintainer (gecko@FreeBSD.org) is cc'd.
 
 Generated with FreeBSD Port Tools 0.99
 >How-To-Repeat:
 >Fix:
 
 --- firefox-4.0_1,1.patch begins here ---
 Index: Makefile
 ===================================================================
 RCS file: /home/ncvs/ports/www/firefox/Makefile,v
 retrieving revision 1.239
 diff -u -u -r1.239 Makefile
 --- Makefile	24 Mar 2011 11:04:17 -0000	1.239
 +++ Makefile	28 Mar 2011 14:34:16 -0000
 @@ -58,7 +58,7 @@
  
  WRKSRC:=	${WRKSRC}-2.0
  
 -GECKO_PTHREAD_LIBS!=${CC} -dumpspecs | ${GREP} -m 1 '%{\!pg: %{pthread:' | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
 +GECKO_PTHREAD_LIBS=	${CC} -dumpspecs | ${GREP} -m 1 '%{\!pg: %{pthread:' | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
  
  .if ${HAVE_GNOME:Mlibgnomeui}!=""
  USE_GNOME+=	libgnomeui
 @@ -75,6 +75,7 @@
  .endif
  
  .if defined(WITH_PGO)
 +www_firefox_check_sqlite3_extension=	${OBJDUMP} 2>&1 -R ${LOCALBASE}/lib/libsqlite3.so | ${EGREP} -w -q 'sqlite3_load_extension'
  BUILD_DEPENDS+=	${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3
  USE_PYTHON_BUILD=	yes
  USE_DISPLAY=		yes
 @@ -88,17 +89,44 @@
  BUILD_DEPENDS+=	yasm:${PORTSDIR}/devel/yasm
  .endif
  
 +PGO_FAIL="\
 +===============================================================\n\
 +For profile-guided-optimized builds, sqlite3 in your system\n\
 +needs to be built with the EXTENSION option enabled.\n\
 +\n\
 +Either re-run \"make config\" and build firefox without PGO, or\n\
 +re-install databases/sqlite3 with EXTENSION enabled before\n\
 +retrying the firefox build.\n\
 +===============================================================\n"
 +
 +# these checks are quite early, but since sqlite3 may be neither
 +# configured nor installed if this Makefile is being processed,
 +# we need to re-check again.
 +pre-everything::
 +.if defined(WITH_PGO)
 +	@fail=0 ; \
 +	if test -e ${PORTS_DBDIR}/sqlite3/options ; then \
 +		if ${EGREP} ^WITHOUT_EXTENSION= ${PORTS_DBDIR}/sqlite ; then fail=1 ; fi \
 +	fi ; \
 +	if test -e ${LOCALBASE}/lib/libsqlite3.so ; then \
 +		${www_firefox_check_sqlite3_extension} || fail=1 ; \
 +	fi ; \
 +	if test $$fail = 1 ; then \
 +		${ECHO_CMD} ${PGO_FAIL} ; \ fi
 +.endif
 +
  pre-extract:
  .if defined(WITH_PGO)
 -	@${ECHO} "*****************************************************************"
 -	@${ECHO} "**************************** attention **************************"
 -	@${ECHO} "*****************************************************************"
 -	@${ECHO} "To build Firefox with PGO support you need a running X server and"
 -	@${ECHO} "   build this port with an user who could access the X server!   "
 +	@${ECHO} "******************************************************************"
 +	@${ECHO} "**************************** Attention ***************************"
 +	@${ECHO} "******************************************************************"
 +	@${ECHO} ""
 +	@${ECHO} "To build Firefox with PGO support you need a running X server and "
 +	@${ECHO} "build this port with a user who can access the X server!          "
  	@${ECHO} ""
 -	@${ECHO} "During the build a Firefox instance will start and run some test."
 -	@${ECHO} "      Do not interrupt or close Firefox during this tests!       "
 -	@${ECHO} "*****************************************************************"
 +	@${ECHO} "During the build a Firefox instance will start and run some tests."
 +	@${ECHO} "Do not interrupt or close Firefox during these tests!             "
 +	@${ECHO} "******************************************************************"
  	@sleep 10
  .endif
  
 @@ -108,7 +136,7 @@
  		<${FILESDIR}/firefox.desktop.in >${WRKDIR}/${MOZILLA}.desktop
  
  post-patch:
 -	${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS:C/-pthread/${GECKO_PTHREAD_LIBS}/}|' \
 +	${REINPLACE_CMD} -e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS:C/-pthread/\$(${GECKO_PTHREAD_LIBS})/}|" \
  		${WRKSRC}/storage/build/Makefile.in \
  		${WRKSRC}/toolkit/library/Makefile.in \
  		${WRKSRC}/db/sqlite3/src/Makefile.in
 @@ -134,6 +162,15 @@
  	(cd ${WRKSRC} && ${GMAKE} distclean)
  .endif
  
 +# run again - if sqlite3 or py-sqlite3 got installed in this port's
 +# depends stage, the pre-everything check may have missed this.
 +pre-build:
 +.if defined(WITH_PGO)
 +	@${www_firefox_check_sqlite3_extension} || { \
 +	    ${ECHO_CMD} -e ${PGO_FAIL} ; \
 +	}
 +.endif
 +
  port-pre-install:
  	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
  	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 --- firefox-4.0_1,1.patch ends here ---
 
 
 --------------060108060600050004080400--

From: Matthias Andree <mandree@FreeBSD.org>
To: Beat Gaetzi <beat@FreeBSD.org>
Cc: Pan Tsu <inyaoo@gmail.com>, bug-followup@FreeBSD.org, 
 gecko@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Mon, 28 Mar 2011 16:44:11 +0200

 This is a multi-part message in MIME format.
 --------------070804080403060103020503
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Whoops, editorial error caused a bogus line fold that broke the file.
 Back out the previous patch (if applied) and use this instead.
 
 --------------070804080403060103020503
 Content-Type: text/x-patch;
  name="fixed-check-www-firefox-PGO.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="fixed-check-www-firefox-PGO.patch"
 
 REVISED:
 
 --- firefox-4.0_1,1.patch begins here ---
 Index: Makefile
 ===================================================================
 RCS file: /home/ncvs/ports/www/firefox/Makefile,v
 retrieving revision 1.239
 diff -u -u -r1.239 Makefile
 --- Makefile	24 Mar 2011 11:04:17 -0000	1.239
 +++ Makefile	28 Mar 2011 14:41:55 -0000
 @@ -58,7 +58,7 @@
  
  WRKSRC:=	${WRKSRC}-2.0
  
 -GECKO_PTHREAD_LIBS!=${CC} -dumpspecs | ${GREP} -m 1 '%{\!pg: %{pthread:' | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
 +GECKO_PTHREAD_LIBS=	${CC} -dumpspecs | ${GREP} -m 1 '%{\!pg: %{pthread:' | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
  
  .if ${HAVE_GNOME:Mlibgnomeui}!=""
  USE_GNOME+=	libgnomeui
 @@ -75,6 +75,7 @@
  .endif
  
  .if defined(WITH_PGO)
 +www_firefox_check_sqlite3_extension=	${OBJDUMP} 2>&1 -R ${LOCALBASE}/lib/libsqlite3.so | ${EGREP} -w -q 'sqlite3_load_extension'
  BUILD_DEPENDS+=	${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3
  USE_PYTHON_BUILD=	yes
  USE_DISPLAY=		yes
 @@ -88,17 +89,45 @@
  BUILD_DEPENDS+=	yasm:${PORTSDIR}/devel/yasm
  .endif
  
 +PGO_FAIL="\
 +===============================================================\n\
 +For profile-guided-optimized builds, sqlite3 in your system\n\
 +needs to be built with the EXTENSION option enabled.\n\
 +\n\
 +Either re-run \"make config\" and build firefox without PGO, or\n\
 +re-install databases/sqlite3 with EXTENSION enabled before\n\
 +retrying the firefox build.\n\
 +===============================================================\n"
 +
 +# these checks are quite early, but since sqlite3 may be neither
 +# configured nor installed if this Makefile is being processed,
 +# we need to re-check again.
 +pre-everything::
 +.if defined(WITH_PGO)
 +	@fail=0 ; \
 +	if test -e ${PORTS_DBDIR}/sqlite3/options ; then \
 +		if ${EGREP} ^WITHOUT_EXTENSION= ${PORTS_DBDIR}/sqlite ; then fail=1 ; fi \
 +	fi ; \
 +	if test -e ${LOCALBASE}/lib/libsqlite3.so ; then \
 +		${www_firefox_check_sqlite3_extension} || fail=1 ; \
 +	fi ; \
 +	if test $$fail = 1 ; then \
 +		${ECHO_CMD} ${PGO_FAIL} ; \
 +	fi
 +.endif
 +
  pre-extract:
  .if defined(WITH_PGO)
 -	@${ECHO} "*****************************************************************"
 -	@${ECHO} "**************************** attention **************************"
 -	@${ECHO} "*****************************************************************"
 -	@${ECHO} "To build Firefox with PGO support you need a running X server and"
 -	@${ECHO} "   build this port with an user who could access the X server!   "
 +	@${ECHO} "******************************************************************"
 +	@${ECHO} "**************************** Attention ***************************"
 +	@${ECHO} "******************************************************************"
 +	@${ECHO} ""
 +	@${ECHO} "To build Firefox with PGO support you need a running X server and "
 +	@${ECHO} "build this port with a user who can access the X server!          "
  	@${ECHO} ""
 -	@${ECHO} "During the build a Firefox instance will start and run some test."
 -	@${ECHO} "      Do not interrupt or close Firefox during this tests!       "
 -	@${ECHO} "*****************************************************************"
 +	@${ECHO} "During the build a Firefox instance will start and run some tests."
 +	@${ECHO} "Do not interrupt or close Firefox during these tests!             "
 +	@${ECHO} "******************************************************************"
  	@sleep 10
  .endif
  
 @@ -108,7 +137,7 @@
  		<${FILESDIR}/firefox.desktop.in >${WRKDIR}/${MOZILLA}.desktop
  
  post-patch:
 -	${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS:C/-pthread/${GECKO_PTHREAD_LIBS}/}|' \
 +	${REINPLACE_CMD} -e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS:C/-pthread/\$(${GECKO_PTHREAD_LIBS})/}|" \
  		${WRKSRC}/storage/build/Makefile.in \
  		${WRKSRC}/toolkit/library/Makefile.in \
  		${WRKSRC}/db/sqlite3/src/Makefile.in
 @@ -134,6 +163,15 @@
  	(cd ${WRKSRC} && ${GMAKE} distclean)
  .endif
  
 +# run again - if sqlite3 or py-sqlite3 got installed in this port's
 +# depends stage, the pre-everything check may have missed this.
 +pre-build:
 +.if defined(WITH_PGO)
 +	@${www_firefox_check_sqlite3_extension} || { \
 +	    ${ECHO_CMD} -e ${PGO_FAIL} ; \
 +	}
 +.endif
 +
  port-pre-install:
  	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
  	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 --- firefox-4.0_1,1.patch ends here ---
 
 
 --------------070804080403060103020503--

From: Pan Tsu <inyaoo@gmail.com>
To: Matthias Andree <mandree@FreeBSD.org>
Cc: Beat Gaetzi <beat@FreeBSD.org>, Pavel Volkov <pavelivolkov@googlemail.com>, bug-followup@FreeBSD.org, freebsd-python@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Tue, 29 Mar 2011 09:24:28 +0400

 Matthias Andree <mandree@FreeBSD.org> writes:
 
 [...]
 > How about the attached patch to www/firefox?  It performs this check in
 > pre-everything (in case sqlite3 is already installed) and again in
 > pre-build (if it got installed in the 'make depends' stage).
 
 Why are you trying to fix only firefox? Every user of py-sqlite3 is affected.
 
   $ python -c 'import sqlite3'
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "LOCALBASE/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
       from dbapi2 import *
     File "LOCALBASE/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
       from _sqlite3 import *
   ImportError: LOCALBASE/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"
 
 Most are run dependency, so they fail during run, e.g.
 
   $ flexget
   FATAL: Unable to use SQLite. Are you running Python 2.5.x or 2.6.x ?
   Python should normally have SQLite support built in.
   If you're running correct version of Python then it is not equipped with SQLite.
   Try installing `pysqlite` and / or if you have compiled python yourself, recompile it with SQLite support.
 
   # runs fine but the Library doesn't work
   $ comix
   ! Could neither find pysqlite2 nor sqlite3.
   load: 0.18  cmd: python 39505 [select] 1.55r 0.17u 0.06s 1% 42872k
 
 but some are not, e.g.
 
   $ make install
   [...]
   gmake[4]: Entering directory `/usr/ports/chinese/ibus-pinyin/work/ibus-pinyin-1.3.8/data/db/android'
   gmake[4]: Nothing to be done for `install-exec-am'.
     GEN    android.db
   Traceback (most recent call last):
     File "./create_db.py", line 2, in <module>
       import sqlite3
     File "LOCALBASE/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
       from dbapi2 import *
     File "LOCALBASE/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
       from _sqlite3 import *
   ImportError: LOCALBASE/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"
   test -z "PREFIX/share/ibus-pinyin/db" || ../../.././install-sh -c -d "PREFIX/share/ibus-pinyin/db"
    install   -m 444 ./android.db 'PREFIX/share/ibus-pinyin/db'
   install: ./android.db: No such file or directory
   gmake[4]: *** [install-main_dbDATA] Error 71
 
 As for slave port, if you make py-sqlite3 depend on PKGNAMESUFFIX
 (or absence) via RUN_DEPENDS it'd guarantee that the port always works
 even if PLIST is identical.
 
   $ cd py-sqlite3; make install
   [...]
   ===>  sqlite3-3.7.5_1 conflicts with installed package(s):
         sqlite3-noext-3.7.5_1
 
   # to resolve conflict
   $ cd sqlite3-noext; make deinstall
   $ cd sqlite3; make install
   $ cd py-sqlite3; make install
 
 Any dependent ports would fail to build/install because py-sqlite3
 dependency cannot be satisfied.
 
 --- a.diff begins here ---
 Index: UPDATING
 ===================================================================
 RCS file: /a/.cvsup/ports/UPDATING,v
 retrieving revision 1.1047
 diff -u -p -r1.1047 UPDATING
 --- UPDATING	25 Mar 2011 10:33:31 -0000	1.1047
 +++ UPDATING	29 Mar 2011 05:05:29 -0000
 @@ -5,6 +5,13 @@ they are unavoidable.
  You should get into the habit of checking this file for changes each time
  you update your ports collection, before attempting any port upgrades.
  
 +XXXXXXXX:
 +  AFFECTS: databases/sqlite3
 +  AUTHOR: none@
 +
 +  EXTENSION was enabled unconditionally. For sqlite3 without its support
 +  refer to databases/sqlite3-noext port.
 +
  20110324:
    AFFECTS: users of KDE SC 4
    AUTHOR: kde@FreeBSD.org
 Index: databases/Makefile
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/Makefile,v
 retrieving revision 1.964
 diff -u -p -r1.964 Makefile
 --- databases/Makefile	21 Mar 2011 20:41:48 -0000	1.964
 +++ databases/Makefile	29 Mar 2011 03:07:56 -0000
 @@ -785,6 +785,7 @@
      SUBDIR += sqlite-ext-mobigroup
      SUBDIR += sqlite2
      SUBDIR += sqlite3
 +    SUBDIR += sqlite3-noext
      SUBDIR += sqlite34
      SUBDIR += sqliteman
      SUBDIR += sqlitemanager
 Index: databases/sqlite3/Makefile
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/sqlite3/Makefile,v
 retrieving revision 1.55
 diff -u -p -r1.55 Makefile
 --- databases/sqlite3/Makefile	4 Mar 2011 14:00:56 -0000	1.55
 +++ databases/sqlite3/Makefile	29 Mar 2011 05:06:29 -0000
 @@ -7,6 +7,7 @@
  
  PORTNAME=	sqlite3
  PORTVERSION=	3.7.5
 +PORTREVISION?=	1
  CATEGORIES=	databases
  MASTER_SITES=	http://www.sqlite.org/ http://www2.sqlite.org/
  DISTNAME=	sqlite-src-3070500
 @@ -19,7 +20,7 @@ LICENSE_NAME=	Public Domain
  LICENSE_PERMS=	${_LICENSE_PERMS_DEFAULT}
  LICENSE_TEXT=	Description of the license can be obtained from the following URL: http://www.sqlite.org/copyright.html
  
 -CONFLICTS=	sqlite34-[0-9]*
 +CONFLICTS+=	sqlite34-[0-9]*
  
  USE_ZIP=	YES
  USE_GMAKE=	YES
 @@ -50,7 +53,6 @@ OPTIONS=	\
  		SECURE_DELETE	"Overwrite deleted information with zeros" on \
  		UNLOCK_NOTIFY	"Enable notification on unlocking"	on \
  		THREADSAFE	"Build thread-safe library"		on \
 -		EXTENSION	"Allow loadable extensions"		on \
  		TCLWRAPPER	"Enable TCL wrapper"			off \
  
  .include <bsd.port.options.mk>
 @@ -178,10 +180,13 @@ CONFIGURE_ARGS+=	--enable-threadsafe
  CONFIGURE_ARGS+=	--disable-threadsafe
  .endif
  
 -.if !defined(WITHOUT_EXTENSION)
 +.if ${SLAVE_PORT} == "no"
  CONFIGURE_ARGS+=	--enable-load-extension
 +CONFLICTS+=		sqlite3-noext-[0-9]*
  .else
 +. if defined(WITHOUT_EXTENSION)
  CONFIGURE_ARGS+=	--disable-load-extension
 +. endif
  .endif
  
  CONFIGURE_ENV+=		CPPFLAGS="-I. -I./src ${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
 Index: databases/sqlite3-noext/Makefile
 ===================================================================
 RCS file: databases/sqlite3-noext/Makefile
 diff -N databases/sqlite3-noext/Makefile
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ databases/sqlite3-noext/Makefile	29 Mar 2011 05:23:20 -0000
 @@ -0,0 +1,19 @@
 +# Ports collection makefile for:	sqlite3-noext
 +# Date created:				29 Mar 2011
 +# Whom:					none
 +#
 +# $FreeBSD$
 +#
 +
 +PKGNAMESUFFIX=	-noext
 +
 +WITHOUT_EXTENSION= yes
 +CONFLICTS=	sqlite3-[0-9]*
 +LATEST_LINK=	sqlite3-noext
 +
 +# force default options
 +#_OPTIONS_OK=	yes
 +
 +MASTERDIR=	${.CURDIR}/../../databases/sqlite3
 +
 +.include "${MASTERDIR}/Makefile"
 Index: databases/py-sqlite3/Makefile
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/py-sqlite3/Makefile,v
 retrieving revision 1.8
 diff -u -p -r1.8 Makefile
 --- databases/py-sqlite3/Makefile	28 Oct 2010 21:00:08 -0000	1.8
 +++ databases/py-sqlite3/Makefile	29 Mar 2011 05:11:27 -0000
 @@ -7,7 +7,7 @@
  
  PORTNAME=	sqlite3
  PORTVERSION=	${PYTHON_PORTVERSION}
 -PORTREVISION=	1
 +PORTREVISION=	2
  CATEGORIES=	databases python
  MASTER_SITES=	${PYTHON_MASTER_SITES}
  MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
 @@ -18,6 +18,7 @@ MAINTAINER=	python@FreeBSD.org
  COMMENT=	Standard Python binding to the SQLite3 library
  
  LIB_DEPENDS=	sqlite3.8:${PORTSDIR}/databases/sqlite3
 +RUN_DEPENDS=	sqlite3>=0:${PORTSDIR}/databases/sqlite3
  
  PLIST_FILES=	lib/%%PYTHON_VERSION%%/site-packages/_sqlite3.so
  DIST_SUBDIR=	python
 --- a.diff ends here ---

From: Pan Tsu <inyaoo@gmail.com>
To: Matthias Andree <mandree@FreeBSD.org>
Cc: Beat Gaetzi <beat@FreeBSD.org>,  Pavel Volkov <pavelivolkov@googlemail.com>,  bug-followup@FreeBSD.org,  freebsd-python@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Tue, 29 Mar 2011 11:48:58 +0400

 Pan Tsu <inyaoo@gmail.com> writes:
 
 > Matthias Andree <mandree@FreeBSD.org> writes:
 >
 > [...]
 >> How about the attached patch to www/firefox?  It performs this check in
 >> pre-everything (in case sqlite3 is already installed) and again in
 >> pre-build (if it got installed in the 'make depends' stage).
 >
 > Why are you trying to fix only firefox? Every user of py-sqlite3 is affected.
 >
 >   $ python -c 'import sqlite3'
 >   Traceback (most recent call last):
 >     File "<string>", line 1, in <module>
 >     File "LOCALBASE/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
 >       from dbapi2 import *
 >     File "LOCALBASE/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
 >       from _sqlite3 import *
 >   ImportError: LOCALBASE/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"
 
 Nevermind, py-sqlite3 has HAVE_LOAD_EXTENSION ifdef around that call.
 
 --- a.diff begins here ---
 Index: databases/py-sqlite3/Makefile
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/py-sqlite3/Makefile,v
 retrieving revision 1.8
 diff -u -p -r1.8 Makefile
 --- databases/py-sqlite3/Makefile	28 Oct 2010 21:00:08 -0000	1.8
 +++ databases/py-sqlite3/Makefile	29 Mar 2011 07:40:40 -0000
 @@ -7,7 +7,7 @@
  
  PORTNAME=	sqlite3
  PORTVERSION=	${PYTHON_PORTVERSION}
 -PORTREVISION=	1
 +PORTREVISION=	2
  CATEGORIES=	databases python
  MASTER_SITES=	${PYTHON_MASTER_SITES}
  MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
 Index: databases/py-sqlite3/files/setup.py
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/py-sqlite3/files/setup.py,v
 retrieving revision 1.2
 diff -u -p -r1.2 setup.py
 --- databases/py-sqlite3/files/setup.py	7 Aug 2006 02:23:05 -0000	1.2
 +++ databases/py-sqlite3/files/setup.py	29 Mar 2011 07:38:29 -0000
 @@ -32,6 +32,12 @@ sqlite_srcs = [
  '_sqlite/statement.c',
  '_sqlite/util.c']
  
 +try:
 +    import ctypes
 +    ctypes.CDLL("libsqlite3.so").sqlite3_load_extension
 +except AttributeError:
 +    macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1'))
 +
  setup(name = "_sqlite3",
        description = "SQLite 3 extension to Python",
        
 Index: databases/py-sqlite3/files/setup3.py
 ===================================================================
 RCS file: /a/.cvsup/ports/databases/py-sqlite3/files/setup3.py,v
 retrieving revision 1.1
 diff -u -p -r1.1 setup3.py
 --- databases/py-sqlite3/files/setup3.py	30 Jun 2009 21:51:53 -0000	1.1
 +++ databases/py-sqlite3/files/setup3.py	29 Mar 2011 07:40:50 -0000
 @@ -31,6 +31,12 @@ sqlite_srcs = [
  '_sqlite/statement.c',
  '_sqlite/util.c']
  
 +try:
 +    import ctypes
 +    ctypes.CDLL("libsqlite3.so").sqlite3_load_extension
 +except AttributeError:
 +    macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1'))
 +
  setup(name = "_sqlite3",
        description = "SQLite 3 extension to Python",
        
 --- a.diff ends here ---

From: Beat Gaetzi <beat@FreeBSD.org>
To: Matthias Andree <mandree@FreeBSD.org>
Cc: Pan Tsu <inyaoo@gmail.com>, bug-followup@FreeBSD.org, gecko@FreeBSD.org
Subject: Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Date: Wed, 30 Mar 2011 15:21:22 +0200

 On 28.03.2011 16:44, Matthias Andree wrote:
 > Whoops, editorial error caused a bogus line fold that broke the file.
 > Back out the previous patch (if applied) and use this instead.
 
 Thanks for the patch. Shouldn't we exit the build after displaying
 PGO_FAIL? Otherwise the message might be overlooked:
 
 https://gecko.chruetertee.ch/tb/errors/8-FreeBSD_AMD64/firefox-4.0_1,1.log
 
 Beat
State-Changed-From-To: feedback->open 
State-Changed-By: mandree 
State-Changed-When: Sun May 22 21:26:18 UTC 2011 
State-Changed-Why:  
feedback received 

http://www.freebsd.org/cgi/query-pr.cgi?pr=155971 
State-Changed-From-To: open->closed 
State-Changed-By: mandree 
State-Changed-When: Sun Jul 17 14:42:45 UTC 2011 
State-Changed-Why:  
port EXTENSION default has changed 

http://www.freebsd.org/cgi/query-pr.cgi?pr=155971 
>Unformatted:
