ports/155949: www/firefox: firefox 4, WITH_PGO, better Text against DISPLAY problem

Kalten kalten at gmx.at
Fri Apr 22 19:00:24 UTC 2011


The following reply was made to PR ports/155949; it has been noted by GNATS.

From: Kalten <kalten at gmx.at>
To: bug-followup at FreeBSD.org, kalten at gmx.at
Cc:  
Subject: Re: ports/155949: www/firefox: firefox 4, WITH_PGO, better Text against DISPLAY problem
Date: Fri, 22 Apr 2011 20:57:22 +0200

 --=-=-=
 Content-Type: text/plain
 
 > That [USE_DISPLAY=yes] is already there but obviously does not work or
 > isn't enough.
 I see--sorry for not having had a look into the Makfile prior to writing
 full of joy and hope--I had a look into ports/Mk/bsd.port.mk now: Let's
 have a deeper look into the matter: (I think, I have solved it) :-)
 
 bsd.port.mk adds the Xvfb (alongside a couple of other ports) to the
 build dependencies and if not building a package (our case) sets the
 DISPLAY variable in the configure- as well as in the make-environment.
 
 The error `cannot open display: localhost:1001' tells us, that the
 python script realiced that fact, but did try to really connect to the X
 server--that is not running (as I assume).  Better saied: the Xvfb(1)
 is not started at display localhost:1001.
 
 The Xvfb realy is being installed (x11-servers/xorg-vfbserver) prior to
 the error, but am I right, that noone did start it?  `Xvfb :1001 &' and
 be aware that you must not use `Xvfb $DISPLAY' as it does not understand
 `localhost:1001' but solely `:1001', and besides: USE_DISPLAY=yes does
 only set DISPLAY in the make- and the configure-environment, not in the
 environment of the Makefile in www/firefox/!
 
 (BTW: courageous; profileserver.py uses a line `PORT=8888' and if
 something else was running there?)
 
 Some not very nice adjustment of www/firefox/Makefile (see attachment).
 It is just meant as an idea of how to do it! (Even too many ${ECHO}s for
 debuging purpose).
 
 I adopted the version of the same problem I happened to find in
 accessibility/accercise/Makefile.  One shoule, at least, write some
 example like this in ports/Mk/bsd.port.mk at USE_DISPLAY: better:
 introduce two functions: one for starting, one for terminating the Xvfb.
 
 One could try to read DISPLAY out of MAKE_ENV or CONFIGURE_ENV, but I
 lost my patience trying; so I set it in the lines below USE_DISPLAY=yes.
 
 Some questions remain open:
 *) What to do, if the build has an error and terminates? post-build will
    not be called and the server will continue to run.  If one calls
    `make clean', the pid-file is gone and noone can terminate the Xvfb
    server.  Restarting one at the same DISPLAY just terminates the new
    one, all will compile.  We could place the pid file elsewhere--still
    no good solution (leads back to some functions mentioned earlier).
    Is there a target being called regardless of failiour in the Makfile
    in <portname>/work/*?
 *) What if some other port is being built paralelly and uses the same
    mechanism: should there be some kind of `smart pointer' to terminate
    the Xvfb, when all currently running port-builds do not need it any
    more?  All will use `:1001' as it es written down in
    ports/Mk/bsd.port.mk at USE_DISPLAY.  Remember: Only the last one
    hast to terminate Xvfb but the others must not do so (at least, I
    think so).
 
 I hope, that `solved' the problem!
 Greetings,
    Kalten
 
 --=-=-=
 Content-Type: text/plain
 Content-Disposition: attachment; filename=patch.txt
 Content-Description: patch-Makefile-PGO
 
 --- Makefile.orig	2011-04-09 01:31:32.000000000 +0200
 +++ Makefile	2011-04-22 20:53:39.000000000 +0200
 @@ -78,6 +78,8 @@
  BUILD_DEPENDS+=	${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3
  USE_PYTHON_BUILD=	yes
  USE_DISPLAY=		yes
 +# in make and config environment, but not accessable here:
 +DISPLAYat=		"localhost:1001"
  .include "${PORTSDIR}/Mk/bsd.python.mk"
  
  MAKEFILE=	client.mk
 @@ -134,6 +136,30 @@
  	(cd ${WRKSRC} && ${GMAKE} distclean)
  .endif
  
 +pre-build:
 +.if defined(WITH_PGO)
 +	@if [ -f ${WRKDIR}/.Xvfb.pid ]; then \
 +	@${ECHO} "Killing ${LOCALBASE}/bin/Xvfb  at PID `${CAT} ${WRKDIR}/.Xvfb.pid`" \
 +	@sleep 5 \
 +	    ${CAT} ${WRKDIR}/.Xvfb.pid | ${XARGS} kill || ${TRUE} ; \
 +	    ${RM} -f ${WRKDIR}/.Xvfb.pid ; \
 +	fi
 +	@${LOCALBASE}/bin/Xvfb `${ECHO_CMD} ${DISPLAYat} | ${SED} -e 's|localhost\(:.*\)|\1|'` \
 +	    -screen 0 800x600x24 > /dev/null 2>&1 & ${ECHO_CMD} $$! > ${WRKDIR}/.Xvfb.pid
 +	@${ECHO} "Started ${LOCALBASE}/bin/Xvfb `${ECHO_CMD} ${DISPLAYat} | ${SED} -e 's|localhost\(:.*\)|\1|'` at PID `${CAT} ${WRKDIR}/.Xvfb.pid` on ${DISPLAYat}"
 +	@sleep 10
 +.endif
 +
 +post-build:
 +.if defined(WITH_PGO)
 +	@if [ -f ${WRKDIR}/.Xvfb.pid ]; then \
 +	@${ECHO} "Killing ${LOCALBASE}/bin/Xvfb  at PID `${CAT} ${WRKDIR}/.Xvfb.pid`" \
 +	@sleep 5 \
 +	    ${CAT} ${WRKDIR}/.Xvfb.pid | ${XARGS} kill || ${TRUE} ; \
 +	    ${RM} -f ${WRKDIR}/.Xvfb.pid ; \
 +	fi
 +.endif
 +
  port-pre-install:
  	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
  	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 
 --=-=-=--


More information about the freebsd-gecko mailing list