From nobody@FreeBSD.org  Mon Feb 26 23:46:38 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 71EFD16A402
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Feb 2007 23:46:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 2CCEE13C4A7
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Feb 2007 23:46:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l1QNkcKY099231
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Feb 2007 23:46:38 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l1QNkcTf099230;
	Mon, 26 Feb 2007 23:46:38 GMT
	(envelope-from nobody)
Message-Id: <200702262346.l1QNkcTf099230@www.freebsd.org>
Date: Mon, 26 Feb 2007 23:46:38 GMT
From: Nick Barkas<snb@threerings.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] math/gnuplot does not include bsd.emacs.mk when emacs is installed
X-Send-Pr-Version: www-3.0

>Number:         109580
>Category:       ports
>Synopsis:       [patch] math/gnuplot does not include bsd.emacs.mk when emacs is installed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glewis
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 26 23:50:04 GMT 2007
>Closed-Date:    
>Last-Modified:  Fri Feb 29 01:53:05 UTC 2008
>Originator:     Nick Barkas
>Release:        FreeBSD 6.1-RELEASE-p6 i386
>Organization:
Three Rings Design
>Environment:
FreeBSD lab1.earth.threerings.net 6.1-RELEASE-p6 FreeBSD 6.1-RELEASE-p6 #5: Wed Sep 13 17:45:32 PDT 2006     root@lab1.earth.threerings.net:/usr/obj/usr/src/sys/SMP  i386
>Description:
When installing math/gnuplot on a machine with emacs or xemacs installed, the port will attempt to install some lisp files. USE_EMACS is set conditionally based on the presence of emacs or xemacs binaries, and having USE_EMACS set is what includes bsd.emacs.mk. However, bsd.emacs.mk does not seem to ever be loaded, and thus variables such as EMACS_SITE_LISPDIR are not set. The packing list incorrectly includes %%EMACS_SITE_LISPDIR%%/gnuplot-gui.el and %%EMACS_SITE_LISPDIR%%/gnuplot.el (without substituting), and gnuplot-gui.el and gnuplot.el get installed in ${PREFIX} rather than ${PREFIX}/${EMACS_SITE_LISPDIR}

I think this might be because USE_EMACS is only conditionally set after bsd.port.pre.mk is included in the makefile. Portlint does complain about the fact that EMACS_PORT_NAME is set after including bsd.port.pre.mk.
>How-To-Repeat:
Try to make install or make package for math/gnuplot on a system with emacs installed.
>Fix:
This patch does something similar to what is done in net/gnu-radius--explicitly includes bsd.emacs.mk if it is needed. A better way to solve this problem may be to set USE_EMACS, EMACS_PORT_NAME, EMACS_NO_BUILD_DEPENDS, and EMACS_NO_RUN_DEPENDS unconditionally, before including bsd.port.pre.mk, but only add --with-lisp-files to the configure args and install the .el files if emacs or xemacs is actually installed on the system.

Patch attached with submission follows:

--- Makefile.orig	Mon Feb 26 13:15:37 2007
+++ Makefile	Mon Feb 26 15:15:40 2007
@@ -37,6 +37,7 @@
 EMACS_PORT_NAME=	emacs21
 EMACS_NO_BUILD_DEPENDS=	yes
 EMACS_NO_RUN_DEPENDS=	yes
+.include "${PORTSDIR}/Mk/bsd.emacs.mk"
 CONFIGURE_ARGS+=	--with-lisp-files
 .else
 PLIST_SUB+=		EMACS_SITE_LISPDIR="@comment "

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->glewis 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Feb 26 23:50:10 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109580 
State-Changed-From-To: open->feedback 
State-Changed-By: glewis 
State-Changed-When: Wed Mar 7 20:05:59 UTC 2007 
State-Changed-Why:  
I've committed a change that sets USE_EMACS before it includes bsd.ports.pre.mk, 
which should also fix this.  Please give this a try. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/109580: commit references a PR
Date: Wed,  7 Mar 2007 20:05:53 +0000 (UTC)

 glewis      2007-03-07 20:05:47 UTC
 
   FreeBSD ports repository
 
   Modified files:
     math/gnuplot         Makefile 
   Log:
   . (Potentially) set USE_EMACS before we include bsd.port.pre.mk, not after,
     so that we pick up bsd.emacs.mk.
   
   PR:             109580
   
   Revision  Changes    Path
   1.66      +2 -2      ports/math/gnuplot/Makefile
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Nick Barkas <snb@threerings.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/109580: [patch] math/gnuplot does not include bsd.emacs.mk when emacs is installed
Date: Wed, 7 Mar 2007 17:32:12 -0800

 --Apple-Mail-1--410678984
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=US-ASCII;
 	delsp=yes;
 	format=flowed
 
 The change committed today does not fully resolve the problem. The  
 test for emacs (.if exists(${PREFIX}/bin/emacs) || exists(${PREFIX}/ 
 bin/xemacs)) occurs before bsd.port.pre.mk is included, so PREFIX is  
 undefined. Therefore unless you have emacs or xemacs installed in / 
 bin, USE_EMACS and other EMACS variables do not get set.
 
 However, later on in the Makefile the same test is run again to  
 determine if ${INSTALL_DATA} ${WRKSRC}/lisp/gnuplot*.el ${PREFIX}/$ 
 {EMACS_SITE_LISPDIR} should be executed. Since PREFIX is now defined,  
 it will pass if you have emacs installed. But, since  
 EMACS_SITE_LISPDIR never got defined (due to bsd.emacs.mk never being  
 loaded by USE_EMACS), gnuplot.el and gnuplot-gui.el get installed  
 into PREFIX. These files are not accounted for at all in the packing  
 list for the port, so in addition to being in the wrong place, they  
 aren't removed when the port is removed.
 
 I tested an idea I mentioned when I opened the PR, but it doesn't  
 seem to work: if USE_EMACS and the other EMACS variables are always  
 defined, but the port adds --without-lisp-files to the configure  
 arguments if emacs isn't installed, gnuplot's build process seems to  
 install .el files itself anyway. Perhaps this is because of various  
 environmental variables set by bsd.emacs.mk.
 
 I can't find a way to get gnuplot to behave correctly with emacs  
 installed other than by reverting the last commit and applying the  
 patch I initially submitted with the PR. I do think explicitly  
 including bsd.emacs.mk like my patch does is pretty ugly though. I  
 also discovered that if my patch is used, the port will install some  
 additional .el and .elc files not accounted for in the packing list.  
 The first patch attached below will do the same thing my original  
 patch did, which is ugly but seems to work, and also updates the  
 packing list to account for those extra files.
 
 As an alternative, the second patch entirely removes support for  
 installing these emacs related lisp files. This seems to work well,  
 and simplifies things greatly!
 
 
 --Apple-Mail-1--410678984
 Content-Transfer-Encoding: 7bit
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name=with-lisp.patch
 Content-Disposition: attachment;
 	filename=with-lisp.patch
 
 --- Makefile.orig	Wed Mar  7 17:07:47 2007
 +++ Makefile	Wed Mar  7 16:48:19 2007
 @@ -30,18 +30,19 @@
  MAN1=		gnuplot.1 lasergnu.1
  INFO=		gnuplot
  
 +.include <bsd.port.pre.mk>
 +
  .if exists(${PREFIX}/bin/emacs) || exists(${PREFIX}/bin/xemacs)
  USE_EMACS=	yes
  EMACS_PORT_NAME=	emacs21
  EMACS_NO_BUILD_DEPENDS=	yes
  EMACS_NO_RUN_DEPENDS=	yes
 +.include "${PORTSDIR}/Mk/bsd.emacs.mk"
  CONFIGURE_ARGS+=	--with-lisp-files
  .else
  PLIST_SUB+=		EMACS_SITE_LISPDIR="@comment "
  CONFIGURE_ARGS+=	--without-lisp-files
  .endif
 -
 -.include <bsd.port.pre.mk>
  
  .if !defined(WITHOUT_READLINE)
  .if ${OSVERSION} < 500018
 --- pkg-plist.orig	Tue Nov  1 12:46:22 2005
 +++ pkg-plist	Wed Mar  7 17:02:28 2007
 @@ -107,7 +107,11 @@
  %%PORTDOCS%%%%DOCSDIR%%/gnuplot.ps
  %%PORTDOCS%%%%DOCSDIR%%/gnuplot.txt
  %%EMACS_SITE_LISPDIR%%/gnuplot-gui.el
 +%%EMACS_SITE_LISPDIR%%/gnuplot-gui.elc
  %%EMACS_SITE_LISPDIR%%/gnuplot.el
 +%%EMACS_SITE_LISPDIR%%/gnuplot.elc
 +%%EMACS_SITE_LISPDIR%%/info-look.20.2.el
 +%%EMACS_SITE_LISPDIR%%/info-look.20.3.el
  %%DATADIR%%/4.0/gnuplot.gih
  @dirrm %%DATADIR%%/4.0
  @dirrm %%DATADIR%%
 
 --Apple-Mail-1--410678984
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=US-ASCII;
 	format=flowed
 
 
 
 --Apple-Mail-1--410678984
 Content-Transfer-Encoding: 7bit
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name=no-lisp.patch
 Content-Disposition: attachment;
 	filename=no-lisp.patch
 
 --- Makefile.orig	Wed Mar  7 17:07:47 2007
 +++ Makefile	Wed Mar  7 17:20:20 2007
 @@ -19,7 +19,8 @@
  CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
  CONFIGURE_ARGS=	--without-tutorial \
  		--without-linux-vga \
 -		--with-lasergnu
 +		--with-lasergnu \
 +		--without-lisp-files
  
  OPTIONS=	GD		"Enable GD support"		on \
  		HISTOGRAMS	"Enable stacked histograms"	off \
 @@ -30,17 +31,6 @@
  MAN1=		gnuplot.1 lasergnu.1
  INFO=		gnuplot
  
 -.if exists(${PREFIX}/bin/emacs) || exists(${PREFIX}/bin/xemacs)
 -USE_EMACS=	yes
 -EMACS_PORT_NAME=	emacs21
 -EMACS_NO_BUILD_DEPENDS=	yes
 -EMACS_NO_RUN_DEPENDS=	yes
 -CONFIGURE_ARGS+=	--with-lisp-files
 -.else
 -PLIST_SUB+=		EMACS_SITE_LISPDIR="@comment "
 -CONFIGURE_ARGS+=	--without-lisp-files
 -.endif
 -
  .include <bsd.port.pre.mk>
  
  .if !defined(WITHOUT_READLINE)
 @@ -105,9 +95,6 @@
  
  post-install:
  	${INSTALL_SCRIPT} ${WRKSRC}/src/lasergnu ${PREFIX}/bin
 -.if exists(${PREFIX}/bin/emacs) || exists(${PREFIX}/bin/xemacs)
 -	${INSTALL_DATA} ${WRKSRC}/lisp/gnuplot*.el ${PREFIX}/${EMACS_SITE_LISPDIR}
 -.endif
  .if !defined(NOPORTDOCS)
  	@${MKDIR} ${EXAMPLESDIR}
  	cd ${WRKSRC}/demo && ${FIND} . \
 --- pkg-plist.orig	Tue Nov  1 12:46:22 2005
 +++ pkg-plist	Wed Mar  7 17:15:23 2007
 @@ -106,8 +106,6 @@
  %%PORTDOCS%%%%DOCSDIR%%/gnuplot.html
  %%PORTDOCS%%%%DOCSDIR%%/gnuplot.ps
  %%PORTDOCS%%%%DOCSDIR%%/gnuplot.txt
 -%%EMACS_SITE_LISPDIR%%/gnuplot-gui.el
 -%%EMACS_SITE_LISPDIR%%/gnuplot.el
  %%DATADIR%%/4.0/gnuplot.gih
  @dirrm %%DATADIR%%/4.0
  @dirrm %%DATADIR%%
 
 --Apple-Mail-1--410678984--
State-Changed-From-To: feedback->open 
State-Changed-By: glewis 
State-Changed-When: Thu Mar 8 05:19:25 UTC 2007 
State-Changed-Why:  
There has to be a better way... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109580 
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Fri Feb 29 01:52:05 UTC 2008 
State-Changed-Why:  
A commit has been done, but it reportedly does not solve the problem. 

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