pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/ghc90 Implement getNumberOfProcessors() for NetBSD



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0f1dad0d3e6f
branches:  trunk
changeset: 450834:0f1dad0d3e6f
user:      pho <pho%pkgsrc.org@localhost>
date:      Thu Apr 22 14:20:23 2021 +0000

description:
Implement getNumberOfProcessors() for NetBSD

diffstat:

 lang/ghc90/Makefile                            |   3 +-
 lang/ghc90/bootstrap.mk                        |   7 +++-
 lang/ghc90/distinfo                            |   5 +-
 lang/ghc90/patches/patch-rts_ProfHeap.c        |   4 +-
 lang/ghc90/patches/patch-rts_posix_OSThreads.c |  43 ++++++++++++++++++++++++++
 5 files changed, 56 insertions(+), 6 deletions(-)

diffs (116 lines):

diff -r 20ed6ac873bd -r 0f1dad0d3e6f lang/ghc90/Makefile
--- a/lang/ghc90/Makefile       Thu Apr 22 13:57:09 2021 +0000
+++ b/lang/ghc90/Makefile       Thu Apr 22 14:20:23 2021 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.2 2021/02/16 15:41:36 ryoon Exp $
+# $NetBSD: Makefile,v 1.3 2021/04/22 14:20:23 pho Exp $
 # -----------------------------------------------------------------------------
 # Package metadata
 #
 DISTNAME=      ghc-9.0.1-src
+PKGREVISION=   1
 PKGNAME=       ${DISTNAME:S/-src$//}
 CATEGORIES=    lang
 MASTER_SITES=  https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
diff -r 20ed6ac873bd -r 0f1dad0d3e6f lang/ghc90/bootstrap.mk
--- a/lang/ghc90/bootstrap.mk   Thu Apr 22 13:57:09 2021 +0000
+++ b/lang/ghc90/bootstrap.mk   Thu Apr 22 14:20:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bootstrap.mk,v 1.1 2021/02/09 13:18:36 ryoon Exp $
+# $NetBSD: bootstrap.mk,v 1.2 2021/04/22 14:20:23 pho Exp $
 # -----------------------------------------------------------------------------
 # Select a bindist of bootstrapping compiler on a per-platform basis.
 #
@@ -13,6 +13,7 @@
 .include "../../mk/bsd.prefs.mk"
 
 # Notes on version dependencies:
+# * GHC 9.0.1 requires 8.8 or later to bootstrap.
 # * GHC 8.8.1 requires 8.4 or later to bootstrap.
 # * GHC 8.4.4 requires 8.0 or later to bootstrap.
 # * GHC 8.0.2 requires 7.8 or later to bootstrap.
@@ -54,7 +55,9 @@
 BOOT_VERSION:= 8.10.4
 BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-unknown-netbsd.tar.xz
 DISTFILES:=    ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
-.  if !empty(MACHINE_PLATFORM:MNetBSD-9.99*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+.  if !empty(MACHINE_PLATFORM:MNetBSD-9.99.*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+# XXX: What is this used for? Does extracting libterminfo.so in
+# ${WRKSRC} do anything useful?
 DISTFILES+=    netbsd-9.0-amd64-libterminfo.tar.gz
 EXTRACT_ONLY+= netbsd-9.0-amd64-libterminfo.tar.gz
 .  endif
diff -r 20ed6ac873bd -r 0f1dad0d3e6f lang/ghc90/distinfo
--- a/lang/ghc90/distinfo       Thu Apr 22 13:57:09 2021 +0000
+++ b/lang/ghc90/distinfo       Thu Apr 22 14:20:23 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1 2021/02/09 13:18:36 ryoon Exp $
+$NetBSD: distinfo,v 1.2 2021/04/22 14:20:23 pho Exp $
 
 SHA1 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 3ff01d768393b3866e7a7543f9f55646aaffce7a
 RMD160 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 39bf10b13054a6316c8477609fb98abe4277fa6c
@@ -26,4 +26,5 @@
 SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607
 SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
 SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
-SHA1 (patch-rts_ProfHeap.c) = 32182bbde0453b60745663d3ae2a3cd54fab85c1
+SHA1 (patch-rts_ProfHeap.c) = ef3d773387efd297830a54102e368ea96b7b0adf
+SHA1 (patch-rts_posix_OSThreads.c) = d5873aad8836067b5f29b37250666e37db67a4be
diff -r 20ed6ac873bd -r 0f1dad0d3e6f lang/ghc90/patches/patch-rts_ProfHeap.c
--- a/lang/ghc90/patches/patch-rts_ProfHeap.c   Thu Apr 22 13:57:09 2021 +0000
+++ b/lang/ghc90/patches/patch-rts_ProfHeap.c   Thu Apr 22 14:20:23 2021 +0000
@@ -1,4 +1,6 @@
-$NetBSD: patch-rts_ProfHeap.c,v 1.1 2021/02/09 13:18:36 ryoon Exp $
+$NetBSD: patch-rts_ProfHeap.c,v 1.2 2021/04/22 14:20:24 pho Exp $
+
+NetBSD does not have uselocale(3).
 
 --- rts/ProfHeap.c.orig        2021-01-25 16:30:28.000000000 +0000
 +++ rts/ProfHeap.c
diff -r 20ed6ac873bd -r 0f1dad0d3e6f lang/ghc90/patches/patch-rts_posix_OSThreads.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc90/patches/patch-rts_posix_OSThreads.c    Thu Apr 22 14:20:23 2021 +0000
@@ -0,0 +1,43 @@
+$NetBSD: patch-rts_posix_OSThreads.c,v 1.1 2021/04/22 14:20:24 pho Exp $
+
+Implementation of getNumberOfProcessors() for NetBSD
+
+TODO: Send this to the upstream.
+
+--- rts/posix/OSThreads.c.orig 2021-04-22 12:36:33.476115260 +0000
++++ rts/posix/OSThreads.c
+@@ -14,6 +14,11 @@
+  * DragonflyBSD, because of some specific types, like u_char, u_int, etc. */
+ #define __BSD_VISIBLE   1
+ #endif
++#if defined(netbsd_HOST_OS)
++/* Inclusion of system headers usually requires _NETBSD_SOURCE on NetBSD,
++ * because of some specific types, like u_char, u_int, etc. */
++#define _NETBSD_SOURCE 1
++#endif
+ #if defined(darwin_HOST_OS)
+ /* Inclusion of system headers usually requires _DARWIN_C_SOURCE on Mac OS X
+  * because of some specific types like u_char, u_int, etc. */
+@@ -42,7 +47,7 @@
+ #include <string.h>
+ #endif
+ 
+-#if defined(darwin_HOST_OS) || defined(freebsd_HOST_OS)
++#if defined(darwin_HOST_OS) || defined(freebsd_HOST_OS) || defined(netbsd_HOST_OS)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
+@@ -279,6 +284,13 @@ getNumberOfProcessors (void)
+             if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0)
+                 nproc = 1;
+         }
++#elif defined(netbsd_HOST_OS)
++        size_t size = sizeof(uint32_t);
++        if (sysctlbyname("hw.ncpuonline", &nproc, &size, NULL, 0) != 0) {
++            if (sysctlbyname("hw.ncpu", &nproc, &size, NULL, 0) != 0) {
++                nproc = 1;
++            }
++        }
+ #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
+         // N.B. This is the number of physical processors.
+         nproc = sysconf(_SC_NPROCESSORS_ONLN);



Home | Main Index | Thread Index | Old Index