Files
haikuports/dev-libs/nss/patches/nss-3.120.1.patchset
Jérôme Duval 76258449f8 nss: bump version
don't skip shlibsign
2026-02-25 21:44:36 +01:00

229 lines
6.7 KiB
Plaintext

From 53c50667ba7d36d1320f68f7823d486387a15e73 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 25ac58e..e7b3b24 100644
--- a/cmd/selfserv/selfserv.c
+++ b/cmd/selfserv/selfserv.c
@@ -2981,7 +2981,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/coreconf/Haiku.mk b/coreconf/Haiku.mk
new file mode 100644
index 0000000..61ba8e2
--- /dev/null
+++ b/coreconf/Haiku.mk
@@ -0,0 +1,56 @@
+#
+# 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
+
+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 04d3e3c..6d0e1e4 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 70d17c6..2bb513a 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 2347e0b..ed9f084 100644
--- a/lib/freebl/stubs.c
+++ b/lib/freebl/stubs.c
@@ -828,6 +828,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.51.0