Subject: pkg/35453: graphics/graphviz fails to build (includes possible fix)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <martijnb@atlas.ipv6.stack.nl>
List: pkgsrc-bugs
Date: 01/21/2007 08:10:01
>Number:         35453
>Category:       pkg
>Synopsis:       graphics/graphviz fails to build (includes possible fix)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 21 08:10:00 +0000 2007
>Originator:     Martijn van Buul
>Release:        NetBSD 4.99.5
>Organization:
	
>Environment:
	
	
System: NetBSD atlas.ipv6.stack.nl 4.99.5 NetBSD 4.99.5 (ATLAS) #0: Sat Dec 2 22:16:36 CET 2006 root@atlas.ipv6.stack.nl:/usr/obj/sys/arch/i386/compile/ATLAS i386
Architecture: i386
Machine: i386
>Description:
	
	patch-af rev. 1.7 tries to patch a file that doesn't exist at the time
	'make patch' is run:

=> Applying pkgsrc patches for graphviz-2.12nb1
File to patch:
No file found--skip this patch? [n] y
1 out of 1 hunks ignored
Patch /usr/export/pkgsrc/graphics/graphviz/patches/patch-af failed
ERROR: Patching failed due to modified or broken patch file(s):
ERROR:  /usr/export/pkgsrc/graphics/graphviz/patches/patch-af
*** Error code 1

The file it tries to patch (tclpkg/gv/gv_lua.cpp) is auto-generated by swig
during the build process, so doesn't exist yet. 

>How-To-Repeat:
      Try to build devel/graphviz
>Fix:
    The section of the affected file is auto-generated by swig, and originates
from ${LOCALBASE}/share/swig/1.3/lua/luarun.swg. IMHO there are two ways to
fix this:

1) Patch swig instead. (see below). The proposed patch to gv_lua.cpp makes
   sense; other packages using swig to generate lua bindings would benefit.  
2) Add some serious makefile hackery to manually create gv_lua.cpp and apply
   the patch before the actual make is being run.

Personally, I prefer the first option. See supplied patch. It patches 
luarun.swg in devel/swig (bumping PKGREVISION, and introducing patch-ac), and
removes the now redundant patch-af from graphviz. Patch is generated from the
pkgsc top directory.

Index: graphics/graphviz/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/graphviz/distinfo,v
retrieving revision 1.22
diff -r1.22 distinfo
11d10
< SHA1 (patch-af) = cd1c185038155d5bcb21009eafe5dec3eb5f347f
Index: graphics/graphviz/patches/patch-af
===================================================================
RCS file: graphics/graphviz/patches/patch-af
diff -N graphics/graphviz/patches/patch-af
1,13d0
< $NetBSD: patch-af,v 1.7 2007/01/20 22:17:53 minskim Exp $
< 
< --- tclpkg/gv/gv_lua.cpp.orig	2007-01-20 14:15:40.000000000 -0800
< +++ tclpkg/gv/gv_lua.cpp
< @@ -708,7 +708,7 @@ extern "C" {
<  
<  #include "lua.h"
<  #include "lauxlib.h"
< -#include <malloc.h>
< +#include <stdlib.h>
<  #include <assert.h>	/* for a few sanity tests */
<  
<  /* -----------------------------------------------------------------------------
Index: devel/swig/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/swig/Makefile,v
retrieving revision 1.21
diff -r1.21 Makefile
3a4,5
> PKGREVISION=	1
> 
Index: devel/swig/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/swig/distinfo,v
retrieving revision 1.8
diff -r1.8 distinfo
7a8
> SHA1 (patch-ac) = 4bf77207c43dd014411c3c2c9783d1d4bae4cae4
Index: devel/swig/patches/patch-ac
===================================================================
RCS file: devel/swig/patches/patch-ac
diff -N devel/swig/patches/patch-ac
0a1,13
> $NetBSD$
> 
> --- Lib/lua/luarun.swg.orig	2006-10-24 08:26:48.000000000 +0200
> +++ Lib/lua/luarun.swg
> @@ -15,7 +15,7 @@ extern "C" {
>  
>  #include "lua.h"
>  #include "lauxlib.h"
> -#include <malloc.h>
> +#include <stdlib.h>
>  #include <assert.h>	/* for a few sanity tests */
>  
>  /* -----------------------------------------------------------------------------

>Unformatted: