Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2008 17:51:10 +0400 (MSD)
From:      Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        flz@FreeBSD.org
Subject:   ports/124936: [patch] fix build of ports-mgmt/pkg_install on 4.x
Message-ID:  <20080624135110.4A8061AF41E@void.codelabs.ru>
Resent-Message-ID: <200806241400.m5OE04PF084551@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         124936
>Category:       ports
>Synopsis:       [patch] fix build of ports-mgmt/pkg_install on 4.x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 24 14:00:04 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-STABLE i386
>Organization:
Code Labs
>Environment:

FreeBSD XXX 4.11-STABLE FreeBSD 4.11-STABLE #1: Tue Sep 26 13:27:24 MSD 2006     root@XXX:/home/cvsup/obj/home/cvsup/src/sys/XXX  i386

>Description:

ports-mgmt/pkg_install does not build on 4.11:
- source code has one mixed code and variable declaration;
- source relies on the presence of getopt library, but it is not
  yet in 4.x.

>How-To-Repeat:

Check out latest port and try to build it on 4.11 (or, generally,
on 4.x).

>Fix:

The attached patch resolves these issues: it changes the place
of variable declaration and enables the port to link against
devel/libgnugetopt for FreeBSD < 500000.

--- 20080530-fix-4.x-build.patch begins here ---
diff -urN ./Makefile ../pkg_install/Makefile
--- ./Makefile	Tue Jun 24 17:31:43 2008
+++ ../pkg_install/Makefile	Tue Jun 24 17:39:46 2008
@@ -31,6 +31,14 @@
 MAKE_ARGS=		-DNO_OBJ -DNO_CRYPT -DNO_OPENSSL
 .endif
 
+# Getopt library is not the part of 4.x, so we're using GNU getopt
+# instead.
+.if ${OSVERSION} < 500000
+CFLAGS+=	-I${PREFIX}/include
+MAKE_ARGS+=	LDFLAGS="-L${PREFIX}/lib -lgnugetopt"
+LIB_DEPENDS+=	gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
+.endif
+
 pre-configure:
 	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
 		-e 's,%%MANPREFIX%%,${MANPREFIX},g' \
diff -urN ./files/patch-lib::match.c ../pkg_install/files/patch-lib::match.c
--- ./files/patch-lib::match.c	Thu Jan  1 03:00:00 1970
+++ ../pkg_install/files/patch-lib::match.c	Tue Jun 24 17:34:13 2008
@@ -0,0 +1,12 @@
+--- lib/match.c.orig	Tue Jun 24 09:38:13 2008
++++ lib/match.c	Tue Jun 24 09:38:20 2008
+@@ -299,8 +299,8 @@
+ 
+     /* Resolve origins into package names, retaining the sequence */
+     for (i = 0; origins[i] != NULL; i++) {
+-	matches = realloc(matches, (i + 1) * sizeof(*matches));
+ 	struct store *store = NULL;
++	matches = realloc(matches, (i + 1) * sizeof(*matches));
+ 	store = storecreate(store);
+ 
+ 	for (j = 0; installed[j] != NULL; j++) {
--- 20080530-fix-4.x-build.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



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