GNU/kFreeBSD support
authorMike Hommey <mh@glandium.org>
Mon, 13 Jan 2014 03:01:08 +0000 (12:01 +0900)
committerMike Hommey <glandium@debian.org>
Sun, 14 Feb 2016 09:25:51 +0000 (09:25 +0000)
Gbp-Pq: Topic porting
Gbp-Pq: Name NSS-GNU-kFreeBSD-support.patch

security/nss/coreconf/Linux.mk
security/nss/coreconf/arch.mk
security/nss/coreconf/config.mk
security/nss/lib/freebl/unix_rand.c
security/nss/lib/softoken/softoken.h
security/nss/lib/ssl/sslmutex.c
security/nss/lib/ssl/sslmutex.h

index 7a2411876dd9e37bd923335af92767a230e836c1..0aebe8a342d519d3864da84b881a16c5021cd30c 100644 (file)
@@ -107,7 +107,7 @@ ifneq ($(OS_TARGET),Android)
 LIBC_TAG               = _glibc
 endif
 
-ifeq ($(OS_RELEASE),2.0)
+ifeq ($(KERNEL)-$(OS_RELEASE),linux-2.0)
        OS_REL_CFLAGS   += -DLINUX2_0
        MKSHLIB         = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
        ifdef MAPFILE
@@ -140,14 +140,21 @@ ifeq ($(USE_PTHREADS),1)
 OS_PTHREAD = -lpthread 
 endif
 
-OS_CFLAGS              = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) $(WARNING_CFLAGS) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
+OS_CFLAGS              = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) $(WARNING_CFLAGS) -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR
+ifeq ($(KERNEL),linux)
+OS_CFLAGS              += -DLINUX -Dlinux
+endif
 OS_LIBS                        = $(OS_PTHREAD) -ldl -lc
 
 ifdef USE_PTHREADS
        DEFINES         += -D_REENTRANT
 endif
 
-ARCH                   = linux
+ifeq ($(KERNEL),linux)
+       ARCH            = linux
+else
+       ARCH            = gnu
+endif
 
 DSO_CFLAGS             = -fPIC
 DSO_LDOPTS             = -shared $(ARCHFLAG) -Wl,--gc-sections
@@ -164,7 +171,7 @@ ifdef _SBOX_DIR
 LDFLAGS                        += -Wl,-rpath-link,/usr/lib:/lib
 endif
 
-# INCLUDES += -I/usr/include -Y/usr/include/linux
+# INCLUDES += -I/usr/include
 G++INCLUDES            = -I/usr/include/g++
 
 #
@@ -199,7 +206,9 @@ RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib'
 endif
 endif
 
+ifeq ($(KERNEL), linux)
 OS_REL_CFLAGS   += -DLINUX2_1
+endif
 MKSHLIB         = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
 
 ifdef MAPFILE
index 62ba8d5dd3516ac33f8d04f4796bd2bab278be66..1ca11fba9f98730756fa123483ea5b066fe27baa 100644 (file)
@@ -122,6 +122,14 @@ ifeq ($(OS_ARCH),Linux)
     ifneq ($(words $(OS_RELEASE)),1)
        OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE))
     endif
+    KERNEL = linux
+endif
+
+# This check must be last.  Since all uses of OS_ARCH that follow affect only
+# userland, we can merge other Glibc systems with Linux here.
+ifneq (, $(filter GNU GNU_%, $(OS_ARCH)))
+OS_ARCH = Linux
+OS_RELEASE = 2.6
 endif
 
 #
index 99c6ce6c1c84491329b13011626461a9309a3ad1..9d619f1df21f0e2da88bb5cd947bca76d4d5bc8e 100644 (file)
@@ -31,7 +31,7 @@ endif
 #######################################################################
 
 TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \
-              AIX RISCOS WINNT WIN95 Linux Android
+              AIX RISCOS WINNT WIN95 Linux Android GNU GNU_%
 
 ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
 include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
index b4fef7a08f9daa707e8ae461c73d420d0f36cbbc..20bfaa94fdcea7942c6feea57c6630bcf58c03c3 100644 (file)
@@ -156,7 +156,8 @@ static SECStatus RNG_kstat(PRUint32* fed)
 
 #if defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(FREEBSD) \
     || defined(NETBSD) || defined(DARWIN) || defined(OPENBSD) \
-    || defined(NTO) || defined(__riscos__)
+    || defined(NTO) || defined(__riscos__) || defined(__GNU__) \
+    || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__)
 #include <sys/times.h>
 
 #define getdtablesize() sysconf(_SC_OPEN_MAX)
index fbd00b6c7f284eac00373d66706f159ae29a8ffa..bb35af8cdc2e87152d9fff4ac86f8b9a24bc8ed9 100644 (file)
@@ -184,7 +184,7 @@ extern PRBool sftk_fatalError;
 
 #define CHECK_FORK_MIXED
 
-#elif defined(LINUX)
+#elif defined(LINUX) || defined (__GLIBC__)
 
 #define CHECK_FORK_PTHREAD
 
index af683daf561617d81731e1d99617c6f8da308b77..087e28b130e8cfd2cab99d01486bfee56b40f6c6 100644 (file)
@@ -56,7 +56,7 @@ static SECStatus single_process_sslMutex_Lock(sslMutex* pMutex)
     return SECSuccess;
 }
 
-#if defined(LINUX) || defined(AIX) || defined(BEOS) || defined(BSDI) || (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD)
+#if defined(LINUX) || defined(AIX) || defined(BEOS) || defined(BSDI) || (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__)
 
 #include <unistd.h>
 #include <fcntl.h>
index d374a883b7328ad85cf54109cb16618aed5e3253..ba1c4722e4e0c66df1468cabe90439cb89304cb0 100644 (file)
@@ -50,7 +50,7 @@ typedef struct
 
 typedef int    sslPID;
 
-#elif defined(LINUX) || defined(AIX) || defined(BEOS) || defined(BSDI) || (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD)
+#elif defined(LINUX) || defined(AIX) || defined(BEOS) || defined(BSDI) || (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__)
 
 #include <sys/types.h>
 #include "prtypes.h"