partial mozilla patches attached

Robert Millan rmh@debian.org
Fri, 10 Dec 2004 19:19:20 +0100


--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Dec 03, 2004 at 10:43:57PM +0100, Alexander Sack wrote:
> Hi,
> 
> attached the patches against the mozilla debian package. Just apply 
> those patches after the debian patches have been applied and it should 
> build cleanly (ok, for now you still have to regenerate the configure 
> scripts after applying those patches of course)

Hi Alexander!

I re-diffed your patch into a followup for my patches in the svn repo and
have a few questions/comments when looking at it.  I'm attaching the patch
as a followup but also quoting some parts here for clarity.

> diff -ur mozilla.old/directory/c-sdk/config/Makefile mozilla/directory/c-sdk/config/Makefile
> --- mozilla.old/directory/c-sdk/config/Makefile	2004-02-11 05:01:16.000000000 +0100
> +++ mozilla/directory/c-sdk/config/Makefile	2004-12-10 18:12:22.000000000 +0100
> @@ -48,11 +48,15 @@
>  
>  include $(topsrcdir)/config/config.mk
>  
> -CSRCS	= nsinstall.c now.c
> +ifndef MOZILLA_CLIENT
> +CSRCS	= nsinstall.c 
> +endif
> +
> +CSRCS	+= now.c
>  
>  PLSRCS	= nfspwd.pl
>  
> -ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
> +ifneq (,$(CROSS_COMPILE)$(filter WINNT OS2,$(OS_ARCH)))
>  PROG_SUFFIX = .exe
>  else
>  PROG_SUFFIX =
> @@ -92,9 +96,9 @@
>      XLDOPTS += $(LDFLAGS)
>  endif
>  
> -ifdef XP_OS2_EMX
> +ifeq ($(MOZ_OS2_TOOLS),EMX)
>  XCFLAGS = $(OS_EXE_CFLAGS)
> -XLDOPTS = -Zlinker /PM:VIO
> +XLDOPTS = -Zomf -Zlinker /PM:VIO
>  endif
>  
>  ifeq ($(MOZ_OS2_TOOLS),VACPP)
> @@ -114,8 +118,10 @@
>  
>  OUTOPTION = -o # end of the line
>  ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
> +ifndef NS_USE_GCC
>  OUTOPTION = /Fe
>  endif
> +endif
>  
>  # Redefine MAKE_OBJDIR for just this directory
>  define MAKE_OBJDIR

What are these hunks for?  Looks like something unrelated slipped into your
patch somehow.

> diff -ur mozilla.old/directory/c-sdk/configure.in mozilla/directory/c-sdk/configure.in
> --- mozilla.old/directory/c-sdk/configure.in	2004-03-30 21:38:43.000000000 +0200
> +++ mozilla/directory/c-sdk/configure.in	2004-12-10 18:12:22.000000000 +0100
> @@ -1123,7 +1123,7 @@
>  	esac
>      ;;
>  
> -*-linux*)
> +*-linux*|*-kfreebsd*)
>      if test -z "$USE_NSPR_THREADS"; then
>          USE_PTHREADS=1
>          IMPL_STRATEGY=_PTH

This looks like a check for userland-specific feature.  For this kind of things
I recommend checking for "linux* | k*bsd*-gnu | gnu*".  This way we cover all
Glibc-based systems currently in existance.

> diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libldap/Makefile.in mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in
> --- mozilla.old/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2004-12-10 18:09:04.000000000 +0100
> +++ mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2004-12-10 18:12:22.000000000 +0100
> @@ -168,7 +168,7 @@
>  EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) $(OS_LIBS) -lc
>  endif
>  
> -ifneq (,$(findstring $(OS_ARCH),Linux GNU))
> +ifneq (,$(findstring $(OS_ARCH),Linux GNU_kFreeBSD))
>  EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) -lpthread
>  endif
>  

Should be just "Linux GNU" for the same reason ("GNU" matches "GNU_kFreeBSD" so
it's ok for us).

> diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libldap/tmplout.c mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c
> --- mozilla.old/directory/c-sdk/ldap/libraries/libldap/tmplout.c	2002-03-26 22:53:52.000000000 +0100
> +++ mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c	2004-12-10 18:12:23.000000000 +0100
> @@ -903,7 +903,8 @@
>      time_t		gmttime;
>  /* CTIME for this platform doesn't use this. */
>  #if !defined(SUNOS4) && !defined(BSDI) && !defined(LINUX1_2) && \
> -    !defined(SNI) && !defined(_WIN32) && !defined(macintosh) && !defined(LINUX)
> +    !defined(SNI) && !defined(_WIN32) && !defined(macintosh) && !defined(LINUX) && \
> +    !defined(KFREEBSD)
>      char		buf[26];
>  #endif
>  

Looks like this is dependant on the ctime API which is provided by libc.  Then
the code is not kernel-dependant, so we should check for GLIBC instead.

> diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libprldap/Makefile.in mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in
> --- mozilla.old/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2004-12-10 17:43:58.000000000 +0100
> +++ mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2004-12-10 18:12:23.000000000 +0100
> @@ -93,7 +93,7 @@
>  GENEXPARGS=$(BUILD_DEBUG) $(PRLDAPVERS_SUFFIX) $(PRLDAPVERS)
>  endif # USE_DLL_EXPORTS_FILE
>  
> -ifeq ($(OS_ARCH), Linux)
> +ifneq (,$(findstring $(OS_ARCH),Linux GNU_kFreeBSD))
>  EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
>  EXTRA_LIBS += -L$(dist_libdir) $(DYNAMICNSPR)
>  endif

Same as above.

> diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c
> --- mozilla.old/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c	2003-03-25 14:57:38.000000000 +0100
> +++ mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c	2004-12-10 18:12:23.000000000 +0100
> @@ -218,7 +218,7 @@
>  
>  #if defined(__hpux) || defined(_AIX) || defined(OSF1) || defined(DARWIN) || \
>    defined(BEOS) || defined(FREEBSD) || defined(BSDI) || defined(VMS) || \
> -  defined(OPENBSD) || defined(NETBSD)
> +  defined(OPENBSD) || defined(NETBSD) || defined(__GLIBC__)
>  #define EDEADLOCK       -1
>  #endif
>  

This time is the other way around:  errno codes are determined by kernel.
Linux has EDEADLOCK and kFreeBSD doesn't.  I'd add a check for
__FreeBSD_kernel__ here instead of __GLIBC__.

> diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libssldap/Makefile mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile
> --- mozilla.old/directory/c-sdk/ldap/libraries/libssldap/Makefile	2004-02-11 05:01:15.000000000 +0100
> +++ mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile	2004-12-10 18:12:23.000000000 +0100
> @@ -92,6 +92,15 @@
>  endif
>  
>  ifeq ($(OS_ARCH), WINNT)
> +ifdef NS_USE_GCC
> +EXTRA_DLL_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
> +	-l$(NSS_LIBNAME)
> +ifeq ($(NSS_DYNAMIC_SOFTOKN),1)
> +EXTRA_DLL_LIBS += -l$(SOFTOKN_LIBNAME)
> +endif
> +EXTRA_DLL_LIBS += -l$(SSL_LIBNAME) \
> +	-l$(PLC_BASENAME) -l$(PLDS_BASENAME) -l$(NSPR_BASENAME)
> +else
>  EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
>              comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
>              rpcrt4.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib
> @@ -106,6 +115,7 @@
>  endif
>  EXTRA_LIBS += $(dist_libdir)/$(SSL_LIBNAME).lib
>  endif
> +endif
>  
>  ifeq ($(OS_ARCH),OS2)
>  EXTRA_LIBS = $(OS_LIBS)

What is this WINNT thing doing here? :)

> diff -ur mozilla.old/security/coreconf/GNU_kFreeBSD.mk mozilla/security/coreconf/GNU_kFreeBSD.mk
> --- mozilla.old/security/coreconf/GNU_kFreeBSD.mk	2004-12-10 18:09:04.000000000 +0100
> +++ mozilla/security/coreconf/GNU_kFreeBSD.mk	2004-12-10 18:12:34.000000000 +0100
> @@ -35,3 +35,13 @@
>  
>  KERNEL=kfreebsd
>  include $(CORE_DEPTH)/coreconf/Linux.mk
> +
> +MKSHLIB		= $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
> +ifdef BUILD_OPT
> +	OPTIMIZER	= -O2
> +endif
> +ifdef MAPFILE
> +	MKSHLIB += -Wl,--version-script,$(MAPFILE)
> +endif
> +PROCESS_MAP_FILE = grep -v ';-' $(LIBRARY_NAME).def | \
> +    sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@

What are these lines for?  This looks generic enough to be somewhere else, like
Linux.mk (which is actualy for Glibc).  Did you copy these lines or wrote them
yourself?

> diff -ur mozilla.old/security/nss/cmd/platlibs.mk mozilla/security/nss/cmd/platlibs.mk
> --- mozilla.old/security/nss/cmd/platlibs.mk	2003-04-20 06:23:14.000000000 +0200
> +++ mozilla/security/nss/cmd/platlibs.mk	2004-12-10 18:12:34.000000000 +0100
> @@ -182,7 +182,7 @@
>  # If GNU ld is used, we must use the -rpath-link option to tell
>  # the linker where to find libsoftokn3.so, an implicit dependency
>  # of libnss3.so.
> -ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD, $(OS_ARCH)))
> +ifeq (,$(filter-out BSD_OS FreeBSD GNU_kFreeBSD Linux NetBSD, $(OS_ARCH)))
>  EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib
>  endif
>  

Same as above (s/GNU_kFreeBSD/GNU/g).

> diff -ur mozilla.old/security/nss/lib/freebl/unix_rand.c mozilla/security/nss/lib/freebl/unix_rand.c
> --- mozilla.old/security/nss/lib/freebl/unix_rand.c	2003-05-31 01:31:19.000000000 +0200
> +++ mozilla/security/nss/lib/freebl/unix_rand.c	2004-12-10 18:12:34.000000000 +0100
> @@ -804,7 +805,7 @@
>  #ifdef DO_PS
>  For now it is considered that it is too expensive to run the ps command
>  for the small amount of entropy it provides.
> -#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX)
> +#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX) || defined(__GLIBC__) || defined (__GNU__)
>      static char ps_cmd[] = "ps aux";
>  #else
>      static char ps_cmd[] = "ps -el";

The ps syntax is not directly related to Glibc.  It isn't directly related to
the kernel either but ps implementations are unfortunately kernel-dependant due
to lack of a standard.  So it's more reasonable to make this check depend on
kernel that on libc.

Ah, and I just tried the patch with a recent mozilla from sid.  Fails to build
when nsinstall barfs on that weird symlink error.  I recall having fixed this
but there are _4_ instances of nsinstall.c in mozilla sources so it's not
strange that the error reappeared =)

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/kfreebsd-gnu
  `-

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mozilla.diff"

diff -ur mozilla.old/directory/c-sdk/config/Makefile mozilla/directory/c-sdk/config/Makefile
--- mozilla.old/directory/c-sdk/config/Makefile	2004-02-11 05:01:16.000000000 +0100
+++ mozilla/directory/c-sdk/config/Makefile	2004-12-10 18:12:22.000000000 +0100
@@ -48,11 +48,15 @@
 
 include $(topsrcdir)/config/config.mk
 
-CSRCS	= nsinstall.c now.c
+ifndef MOZILLA_CLIENT
+CSRCS	= nsinstall.c 
+endif
+
+CSRCS	+= now.c
 
 PLSRCS	= nfspwd.pl
 
-ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
+ifneq (,$(CROSS_COMPILE)$(filter WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
@@ -92,9 +96,9 @@
     XLDOPTS += $(LDFLAGS)
 endif
 
-ifdef XP_OS2_EMX
+ifeq ($(MOZ_OS2_TOOLS),EMX)
 XCFLAGS = $(OS_EXE_CFLAGS)
-XLDOPTS = -Zlinker /PM:VIO
+XLDOPTS = -Zomf -Zlinker /PM:VIO
 endif
 
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
@@ -114,8 +118,10 @@
 
 OUTOPTION = -o # end of the line
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifndef NS_USE_GCC
 OUTOPTION = /Fe
 endif
+endif
 
 # Redefine MAKE_OBJDIR for just this directory
 define MAKE_OBJDIR
diff -ur mozilla.old/directory/c-sdk/config/nsinstall.c mozilla/directory/c-sdk/config/nsinstall.c
--- mozilla.old/directory/c-sdk/config/nsinstall.c	2002-03-27 11:06:18.000000000 +0100
+++ mozilla/directory/c-sdk/config/nsinstall.c	2004-12-10 18:12:22.000000000 +0100
@@ -64,7 +64,7 @@
 #if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) \
     || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) \
     || defined(RHAPSODY) || defined(NEXTSTEP) || defined(QNX) \
-    || defined(BEOS) || defined(VMS) || defined(DARWIN)
+    || defined(BEOS) || defined(VMS) || defined(DARWIN) || defined(GLIBC)
 #undef HAVE_LCHOWN
 #endif
 
@@ -106,7 +106,7 @@
 }
 #endif /* NEXTSTEP */
 
-#ifdef LINUX
+#if defined(LINUX) || defined(GLIBC)
 #include <getopt.h>
 #endif
 
diff -ur mozilla.old/directory/c-sdk/configure.in mozilla/directory/c-sdk/configure.in
--- mozilla.old/directory/c-sdk/configure.in	2004-03-30 21:38:43.000000000 +0200
+++ mozilla/directory/c-sdk/configure.in	2004-12-10 18:12:22.000000000 +0100
@@ -1123,7 +1123,7 @@
 	esac
     ;;
 
-*-linux*)
+*-linux*|*-kfreebsd*)
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
         IMPL_STRATEGY=_PTH
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libldap/Makefile.in mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in
--- mozilla.old/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2004-12-10 18:12:22.000000000 +0100
@@ -168,7 +168,7 @@
 EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) $(OS_LIBS) -lc
 endif
 
-ifneq (,$(findstring $(OS_ARCH),Linux GNU))
+ifneq (,$(findstring $(OS_ARCH),Linux GNU_kFreeBSD))
 EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) -lpthread
 endif
 
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libldap/request.c mozilla/directory/c-sdk/ldap/libraries/libldap/request.c
--- mozilla.old/directory/c-sdk/ldap/libraries/libldap/request.c	2002-03-26 22:53:46.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libldap/request.c	2004-12-10 18:12:22.000000000 +0100
@@ -627,7 +627,7 @@
 	LDAPConn	*lc;
 	char        msg[256];
 /* CTIME for this platform doesn't use this. */
-#if !defined(SUNOS4) && !defined(_WIN32) && !defined(LINUX) && !defined(macintosh)
+#if !defined(SUNOS4) && !defined(_WIN32) && !defined(LINUX) && !defined(macintosh) && !defined(GLIBC)
 	char		buf[26];
 #endif
 
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libldap/tmplout.c mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c
--- mozilla.old/directory/c-sdk/ldap/libraries/libldap/tmplout.c	2002-03-26 22:53:52.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libldap/tmplout.c	2004-12-10 18:12:23.000000000 +0100
@@ -903,7 +903,8 @@
     time_t		gmttime;
 /* CTIME for this platform doesn't use this. */
 #if !defined(SUNOS4) && !defined(BSDI) && !defined(LINUX1_2) && \
-    !defined(SNI) && !defined(_WIN32) && !defined(macintosh) && !defined(LINUX)
+    !defined(SNI) && !defined(_WIN32) && !defined(macintosh) && !defined(LINUX) && \
+    !defined(KFREEBSD)
     char		buf[26];
 #endif
 
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libprldap/Makefile.in mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in
--- mozilla.old/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2004-12-10 17:43:58.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2004-12-10 18:12:23.000000000 +0100
@@ -93,7 +93,7 @@
 GENEXPARGS=$(BUILD_DEBUG) $(PRLDAPVERS_SUFFIX) $(PRLDAPVERS)
 endif # USE_DLL_EXPORTS_FILE
 
-ifeq ($(OS_ARCH), Linux)
+ifneq (,$(findstring $(OS_ARCH),Linux GNU_kFreeBSD))
 EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
 EXTRA_LIBS += -L$(dist_libdir) $(DYNAMICNSPR)
 endif
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c
--- mozilla.old/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c	2003-03-25 14:57:38.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libprldap/ldappr-error.c	2004-12-10 18:12:23.000000000 +0100
@@ -218,7 +218,7 @@
 
 #if defined(__hpux) || defined(_AIX) || defined(OSF1) || defined(DARWIN) || \
   defined(BEOS) || defined(FREEBSD) || defined(BSDI) || defined(VMS) || \
-  defined(OPENBSD) || defined(NETBSD)
+  defined(OPENBSD) || defined(NETBSD) || defined(__GLIBC__)
 #define EDEADLOCK       -1
 #endif
 
diff -ur mozilla.old/directory/c-sdk/ldap/libraries/libssldap/Makefile mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile
--- mozilla.old/directory/c-sdk/ldap/libraries/libssldap/Makefile	2004-02-11 05:01:15.000000000 +0100
+++ mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile	2004-12-10 18:12:23.000000000 +0100
@@ -92,6 +92,15 @@
 endif
 
 ifeq ($(OS_ARCH), WINNT)
+ifdef NS_USE_GCC
+EXTRA_DLL_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
+	-l$(NSS_LIBNAME)
+ifeq ($(NSS_DYNAMIC_SOFTOKN),1)
+EXTRA_DLL_LIBS += -l$(SOFTOKN_LIBNAME)
+endif
+EXTRA_DLL_LIBS += -l$(SSL_LIBNAME) \
+	-l$(PLC_BASENAME) -l$(PLDS_BASENAME) -l$(NSPR_BASENAME)
+else
 EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
             comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
             rpcrt4.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib
@@ -106,6 +115,7 @@
 endif
 EXTRA_LIBS += $(dist_libdir)/$(SSL_LIBNAME).lib
 endif
+endif
 
 ifeq ($(OS_ARCH),OS2)
 EXTRA_LIBS = $(OS_LIBS)
diff -ur mozilla.old/nsprpub/configure.in mozilla/nsprpub/configure.in
--- mozilla.old/nsprpub/configure.in	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/nsprpub/configure.in	2004-12-10 18:12:29.000000000 +0100
@@ -511,9 +511,9 @@
     OS_RELEASE=
     OS_TEST="${target_cpu}"
     case "${target_os}" in
-        linux*)        OS_ARCH=Linux ;;
-        solaris*)      OS_ARCH=SunOS OS_RELEASE=5 ;;
-        mingw*)        OS_ARCH=WINNT ;;
+        linux*)       OS_ARCH=Linux ;;
+        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
+        mingw*)       OS_ARCH=WINNT ;;
         kfreebsd*-gnu) OS_ARCH=GNU/kFreeBSD ;;
         knetbsd*-gnu)  OS_ARCH=GNU/kNetBSD ;;
         gnu*)          OS_ARCH=GNU ;;
diff -ur mozilla.old/nsprpub/pr/include/md/_pth.h mozilla/nsprpub/pr/include/md/_pth.h
--- mozilla.old/nsprpub/pr/include/md/_pth.h	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/nsprpub/pr/include/md/_pth.h	2004-12-10 18:12:29.000000000 +0100
@@ -136,7 +136,7 @@
 	(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
 #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
-	|| defined(HPUX) || defined(GLIBC) || defined(FREEBSD) \
+	|| defined(HPUX) || defined(LINUX) || defined(GLIBC) || defined(FREEBSD) \
 	|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
 	|| defined(VMS) || defined(NTO) || defined(DARWIN) \
 	|| defined(UNIXWARE)
@@ -228,7 +228,7 @@
 #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
 #endif /* defined(_PR_DCETHREADS) */
 
-#elif defined(GLIBC) || defined(FREEBSD)
+#elif defined(LINUX) || defined(GLIBC) || defined(FREEBSD)
 #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
 #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
 #elif defined(NTO)
@@ -283,7 +283,7 @@
 		onemillisec.tv_nsec = 1000000L;			\
         nanosleep(&onemillisec,NULL);			\
     PR_END_MACRO
-#elif defined(HPUX) || defined(GLIBC) || defined(SOLARIS) \
+#elif defined(HPUX) || defined(LINUX) || defined(GLIBC) || defined(SOLARIS) \
 	|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
 	|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
 	|| defined(UNIXWARE)
diff -ur mozilla.old/nsprpub/pr/src/md/unix/unix.c mozilla/nsprpub/pr/src/md/unix/unix.c
--- mozilla.old/nsprpub/pr/src/md/unix/unix.c	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/nsprpub/pr/src/md/unix/unix.c	2004-12-10 18:12:29.000000000 +0100
@@ -65,7 +65,7 @@
  * PRInt32* pointer to a _PRSockLen_t* pointer.
  */
 #if defined(HAVE_SOCKLEN_T) \
-    || (defined(GLIBC) && __GLIBC__ >= 2)
+    || ((defined(LINUX) || defined(GLIBC)) && __GLIBC__ >= 2)
 #define _PRSockLen_t socklen_t
 #elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
     || defined(AIX4_1) || defined(LINUX) || defined(SONY) \
diff -ur mozilla.old/nsprpub/pr/src/md/unix/uxproces.c mozilla/nsprpub/pr/src/md/unix/uxproces.c
--- mozilla.old/nsprpub/pr/src/md/unix/uxproces.c	2002-03-15 00:20:54.000000000 +0100
+++ mozilla/nsprpub/pr/src/md/unix/uxproces.c	2004-12-10 18:12:29.000000000 +0100
@@ -89,7 +89,8 @@
  * that can share the virtual address space and file descriptors.
  */
 #if (defined(IRIX) && !defined(_PR_PTHREADS)) \
-        || (defined(LINUX) && defined(_PR_PTHREADS))
+        || (defined(LINUX) && defined(_PR_PTHREADS)) \
+        || (defined(GLIBC) && defined(_PR_PTHREADS))
 #define _PR_SHARE_CLONES
 #endif
 
@@ -103,7 +104,7 @@
  */
 
 #if defined(_PR_GLOBAL_THREADS_ONLY) \
-	|| (defined(_PR_PTHREADS) && !defined(LINUX))
+	|| (defined(_PR_PTHREADS) && !(defined(LINUX) || defined(GLIBC)))
 #define _PR_NATIVE_THREADS
 #endif
 
diff -ur mozilla.old/nsprpub/pr/src/misc/prnetdb.c mozilla/nsprpub/pr/src/misc/prnetdb.c
--- mozilla.old/nsprpub/pr/src/misc/prnetdb.c	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/nsprpub/pr/src/misc/prnetdb.c	2004-12-10 18:12:29.000000000 +0100
@@ -105,7 +105,7 @@
 #define _PR_HAVE_GETPROTO_R_INT
 #endif
 
-#if (defined(GLIBC) && __GLIBC__ >= 2)
+#if ((defined(LINUX)|| defined(GLIBC)) && __GLIBC__ >= 2)
 #define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_5_ARG_GETPROTO_R
 #endif
diff -ur mozilla.old/nsprpub/pr/src/pthreads/ptio.c mozilla/nsprpub/pr/src/pthreads/ptio.c
--- mozilla.old/nsprpub/pr/src/pthreads/ptio.c	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/nsprpub/pr/src/pthreads/ptio.c	2004-12-10 18:12:30.000000000 +0100
@@ -301,7 +301,7 @@
  * most current systems.
  */
 #if defined(HAVE_SOCKLEN_T) \
-    || (defined(GLIBC) && __GLIBC__ >= 2)
+    || ((defined(LINUX) || defined(GLIBC)) && __GLIBC__ >= 2)
 typedef socklen_t pt_SockLen;
 #elif (defined(AIX) && !defined(AIX4_1)) \
     || defined(VMS)
diff -ur mozilla.old/security/coreconf/GNU_kFreeBSD.mk mozilla/security/coreconf/GNU_kFreeBSD.mk
--- mozilla.old/security/coreconf/GNU_kFreeBSD.mk	2004-12-10 18:09:04.000000000 +0100
+++ mozilla/security/coreconf/GNU_kFreeBSD.mk	2004-12-10 18:12:34.000000000 +0100
@@ -35,3 +35,13 @@
 
 KERNEL=kfreebsd
 include $(CORE_DEPTH)/coreconf/Linux.mk
+
+MKSHLIB		= $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
+ifdef BUILD_OPT
+	OPTIMIZER	= -O2
+endif
+ifdef MAPFILE
+	MKSHLIB += -Wl,--version-script,$(MAPFILE)
+endif
+PROCESS_MAP_FILE = grep -v ';-' $(LIBRARY_NAME).def | \
+    sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
diff -ur mozilla.old/security/nss/cmd/platlibs.mk mozilla/security/nss/cmd/platlibs.mk
--- mozilla.old/security/nss/cmd/platlibs.mk	2003-04-20 06:23:14.000000000 +0200
+++ mozilla/security/nss/cmd/platlibs.mk	2004-12-10 18:12:34.000000000 +0100
@@ -182,7 +182,7 @@
 # If GNU ld is used, we must use the -rpath-link option to tell
 # the linker where to find libsoftokn3.so, an implicit dependency
 # of libnss3.so.
-ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD, $(OS_ARCH)))
+ifeq (,$(filter-out BSD_OS FreeBSD GNU_kFreeBSD Linux NetBSD, $(OS_ARCH)))
 EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib
 endif
 
diff -ur mozilla.old/security/nss/lib/freebl/unix_rand.c mozilla/security/nss/lib/freebl/unix_rand.c
--- mozilla.old/security/nss/lib/freebl/unix_rand.c	2003-05-31 01:31:19.000000000 +0200
+++ mozilla/security/nss/lib/freebl/unix_rand.c	2004-12-10 18:12:34.000000000 +0100
@@ -78,7 +78,8 @@
 }
 
 #if defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(FREEBSD) \
-    || defined(NETBSD) || defined(NTO) || defined(DARWIN) || defined(OPENBSD)
+    || defined(NETBSD) || defined(NTO) || defined(DARWIN) || defined(OPENBSD) \
+    || (defined(__GLIBC__) && !defined(LINUX))
 #include <sys/times.h>
 
 #define getdtablesize() sysconf(_SC_OPEN_MAX)
@@ -804,7 +805,7 @@
 #ifdef DO_PS
 For now it is considered that it is too expensive to run the ps command
 for the small amount of entropy it provides.
-#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX)
+#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX) || defined(__GLIBC__) || defined (__GNU__)
     static char ps_cmd[] = "ps aux";
 #else
     static char ps_cmd[] = "ps -el";
diff -ur mozilla.old/security/nss/lib/ssl/sslmutex.c mozilla/security/nss/lib/ssl/sslmutex.c
--- mozilla.old/security/nss/lib/ssl/sslmutex.c	2003-08-29 00:23:59.000000000 +0200
+++ mozilla/security/nss/lib/ssl/sslmutex.c	2004-12-10 18:12:34.000000000 +0100
@@ -87,7 +87,7 @@
     return SECSuccess;
 }
 
-#if defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS) || defined(BSDI) || defined(NETBSD) || defined(OPENBSD)
+#if defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS) || defined(BSDI) || defined(NETBSD) || defined(OPENBSD) || defined(__GNU__) || defined(__GLIBC__)
 
 #include <unistd.h>
 #include <fcntl.h>
diff -ur mozilla.old/security/nss/lib/ssl/sslmutex.h mozilla/security/nss/lib/ssl/sslmutex.h
--- mozilla.old/security/nss/lib/ssl/sslmutex.h	2002-05-18 05:24:17.000000000 +0200
+++ mozilla/security/nss/lib/ssl/sslmutex.h	2004-12-10 18:12:34.000000000 +0100
@@ -77,7 +77,7 @@
 
 typedef int    sslPID;
 
-#elif defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS) || defined(BSDI) || defined(NETBSD) || defined(OPENBSD)
+#elif defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS) || defined(BSDI) || defined(NETBSD) || defined(OPENBSD) || defined(__GNU__) || defined(__GLIBC__)
 
 #include <sys/types.h>
 #include "prtypes.h"

--EVF5PPMfhYS0aIcm--