Subject: pkg/28635: firefox-gtk2 fails to build
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Julius Malkiewicz <jpmalkiewicz@acm.org>
List: pkgsrc-bugs
Date: 12/12/2004 16:04:00
>Number:         28635
>Category:       pkg
>Synopsis:       firefox-gtk2 fails to build
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 12 16:04:00 +0000 2004
>Originator:     Julius P. Malkiewicz
>Release:        NetBSD 2.0 (20041213)
>Organization:
>Environment:
System: NetBSD thingy 2.0 NetBSD 2.0 (INSPIRON) #0: Mon Dec 13 04:49:35 EST 2004 julius@thingy:/home/julius/build/obj/sys/arch/i386/compile/INSPIRON i386
Architecture: i386
Machine: i386
>Description:
	sys/statvfs.h and sys/statfs.h are both included in
	xpcom/io/nsLocalFileUnix.h and xpcom/obsolete/nsFileSpecUnix.cpp
	leading to redefinition of types and structures.
>How-To-Repeat:
	attempt to build www/firefox-gtk2 in current pkgsrc tree (probably
	affects other firefox -based browsers as well).
>Fix:
        avoid including <sys/statvfs.h> and <sys/statfs.h> in the same file.

  	1. Perhaps change the system file to avoid the problem (ie, allow
	   sys/statfs.h know about sys/statvfs.h, and only allow one to be
	   included using the usual #ifndef _SYS_STATVFS_H_ style.

	2.  only include <sys/statvfs.h> when HAVE_SYS_STATFS_H and
	    HAVE_STATVFS are defined. Two proposed patches follow: one changes
            existing www/firefox/patches/patch-bq, the other is a proposed
	    new patch, prehaps www/firefox/patches/patch-cg

---- patch-bq -----------------------------------------------------------------
--- ../Orig/mozilla/xpcom/io/nsLocalFileUnix.h	2004-12-13 12:23:01.000000000 +1100
+++ ./xpcom/io/nsLocalFileUnix.h	2004-12-13 12:23:12.000000000 +1100
@@ -39,14 +39,14 @@
 /** 
  *  we need these for statfs()
  */
-#ifdef HAVE_SYS_STATVFS_H
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
     #if defined(__osf__) && defined(__DECCXX)
         extern "C" int statvfs(const char *, struct statvfs *);
     #endif
     #include <sys/statvfs.h>
 #endif
 
-#ifdef HAVE_SYS_STATFS_H
+#if defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATVFS)
     #include <sys/statfs.h>
 #endif
 
@@ -57,7 +57,7 @@
 #endif
 
 // so we can statfs on freebsd
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || (defined(__NetBSD__) && !defined(HAVE_STATVFS))
     #define HAVE_SYS_STATFS_H
     #define STATFS statfs
     #include <sys/param.h>

---- patch-cg -----------------------------------------------------------------
--- ../Orig/mozilla/xpcom/obsolete/nsFileSpecUnix.cpp	2004-12-13 12:23:20.000000000 +1100
+++ ./xpcom/obsolete/nsFileSpecUnix.cpp	2004-12-13 12:23:37.000000000 +1100
@@ -54,7 +54,7 @@
 #define _SVID3  /* for statvfs.h */
 #endif
 
-#ifdef HAVE_SYS_STATVFS_H
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
 #include <sys/statvfs.h>
 #endif