nspr: haiku config

This commit is contained in:
Jerome Duval
2021-02-27 20:19:52 +01:00
parent 934993b38d
commit 17e23f8472
2 changed files with 445 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ LICENSE="GNU GPL v2
GNU LGPL v2.1
MPL v2.0
"
REVISION="2"
REVISION="3"
SOURCE_URI="https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v$portVersion/src/nspr-$portVersion.tar.gz"
CHECKSUM_SHA256="fc9d142d85b74ffd2e6374a0c9016f3f2dac074225e24df3070e5a72d31b773d"
SOURCE_DIR="nspr-$portVersion/nspr"
@@ -58,12 +58,11 @@ BUILD_PREREQUIRES="
BUILD()
{
if [ $effectiveTargetArchitecture == 'x86_64' ]; then
use64bits="--enable-64bit"
if [ "$effectiveTargetArchitecture" = x86_64 ]; then
use64Bits="--enable-64bit"
fi
autoreconf -fi
runConfigure ./configure --disable-debug --enable-optimize \
$use64bits
runConfigure ./configure --disable-debug --enable-optimize $use64Bits
make $jobArgs
}
@@ -87,8 +86,11 @@ INSTALL()
TEST()
{
if [ "$effectiveTargetArchitecture" = x86_64 ]; then
use64Bits="--enable-64bit"
fi
autoconf
runConfigure ./configure
runConfigure ./configure $use64Bits
cd pr/tests
make $jobArgs
make runtests

View File

@@ -1,4 +1,4 @@
From 84edf90a3246ec87f4f28104d327d9d4e7a197fe Mon Sep 17 00:00:00 2001
From 4b77ba361db250c1a59829dfaf97d64c0f8351c5 Mon Sep 17 00:00:00 2001
From: Ken Mays <kmays2000@gmail.com>
Date: Sat, 27 Jun 2020 00:09:11 +0200
Subject: Migrated NSPR 4.19 patchset to NSPR 4.26
@@ -368,4 +368,439 @@ index a58a846..c5bd9a7 100644
$(OBJDIR)/attach: $(OBJDIR)/attach.o
$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
--
2.27.0
2.30.0
From 4140a54407dc15ec54dfa0e4ff07779265a83cce Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 22 Feb 2021 19:11:19 +0100
Subject: Haiku library path
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index 1f34307..dd0b1e9 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -275,7 +275,11 @@ PR_GetLibraryPath(void)
char *p=NULL;
int len;
+#if defined(XP_HAIKU)
+ ev = getenv("LIBRARY_PATH");
+#else
ev = getenv("LD_LIBRARY_PATH");
+#endif
if (!ev) {
ev = "/usr/lib:/lib";
}
diff --git a/pr/tests/ipv6.c b/pr/tests/ipv6.c
index cc323e1..01a31ee 100644
--- a/pr/tests/ipv6.c
+++ b/pr/tests/ipv6.c
@@ -122,7 +122,11 @@ int main(int argc, char **argv)
#define NSPR_LIB "nspr4"
#endif
const PRVersionDescription *version_info;
+#ifdef __HAIKU__
+ char *nspr_path = PR_GetEnv("LIBRARY_PATH");
+#else
char *nspr_path = PR_GetEnv("LD_LIBRARY_PATH");
+#endif
char *nspr_name = PR_GetLibraryName(nspr_path, NSPR_LIB);
PRLibrary *runtime = PR_LoadLibrary(nspr_name);
if (NULL == runtime) {
diff --git a/pr/tests/runtests.sh b/pr/tests/runtests.sh
index 8d31440..e5e6b1f 100755
--- a/pr/tests/runtests.sh
+++ b/pr/tests/runtests.sh
@@ -16,6 +16,7 @@ cd -
export DYLD_LIBRARY_PATH=${ABS_LIB}:${DYLD_LIBRARY_PATH}
export LD_LIBRARY_PATH=${ABS_LIB}:${LD_LIBRARY_PATH}
+export LIBRARY_PATH=${ABS_LIB}:${LIBRARY_PATH}
export PATH=${ABS_LIB}:${PATH}
#
--
2.30.0
From 847bc98cf2148b0a3829922bc5f2181fbace208c Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 27 Feb 2021 17:33:32 +0100
Subject: _haiku.cfg for Haiku
diff --git a/configure.in b/configure.in
index a3b6610..8b3003e 100644
--- a/configure.in
+++ b/configure.in
@@ -1492,7 +1492,7 @@ tools are selected during the Xcode/Developer Tools installation.])
DSO_CFLAGS="-fPIC"
USE_PTHREADS=1
IMPL_STRATEGY=_PTH
- MDCPUCFG_H=_linux.cfg
+ MDCPUCFG_H=_haiku.cfg
if test -n "$USE_64"; then
PR_MD_ASFILES=os_Linux_x86_64.s
else
diff --git a/pr/include/md/_haiku.cfg b/pr/include/md/_haiku.cfg
new file mode 100644
index 0000000..3cf3cd9
--- /dev/null
+++ b/pr/include/md/_haiku.cfg
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+#ifndef nspr_cpucfg___
+#define nspr_cpucfg___
+
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif
+
+#if !defined(HAIKU) && defined(__HAIKU__)
+#define HAIKU
+#endif
+
+#define PR_AF_INET6 5 /* same as AF_INET6 */
+
+#if defined(__x86_64__)
+
+#ifdef __ILP32__
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 4
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 4
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 32
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 32
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 5
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 5
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 4
+#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD 4
+
+#define PR_BYTES_PER_WORD_LOG2 2
+#define PR_BYTES_PER_DWORD_LOG2 3
+
+#else
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+#define IS_64
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 8
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 8
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 64
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 64
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 6
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 6
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 8
+#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD 8
+
+#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
+#endif
+
+#elif defined(__i386__)
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 4
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 4
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 32
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 32
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 5
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 5
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 4
+#define PR_ALIGN_OF_INT64 4
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD 4
+
+#define PR_BYTES_PER_WORD_LOG2 2
+#define PR_BYTES_PER_DWORD_LOG2 3
+
+#else
+
+#error "Unknown CPU architecture"
+
+#endif
+
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG
+#endif
+#if PR_ALIGN_OF_DOUBLE == 8
+#define HAVE_ALIGNED_DOUBLES
+#endif
+#if PR_ALIGN_OF_INT64 == 8
+#define HAVE_ALIGNED_LONGLONGS
+#endif
+
+#ifndef NO_NSPR_10_SUPPORT
+
+#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
+#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
+#define BYTES_PER_INT PR_BYTES_PER_INT
+#define BYTES_PER_INT64 PR_BYTES_PER_INT64
+#define BYTES_PER_LONG PR_BYTES_PER_LONG
+#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
+#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
+#define BYTES_PER_WORD PR_BYTES_PER_WORD
+#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
+
+#define BITS_PER_BYTE PR_BITS_PER_BYTE
+#define BITS_PER_SHORT PR_BITS_PER_SHORT
+#define BITS_PER_INT PR_BITS_PER_INT
+#define BITS_PER_INT64 PR_BITS_PER_INT64
+#define BITS_PER_LONG PR_BITS_PER_LONG
+#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
+#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
+#define BITS_PER_WORD PR_BITS_PER_WORD
+
+#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
+#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
+#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
+#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
+#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
+#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
+#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
+#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
+
+#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
+#define ALIGN_OF_INT PR_ALIGN_OF_INT
+#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
+#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
+#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
+#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
+#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
+#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
+
+#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
+#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
+#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
+
+#endif /* NO_NSPR_10_SUPPORT */
+
+#endif /* nspr_cpucfg___ */
diff --git a/pr/include/md/_haiku.h b/pr/include/md/_haiku.h
new file mode 100644
index 0000000..fb9dbc7
--- /dev/null
+++ b/pr/include/md/_haiku.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+#ifndef nspr_haiku_defs_h___
+#define nspr_haiku_defs_h___
+
+#include "prthread.h"
+
+#define PR_LINKER_ARCH "haiku"
+#define _PR_SI_SYSNAME "HAIKU"
+#if defined(__i386__)
+#define _PR_SI_ARCHITECTURE "x86"
+#elif defined(__alpha__)
+#define _PR_SI_ARCHITECTURE "alpha"
+#elif defined(__sparc__)
+#define _PR_SI_ARCHITECTURE "sparc"
+#elif defined(__ia64__)
+#define _PR_SI_ARCHITECTURE "ia64"
+#elif defined(__amd64__)
+#define _PR_SI_ARCHITECTURE "amd64"
+#elif defined(__powerpc64__)
+#define _PR_SI_ARCHITECTURE "powerpc64"
+#elif defined(__powerpc__)
+#define _PR_SI_ARCHITECTURE "powerpc"
+#elif defined(__aarch64__)
+#define _PR_SI_ARCHITECTURE "aarch64"
+#elif defined(__arm__)
+#define _PR_SI_ARCHITECTURE "arm"
+#elif defined(__mips64__)
+#define _PR_SI_ARCHITECTURE "mips64"
+#elif defined(__mips__)
+#define _PR_SI_ARCHITECTURE "mips"
+#else
+#error "Unknown CPU architecture"
+#endif
+#if defined(__ELF__)
+#define PR_DLL_SUFFIX ".so"
+#else
+#define PR_DLL_SUFFIX ".so.1.0"
+#endif
+
+#define _PR_VMBASE 0x30000000
+#define _PR_STACK_VMBASE 0x50000000
+#define _MD_DEFAULT_STACK_SIZE 65536L
+#define _MD_MMAP_FLAGS MAP_PRIVATE
+
+#undef HAVE_STACK_GROWING_UP
+#define HAVE_DLL
+#define USE_DLFCN
+#define _PR_HAVE_SOCKADDR_LEN
+#define _PR_STAT_HAS_ST_ATIM
+#define _PR_HAVE_LARGE_OFF_T
+
+#define _PR_POLL_AVAILABLE
+#undef _PR_USE_POLL
+
+#define _PR_HAVE_SYSV_SEMAPHORES
+
+#define _PR_INET6
+#define _PR_HAVE_INET_NTOP
+#define _PR_HAVE_GETHOSTBYNAME2
+#define _PR_HAVE_GETADDRINFO
+#define _PR_INET6_PROBE
+#define _PR_IPV6_V6ONLY_PROBE
+
+#define USE_SETJMP
+
+extern void _MD_EarlyInit(void);
+
+#define _MD_EARLY_INIT _MD_EarlyInit
+#define _MD_FINAL_INIT _PR_UnixInit
+#define _PR_HAVE_CLOCK_MONOTONIC
+
+/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
+ want to be including that.. */
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK (u_long)0x7F000001
+#endif
+
+/* For writev() */
+#include <sys/uio.h>
+
+#endif /* nspr_haiku_defs_h___ */
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
index e372315..4ee4f67 100644
--- a/pr/include/md/prosdep.h
+++ b/pr/include/md/prosdep.h
@@ -46,10 +46,13 @@ PR_BEGIN_EXTERN_C
#elif defined(BSDI)
#include "md/_bsdi.h"
+#elif defined(HAIKU)
+#include "md/_haiku.h"
+
#elif defined(HPUX)
#include "md/_hpux.h"
-#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(__HAIKU__)
+#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
#include "md/_linux.h"
#elif defined(DARWIN)
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index 8f685c9..34119e4 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -34,6 +34,7 @@
#if defined(SOLARIS) || defined(UNIXWARE)
#include <sys/filio.h> /* to pick up FIONREAD */
#endif
+#include "primpl.h"
#ifdef _PR_POLL_AVAILABLE
#include <poll.h>
#endif
@@ -153,8 +154,6 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
#include <sys/sendfile.h>
#endif
-#include "primpl.h"
-
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */
#endif
--
2.30.0