From owner-freebsd-ports-bugs Wed Mar 26 13:30:19 2003 Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2915C37B404 for ; Wed, 26 Mar 2003 13:30:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2AEEB43FA3 for ; Wed, 26 Mar 2003 13:30:14 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h2QLUENS097873 for ; Wed, 26 Mar 2003 13:30:14 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h2QLUDok097872; Wed, 26 Mar 2003 13:30:14 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20D8537B404 for ; Wed, 26 Mar 2003 13:30:00 -0800 (PST) Received: from outpost.lukarcos.com (outpost.globcon.net [62.141.88.161]) by mx1.FreeBSD.org (Postfix) with SMTP id 7ABF743F93 for ; Wed, 26 Mar 2003 13:29:58 -0800 (PST) (envelope-from sgk@kolobov.com) Received: (qmail 42774 invoked from network); 26 Mar 2003 21:30:00 -0000 Received: from h166.lukarcos.com (HELO kolobov.com) (62.141.88.166) by outpost.globcon.net with SMTP; 26 Mar 2003 21:30:00 -0000 Received: (qmail 4607 invoked by uid 911); 26 Mar 2003 21:30:03 -0000 Message-Id: <20030326213003.4606.qmail@kolobov.com> Date: 26 Mar 2003 21:30:03 -0000 From: Sergei Kolobov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/50323: [PATCH] bsd.port.mk: add USE_GNUGETOPT option X-Spam-Status: No, hits=-6.8 required=5.0 tests=PATCH_UNIFIED_DIFF,RESENT_TO autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-ports-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 50323 >Category: ports >Synopsis: [PATCH] bsd.port.mk: add USE_GNUGETOPT option >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Mar 26 13:30:13 PST 2003 >Closed-Date: >Last-Modified: >Originator: Sergei Kolobov >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD elf.chetwood.ru 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sun Mar 16 04:38:45 MSK 2003 root@elf.chetwood.ru:/usr/obj/usr/src/sys/GENERIC i386 >Description: 135 ports depend on getopt_long(3) provided by devel/libgnugetopt port. Recently, getopt_long(3) has been added to libc in -CURRENT (OSVERSION == 500041). Some 27 of the ports depending on getopt_long(3) try to take advantage of that and conditionalize their dependency on devel/libgnugetopt port by simply checking for presence of /usr/include/getopt.h file: .if !exists(/usr/include/getopt.h) CONFIGURE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \ LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -lgnugetopt" LIB_DEPENDS= gnugetopt.1:${PORTSDIR}/devel/libgnugetopt .endif Unfortunately, this is not a correct way of checking for getopt_long(3) presence and may cause INDEX build (which is done separately from package building). Instead, the check should be done against OSVERSION. To simplify Makefiles of these ports and to avoid code duplication, the following patch adds USE_GNUGETOPT option to bsd.port.mk. So, instead of the Makefile fragment above, the following will be sufficient: USE_GNUGETOPT= yes The patch was tested under 5.0-CURRENT and 4.8-RC. >How-To-Repeat: >Fix: --- bsd.port.mk-gnugetopt.patch begins here --- Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.444 diff -u -r1.444 bsd.port.mk --- bsd.port.mk 22 Mar 2003 04:45:24 -0000 1.444 +++ bsd.port.mk 26 Mar 2003 21:03:07 -0000 @@ -275,6 +275,12 @@ # LIBTOOLFLAGS - Additional flags to pass to ltconfig # (default: --disable-ltlibs) ## +# USE_GNUGETOPT - Says that the port uses getopt_long. If OSVERSION +# less than 500041, automatically adds devel/libgnugeopt +# to LIB_DEPENDS, and pass adjusted values of +# CPPFLAGS and LDFLAGS in CONFIGURE_ENV. +# Default: not set. +## # USE_PERL5 - Says that the port uses perl5 for building and running. # USE_PERL5_BUILD - Says that the port uses perl5 for building. # USE_PERL5_RUN - Says that the port uses perl5 for running. @@ -1252,6 +1258,15 @@ CC= gcc32 CXX= g++32 BUILD_DEPENDS+= gcc32:${PORTSDIR}/lang/gcc32 +.endif + +.if defined(USE_GNUGETOPT) +.if ${OSVERSION} < 500041 +LIB_DEPENDS= gnugetopt.1:${PORTSDIR}/devel/libgnugetopt +CPPFLAGS+= -I${LOCALBASE}/include +LDFLAGS+= -L${LOCALBASE}/lib -lgnugetopt +CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" +.endif .endif .if defined(USE_LINUX) --- bsd.port.mk-gnugetopt.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message