Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Mar 2011 16:41:12 +0200
From:      Matthias Andree <mandree@FreeBSD.org>
To:        Beat Gaetzi <beat@FreeBSD.org>
Cc:        gecko@FreeBSD.org, bug-followup@FreeBSD.org, Pan Tsu <inyaoo@gmail.com>
Subject:   Re: ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS
Message-ID:  <4D909E08.2080006@FreeBSD.org>
In-Reply-To: <0a97b224749efa1cae65845675036f4d.squirrel@wmail.chruetertee.ch>
References:  <201103280800.p2S80NRT048809@freefall.freebsd.org> <4D90740E.9010305@FreeBSD.org> <0a97b224749efa1cae65845675036f4d.squirrel@wmail.chruetertee.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060108060600050004080400
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Beat Gätzi:

> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D909E08.2080006>