Files
haikuports/dev-libs/nss/patches/nss-3.114.patchset
Gerasim Troeglazov 49e53bf5d6 nss: bump version
2025-07-31 22:01:53 +10:00

244 lines
7.0 KiB
Plaintext

From d269d2817ae450e2863a4447007536f81777ed6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Mon, 25 Nov 2024 20:12:37 +0100
Subject: Haiku support
diff --git a/cmd/httpserv/httpserv.c b/cmd/httpserv/httpserv.c
index 76f6ff5..1178a24 100644
--- a/cmd/httpserv/httpserv.c
+++ b/cmd/httpserv/httpserv.c
@@ -1316,7 +1316,7 @@ main(int argc, char **argv)
FILE *tmpfile = fopen(pidFile, "w+");
if (tmpfile) {
- fprintf(tmpfile, "%d", getpid());
+ fprintf(tmpfile, "%d", (int)getpid());
fclose(tmpfile);
}
}
diff --git a/cmd/selfserv/selfserv.c b/cmd/selfserv/selfserv.c
index ee1c4da..2093e1c 100644
--- a/cmd/selfserv/selfserv.c
+++ b/cmd/selfserv/selfserv.c
@@ -2877,7 +2877,7 @@ main(int argc, char **argv)
FILE *tmpfile = fopen(pidFile, "w+");
if (tmpfile) {
- fprintf(tmpfile, "%d", getpid());
+ fprintf(tmpfile, "%d", (int)getpid());
fclose(tmpfile);
}
}
diff --git a/cmd/shlibsign/Makefile b/cmd/shlibsign/Makefile
index 638f723..e86ec08 100644
--- a/cmd/shlibsign/Makefile
+++ b/cmd/shlibsign/Makefile
@@ -72,7 +72,9 @@ SRCDIR = $(call core_abspath,.)
endif
+ifndef SKIP_SHLIBSIGN
libs: install
+endif
ifdef CHECKLOC
$(MAKE) $(CHECKLOC)
endif
diff --git a/coreconf/Haiku.mk b/coreconf/Haiku.mk
new file mode 100644
index 0000000..bc9347d
--- /dev/null
+++ b/coreconf/Haiku.mk
@@ -0,0 +1,57 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEFAULT_COMPILER = gcc
+CC ?= gcc
+CCC ?= g++
+RANLIB ?= ranlib
+LD ?= ld
+
+include $(CORE_DEPTH)/coreconf/UNIX.mk
+
+USE_PTHREADS = 1
+
+ifeq ($(USE_PTHREADS),1)
+ IMPL_STRATEGY = _PTH
+endif
+
+ifeq ($(OS_TEST),ppc)
+ CPU_ARCH = ppc
+endif
+ifeq ($(OS_TEST),x86_64)
+ifeq ($(USE_64),1)
+ CPU_ARCH = x86_64
+else
+ CPU_ARCH = x86
+endif
+endif
+
+ifdef BUILD_OPT
+ OPTIMIZER = -O2
+endif
+
+ifdef USE_PTHREADS
+ DEFINES += -D_REENTRANT
+endif
+
+DSO_CFLAGS = -fPIC
+DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,--gc-sections
+
+OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -pipe -DHAIKU
+OS_LIBS = -lbe
+
+SKIP_SHLIBSIGN=1
+USE_SYSTEM_ZLIB = 1
+ZLIB_LIBS = -lz
+NSS_USE_SYSTEM_SQLITE=1
+NSS_DISABLE_GTESTS=1
+
+MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
+
+ifdef MAPFILE
+ MKSHLIB += -Wl,--version-script,$(MAPFILE)
+endif
+PROCESS_MAP_FILE = grep -v ';-' $< | \
+ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
diff --git a/coreconf/config.mk b/coreconf/config.mk
index 4d57462..f67bc33 100644
--- a/coreconf/config.mk
+++ b/coreconf/config.mk
@@ -31,7 +31,7 @@ endif
#######################################################################
TARGET_OSES = FreeBSD NetBSD OpenUNIX QNX Darwin OpenBSD \
- AIX WINNT Linux Android
+ AIX WINNT Linux Android Haiku
ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
diff --git a/coreconf/nsinstall/nsinstall.c b/coreconf/nsinstall/nsinstall.c
index e946325..3f9a745 100644
--- a/coreconf/nsinstall/nsinstall.c
+++ b/coreconf/nsinstall/nsinstall.c
@@ -26,7 +26,7 @@ typedef unsigned int mode_t;
#define HAVE_LCHOWN
-#if defined(AIX) || defined(HPUX) || defined(LINUX) || defined(NTO) || defined(DARWIN) || defined(__riscos__)
+#if defined(AIX) || defined(HPUX) || defined(LINUX) || defined(NTO) || defined(DARWIN) || defined(__riscos__) || defined(__HAIKU__)
#undef HAVE_LCHOWN
#endif
diff --git a/lib/dbm/include/mcom_db.h b/lib/dbm/include/mcom_db.h
index f3d6809..b49f1d2 100644
--- a/lib/dbm/include/mcom_db.h
+++ b/lib/dbm/include/mcom_db.h
@@ -60,7 +60,7 @@ typedef PRUint32 uint32;
#include <sys/byteorder.h>
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__HAIKU__)
#include <endian.h>
#ifndef BYTE_ORDER
#define BYTE_ORDER __BYTE_ORDER
diff --git a/lib/freebl/Makefile b/lib/freebl/Makefile
index e744314..535ac9a 100644
--- a/lib/freebl/Makefile
+++ b/lib/freebl/Makefile
@@ -358,7 +358,7 @@ endif
# to bind the blapi function references in FREEBLVector vector
# (ldvector.c) to the blapi functions defined in the freebl
# shared libraries.
-ifeq (,$(filter-out FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET)))
+ifeq (,$(filter-out FreeBSD Linux NetBSD OpenBSD Haiku, $(OS_TARGET)))
MKSHLIB += -Wl,-Bsymbolic
endif
diff --git a/lib/freebl/stubs.c b/lib/freebl/stubs.c
index a79cf69..21eec91 100644
--- a/lib/freebl/stubs.c
+++ b/lib/freebl/stubs.c
@@ -813,6 +813,10 @@ freebl_InitNSSUtil(void *lib)
return SECSuccess;
}
+#ifndef RTLD_NOLOAD
+ #define RTLD_NOLOAD 0
+#endif
+
/*
* fetch the library if it's loaded. For NSS it should already be loaded
*/
diff --git a/lib/freebl/unix_rand.c b/lib/freebl/unix_rand.c
index 219a0bb..a69030b 100644
--- a/lib/freebl/unix_rand.c
+++ b/lib/freebl/unix_rand.c
@@ -160,7 +160,7 @@ RNG_kstat(PRUint32 *fed)
#endif
-#if defined(FREEBSD) || defined(NETBSD) || defined(DARWIN) || defined(OPENBSD) || defined(NTO) || defined(__riscos__) || defined(__GNU__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__)
+#if defined(FREEBSD) || defined(NETBSD) || defined(DARWIN) || defined(OPENBSD) || defined(NTO) || defined(__riscos__) || defined(__GNU__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__) || defined(__HAIKU__)
#include <sys/times.h>
static size_t
@@ -616,6 +616,16 @@ RNG_SystemInfoForRNG(void)
#else
extern char **environ;
#endif
+#ifdef HAIKU
+ static const char *const files[] = {
+ "/boot/var/swap",
+ "/boot/var/log/syslog",
+ "/boot/var/tmp",
+ "/boot/home/config/settings",
+ "/boot/home",
+ 0
+ };
+#else
static const char *const files[] = {
"/etc/passwd",
"/etc/utmp",
@@ -624,6 +634,7 @@ RNG_SystemInfoForRNG(void)
"/usr/tmp",
0
};
+#endif
GiveSystemInfo();
diff --git a/lib/ssl/sslmutex.c b/lib/ssl/sslmutex.c
index 1a884df..f8091e7 100644
--- a/lib/ssl/sslmutex.c
+++ b/lib/ssl/sslmutex.c
@@ -61,7 +61,7 @@ single_process_sslMutex_Lock(sslMutex* pMutex)
}
#if defined(LINUX) || defined(AIX) || defined(BSDI) || \
- (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__)
+ (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__) || defined(__HAIKU__)
#include <unistd.h>
#include <fcntl.h>
diff --git a/lib/ssl/sslmutex.h b/lib/ssl/sslmutex.h
index f99b4d0..36f86f1 100644
--- a/lib/ssl/sslmutex.h
+++ b/lib/ssl/sslmutex.h
@@ -50,7 +50,7 @@ typedef struct {
typedef int sslPID;
#elif defined(LINUX) || defined(AIX) || defined(BSDI) || \
- (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__)
+ (defined(NETBSD) && __NetBSD_Version__ < 500000000) || defined(OPENBSD) || defined(__GLIBC__) || defined(__HAIKU__)
#include <sys/types.h>
#include "prtypes.h"
--
2.45.2