From trevor@FreeBSD.org  Thu Apr  8 20:55:49 2004
Return-Path: <trevor@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 553E516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Apr 2004 20:55:49 -0700 (PDT)
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3AB4643D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Apr 2004 20:55:49 -0700 (PDT)
	(envelope-from trevor@FreeBSD.org)
Received: from freefall.freebsd.org (trevor@localhost [127.0.0.1])
	by freefall.freebsd.org (8.12.10/8.12.10) with ESMTP id i393tnbv072794
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 8 Apr 2004 20:55:49 -0700 (PDT)
	(envelope-from trevor@freefall.freebsd.org)
Received: (from trevor@localhost)
	by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i393tnEl072793;
	Thu, 8 Apr 2004 20:55:49 -0700 (PDT)
	(envelope-from trevor)
Message-Id: <200404090355.i393tnEl072793@freefall.freebsd.org>
Date: Thu, 8 Apr 2004 20:55:49 -0700 (PDT)
From: Trevor Johnson <trevor@FreeBSD.org>
Reply-To: Trevor Johnson <trevor@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: USE_ macros for graphics libraries
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         65344
>Category:       ports
>Synopsis:       [patch] USE_ macros for graphics libraries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 08 21:00:34 PDT 2004
>Closed-Date:    Fri May 25 03:05:30 GMT 2007
>Last-Modified:  Fri May 25 03:05:30 GMT 2007
>Originator:     Trevor Johnson
>Release:        
>Organization:
>Environment:
bsd.port.mk 1.486
>Description:
	Add new macros USE_JPEG, USE_MNG, USE_PNG and USE_TIFF for more
conveniently listing and maintaining dependencies on graphics
libraries.
>How-To-Repeat:
	
N/A
>Fix:
	also at <URL:http://people.freebsd.org/~trevor/ports/use-graphics.diff>

Index: Mk/bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.486
diff -u -r1.486 bsd.port.mk
--- Mk/bsd.port.mk	3 Apr 2004 23:59:50 -0000	1.486
+++ Mk/bsd.port.mk	9 Apr 2004 03:53:27 -0000
@@ -377,6 +377,10 @@
 #			  NO_OPENMOTIF.
 # USE_SDL		- Says that the port uses the sdl libraries.
 #				See bsd.sdl.mk for more information.
+# USE_JPEG		- Says that the port uses libjpeg.
+# USE_MNG		- Says that the port uses libmng.
+# USE_PNG		- Says that the port uses libpng.
+# USE_TIFF		- Says that the port uses libtiff.
 # USE_XPM		- Says that the port uses the xpm graphics libraries.
 ##
 # USE_OPENSSL	- Says that the port relies on the OpenSSL package.
@@ -1731,6 +1735,22 @@
 
 .if defined(USE_MESA)
 LIB_DEPENDS+=			glut.3:${PORTSDIR}/graphics/libglut
+.endif
+
+.if defined(USE_JPEG)
+LIB_DEPENDS+=			jpeg.9:${PORTSDIR}/graphics/jpeg
+.endif
+
+.if defined(USE_MNG)
+LIB_DEPENDS+=			mng.1:${PORTSDIR}/graphics/libmng
+.endif
+
+.if defined(USE_PNG)
+LIB_DEPENDS+=			png.5:${PORTSDIR}/graphics/png
+.endif
+
+.if defined(USE_TIFF)
+LIB_DEPENDS+=			tiff.4:${PORTSDIR}/graphics/tiff
 .endif
 
 .if defined(USE_BISON)
Index: graphics/jpeg/Makefile
===================================================================
RCS file: /home/ncvs/ports/graphics/jpeg/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- graphics/jpeg/Makefile	18 Mar 2004 14:53:46 -0000	1.39
+++ graphics/jpeg/Makefile	9 Apr 2004 03:37:52 -0000
@@ -37,6 +37,11 @@
 
 MAN1=		cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
 
+.ifdef USE_JPEG
+.error  USE_JPEG is defined as an environment variable, or in the arguments \
+	to "make".  Please unset it and restart the build.
+.endif
+
 post-extract:
 	@${CP} ${DISTDIR}/jpegexiforient.c ${WRKSRC}/
 	@${CP} ${DISTDIR}/exifautotran.txt ${WRKSRC}/exifautotran
Index: graphics/libmng/Makefile
===================================================================
RCS file: /home/ncvs/ports/graphics/libmng/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- graphics/libmng/Makefile	3 Apr 2004 17:45:33 -0000	1.19
+++ graphics/libmng/Makefile	9 Apr 2004 03:38:14 -0000
@@ -26,6 +26,11 @@
 MAN3=		libmng.3
 MAN5=		mng.5 jng.5
 
+.ifdef USE_MNG
+.error  USE_MNG is defined as an environment variable, or in the arguments \
+	to "make".  Please unset it and restart the build.
+.endif
+
 post-install:
 	cd ${WRKSRC}/doc/man && ${INSTALL_MAN} ${MAN3} ${PREFIX}/man/man3 \
 		&& ${INSTALL_MAN} ${MAN5} ${PREFIX}/man/man5
Index: graphics/png/Makefile
===================================================================
RCS file: /home/ncvs/ports/graphics/png/Makefile,v
retrieving revision 1.60
diff -u -r1.60 Makefile
--- graphics/png/Makefile	16 Mar 2004 20:08:06 -0000	1.60
+++ graphics/png/Makefile	9 Apr 2004 03:38:30 -0000
@@ -33,6 +33,11 @@
 MAN5=		png.5
 MANCOMPRESSED=	maybe
 
+.ifdef USE_PNG
+.error  USE_PNG is defined as an environment variable, or in the arguments \
+	to "make".  Please unset it and restart the build.
+.endif
+
 .include <bsd.port.pre.mk>
 
 post-extract:
Index: graphics/tiff/Makefile
===================================================================
RCS file: /home/ncvs/ports/graphics/tiff/Makefile,v
retrieving revision 1.43
diff -u -r1.43 Makefile
--- graphics/tiff/Makefile	8 Mar 2004 12:56:09 -0000	1.43
+++ graphics/tiff/Makefile	9 Apr 2004 03:39:16 -0000
@@ -113,4 +113,9 @@
 	TIFFtile.3t           TIFFTileRowSize.3t \
 	TIFFtile.3t           TIFFVTileSize.3t
 
+.ifdef USE_TIFF
+.error  USE_TIFF is defined as an environment variable, or in the arguments \
+	to "make".  Please unset it and restart the build.
+.endif
+
 .include <bsd.port.mk>
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: trevor 
Responsible-Changed-When: Thu Apr 8 21:01:55 PDT 2004 
Responsible-Changed-Why:  
to maintainers 

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

From: "Edwin Groothuis" <edwin@barnet.com.au>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: ports/65344: USE_ macros for graphics libraries
Date: Fri, 9 Apr 2004 14:11:58 +1000 (EST)

 Trevor Johnson said:
 > Synopsis: USE_ macros for graphics libraries
 
 Wouldn't a "USE_GRAPHICS= png gif jpeg" style of adding it not be a more
 attractive approach?
 
 Or "USE_LIBS= png gif" so that you don't only stick to graphics ones only.
 
 Edwin
 
 -- 
 Edwin Groothuis
 edwin@barnet.com.au
 http://www.barnet.com.au/ (BarNet website)
 http://www.mavetju.org/ (Personal website)
 

From: Kris Kennaway <kris@obsecurity.org>
To: Edwin Groothuis <edwin@barnet.com.au>
Cc: portmgr@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/65344: USE_ macros for graphics libraries
Date: Thu, 8 Apr 2004 21:43:34 -0700

 On Thu, Apr 08, 2004 at 09:20:13PM -0700, Edwin Groothuis wrote:
 > The following reply was made to PR ports/65344; it has been noted by GNATS.
 > 
 > From: "Edwin Groothuis" <edwin@barnet.com.au>
 > To: freebsd-gnats-submit@freebsd.org
 > Cc:  
 > Subject: Re: ports/65344: USE_ macros for graphics libraries
 > Date: Fri, 9 Apr 2004 14:11:58 +1000 (EST)
 > 
 >  Trevor Johnson said:
 >  > Synopsis: USE_ macros for graphics libraries
 >  
 >  Wouldn't a "USE_GRAPHICS= png gif jpeg" style of adding it not be a more
 >  attractive approach?
 >  
 >  Or "USE_LIBS= png gif" so that you don't only stick to graphics ones only.
 
 I've mentioned to a few people that I'd like to explore something like
 this (I suggested REQUIRES) to avoid proliferating dozens of USE_FOO
 knobs.  The only concern I have is how it will impact things like
 index build times.
 
 kris
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Sun Jan 23 21:57:53 GMT 2005 
State-Changed-Why:  
Although I don't have any problem with the patch to bsd.port.mk, I will 
observe that the use of .error is undesirable in ports Makefiles. 

The problem is that using .error means that any evaluation of the 
Makefile will fail -- including 'make describe' (which is invoked by 
'make index'), 'make fetch', or even 'make -V DISTFILES', for instance. 

The canonical way to handle these situations is to set IGNORE instead 
of using .error. 

As for the followup discussion about a possible better way to implement 
the USE_* variables, while interesting as a future direction, my own 
personal view is that it should not necessarily hold up the adoption of 
a revised patch that's based on what is already here, which is what 
seems to have happened. 

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

From: Trevor Johnson <trevor@jpj.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/65344: USE_ macros for graphics libraries
Date: Mon, 24 Jan 2005 19:12:13 -0500 (EST)

 > Although I don't have any problem with the patch to bsd.port.mk, I will
 > observe that the use of .error is undesirable in ports Makefiles.
 >
 > The problem is that using .error means that any evaluation of the
 > Makefile will fail -- including 'make describe' (which is invoked by
 > 'make index'), 'make fetch', or even 'make -V DISTFILES', for instance.
 >
 > The canonical way to handle these situations is to set IGNORE instead
 > of using .error.
 
 I merely copied the mechanism added by sobomax to several ports:
 
   1.37      +4 -0      ports/archivers/bzip2/Makefile
   1.39      +4 -0      ports/archivers/unzip/Makefile
   1.33      +4 -0      ports/devel/autoconf213/Makefile
   1.24      +4 -0      ports/devel/automake/Makefile
   1.24      +4 -0      ports/devel/automake14/Makefile
   1.33      +4 -0      ports/devel/bison/Makefile
   1.44      +4 -0      ports/devel/gmake/Makefile
   1.24      +4 -0      ports/devel/imake-4/Makefile
   1.12      +4 -0      ports/devel/imake/Makefile
   1.20      +4 -0      ports/devel/libtool/Makefile
   1.66      +4 -0      ports/emulators/linux_base/Makefile
   1.53      +4 -0      ports/graphics/Mesa3/Makefile
   1.34      +5 -1      ports/graphics/xpm/Makefile
   1.85      +4 -0      ports/lang/gcc295/Makefile
   1.129     +4 -0      ports/lang/gcc31/Makefile
   1.48      +4 -0      ports/lang/perl5/Makefile
   1.26      +4 -0      ports/print/freetype/Makefile
   1.66      +4 -0      ports/security/openssl/Makefile
   1.3       +4 -0      ports/textproc/sed_inplace/Makefile
   1.24      +4 -0      ports/x11-toolkits/open-motif/Makefile
   1.112     +4 -0      ports/x11/XFree86-4-libraries/Makefile
   1.102     +4 -0      ports/x11/XFree86/Makefile
   1.28      +4 -2      ports/x11/dgs/Makefile
 
 Many of them still include it, and it has been added to other ports as
 well (libiconv for instance).  If it's now considered bad style, I would
 suggest simply doing ".undef USE_JPEG" and the like as an alternative in
 this patch, and revising those other ports.
 
 > As for the followup discussion about a possible better way to implement
 > the USE_* variables, while interesting as a future direction, my own
 > personal view is that it should not necessarily hold up the adoption of
 > a revised patch that's based on what is already here, which is what
 > seems to have happened.
 
 Unless the soname of one of these libraries is about to change, there's no
 urgency to this patch.  I don't object to the ideas for something more
 elaborate, but right now I have no intention of implementing them.
 -- 
 Trevor Johnson
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Fri May 25 03:04:52 UTC 2007 
State-Changed-Why:  
After some discussion among several of the portmgr members at BSDCan 2007, 
we feel that this doesn't affect that many ports, and thus doesn't need 
to be done. 

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