Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Feb 2003 03:00:05 +0200
From:      Maxim Sobolev <sobomax@freebsd.org>
To:        "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
Cc:        ports@freebsd.org, portmgr@freebsd.org
Subject:   Re: USE_GETOPT patch available
Message-ID:  <20030205010005.GA35933@vega.vega.com>
In-Reply-To: <20030205011921.24c642cb.corecode@corecode.ath.cx>
References:  <20030205011921.24c642cb.corecode@corecode.ath.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
I think that you had overcomplicated things a bit, with all those
automagick. Something like the following would be more than enough:

.if defined(USE_GNUGETOPT)
.if ${OSVERSION} < BLABLABLA
LIB_DEPENDS+=		gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
GNUGETOPT_CFLAGS?=	-I${LOCALBASE}/include
GNUGETOPT_LIBS?=	-lgnugetopt
.else
# Do nothing - gnugetopt already in libc.
.endif
.endif

And then poke individual maintainers to fix their ports. Those maintainers
could be easily identified by looking at LIB_DEPENDS in each particular
makefile.

-Maxim


On Wed, Feb 05, 2003 at 01:19:21AM +0100, Simon 'corecode' Schubert wrote:
> hi people,
> 
> find a patch for bsd.ports.mk which enables conditionalization of
> libgnugetopt requirement:
> 
> or get it at <http://corecode.ath.cx/~corecode/stuff/patch-getopt>;
> 
> comments (as usual) welcome
> 
> cheers
>   simon
> 
> Index: Mk/bsd.port.mk
> ===================================================================
> RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
> retrieving revision 1.437
> diff -u -r1.437 bsd.port.mk
> --- Mk/bsd.port.mk	5 Dec 2002 22:43:22 -0000	1.437
> +++ Mk/bsd.port.mk	5 Feb 2003 00:15:11 -0000
> @@ -259,6 +259,9 @@
>  # USE_XLIB		- Says that the port uses X libraries.
>  # USE_MOTIF		- Says that the port uses the Motif toolkit.  Implies USE_XPM.
>  #
> +# USE_GETOPT	- Says that the port uses getopt*(3). Set to "long_only" if
> +# 				  getopt_long_only(3) is required
> +#
>  # Dependency checking.  Use these if your port requires another port
>  # not in the list above.
>  #
> @@ -1250,6 +1253,46 @@
>  REINPLACE_CMD?=	${LOCALBASE}/bin/sed_inplace ${REINPLACE_ARGS}
>  .else
>  REINPLACE_CMD?=	${SED} ${REINPLACE_ARGS}
> +.endif
> +.endif
> +
> +.if defined(USE_GETOPT)
> +.if !empty(USE_GETOPT:Mlong_only) || !exists(/usr/include/getopt.h)
> +LIB_DEPENDS+=	gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
> +CFLAGS+=	-I${LOCALBASE}/include
> +.	if !empty(CONFIGURE_ENV:MCFLAGS=*)
> +.		undef __c
> +.		for _p in ${CONFIGURE_ENV}
> +__p:=	${_p}
> +.			if !empty(__p:MCFLAGS=*)
> +.				if !empty(__p:C/[^"]*//g) && empty(__p:C/[^"]*//g:C/"//1)
> +__p:=	${__p:C/=.*//}="-I${LOCALBASE}/include "${__p:C/[^=]*=//}
> +.				else
> +__p:=	${__p}" -I${LOCALBASE}/include"
> +.				endif
> +.			endif
> +__c:=	${__c} ${__p}
> +.		endfor
> +CONFIGURE_ENV:=	${__c}
> +.	endif
> +.for __env in CONFIGURE MAKE
> +.	if empty(${__env}_ENV:MLDFLAGS=*)
> +${__env}_ENV+=	LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -lgnugetopt"
> +.	else
> +.undef __c
> +.		for __p in ${${__env}_ENV}
> +.			if !empty(__p:MLDFLAGS=*)
> +.				if !empty(__p:C/[^"]*//g) && empty(__p:C/[^"]*//g:C/"//1)
> +__p:=	${__p:C/=.*//}=" -L${LOCALBASE}/lib -lgnugetopt "${__p:C/[^=]*=//}
> +.				else
> +__p:=	${__p}" -L${LOCALBASE}/lib -lgnugetopt"
> +.				endif
> +.			endif
> +__c:=	${__c} ${__p}
> +.		endfor
> +${__env}_ENV:=	${__c}
> +.	endif
> +.endfor
>  .endif
>  .endif
>  
> 
> -- 
> /"\   http://corecode.ath.cx/#donate
> \ /
>  \     ASCII Ribbon Campaign
> / \  Against HTML Mail and News



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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