pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Move old LDC to ldc017 subdir
Module Name: pkgsrc-wip
Committed By: Dan Cîrnaț <dan%alt.md@localhost>
Pushed By: cirnatdan
Date: Thu May 7 16:33:18 2020 +0200
Changeset: d7e0a9176961e6f4da3b320b312c6228976550b0
Modified Files:
Makefile
Added Files:
ldc017/DESCR
ldc017/Makefile
ldc017/PLIST
ldc017/distinfo
ldc017/patches/patch-runtime_CMakeLists.txt
ldc017/patches/patch-runtime_druntime_osmodel.mak
ldc017/patches/patch-runtime_druntime_src_core_runtime.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_errno.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_fenv.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_locale.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_math.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_stdio.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_string.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
ldc017/patches/patch-runtime_druntime_src_core_stdc_time.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_time.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
ldc017/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
ldc017/patches/patch-runtime_druntime_src_core_thread.d
ldc017/patches/patch-runtime_druntime_src_core_time.d
ldc017/patches/patch-runtime_druntime_src_gc_os.d
ldc017/patches/patch-runtime_druntime_src_rt_bss__section.c
ldc017/patches/patch-runtime_druntime_src_rt_sections.d
ldc017/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
ldc017/patches/patch-runtime_druntime_src_rt_sections__ldc.d
ldc017/patches/patch-runtime_druntime_test_shared_src_load.d
ldc017/patches/patch-runtime_phobos_osmodel.mak
ldc017/patches/patch-runtime_phobos_std_complex.d
ldc017/patches/patch-runtime_phobos_std_conv.d
ldc017/patches/patch-runtime_phobos_std_datetime.d
ldc017/patches/patch-runtime_phobos_std_file.d
ldc017/patches/patch-runtime_phobos_std_math.d
ldc017/patches/patch-runtime_phobos_std_numeric.d
ldc017/patches/patch-runtime_phobos_std_parallelism.d
ldc017/patches/patch-runtime_phobos_std_socket.d
ldc017/patches/patch-runtime_phobos_std_stdio.d
ldc017/patches/patch-runtime_phobos_std_system.d
Removed Files:
ldc/DESCR
ldc/Makefile
ldc/PLIST
ldc/distinfo
ldc/patches/patch-runtime_CMakeLists.txt
ldc/patches/patch-runtime_druntime_osmodel.mak
ldc/patches/patch-runtime_druntime_src_core_runtime.d
ldc/patches/patch-runtime_druntime_src_core_stdc_errno.d
ldc/patches/patch-runtime_druntime_src_core_stdc_fenv.d
ldc/patches/patch-runtime_druntime_src_core_stdc_locale.d
ldc/patches/patch-runtime_druntime_src_core_stdc_math.d
ldc/patches/patch-runtime_druntime_src_core_stdc_stdio.d
ldc/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
ldc/patches/patch-runtime_druntime_src_core_stdc_string.d
ldc/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
ldc/patches/patch-runtime_druntime_src_core_stdc_time.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_time.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
ldc/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
ldc/patches/patch-runtime_druntime_src_core_thread.d
ldc/patches/patch-runtime_druntime_src_core_time.d
ldc/patches/patch-runtime_druntime_src_gc_os.d
ldc/patches/patch-runtime_druntime_src_rt_bss__section.c
ldc/patches/patch-runtime_druntime_src_rt_sections.d
ldc/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
ldc/patches/patch-runtime_druntime_src_rt_sections__ldc.d
ldc/patches/patch-runtime_druntime_test_shared_src_load.d
ldc/patches/patch-runtime_phobos_osmodel.mak
ldc/patches/patch-runtime_phobos_std_complex.d
ldc/patches/patch-runtime_phobos_std_conv.d
ldc/patches/patch-runtime_phobos_std_datetime.d
ldc/patches/patch-runtime_phobos_std_file.d
ldc/patches/patch-runtime_phobos_std_math.d
ldc/patches/patch-runtime_phobos_std_numeric.d
ldc/patches/patch-runtime_phobos_std_parallelism.d
ldc/patches/patch-runtime_phobos_std_socket.d
ldc/patches/patch-runtime_phobos_std_stdio.d
ldc/patches/patch-runtime_phobos_std_system.d
Log Message:
Move old LDC to ldc017 subdir
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d7e0a9176961e6f4da3b320b312c6228976550b0
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 2 +-
ldc/DESCR | 4 -
ldc/Makefile | 39 --
ldc/PLIST | 335 ------------
ldc/distinfo | 74 ---
ldc/patches/patch-runtime_CMakeLists.txt | 13 -
ldc/patches/patch-runtime_druntime_osmodel.mak | 14 -
.../patch-runtime_druntime_src_core_runtime.d | 23 -
.../patch-runtime_druntime_src_core_stdc_errno.d | 143 ------
.../patch-runtime_druntime_src_core_stdc_fenv.d | 17 -
.../patch-runtime_druntime_src_core_stdc_locale.d | 30 --
.../patch-runtime_druntime_src_core_stdc_math.d | 27 -
.../patch-runtime_druntime_src_core_stdc_stdio.d | 53 --
.../patch-runtime_druntime_src_core_stdc_stdlib.d | 14 -
.../patch-runtime_druntime_src_core_stdc_string.d | 17 -
.../patch-runtime_druntime_src_core_stdc_tgmath.d | 561 ---------------------
.../patch-runtime_druntime_src_core_stdc_time.d | 31 --
...runtime_druntime_src_core_sys_posix_arpa_inet.d | 50 --
...ch-runtime_druntime_src_core_sys_posix_dirent.d | 90 ----
...tch-runtime_druntime_src_core_sys_posix_dlfcn.d | 36 --
...tch-runtime_druntime_src_core_sys_posix_fcntl.d | 66 ---
...patch-runtime_druntime_src_core_sys_posix_grp.d | 48 --
...-runtime_druntime_src_core_sys_posix_net_if__.d | 28 -
...tch-runtime_druntime_src_core_sys_posix_netdb.d | 119 -----
...time_druntime_src_core_sys_posix_netinet_in__.d | 206 --------
...ntime_druntime_src_core_sys_posix_netinet_tcp.d | 17 -
...atch-runtime_druntime_src_core_sys_posix_poll.d | 46 --
...h-runtime_druntime_src_core_sys_posix_pthread.d | 205 --------
...patch-runtime_druntime_src_core_sys_posix_pwd.d | 56 --
...tch-runtime_druntime_src_core_sys_posix_sched.d | 48 --
...runtime_druntime_src_core_sys_posix_semaphore.d | 30 --
...ch-runtime_druntime_src_core_sys_posix_setjmp.d | 56 --
...ch-runtime_druntime_src_core_sys_posix_signal.d | 339 -------------
...tch-runtime_druntime_src_core_sys_posix_stdio.d | 17 -
...ch-runtime_druntime_src_core_sys_posix_stdlib.d | 74 ---
...runtime_druntime_src_core_sys_posix_sys_ioctl.d | 25 -
...h-runtime_druntime_src_core_sys_posix_sys_ipc.d | 39 --
...-runtime_druntime_src_core_sys_posix_sys_mman.d | 121 -----
...time_druntime_src_core_sys_posix_sys_resource.d | 84 ---
...untime_druntime_src_core_sys_posix_sys_select.d | 62 ---
...h-runtime_druntime_src_core_sys_posix_sys_shm.d | 39 --
...untime_druntime_src_core_sys_posix_sys_socket.d | 240 ---------
...-runtime_druntime_src_core_sys_posix_sys_stat.d | 113 -----
...-runtime_druntime_src_core_sys_posix_sys_time.d | 32 --
...h-runtime_druntime_src_core_sys_posix_sys_uio.d | 24 -
...ch-runtime_druntime_src_core_sys_posix_sys_un.d | 22 -
...ntime_druntime_src_core_sys_posix_sys_utsname.d | 29 --
...-runtime_druntime_src_core_sys_posix_sys_wait.d | 18 -
...ch-runtime_druntime_src_core_sys_posix_syslog.d | 78 ---
...h-runtime_druntime_src_core_sys_posix_termios.d | 47 --
...atch-runtime_druntime_src_core_sys_posix_time.d | 17 -
...-runtime_druntime_src_core_sys_posix_ucontext.d | 67 ---
...ch-runtime_druntime_src_core_sys_posix_unistd.d | 192 -------
...tch-runtime_druntime_src_core_sys_posix_utime.d | 23 -
.../patch-runtime_druntime_src_core_thread.d | 98 ----
ldc/patches/patch-runtime_druntime_src_core_time.d | 38 --
ldc/patches/patch-runtime_druntime_src_gc_os.d | 14 -
.../patch-runtime_druntime_src_rt_bss__section.c | 15 -
.../patch-runtime_druntime_src_rt_sections.d | 15 -
...runtime_druntime_src_rt_sections__elf__shared.d | 67 ---
.../patch-runtime_druntime_src_rt_sections__ldc.d | 14 -
.../patch-runtime_druntime_test_shared_src_load.d | 14 -
ldc/patches/patch-runtime_phobos_osmodel.mak | 14 -
ldc/patches/patch-runtime_phobos_std_complex.d | 36 --
ldc/patches/patch-runtime_phobos_std_conv.d | 25 -
ldc/patches/patch-runtime_phobos_std_datetime.d | 14 -
ldc/patches/patch-runtime_phobos_std_file.d | 27 -
ldc/patches/patch-runtime_phobos_std_math.d | 91 ----
ldc/patches/patch-runtime_phobos_std_numeric.d | 16 -
ldc/patches/patch-runtime_phobos_std_parallelism.d | 29 --
ldc/patches/patch-runtime_phobos_std_socket.d | 21 -
ldc/patches/patch-runtime_phobos_std_stdio.d | 19 -
ldc/patches/patch-runtime_phobos_std_system.d | 22 -
ldc017/DESCR | 4 +
ldc017/Makefile | 39 ++
ldc017/PLIST | 335 ++++++++++++
ldc017/distinfo | 74 +++
ldc017/patches/patch-runtime_CMakeLists.txt | 13 +
ldc017/patches/patch-runtime_druntime_osmodel.mak | 14 +
.../patch-runtime_druntime_src_core_runtime.d | 23 +
.../patch-runtime_druntime_src_core_stdc_errno.d | 143 ++++++
.../patch-runtime_druntime_src_core_stdc_fenv.d | 17 +
.../patch-runtime_druntime_src_core_stdc_locale.d | 30 ++
.../patch-runtime_druntime_src_core_stdc_math.d | 27 +
.../patch-runtime_druntime_src_core_stdc_stdio.d | 53 ++
.../patch-runtime_druntime_src_core_stdc_stdlib.d | 14 +
.../patch-runtime_druntime_src_core_stdc_string.d | 17 +
.../patch-runtime_druntime_src_core_stdc_tgmath.d | 561 +++++++++++++++++++++
.../patch-runtime_druntime_src_core_stdc_time.d | 31 ++
...runtime_druntime_src_core_sys_posix_arpa_inet.d | 50 ++
...ch-runtime_druntime_src_core_sys_posix_dirent.d | 90 ++++
...tch-runtime_druntime_src_core_sys_posix_dlfcn.d | 36 ++
...tch-runtime_druntime_src_core_sys_posix_fcntl.d | 66 +++
...patch-runtime_druntime_src_core_sys_posix_grp.d | 48 ++
...-runtime_druntime_src_core_sys_posix_net_if__.d | 28 +
...tch-runtime_druntime_src_core_sys_posix_netdb.d | 119 +++++
...time_druntime_src_core_sys_posix_netinet_in__.d | 206 ++++++++
...ntime_druntime_src_core_sys_posix_netinet_tcp.d | 17 +
...atch-runtime_druntime_src_core_sys_posix_poll.d | 46 ++
...h-runtime_druntime_src_core_sys_posix_pthread.d | 205 ++++++++
...patch-runtime_druntime_src_core_sys_posix_pwd.d | 56 ++
...tch-runtime_druntime_src_core_sys_posix_sched.d | 48 ++
...runtime_druntime_src_core_sys_posix_semaphore.d | 30 ++
...ch-runtime_druntime_src_core_sys_posix_setjmp.d | 56 ++
...ch-runtime_druntime_src_core_sys_posix_signal.d | 339 +++++++++++++
...tch-runtime_druntime_src_core_sys_posix_stdio.d | 17 +
...ch-runtime_druntime_src_core_sys_posix_stdlib.d | 74 +++
...runtime_druntime_src_core_sys_posix_sys_ioctl.d | 25 +
...h-runtime_druntime_src_core_sys_posix_sys_ipc.d | 39 ++
...-runtime_druntime_src_core_sys_posix_sys_mman.d | 121 +++++
...time_druntime_src_core_sys_posix_sys_resource.d | 84 +++
...untime_druntime_src_core_sys_posix_sys_select.d | 62 +++
...h-runtime_druntime_src_core_sys_posix_sys_shm.d | 39 ++
...untime_druntime_src_core_sys_posix_sys_socket.d | 240 +++++++++
...-runtime_druntime_src_core_sys_posix_sys_stat.d | 113 +++++
...-runtime_druntime_src_core_sys_posix_sys_time.d | 32 ++
...h-runtime_druntime_src_core_sys_posix_sys_uio.d | 24 +
...ch-runtime_druntime_src_core_sys_posix_sys_un.d | 22 +
...ntime_druntime_src_core_sys_posix_sys_utsname.d | 29 ++
...-runtime_druntime_src_core_sys_posix_sys_wait.d | 18 +
...ch-runtime_druntime_src_core_sys_posix_syslog.d | 78 +++
...h-runtime_druntime_src_core_sys_posix_termios.d | 47 ++
...atch-runtime_druntime_src_core_sys_posix_time.d | 17 +
...-runtime_druntime_src_core_sys_posix_ucontext.d | 67 +++
...ch-runtime_druntime_src_core_sys_posix_unistd.d | 192 +++++++
...tch-runtime_druntime_src_core_sys_posix_utime.d | 23 +
.../patch-runtime_druntime_src_core_thread.d | 98 ++++
.../patches/patch-runtime_druntime_src_core_time.d | 38 ++
ldc017/patches/patch-runtime_druntime_src_gc_os.d | 14 +
.../patch-runtime_druntime_src_rt_bss__section.c | 15 +
.../patch-runtime_druntime_src_rt_sections.d | 15 +
...runtime_druntime_src_rt_sections__elf__shared.d | 67 +++
.../patch-runtime_druntime_src_rt_sections__ldc.d | 14 +
.../patch-runtime_druntime_test_shared_src_load.d | 14 +
ldc017/patches/patch-runtime_phobos_osmodel.mak | 14 +
ldc017/patches/patch-runtime_phobos_std_complex.d | 36 ++
ldc017/patches/patch-runtime_phobos_std_conv.d | 25 +
ldc017/patches/patch-runtime_phobos_std_datetime.d | 14 +
ldc017/patches/patch-runtime_phobos_std_file.d | 27 +
ldc017/patches/patch-runtime_phobos_std_math.d | 91 ++++
ldc017/patches/patch-runtime_phobos_std_numeric.d | 16 +
.../patches/patch-runtime_phobos_std_parallelism.d | 29 ++
ldc017/patches/patch-runtime_phobos_std_socket.d | 21 +
ldc017/patches/patch-runtime_phobos_std_stdio.d | 19 +
ldc017/patches/patch-runtime_phobos_std_system.d | 22 +
145 files changed, 4788 insertions(+), 4788 deletions(-)
diffs:
diff --git a/Makefile b/Makefile
index f4a32fc9c7..d39a855291 100644
--- a/Makefile
+++ b/Makefile
@@ -1790,7 +1790,7 @@ SUBDIR+= lcov-git
SUBDIR+= ldapbrowser
SUBDIR+= ldapdns
SUBDIR+= ldapuseradd
-SUBDIR+= ldc
+SUBDIR+= ldc017
SUBDIR+= ldc-git
SUBDIR+= lde
SUBDIR+= ldtp
diff --git a/ldc/DESCR b/ldc/DESCR
deleted file mode 100644
index 79a999ac8b..0000000000
--- a/ldc/DESCR
+++ /dev/null
@@ -1,4 +0,0 @@
-The LDC project aims to provide a portable D programming language
-compiler with modern optimization and code generation capabilities.
-The compiler uses the official DMD frontend to support the latest D2
-version and relies on the LLVM Core libraries for code generation.
diff --git a/ldc/Makefile b/ldc/Makefile
deleted file mode 100644
index 1c1b2d7522..0000000000
--- a/ldc/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# $NetBSD$
-
-PKGNAME= ldc-0.17.6
-PKGREVISION= 1
-DISTNAME= ${PKGNAME_NOREV}-src
-GITHUB_RELEASE= v${PKGVERSION_NOREV}
-CATEGORIES= lang
-MASTER_SITES= ${MASTER_SITE_GITHUB:=ldc-developers/}
-
-MAINTAINER= pkgsrc-users%NetBSD.org@localhost
-HOMEPAGE= https://github.com/ldc-developers/ldc/
-COMMENT= D compiler based on LLVM
-LICENSE= modified-bsd \
- AND (artistic OR gnu-gpl-v1) \
- AND (artistic OR gnu-gpl-v2 OR gnu-gpl-v3) \
- AND gnu-lgpl-v2.1 \
- AND modified-bsd \
- AND boost-license
-#TODO: The modified-bsd two lines above should be
-# University of Illinois Open Source License.
-# They are similar, but I am not sure if they are equivalent.
-
-USE_CMAKE= yes
-USE_LANGUAGES= c c++
-
-CMAKE_ARGS+= -DLLVM_CONFIG=${LLVM_CONFIG_PATH}
-
-EGDIR= ${PREFIX}/share/examples/${PKGBASE}
-
-CONF_FILES= ${EGDIR}/ldc2.conf ${PKG_SYSCONFDIR}/ldc2.conf
-
-post-install:
- ${MKDIR} -p ${DESTDIR}${EGDIR} \
- && ${MV} ${DESTDIR}${PREFIX}/etc/ldc2.conf \
- ${DESTDIR}${EGDIR}
-
-.include "../../wip/libLLVM38/buildlink3.mk"
-.include "../../devel/libconfig/buildlink3.mk"
-.include "../../mk/bsd.pkg.mk"
diff --git a/ldc/PLIST b/ldc/PLIST
deleted file mode 100644
index 72abc79d5d..0000000000
--- a/ldc/PLIST
+++ /dev/null
@@ -1,335 +0,0 @@
-@comment $NetBSD$
-bin/ldc2
-bin/ldmd2
-etc/bash_completion.d/ldc2
-include/d/core/atomic.d
-include/d/core/bitop.d
-include/d/core/checkedint.d
-include/d/core/cpuid.d
-include/d/core/demangle.d
-include/d/core/exception.d
-include/d/core/internal/convert.d
-include/d/core/internal/hash.d
-include/d/core/internal/traits.d
-include/d/core/math.d
-include/d/core/memory.d
-include/d/core/runtime.d
-include/d/core/simd.d
-include/d/core/stdc/complex.d
-include/d/core/stdc/config.d
-include/d/core/stdc/ctype.d
-include/d/core/stdc/errno.c
-include/d/core/stdc/errno.d
-include/d/core/stdc/fenv.d
-include/d/core/stdc/float_.d
-include/d/core/stdc/inttypes.d
-include/d/core/stdc/limits.d
-include/d/core/stdc/locale.d
-include/d/core/stdc/math.d
-include/d/core/stdc/signal.d
-include/d/core/stdc/stdarg.d
-include/d/core/stdc/stddef.d
-include/d/core/stdc/stdint.d
-include/d/core/stdc/stdio.d
-include/d/core/stdc/stdlib.d
-include/d/core/stdc/string.d
-include/d/core/stdc/tgmath.d
-include/d/core/stdc/time.d
-include/d/core/stdc/wchar_.d
-include/d/core/stdc/wctype.d
-include/d/core/sync/barrier.d
-include/d/core/sync/condition.d
-include/d/core/sync/config.d
-include/d/core/sync/exception.d
-include/d/core/sync/mutex.d
-include/d/core/sync/rwmutex.d
-include/d/core/sync/semaphore.d
-include/d/core/sys/dragonflybsd/dlfcn.d
-include/d/core/sys/dragonflybsd/execinfo.d
-include/d/core/sys/dragonflybsd/netinet/in_.d
-include/d/core/sys/dragonflybsd/pthread_np.d
-include/d/core/sys/dragonflybsd/sys/_bitset.d
-include/d/core/sys/dragonflybsd/sys/_cpuset.d
-include/d/core/sys/dragonflybsd/sys/cdefs.d
-include/d/core/sys/dragonflybsd/sys/elf.d
-include/d/core/sys/dragonflybsd/sys/elf32.d
-include/d/core/sys/dragonflybsd/sys/elf64.d
-include/d/core/sys/dragonflybsd/sys/elf_common.d
-include/d/core/sys/dragonflybsd/sys/event.d
-include/d/core/sys/dragonflybsd/sys/link_elf.d
-include/d/core/sys/dragonflybsd/sys/mman.d
-include/d/core/sys/dragonflybsd/time.d
-include/d/core/sys/freebsd/dlfcn.d
-include/d/core/sys/freebsd/execinfo.d
-include/d/core/sys/freebsd/sys/cdefs.d
-include/d/core/sys/freebsd/sys/elf.d
-include/d/core/sys/freebsd/sys/elf32.d
-include/d/core/sys/freebsd/sys/elf64.d
-include/d/core/sys/freebsd/sys/elf_common.d
-include/d/core/sys/freebsd/sys/event.d
-include/d/core/sys/freebsd/sys/link_elf.d
-include/d/core/sys/freebsd/sys/mman.d
-include/d/core/sys/freebsd/time.d
-include/d/core/sys/linux/config.d
-include/d/core/sys/linux/dlfcn.d
-include/d/core/sys/linux/elf.d
-include/d/core/sys/linux/epoll.d
-include/d/core/sys/linux/errno.d
-include/d/core/sys/linux/execinfo.d
-include/d/core/sys/linux/link.d
-include/d/core/sys/linux/stdio.d
-include/d/core/sys/linux/sys/inotify.d
-include/d/core/sys/linux/sys/mman.d
-include/d/core/sys/linux/sys/signalfd.d
-include/d/core/sys/linux/sys/sysinfo.d
-include/d/core/sys/linux/sys/xattr.d
-include/d/core/sys/linux/termios.d
-include/d/core/sys/linux/time.d
-include/d/core/sys/linux/tipc.d
-include/d/core/sys/osx/execinfo.d
-include/d/core/sys/osx/mach/dyld.d
-include/d/core/sys/osx/mach/getsect.d
-include/d/core/sys/osx/mach/kern_return.d
-include/d/core/sys/osx/mach/loader.d
-include/d/core/sys/osx/mach/port.d
-include/d/core/sys/osx/mach/semaphore.d
-include/d/core/sys/osx/mach/thread_act.d
-include/d/core/sys/osx/pthread.d
-include/d/core/sys/osx/sys/cdefs.d
-include/d/core/sys/osx/sys/event.d
-include/d/core/sys/osx/sys/mman.d
-include/d/core/sys/posix/arpa/inet.d
-include/d/core/sys/posix/config.d
-include/d/core/sys/posix/dirent.d
-include/d/core/sys/posix/dlfcn.d
-include/d/core/sys/posix/fcntl.d
-include/d/core/sys/posix/grp.d
-include/d/core/sys/posix/inttypes.d
-include/d/core/sys/posix/net/if_.d
-include/d/core/sys/posix/netdb.d
-include/d/core/sys/posix/netinet/in_.d
-include/d/core/sys/posix/netinet/tcp.d
-include/d/core/sys/posix/poll.d
-include/d/core/sys/posix/pthread.d
-include/d/core/sys/posix/pwd.d
-include/d/core/sys/posix/sched.d
-include/d/core/sys/posix/semaphore.d
-include/d/core/sys/posix/setjmp.d
-include/d/core/sys/posix/signal.d
-include/d/core/sys/posix/stdio.d
-include/d/core/sys/posix/stdlib.d
-include/d/core/sys/posix/sys/ioctl.d
-include/d/core/sys/posix/sys/ipc.d
-include/d/core/sys/posix/sys/mman.d
-include/d/core/sys/posix/sys/msg.d
-include/d/core/sys/posix/sys/resource.d
-include/d/core/sys/posix/sys/select.d
-include/d/core/sys/posix/sys/shm.d
-include/d/core/sys/posix/sys/socket.d
-include/d/core/sys/posix/sys/stat.d
-include/d/core/sys/posix/sys/statvfs.d
-include/d/core/sys/posix/sys/time.d
-include/d/core/sys/posix/sys/types.d
-include/d/core/sys/posix/sys/uio.d
-include/d/core/sys/posix/sys/un.d
-include/d/core/sys/posix/sys/utsname.d
-include/d/core/sys/posix/sys/wait.d
-include/d/core/sys/posix/syslog.d
-include/d/core/sys/posix/termios.d
-include/d/core/sys/posix/time.d
-include/d/core/sys/posix/ucontext.d
-include/d/core/sys/posix/unistd.d
-include/d/core/sys/posix/utime.d
-include/d/core/sys/solaris/dlfcn.d
-include/d/core/sys/solaris/elf.d
-include/d/core/sys/solaris/execinfo.d
-include/d/core/sys/solaris/libelf.d
-include/d/core/sys/solaris/link.d
-include/d/core/sys/solaris/sys/elf.d
-include/d/core/sys/solaris/sys/elf_386.d
-include/d/core/sys/solaris/sys/elf_SPARC.d
-include/d/core/sys/solaris/sys/elf_amd64.d
-include/d/core/sys/solaris/sys/elf_notes.d
-include/d/core/sys/solaris/sys/elftypes.d
-include/d/core/sys/solaris/sys/link.d
-include/d/core/sys/solaris/sys/priocntl.d
-include/d/core/sys/solaris/sys/procset.d
-include/d/core/sys/solaris/sys/types.d
-include/d/core/sys/solaris/time.d
-include/d/core/sys/windows/com.d
-include/d/core/sys/windows/dbghelp.d
-include/d/core/sys/windows/dll.d
-include/d/core/sys/windows/stacktrace.d
-include/d/core/sys/windows/stat.d
-include/d/core/sys/windows/threadaux.d
-include/d/core/sys/windows/windows.d
-include/d/core/sys/windows/winsock2.d
-include/d/core/thread.d
-include/d/core/threadasm.S
-include/d/core/time.d
-include/d/core/vararg.d
-include/d/etc/c/curl.d
-include/d/etc/c/odbc/sql.d
-include/d/etc/c/odbc/sqlext.d
-include/d/etc/c/odbc/sqltypes.d
-include/d/etc/c/odbc/sqlucode.d
-include/d/etc/c/sqlite3.d
-include/d/etc/c/zlib.d
-include/d/etc/linux/memoryerror.d
-include/d/ldc/arm_unwind.c
-include/d/ldc/arrayinit.d
-include/d/ldc/attributes.d
-include/d/ldc/eh/common.d
-include/d/ldc/eh/fixedpool.d
-include/d/ldc/eh/libunwind.d
-include/d/ldc/eh/win32.d
-include/d/ldc/eh/win64.d
-include/d/ldc/eh_asm.S
-include/d/ldc/gccbuiltins_aarch64.di
-include/d/ldc/internal/vararg.di
-include/d/ldc/intrinsics.di
-include/d/ldc/llvmasm.di
-include/d/ldc/msvc.c
-include/d/ldc/object.d
-include/d/ldc/osx_tls.c
-include/d/ldc/simd.di
-include/d/std/algorithm/comparison.d
-include/d/std/algorithm/internal.d
-include/d/std/algorithm/iteration.d
-include/d/std/algorithm/mutation.d
-include/d/std/algorithm/package.d
-include/d/std/algorithm/searching.d
-include/d/std/algorithm/setops.d
-include/d/std/algorithm/sorting.d
-include/d/std/array.d
-include/d/std/ascii.d
-include/d/std/base64.d
-include/d/std/bigint.d
-include/d/std/bitmanip.d
-include/d/std/c/fenv.d
-include/d/std/c/freebsd/socket.d
-include/d/std/c/linux/linux.d
-include/d/std/c/linux/linuxextern.d
-include/d/std/c/linux/pthread.d
-include/d/std/c/linux/socket.d
-include/d/std/c/linux/termios.d
-include/d/std/c/linux/tipc.d
-include/d/std/c/locale.d
-include/d/std/c/math.d
-include/d/std/c/osx/socket.d
-include/d/std/c/process.d
-include/d/std/c/stdarg.d
-include/d/std/c/stddef.d
-include/d/std/c/stdio.d
-include/d/std/c/stdlib.d
-include/d/std/c/string.d
-include/d/std/c/time.d
-include/d/std/c/wcharh.d
-include/d/std/c/windows/com.d
-include/d/std/c/windows/stat.d
-include/d/std/c/windows/windows.d
-include/d/std/c/windows/winsock.d
-include/d/std/compiler.d
-include/d/std/complex.d
-include/d/std/concurrency.d
-include/d/std/container/array.d
-include/d/std/container/binaryheap.d
-include/d/std/container/dlist.d
-include/d/std/container/package.d
-include/d/std/container/rbtree.d
-include/d/std/container/slist.d
-include/d/std/container/util.d
-include/d/std/conv.d
-include/d/std/cstream.d
-include/d/std/csv.d
-include/d/std/datetime.d
-include/d/std/demangle.d
-include/d/std/digest/crc.d
-include/d/std/digest/digest.d
-include/d/std/digest/md.d
-include/d/std/digest/ripemd.d
-include/d/std/digest/sha.d
-include/d/std/encoding.d
-include/d/std/exception.d
-include/d/std/experimental/logger/core.d
-include/d/std/experimental/logger/filelogger.d
-include/d/std/experimental/logger/multilogger.d
-include/d/std/experimental/logger/nulllogger.d
-include/d/std/experimental/logger/package.d
-include/d/std/file.d
-include/d/std/format.d
-include/d/std/functional.d
-include/d/std/getopt.d
-include/d/std/internal/cstring.d
-include/d/std/internal/digest/sha_SSSE3.d
-include/d/std/internal/math/biguintcore.d
-include/d/std/internal/math/biguintnoasm.d
-include/d/std/internal/math/biguintx86.d
-include/d/std/internal/math/errorfunction.d
-include/d/std/internal/math/gammafunction.d
-include/d/std/internal/processinit.d
-include/d/std/internal/scopebuffer.d
-include/d/std/internal/test/dummyrange.d
-include/d/std/internal/unicode_comp.d
-include/d/std/internal/unicode_decomp.d
-include/d/std/internal/unicode_grapheme.d
-include/d/std/internal/unicode_norm.d
-include/d/std/internal/unicode_tables.d
-include/d/std/internal/windows/advapi32.d
-include/d/std/json.d
-include/d/std/math.d
-include/d/std/mathspecial.d
-include/d/std/meta.d
-include/d/std/metastrings.d
-include/d/std/mmfile.d
-include/d/std/net/curl.d
-include/d/std/net/isemail.d
-include/d/std/numeric.d
-include/d/std/outbuffer.d
-include/d/std/parallelism.d
-include/d/std/path.d
-include/d/std/process.d
-include/d/std/random.d
-include/d/std/range/interfaces.d
-include/d/std/range/package.d
-include/d/std/range/primitives.d
-include/d/std/regex/internal/backtracking.d
-include/d/std/regex/internal/generator.d
-include/d/std/regex/internal/ir.d
-include/d/std/regex/internal/kickstart.d
-include/d/std/regex/internal/parser.d
-include/d/std/regex/internal/tests.d
-include/d/std/regex/internal/thompson.d
-include/d/std/regex/package.d
-include/d/std/signals.d
-include/d/std/socket.d
-include/d/std/socketstream.d
-include/d/std/stdint.d
-include/d/std/stdio.d
-include/d/std/stdiobase.d
-include/d/std/stream.d
-include/d/std/string.d
-include/d/std/syserror.d
-include/d/std/system.d
-include/d/std/traits.d
-include/d/std/typecons.d
-include/d/std/typelist.d
-include/d/std/typetuple.d
-include/d/std/uni.d
-include/d/std/uri.d
-include/d/std/utf.d
-include/d/std/uuid.d
-include/d/std/variant.d
-include/d/std/windows/charset.d
-include/d/std/windows/iunknown.d
-include/d/std/windows/registry.d
-include/d/std/windows/syserror.d
-include/d/std/xml.d
-include/d/std/zip.d
-include/d/std/zlib.d
-lib/libdruntime-ldc-debug.a
-lib/libdruntime-ldc.a
-lib/libphobos2-ldc-debug.a
-lib/libphobos2-ldc.a
-share/examples/ldc/ldc2.conf
-@pkgdir include/d/etc/c/zlib
diff --git a/ldc/distinfo b/ldc/distinfo
deleted file mode 100644
index bc42425a8a..0000000000
--- a/ldc/distinfo
+++ /dev/null
@@ -1,74 +0,0 @@
-$NetBSD$
-
-SHA1 (ldc-0.17.6-src.tar.gz) = b702484fc38feded05e5f42c34ce66d0d14db139
-RMD160 (ldc-0.17.6-src.tar.gz) = 2e77c5c50fef02c6d6ae912dad478d3043389560
-SHA512 (ldc-0.17.6-src.tar.gz) = 433a3582bb5214004a676741d7483ed87066b47b8bfec4633796ca5a717c78ea54ee7b9c2ce1cf7bc399082802f15133d28cb4884b879326d224f48687af68e3
-Size (ldc-0.17.6-src.tar.gz) = 4986528 bytes
-SHA1 (patch-runtime_CMakeLists.txt) = a3521c5d824e9d832ed3b183147ff6c9050d2b4a
-SHA1 (patch-runtime_druntime_osmodel.mak) = 547cec590e69a96909894361affc464b250ceb7d
-SHA1 (patch-runtime_druntime_src_core_runtime.d) = cade769b1da2d7abe71533cc85bafffc06938046
-SHA1 (patch-runtime_druntime_src_core_stdc_errno.d) = 55e14f8d16928f97a03d6a45858d9dfa873f9094
-SHA1 (patch-runtime_druntime_src_core_stdc_fenv.d) = 1c9ac3e39e6539f6468cdece973f5ac4a4151c0e
-SHA1 (patch-runtime_druntime_src_core_stdc_locale.d) = cb0d3424dfbe61570e446ea04d1298bba5123f83
-SHA1 (patch-runtime_druntime_src_core_stdc_math.d) = 575c6169f92c72ba1bac9a3a0775467f090f19b2
-SHA1 (patch-runtime_druntime_src_core_stdc_stdio.d) = bde2de27d32a24513871cc6d06f1e0cea4db0933
-SHA1 (patch-runtime_druntime_src_core_stdc_stdlib.d) = 5c4815141e1ffd5b2033524d3cf11fd423379afd
-SHA1 (patch-runtime_druntime_src_core_stdc_string.d) = 7b32050fbc38700ec9b258f4c7ed497ed8d6cde2
-SHA1 (patch-runtime_druntime_src_core_stdc_tgmath.d) = 4d8945b639362035b9bc45d325e50291e77a0eaa
-SHA1 (patch-runtime_druntime_src_core_stdc_time.d) = 949dd115a983c378c411e205c0d5f4d5e7d295eb
-SHA1 (patch-runtime_druntime_src_core_sys_posix_arpa_inet.d) = 2cf8ad42ebae1a238b2e11daab7daddde1b908f1
-SHA1 (patch-runtime_druntime_src_core_sys_posix_dirent.d) = 2355ef250f2401a6542b6a9ff5df5362520f4eeb
-SHA1 (patch-runtime_druntime_src_core_sys_posix_dlfcn.d) = 10e243b140b50fddd2304f343a28d778fca4ee75
-SHA1 (patch-runtime_druntime_src_core_sys_posix_fcntl.d) = bfab0d7bdfc9a55795668884aac77fac7f9b9e3b
-SHA1 (patch-runtime_druntime_src_core_sys_posix_grp.d) = 9fe4d406ed4b49b9291900934e287bf95c9824d4
-SHA1 (patch-runtime_druntime_src_core_sys_posix_net_if__.d) = 56ccad60f480a0052224b07978050057174724c1
-SHA1 (patch-runtime_druntime_src_core_sys_posix_netdb.d) = 028ad42939529e2d6c2bed61cf07dbb44c8c68c3
-SHA1 (patch-runtime_druntime_src_core_sys_posix_netinet_in__.d) = 73177953d3f720762690312f3914d389081a5e66
-SHA1 (patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d) = cef34601e8c65692a828ced8b0ccdc381611d4c8
-SHA1 (patch-runtime_druntime_src_core_sys_posix_poll.d) = ba528e4bc0bc6437cd537d17abe6a7eea69b1adf
-SHA1 (patch-runtime_druntime_src_core_sys_posix_pthread.d) = 652e533f8b484ba440c507df17351de21291de43
-SHA1 (patch-runtime_druntime_src_core_sys_posix_pwd.d) = 9be61a4dc40f7f6aed896d34a99e3c69e317fe3c
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sched.d) = 31575d0885a7f778e24698e5246e79687d27c534
-SHA1 (patch-runtime_druntime_src_core_sys_posix_semaphore.d) = 543678a528f1ac31f0413086971e15860ef4860a
-SHA1 (patch-runtime_druntime_src_core_sys_posix_setjmp.d) = ff1cc78d36171e2ec510a0328653edbd015fbc40
-SHA1 (patch-runtime_druntime_src_core_sys_posix_signal.d) = ea412381a7a239877a90d379a219bde5926ce7a1
-SHA1 (patch-runtime_druntime_src_core_sys_posix_stdio.d) = 4ed539032bcf8fb4626e9b1933e01c82afbe4476
-SHA1 (patch-runtime_druntime_src_core_sys_posix_stdlib.d) = 82d9dbf6dbb2970e87b78f6f29567b87da83e21e
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d) = 5cbe309208ce02b0e2b39fc8794452c16fc905d6
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_ipc.d) = b3f63a86b25104cf281927993f119c42e0729cc3
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_mman.d) = ecdd0d0caedd9d268e1784318db9f46cca4c683d
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_resource.d) = cdf348a19e93d60bece85f2df176042b317f0929
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_select.d) = 5a8c8a580f6fd79ad81d98ce2a7e0eaefce67c8b
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_shm.d) = 0e3c3c2bd97d9d1053aba468db1580566d93733e
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_socket.d) = 4d18fe407850b77e8d1ce5de48c02d6439b5d4b6
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_stat.d) = dd8f7735a59bab989c3d26a28d7dca15a86b70a0
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_time.d) = c162669540f8cceb9e3cae943cc9047d85a8e12d
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_uio.d) = 313aa166c0905d5230a9d54322b79bd47d2b7181
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_un.d) = 267e89401dfe63c64d81292d87e9d2a01aab4d11
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_utsname.d) = 30092b5586b66f3b5da4623ae51829af66fd837d
-SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_wait.d) = f77e2fd7c73d25669021669596a83ac567e93983
-SHA1 (patch-runtime_druntime_src_core_sys_posix_syslog.d) = 04da01b67b6248fdbad4d7e3a8f05c11fabfdcab
-SHA1 (patch-runtime_druntime_src_core_sys_posix_termios.d) = 75406c3e698d3cc89a5bea48a1fc0f7215ffbc37
-SHA1 (patch-runtime_druntime_src_core_sys_posix_time.d) = aa3f5090c798096f838f21acf819747485130129
-SHA1 (patch-runtime_druntime_src_core_sys_posix_ucontext.d) = 07801bd15648a0f0bd76dad4763768addbc6261e
-SHA1 (patch-runtime_druntime_src_core_sys_posix_unistd.d) = f3cb6cbd02f0cad76460faa1293247199794bbd7
-SHA1 (patch-runtime_druntime_src_core_sys_posix_utime.d) = 2099425c3687f79d945103029432499368ea209b
-SHA1 (patch-runtime_druntime_src_core_thread.d) = 61230088ba3327b6e98573d9edca1af82035e634
-SHA1 (patch-runtime_druntime_src_core_time.d) = bf3555fcc057b0e3b76a3a9cd265137cdeec90d0
-SHA1 (patch-runtime_druntime_src_gc_os.d) = 4ffdfe958a2a42d832828fb85817fbaea2ef94fe
-SHA1 (patch-runtime_druntime_src_rt_bss__section.c) = fdd58f4255abc77f68eb9203df5a7951235c0871
-SHA1 (patch-runtime_druntime_src_rt_sections.d) = 72a0e4a3afc7fc36bd79f20793347ffd4906569d
-SHA1 (patch-runtime_druntime_src_rt_sections__elf__shared.d) = 1bb42fa3b890c7befefdb535481afa8904558d68
-SHA1 (patch-runtime_druntime_src_rt_sections__ldc.d) = c41ae450fcb85b40040d208d1328da0f7cb1ac1d
-SHA1 (patch-runtime_druntime_test_shared_src_load.d) = 804c00808e2e32d12834412d61ca5139d449f16c
-SHA1 (patch-runtime_phobos_osmodel.mak) = 075d6bdec960fa7c1de1db57df671d951479a9cb
-SHA1 (patch-runtime_phobos_std_complex.d) = d559b11fe05bdceaf1306591f76f6a737a23ac65
-SHA1 (patch-runtime_phobos_std_conv.d) = ae959c9db96c693dfd3a2e1de38572b7e7c4edc7
-SHA1 (patch-runtime_phobos_std_datetime.d) = a14f6f093737969dde0f8bb98d98bf7faadd6328
-SHA1 (patch-runtime_phobos_std_file.d) = 5d302b37936210a34b057184fa7bd7dffcdafacf
-SHA1 (patch-runtime_phobos_std_math.d) = c80ad1bc880e69ce6876e0e309ed511eb704c166
-SHA1 (patch-runtime_phobos_std_numeric.d) = cae1a1ea5576f7a035c7a4823cf5b190a79b3c9e
-SHA1 (patch-runtime_phobos_std_parallelism.d) = f5a6a8613178fd8531a15941a85b38085c29145b
-SHA1 (patch-runtime_phobos_std_socket.d) = 9dd63f526c89b81e80c4bc839a2ed7563602af9d
-SHA1 (patch-runtime_phobos_std_stdio.d) = dc0602eaa116c9da6706b7d89902f5783e75aefc
-SHA1 (patch-runtime_phobos_std_system.d) = 52292a046f338630962b3c700c717b32d4cc3a0c
diff --git a/ldc/patches/patch-runtime_CMakeLists.txt b/ldc/patches/patch-runtime_CMakeLists.txt
deleted file mode 100644
index 85a5849204..0000000000
--- a/ldc/patches/patch-runtime_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- runtime/CMakeLists.txt.orig 2018-08-23 23:29:39.000000000 +0000
-+++ runtime/CMakeLists.txt
-@@ -575,7 +575,7 @@ set(DRUNTIME_PACKAGES core etc ldc)
-
- install(FILES ${RUNTIME_DIR}/src/object.d DESTINATION ${INCLUDE_INSTALL_DIR}/ldc)
- foreach(p ${DRUNTIME_PACKAGES})
-- install(DIRECTORY ${RUNTIME_DIR}/src/${p} DESTINATION ${INCLUDE_INSTALL_DIR})
-+ install(DIRECTORY ${RUNTIME_DIR}/src/${p} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT copy-files PATTERN "*.orig" EXCLUDE)
- endforeach()
- if(PHOBOS2_DIR)
- install(DIRECTORY ${PHOBOS2_DIR}/std DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.d")
diff --git a/ldc/patches/patch-runtime_druntime_osmodel.mak b/ldc/patches/patch-runtime_druntime_osmodel.mak
deleted file mode 100644
index 53b93b090c..0000000000
--- a/ldc/patches/patch-runtime_druntime_osmodel.mak
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/osmodel.mak.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/osmodel.mak
-@@ -15,6 +15,9 @@ ifeq (,$(OS))
- ifeq (OpenBSD,$(uname_S))
- OS:=openbsd
- endif
-+ ifeq (NetBSD,$(uname_S))
-+ OS:=netbsd
-+ endif
- ifeq (Solaris,$(uname_S))
- OS:=solaris
- endif
diff --git a/ldc/patches/patch-runtime_druntime_src_core_runtime.d b/ldc/patches/patch-runtime_druntime_src_core_runtime.d
deleted file mode 100644
index bbeaa13401..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_runtime.d
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/runtime.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/runtime.d
-@@ -666,6 +666,18 @@ Throwable.TraceInfo defaultTraceHandler(
- symEnd = eptr - buf.ptr;
- }
- }
-+ else version( NetBSD )
-+ {
-+ // format is: 0x00000000 <_D6module4funcAFZv+0x78> at module
-+ auto bptr = cast(char*) memchr( buf.ptr, '<', buf.length );
-+ auto eptr = cast(char*) memchr( buf.ptr, '+', buf.length );
-+
-+ if( bptr++ && eptr )
-+ {
-+ symBeg = bptr - buf.ptr;
-+ symEnd = eptr - buf.ptr;
-+ }
-+ }
- else version( Solaris )
- {
- // format is object'symbol+offset [pc]
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_errno.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_errno.d
deleted file mode 100644
index f9bce6567c..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_errno.d
+++ /dev/null
@@ -1,143 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/stdc/errno.d.orig 2020-05-07 08:52:13.684688490 +0000
-+++ runtime/druntime/src/core/stdc/errno.d
-@@ -1414,6 +1414,138 @@ else version( DragonFlyBSD )
- enum EASYNC = 99;
- enum ELAST = 99;
- }
-+else version (NetBSD)
-+{
-+ enum EPERM = 1 /** Operation not permitted */;
-+ enum ENOENT = 2 /** No such file or directory */;
-+ enum ESRCH = 3 /** No such process */;
-+ enum EINTR = 4 /** Interrupted system call */;
-+ enum EIO = 5 /** Input/output error */;
-+ enum ENXIO = 6 /** Device not configured */;
-+ enum E2BIG = 7 /** Argument list too long */;
-+ enum ENOEXEC = 8 /** Exec format error */;
-+ enum EBADF = 9 /** Bad file descriptor */;
-+ enum ECHILD = 10 /** No child processes */;
-+ enum EDEADLK = 11 /** Resource deadlock avoided */;
-+ /* 11 was EAGAIN */
-+ enum ENOMEM = 12 /** Cannot allocate memory */;
-+ enum EACCES = 13 /** Permission denied */;
-+ enum EFAULT = 14 /** Bad address */;
-+ enum ENOTBLK = 15 /** Block device required */;
-+ enum EBUSY = 16 /** Device busy */;
-+ enum EEXIST = 17 /** File exists */;
-+ enum EXDEV = 18 /** Cross-device link */;
-+ enum ENODEV = 19 /** Operation not supported by device */;
-+ enum ENOTDIR = 20 /** Not a directory */;
-+ enum EISDIR = 21 /** Is a directory */;
-+ enum EINVAL = 22 /** Invalid argument */;
-+ enum ENFILE = 23 /** Too many open files in system */;
-+ enum EMFILE = 24 /** Too many open files */;
-+ enum ENOTTY = 25 /** Inappropriate ioctl for device */;
-+ enum ETXTBSY = 26 /** Text file busy */;
-+ enum EFBIG = 27 /** File too large */;
-+ enum ENOSPC = 28 /** No space left on device */;
-+ enum ESPIPE = 29 /** Illegal seek */;
-+ enum EROFS = 30 /** Read-only file system */;
-+ enum EMLINK = 31 /** Too many links */;
-+ enum EPIPE = 32 /** Broken pipe */;
-+ /* math software */
-+ enum EDOM = 33 /** Numerical argument out of domain */;
-+ enum ERANGE = 34 /** Result too large or too small */;
-+
-+ /* non-blocking and interrupt i/o */
-+ enum EAGAIN = 35 /** Resource temporarily unavailable */;
-+ enum EWOULDBLOCK = EAGAIN /** Operation would block */;
-+ enum EINPROGRESS = 36 /** Operation now in progress */;
-+ enum EALREADY = 37 /** Operation already in progress */;
-+
-+ /* ipc/network software -- argument errors */
-+ enum ENOTSOCK = 38 /** Socket operation on non-socket */;
-+ enum EDESTADDRREQ = 39 /** Destination address required */;
-+ enum EMSGSIZE = 40 /** Message too long */;
-+ enum EPROTOTYPE = 41 /** Protocol wrong type for socket */;
-+ enum ENOPROTOOPT = 42 /** Protocol option not available */;
-+ enum EPROTONOSUPPORT = 43 /** Protocol not supported */;
-+ enum ESOCKTNOSUPPORT = 44 /** Socket type not supported */;
-+ enum EOPNOTSUPP = 45 /** Operation not supported */;
-+ enum EPFNOSUPPORT = 46 /** Protocol family not supported */;
-+ enum EAFNOSUPPORT = 47 /** Address family not supported by protocol family */;
-+ enum EADDRINUSE = 48 /** Address already in use */;
-+ enum EADDRNOTAVAIL = 49 /** Can't assign requested address */;
-+
-+ /* ipc/network software -- operational errors */
-+ enum ENETDOWN = 50 /** Network is down */;
-+ enum ENETUNREACH = 51 /** Network is unreachable */;
-+ enum ENETRESET = 52 /** Network dropped connection on reset */;
-+ enum ECONNABORTED = 53 /** Software caused connection abort */;
-+ enum ECONNRESET = 54 /** Connection reset by peer */;
-+ enum ENOBUFS = 55 /** No buffer space available */;
-+ enum EISCONN = 56 /** Socket is already connected */;
-+ enum ENOTCONN = 57 /** Socket is not connected */;
-+ enum ESHUTDOWN = 58 /** Can't send after socket shutdown */;
-+ enum ETOOMANYREFS = 59 /** Too many references: can't splice */;
-+ enum ETIMEDOUT = 60 /** Operation timed out */;
-+ enum ECONNREFUSED = 61 /** Connection refused */;
-+ enum ELOOP = 62 /** Too many levels of symbolic links */;
-+ enum ENAMETOOLONG = 63 /** File name too long */;
-+
-+ /* should be rearranged */
-+ enum EHOSTDOWN = 64 /** Host is down */;
-+ enum EHOSTUNREACH = 65 /** No route to host */;
-+ enum ENOTEMPTY = 66 /** Directory not empty */;
-+
-+ /* quotas & mush */
-+ enum EPROCLIM = 67 /** Too many processes */;
-+ enum EUSERS = 68 /** Too many users */;
-+ enum EDQUOT = 69 /** Disc quota exceeded */;
-+
-+ /* Network File System */
-+ enum ESTALE = 70 /** Stale NFS file handle */;
-+ enum EREMOTE = 71 /** Too many levels of remote in path */;
-+ enum EBADRPC = 72 /** RPC struct is bad */;
-+ enum ERPCMISMATCH = 73 /** RPC version wrong */;
-+ enum EPROGUNAVAIL = 74 /** RPC prog. not avail */;
-+ enum EPROGMISMATCH = 75 /** Program version wrong */;
-+ enum EPROCUNAVAIL = 76 /** Bad procedure for program */;
-+
-+ enum ENOLCK = 77 /** No locks available */;
-+ enum ENOSYS = 78 /** Function not implemented */;
-+
-+ enum EFTYPE = 79 /** Inappropriate file type or format */;
-+ enum EAUTH = 80 /** Authentication error */;
-+ enum ENEEDAUTH = 81 /** Need authenticator */;
-+
-+ /* SystemV IPC */
-+ enum EIDRM = 82 /** Identifier removed */;
-+ enum ENOMSG = 83 /** No message of desired type */;
-+ enum EOVERFLOW = 84 /** Value too large to be stored in data type */;
-+ /* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */
-+ enum EILSEQ = 85 /** Illegal byte sequence */;
-+
-+ /* From IEEE Std 1003.1-2001 */
-+ /* Base, Realtime, Threads or Thread Priority Scheduling option errors */
-+ enum ENOTSUP = 86 /** Not supported */;
-+
-+ /* Realtime option errors */
-+ enum ECANCELED = 87 /** Operation canceled */;
-+
-+ /* Realtime, XSI STREAMS option errors */
-+ enum EBADMSG = 88 /** Bad or Corrupt message */;
-+
-+ /* XSI STREAMS option errors */
-+ enum ENODATA = 89 /** No message available */;
-+ enum ENOSR = 90 /** No STREAM resources */;
-+ enum ENOSTR = 91 /** Not a STREAM */;
-+ enum ETIME = 92 /** STREAM ioctl timeout */;
-+
-+ /* File system extended attribute errors */
-+ enum ENOATTR = 93 /** Attribute not found */;
-+
-+ /* Realtime, XSI STREAMS option errors */
-+ enum EMULTIHOP = 94 /** Multihop attempted */;
-+ enum ENOLINK = 95 /** Link has been severed */;
-+ enum EPROTO = 96 /** Protocol error */;
-+}
- else version (Solaris)
- {
- enum EPERM = 1 /** Not super-user */;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_fenv.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_fenv.d
deleted file mode 100644
index 67a163d267..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_fenv.d
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/stdc/fenv.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/stdc/fenv.d
-@@ -338,6 +338,12 @@ else version( DragonFlyBSD )
- ///
- enum FE_DFL_ENV = &__fe_dfl_env;
- }
-+else version( NetBSD )
-+{
-+ private extern const fenv_t __fe_dfl_env;
-+ ///
-+ enum FE_DFL_ENV = &__fe_dfl_env;
-+}
- else version( CRuntime_Bionic )
- {
- private extern const fenv_t __fe_dfl_env;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_locale.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_locale.d
deleted file mode 100644
index 7dc7e1386d..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_locale.d
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/stdc/locale.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/stdc/locale.d
-@@ -126,6 +126,23 @@ else version(FreeBSD)
- ///
- enum LC_MESSAGES = 6;
- }
-+else version(NetBSD)
-+{
-+ ///
-+ enum LC_ALL = 0;
-+ ///
-+ enum LC_COLLATE = 1;
-+ ///
-+ enum LC_CTYPE = 2;
-+ ///
-+ enum LC_MONETARY = 3;
-+ ///
-+ enum LC_NUMERIC = 4;
-+ ///
-+ enum LC_TIME = 5;
-+ ///
-+ enum LC_MESSAGES = 6;
-+}
- else version(Solaris)
- {
- enum LC_CTYPE = 0;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_math.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_math.d
deleted file mode 100644
index a4f8eed327..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_math.d
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/stdc/math.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/stdc/math.d
-@@ -52,6 +52,13 @@ else version (DragonFlyBSD)
- ///
- enum int FP_ILOGBNAN = int.max;
- }
-+version ( NetBSD )
-+{
-+ ///
-+ enum int FP_ILOGB0 = -int.max;
-+ ///
-+ enum int FP_ILOGBNAN = int.max;
-+}
- else version (CRuntime_Bionic)
- {
- ///
-@@ -1521,7 +1528,7 @@ else version( FreeBSD )
- }
- else
- {
-- ///
-+ ///
- real acosl(real x);
- ///
- real asinl(real x);
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_stdio.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_stdio.d
deleted file mode 100644
index a38cbaec64..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_stdio.d
+++ /dev/null
@@ -1,53 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/stdc/stdio.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/stdc/stdio.d
-@@ -29,6 +29,10 @@ private
- {
- import core.sys.posix.sys.types;
- }
-+ version (NetBSD)
-+ {
-+ import core.sys.posix.sys.types;
-+ }
- }
-
- extern (C):
-@@ -209,6 +213,37 @@ else version ( DragonFlyBSD )
- long _mbstateL;
- }
- }
-+else version ( NetBSD )
-+{
-+ enum
-+ {
-+ ///
-+ BUFSIZ = 1024,
-+ ///
-+ EOF = -1,
-+ ///
-+ FOPEN_MAX = 20,
-+ ///
-+ FILENAME_MAX = 1024,
-+ ///
-+ TMP_MAX = 308915776,
-+ ///
-+ L_tmpnam = 1024
-+ }
-+
-+ struct __sbuf
-+ {
-+ ubyte *_base;
-+ int _size;
-+ }
-+
-+ union __mbstate_t // <sys/_types.h>
-+ {
-+ char[128] _mbstate8;
-+ long _mbstateL;
-+ }
-+}
-+
- else version (Solaris)
- {
- enum
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_stdlib.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
deleted file mode 100644
index 0e3d92a2a5..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/stdc/stdlib.d.orig 2020-05-07 08:52:13.934687779 +0000
-+++ runtime/druntime/src/core/stdc/stdlib.d
-@@ -67,6 +67,7 @@ else version(CRuntime_Glibc) enum RAND_
- else version(OSX) enum RAND_MAX = 0x7fffffff;
- else version(FreeBSD) enum RAND_MAX = 0x7fffffff;
- else version(DragonFlyBSD) enum RAND_MAX = 0x7fffffff;
-+else version(NetBSD) enum RAND_MAX = 0x7fffffff;
- else version(Solaris) enum RAND_MAX = 0x7fff;
- else version(CRuntime_Bionic) enum RAND_MAX = 0x7fffffff;
- else static assert( false, "Unsupported platform" );
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_string.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_string.d
deleted file mode 100644
index d0ccf84536..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_string.d
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/stdc/string.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/stdc/string.d
-@@ -80,6 +80,10 @@ else version (FreeBSD)
- {
- int strerror_r(int errnum, char* buf, size_t buflen);
- }
-+else version (NetBSD)
-+{
-+ int strerror_r(int errnum, char* buf, size_t buflen);
-+}
- else version (Solaris)
- {
- int strerror_r(int errnum, char* buf, size_t buflen);
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_tgmath.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
deleted file mode 100644
index 9c1aff8b77..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
+++ /dev/null
@@ -1,561 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/stdc/tgmath.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/stdc/tgmath.d
-@@ -571,6 +571,554 @@ version( FreeBSD )
- // alias core.stdc.complex.crealf creal;
- // alias core.stdc.complex.creall creal;
- }
-+version( NetBSD )
-+{
-+ ///
-+ alias core.stdc.math.acos acos;
-+ ///
-+ alias core.stdc.math.acosf acos;
-+ ///
-+ alias core.stdc.math.acosl acos;
-+
-+ ///
-+ alias core.stdc.complex.cacos acos;
-+ ///
-+ alias core.stdc.complex.cacosf acos;
-+ ///
-+ alias core.stdc.complex.cacosl acos;
-+
-+ ///
-+ alias core.stdc.math.asin asin;
-+ ///
-+ alias core.stdc.math.asinf asin;
-+ ///
-+ alias core.stdc.math.asinl asin;
-+
-+ ///
-+ alias core.stdc.complex.casin asin;
-+ ///
-+ alias core.stdc.complex.casinf asin;
-+ ///
-+ alias core.stdc.complex.casinl asin;
-+
-+ ///
-+ alias core.stdc.math.atan atan;
-+ ///
-+ alias core.stdc.math.atanf atan;
-+ ///
-+ alias core.stdc.math.atanl atan;
-+
-+ ///
-+ alias core.stdc.complex.catan atan;
-+ ///
-+ alias core.stdc.complex.catanf atan;
-+ ///
-+ alias core.stdc.complex.catanl atan;
-+
-+ ///
-+ alias core.stdc.math.atan2 atan2;
-+ ///
-+ alias core.stdc.math.atan2f atan2;
-+ ///
-+ alias core.stdc.math.atan2l atan2;
-+
-+ ///
-+ alias core.stdc.math.cos cos;
-+ ///
-+ alias core.stdc.math.cosf cos;
-+ ///
-+ alias core.stdc.math.cosl cos;
-+
-+ ///
-+ alias core.stdc.complex.ccos cos;
-+ ///
-+ alias core.stdc.complex.ccosf cos;
-+ ///
-+ alias core.stdc.complex.ccosl cos;
-+
-+ ///
-+ alias core.stdc.math.sin sin;
-+ ///
-+ alias core.stdc.math.sinf sin;
-+ ///
-+ alias core.stdc.math.sinl sin;
-+
-+ ///
-+ alias core.stdc.complex.csin csin;
-+ ///
-+ alias core.stdc.complex.csinf csin;
-+ ///
-+ alias core.stdc.complex.csinl csin;
-+
-+ ///
-+ alias core.stdc.math.tan tan;
-+ ///
-+ alias core.stdc.math.tanf tan;
-+ ///
-+ alias core.stdc.math.tanl tan;
-+
-+ ///
-+ alias core.stdc.complex.ctan tan;
-+ ///
-+ alias core.stdc.complex.ctanf tan;
-+ ///
-+ alias core.stdc.complex.ctanl tan;
-+
-+ ///
-+ alias core.stdc.math.acosh acosh;
-+ ///
-+ alias core.stdc.math.acoshf acosh;
-+ ///
-+ alias core.stdc.math.acoshl acosh;
-+
-+ ///
-+ alias core.stdc.complex.cacosh acosh;
-+ ///
-+ alias core.stdc.complex.cacoshf acosh;
-+ ///
-+ alias core.stdc.complex.cacoshl acosh;
-+
-+ ///
-+ alias core.stdc.math.asinh asinh;
-+ ///
-+ alias core.stdc.math.asinhf asinh;
-+ ///
-+ alias core.stdc.math.asinhl asinh;
-+
-+ ///
-+ alias core.stdc.complex.casinh asinh;
-+ ///
-+ alias core.stdc.complex.casinhf asinh;
-+ ///
-+ alias core.stdc.complex.casinhl asinh;
-+
-+ ///
-+ alias core.stdc.math.atanh atanh;
-+ ///
-+ alias core.stdc.math.atanhf atanh;
-+ ///
-+ alias core.stdc.math.atanhl atanh;
-+
-+ ///
-+ alias core.stdc.complex.catanh atanh;
-+ ///
-+ alias core.stdc.complex.catanhf atanh;
-+ ///
-+ alias core.stdc.complex.catanhl atanh;
-+
-+ ///
-+ alias core.stdc.math.cosh cosh;
-+ ///
-+ alias core.stdc.math.coshf cosh;
-+ ///
-+ alias core.stdc.math.coshl cosh;
-+
-+ ///
-+ alias core.stdc.complex.ccosh cosh;
-+ ///
-+ alias core.stdc.complex.ccoshf cosh;
-+ ///
-+ alias core.stdc.complex.ccoshl cosh;
-+
-+ ///
-+ alias core.stdc.math.sinh sinh;
-+ ///
-+ alias core.stdc.math.sinhf sinh;
-+ ///
-+ alias core.stdc.math.sinhl sinh;
-+
-+ ///
-+ alias core.stdc.complex.csinh sinh;
-+ ///
-+ alias core.stdc.complex.csinhf sinh;
-+ ///
-+ alias core.stdc.complex.csinhl sinh;
-+
-+ ///
-+ alias core.stdc.math.tanh tanh;
-+ ///
-+ alias core.stdc.math.tanhf tanh;
-+ ///
-+ alias core.stdc.math.tanhl tanh;
-+
-+ ///
-+ alias core.stdc.complex.ctanh tanh;
-+ ///
-+ alias core.stdc.complex.ctanhf tanh;
-+ ///
-+ alias core.stdc.complex.ctanhl tanh;
-+
-+ ///
-+ alias core.stdc.math.exp exp;
-+ ///
-+ alias core.stdc.math.expf exp;
-+ ///
-+ alias core.stdc.math.expl exp;
-+
-+ ///
-+ alias core.stdc.complex.cexp exp;
-+ ///
-+ alias core.stdc.complex.cexpf exp;
-+ ///
-+ alias core.stdc.complex.cexpl exp;
-+
-+ ///
-+ alias core.stdc.math.exp2 exp2;
-+ ///
-+ alias core.stdc.math.exp2f exp2;
-+ ///
-+ alias core.stdc.math.exp2l exp2;
-+
-+ ///
-+ alias core.stdc.math.expm1 expm1;
-+ ///
-+ alias core.stdc.math.expm1f expm1;
-+ ///
-+ alias core.stdc.math.expm1l expm1;
-+
-+ ///
-+ alias core.stdc.math.frexp frexp;
-+ ///
-+ alias core.stdc.math.frexpf frexp;
-+ ///
-+ alias core.stdc.math.frexpl frexp;
-+
-+ ///
-+ alias core.stdc.math.ilogb ilogb;
-+ ///
-+ alias core.stdc.math.ilogbf ilogb;
-+ ///
-+ alias core.stdc.math.ilogbl ilogb;
-+
-+ ///
-+ alias core.stdc.math.ldexp ldexp;
-+ ///
-+ alias core.stdc.math.ldexpf ldexp;
-+ ///
-+ alias core.stdc.math.ldexpl ldexp;
-+
-+ ///
-+ alias core.stdc.math.log log;
-+ ///
-+ alias core.stdc.math.logf log;
-+ ///
-+ alias core.stdc.math.logl log;
-+
-+ ///
-+ alias core.stdc.complex.clog log;
-+ ///
-+ alias core.stdc.complex.clogf log;
-+ ///
-+ alias core.stdc.complex.clogl log;
-+
-+ ///
-+ alias core.stdc.math.log10 log10;
-+ ///
-+ alias core.stdc.math.log10f log10;
-+ ///
-+ alias core.stdc.math.log10l log10;
-+
-+ ///
-+ alias core.stdc.math.log1p log1p;
-+ ///
-+ alias core.stdc.math.log1pf log1p;
-+ ///
-+ alias core.stdc.math.log1pl log1p;
-+
-+ ///
-+ alias core.stdc.math.log2 log2;
-+ ///
-+ alias core.stdc.math.log2f log2;
-+ ///
-+ alias core.stdc.math.log2l log2;
-+
-+ ///
-+ alias core.stdc.math.logb logb;
-+ ///
-+ alias core.stdc.math.logbf logb;
-+ ///
-+ alias core.stdc.math.logbl logb;
-+
-+ ///
-+ alias core.stdc.math.modf modf;
-+ ///
-+ alias core.stdc.math.modff modf;
-+// alias core.stdc.math.modfl modf;
-+
-+ ///
-+ alias core.stdc.math.scalbn scalbn;
-+ ///
-+ alias core.stdc.math.scalbnf scalbn;
-+ ///
-+ alias core.stdc.math.scalbnl scalbn;
-+
-+ ///
-+ alias core.stdc.math.scalbln scalbln;
-+ ///
-+ alias core.stdc.math.scalblnf scalbln;
-+ ///
-+ alias core.stdc.math.scalblnl scalbln;
-+
-+ ///
-+ alias core.stdc.math.cbrt cbrt;
-+ ///
-+ alias core.stdc.math.cbrtf cbrt;
-+ ///
-+ alias core.stdc.math.cbrtl cbrt;
-+
-+ ///
-+ alias core.stdc.math.fabs fabs;
-+ ///
-+ alias core.stdc.math.fabsf fabs;
-+ ///
-+ alias core.stdc.math.fabsl fabs;
-+
-+ ///
-+ alias core.stdc.complex.cabs fabs;
-+ ///
-+ alias core.stdc.complex.cabsf fabs;
-+ ///
-+ alias core.stdc.complex.cabsl fabs;
-+
-+ ///
-+ alias core.stdc.math.hypot hypot;
-+ ///
-+ alias core.stdc.math.hypotf hypot;
-+ ///
-+ alias core.stdc.math.hypotl hypot;
-+
-+ ///
-+ alias core.stdc.math.pow pow;
-+ ///
-+ alias core.stdc.math.powf pow;
-+ ///
-+ alias core.stdc.math.powl pow;
-+
-+ ///
-+ alias core.stdc.complex.cpow pow;
-+ ///
-+ alias core.stdc.complex.cpowf pow;
-+ ///
-+ alias core.stdc.complex.cpowl pow;
-+
-+ ///
-+ alias core.stdc.math.sqrt sqrt;
-+ ///
-+ alias core.stdc.math.sqrtf sqrt;
-+ ///
-+ alias core.stdc.math.sqrtl sqrt;
-+
-+ ///
-+ alias core.stdc.complex.csqrt sqrt;
-+ ///
-+ alias core.stdc.complex.csqrtf sqrt;
-+ ///
-+ alias core.stdc.complex.csqrtl sqrt;
-+
-+ ///
-+ alias core.stdc.math.erf erf;
-+ ///
-+ alias core.stdc.math.erff erf;
-+ ///
-+ alias core.stdc.math.erfl erf;
-+
-+ ///
-+ alias core.stdc.math.erfc erfc;
-+ ///
-+ alias core.stdc.math.erfcf erfc;
-+ ///
-+ alias core.stdc.math.erfcl erfc;
-+
-+ ///
-+ alias core.stdc.math.lgamma lgamma;
-+ ///
-+ alias core.stdc.math.lgammaf lgamma;
-+ ///
-+ alias core.stdc.math.lgammal lgamma;
-+
-+ ///
-+ alias core.stdc.math.tgamma tgamma;
-+ ///
-+ alias core.stdc.math.tgammaf tgamma;
-+ ///
-+ alias core.stdc.math.tgammal tgamma;
-+
-+ ///
-+ alias core.stdc.math.ceil ceil;
-+ ///
-+ alias core.stdc.math.ceilf ceil;
-+ ///
-+ alias core.stdc.math.ceill ceil;
-+
-+ ///
-+ alias core.stdc.math.floor floor;
-+ ///
-+ alias core.stdc.math.floorf floor;
-+ ///
-+ alias core.stdc.math.floorl floor;
-+
-+ ///
-+ alias core.stdc.math.nearbyint nearbyint;
-+ ///
-+ alias core.stdc.math.nearbyintf nearbyint;
-+ ///
-+ alias core.stdc.math.nearbyintl nearbyint;
-+
-+ ///
-+ alias core.stdc.math.rint rint;
-+ ///
-+ alias core.stdc.math.rintf rint;
-+ ///
-+ alias core.stdc.math.rintl rint;
-+
-+ ///
-+ alias core.stdc.math.lrint lrint;
-+ ///
-+ alias core.stdc.math.lrintf lrint;
-+ ///
-+ alias core.stdc.math.lrintl lrint;
-+
-+ ///
-+ alias core.stdc.math.llrint llrint;
-+ ///
-+ alias core.stdc.math.llrintf llrint;
-+ ///
-+ alias core.stdc.math.llrintl llrint;
-+
-+ ///
-+ alias core.stdc.math.round round;
-+ ///
-+ alias core.stdc.math.roundf round;
-+ ///
-+ alias core.stdc.math.roundl round;
-+
-+ ///
-+ alias core.stdc.math.lround lround;
-+ ///
-+ alias core.stdc.math.lroundf lround;
-+ ///
-+ alias core.stdc.math.lroundl lround;
-+
-+ ///
-+ alias core.stdc.math.llround llroundl;
-+ ///
-+ alias core.stdc.math.llroundf llroundl;
-+ ///
-+ alias core.stdc.math.llroundl llroundl;
-+
-+ ///
-+ alias core.stdc.math.trunc trunc;
-+ ///
-+ alias core.stdc.math.truncf trunc;
-+ ///
-+ alias core.stdc.math.truncl trunc;
-+
-+ ///
-+ alias core.stdc.math.fmod fmod;
-+ ///
-+ alias core.stdc.math.fmodf fmod;
-+ ///
-+ alias core.stdc.math.fmodl fmod;
-+
-+ ///
-+ alias core.stdc.math.remainder remainder;
-+ ///
-+ alias core.stdc.math.remainderf remainder;
-+ ///
-+ alias core.stdc.math.remainderl remainder;
-+
-+ ///
-+ alias core.stdc.math.remquo remquo;
-+ ///
-+ alias core.stdc.math.remquof remquo;
-+ ///
-+ alias core.stdc.math.remquol remquo;
-+
-+ ///
-+ alias core.stdc.math.copysign copysign;
-+ ///
-+ alias core.stdc.math.copysignf copysign;
-+ ///
-+ alias core.stdc.math.copysignl copysign;
-+
-+// alias core.stdc.math.nan nan;
-+// alias core.stdc.math.nanf nan;
-+// alias core.stdc.math.nanl nan;
-+
-+ ///
-+ alias core.stdc.math.nextafter nextafter;
-+ ///
-+ alias core.stdc.math.nextafterf nextafter;
-+ ///
-+ alias core.stdc.math.nextafterl nextafter;
-+
-+ ///
-+ alias core.stdc.math.nexttoward nexttoward;
-+ ///
-+ alias core.stdc.math.nexttowardf nexttoward;
-+ ///
-+ alias core.stdc.math.nexttowardl nexttoward;
-+
-+ ///
-+ alias core.stdc.math.fdim fdim;
-+ ///
-+ alias core.stdc.math.fdimf fdim;
-+ ///
-+ alias core.stdc.math.fdiml fdim;
-+
-+ ///
-+ alias core.stdc.math.fmax fmax;
-+ ///
-+ alias core.stdc.math.fmaxf fmax;
-+ ///
-+ alias core.stdc.math.fmaxl fmax;
-+
-+ ///
-+ alias core.stdc.math.fmin fmin;
-+ ///
-+ alias core.stdc.math.fmin fmin;
-+ ///
-+ alias core.stdc.math.fminl fmin;
-+
-+ ///
-+ alias core.stdc.math.fma fma;
-+ ///
-+ alias core.stdc.math.fmaf fma;
-+ ///
-+ alias core.stdc.math.fmal fma;
-+
-+ ///
-+ alias core.stdc.complex.carg carg;
-+ ///
-+ alias core.stdc.complex.cargf carg;
-+ ///
-+ alias core.stdc.complex.cargl carg;
-+
-+ ///
-+ alias core.stdc.complex.cimag cimag;
-+ ///
-+ alias core.stdc.complex.cimagf cimag;
-+ ///
-+ alias core.stdc.complex.cimagl cimag;
-+
-+ ///
-+ alias core.stdc.complex.conj conj;
-+ ///
-+ alias core.stdc.complex.conjf conj;
-+ ///
-+ alias core.stdc.complex.conjl conj;
-+
-+ ///
-+ alias core.stdc.complex.cproj cproj;
-+ ///
-+ alias core.stdc.complex.cprojf cproj;
-+ ///
-+ alias core.stdc.complex.cprojl cproj;
-+
-+// alias core.stdc.complex.creal creal;
-+// alias core.stdc.complex.crealf creal;
-+// alias core.stdc.complex.creall creal;
-+}
- else
- {
- ///
diff --git a/ldc/patches/patch-runtime_druntime_src_core_stdc_time.d b/ldc/patches/patch-runtime_druntime_src_core_stdc_time.d
deleted file mode 100644
index a8b30accf6..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_stdc_time.d
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/stdc/time.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/stdc/time.d
-@@ -86,6 +86,10 @@ else version( DragonFlyBSD )
- {
- enum clock_t CLOCKS_PER_SEC = 128;
- }
-+else version( NetBSD )
-+{
-+ enum clock_t CLOCKS_PER_SEC = 100;
-+}
- else version (CRuntime_Glibc)
- {
- enum clock_t CLOCKS_PER_SEC = 1_000_000;
-@@ -153,6 +157,13 @@ else version( DragonFlyBSD )
- {
- ///
- void tzset(); // non-standard
-+ ///
-+ extern __gshared const(char)*[2] tzname; // non-standard
-+}
-+else version( NetBSD )
-+{
-+ ///
-+ void tzset(); // non-standard
- ///
- extern __gshared const(char)*[2] tzname; // non-standard
- }
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
deleted file mode 100644
index 15844c4c96..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
+++ /dev/null
@@ -1,50 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/arpa/inet.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/arpa/inet.d
-@@ -173,6 +173,32 @@ else version( Solaris )
- const(char)* inet_ntop(int, in void*, char*, socklen_t);
- int inet_pton(int, in char*, void*);
- }
-+else version( NetBSD )
-+{
-+ alias uint16_t in_port_t;
-+ alias uint32_t in_addr_t;
-+
-+ struct in_addr
-+ {
-+ in_addr_t s_addr;
-+ }
-+
-+ enum INET_ADDRSTRLEN = 16;
-+
-+ @trusted pure
-+ {
-+ uint32_t htonl(uint32_t);
-+ uint16_t htons(uint16_t);
-+ uint32_t ntohl(uint32_t);
-+ uint16_t ntohs(uint16_t);
-+ }
-+
-+ in_addr_t inet_addr(in char*);
-+ char* inet_ntoa(in_addr);
-+ const(char)* inet_ntop(int, in void*, char*, socklen_t);
-+ int inet_pton(int, in char*, void*);
-+}
-+
- else version( Solaris )
- {
- alias uint16_t in_port_t;
-@@ -264,6 +290,10 @@ else version( DragonFlyBSD )
- {
- enum INET6_ADDRSTRLEN = 46;
- }
-+else version ( NetBSD )
-+{
-+ enum INET6_ADDRSTRLEN = 46;
-+}
- else version( Solaris )
- {
- enum INET6_ADDRSTRLEN = 46;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
deleted file mode 100644
index 882acd4441..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
+++ /dev/null
@@ -1,90 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/dirent.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/dirent.d
-@@ -172,6 +172,36 @@ else version( DragonFlyBSD )
-
- dirent* readdir(DIR*);
- }
-+else version( NetBSD )
-+{
-+ enum
-+ {
-+ DT_UNKNOWN = 0,
-+ DT_FIFO = 1,
-+ DT_CHR = 2,
-+ DT_DIR = 4,
-+ DT_BLK = 6,
-+ DT_REG = 8,
-+ DT_LNK = 10,
-+ DT_SOCK = 12,
-+ DT_WHT = 14
-+ }
-+
-+
-+ struct dirent
-+ {
-+ ulong d_fileno;
-+ ushort d_reclen;
-+ ushort d_namlen;
-+ ubyte d_type;
-+ char[512] d_name;
-+ }
-+
-+ alias void* DIR;
-+
-+ dirent* __readdir30(DIR*);
-+ alias __readdir30 readdir;
-+}
- else version (Solaris)
- {
- struct dirent
-@@ -243,11 +273,20 @@ else
- static assert(false, "Unsupported platform");
- }
-
-+version( NetBSD )
-+{
-+ DIR* __opendir30(in char*);
-+ alias __opendir30 opendir;
-+}
-+else
-+{
-+ DIR* opendir(in char*);
-+}
- int closedir(DIR*);
--DIR* opendir(in char*);
- //dirent* readdir(DIR*);
- void rewinddir(DIR*);
-
-+
- //
- // Thread-Safe Functions (TSF)
- //
-@@ -279,6 +318,12 @@ else version( DragonFlyBSD )
- {
- int readdir_r(DIR*, dirent*, dirent**);
- }
-+else version( NetBSD )
-+{
-+ int __readdir_r30(DIR*, dirent*, dirent**);
-+ alias __readdir_r30 readdir_r;
-+}
-+
- else version (Solaris)
- {
- static if (__USE_LARGEFILE64)
-@@ -322,6 +367,11 @@ else version( DragonFlyBSD )
- {
- void seekdir(DIR*, c_long);
- c_long telldir(DIR*);
-+}
-+else version( NetBSD )
-+{
-+ void seekdir(DIR*, c_long);
-+ c_long telldir(DIR*);
- }
- else version (OSX)
- {
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
deleted file mode 100644
index 381d458abb..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
+++ /dev/null
@@ -1,36 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/dlfcn.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/dlfcn.d
-@@ -165,6 +165,29 @@ else version( FreeBSD )
- void* dli_saddr;
- }
- }
-+else version( NetBSD )
-+{
-+ enum RTLD_LAZY = 1;
-+ enum RTLD_NOW = 2;
-+ enum RTLD_GLOBAL = 0x100;
-+ enum RTLD_LOCAL = 0x200;
-+ enum RTLD_NODELETE = 0x01000; /* Do not remove members. */
-+ enum RTLD_NOLOAD = 0x02000;
-+
-+ int dlclose(void*);
-+ char* dlerror();
-+ void* dlopen(in char*, int);
-+ void* dlsym(void*, in char*);
-+ int dladdr(const(void)* addr, Dl_info* info);
-+
-+ struct Dl_info
-+ {
-+ const(char)* dli_fname;
-+ void* dli_fbase;
-+ const(char)* dli_sname;
-+ void* dli_saddr;
-+ }
-+}
- else version( Solaris )
- {
- enum RTLD_LAZY = 1;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
deleted file mode 100644
index 898f985f49..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
+++ /dev/null
@@ -1,66 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/fcntl.d.orig 2020-05-07 08:52:15.234684078 +0000
-+++ runtime/druntime/src/core/sys/posix/fcntl.d
-@@ -462,6 +462,59 @@ else version( DragonFlyBSD )
- //int fcntl(int, int, ...); /*defined below*/
- //int flock(int, int);
- }
-+else version( NetBSD )
-+{
-+ enum F_DUPFD = 0;
-+ enum F_GETFD = 1;
-+ enum F_SETFD = 2;
-+ enum F_GETFL = 3;
-+ enum F_SETFL = 4;
-+ enum F_GETOWN = 5;
-+ enum F_SETOWN = 6;
-+ enum F_GETLK = 7;
-+ enum F_SETLK = 8;
-+ enum F_SETLKW = 9;
-+ enum F_CLOSEM = 10;
-+ enum F_MAXFD = 11;
-+ enum F_DUPFD_CLOEXEC= 12;
-+ enum F_GETNOSIGPIPE = 13;
-+ enum F_SETNOSIGPIPE = 14;
-+
-+ enum FD_CLOEXEC = 1;
-+
-+ enum F_RDLCK = 1;
-+ enum F_UNLCK = 2;
-+ enum F_WRLCK = 3;
-+
-+ enum O_CREAT = 0x0200;
-+ enum O_EXCL = 0x0800;
-+ enum O_NOCTTY = 0x8000;
-+ enum O_TRUNC = 0x0400;
-+
-+ enum O_RDONLY = 0x0000;
-+ enum O_WRONLY = 0x0001;
-+ enum O_RDWR = 0x0002;
-+ enum O_ACCMODE = 0x0003;
-+
-+ enum O_NONBLOCK = 0x0004;
-+ enum O_APPEND = 0x0008;
-+ enum O_SYNC = 0x0080;
-+ //enum O_DSYNC
-+ //enum O_RSYNC
-+
-+ struct flock
-+ {
-+ off_t l_start;
-+ off_t l_len;
-+ pid_t l_pid;
-+ short l_type;
-+ short l_whence;
-+ }
-+
-+
-+ int creat(in char*, mode_t);
-+ int open(in char*, int, ...);
-+}
- else version (Solaris)
- {
- enum F_DUPFD = 0;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_grp.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
deleted file mode 100644
index fcac08bc63..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
+++ /dev/null
@@ -1,48 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/grp.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/grp.d
-@@ -78,6 +78,16 @@ else version( DragonFlyBSD )
- char** gr_mem;
- }
- }
-+else version( NetBSD )
-+{
-+ struct group
-+ {
-+ char* gr_name;
-+ char* gr_passwd;
-+ gid_t gr_gid;
-+ char** gr_mem;
-+ }
-+}
- else version( Solaris )
- {
- struct group
-@@ -134,6 +144,11 @@ else version( DragonFlyBSD )
- int getgrnam_r(in char*, group*, char*, size_t, group**);
- int getgrgid_r(gid_t, group*, char*, size_t, group**);
- }
-+else version( NetBSD )
-+{
-+ int getgrnam_r(in char*, group*, char*, size_t, group**);
-+ int getgrgid_r(gid_t, group*, char*, size_t, group**);
-+}
- else version( Solaris )
- {
- int getgrnam_r(in char*, group*, char*, int, group**);
-@@ -178,6 +193,12 @@ else version( DragonFlyBSD )
- {
- group* getgrent();
- @trusted void endgrent();
-+ @trusted void setgrent();
-+}
-+else version( NetBSD )
-+{
-+ group* getgrent();
-+ @trusted void endgrent();
- @trusted void setgrent();
- }
- else version( Solaris )
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
deleted file mode 100644
index b2e51a2eab..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
+++ /dev/null
@@ -1,28 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/net/if_.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/net/if_.d
-@@ -82,6 +82,21 @@ else version( FreeBSD )
- if_nameindex_t* if_nameindex();
- void if_freenameindex(if_nameindex_t*);
- }
-+else version( NetBSD )
-+{
-+ struct if_nameindex_t
-+ {
-+ uint if_index;
-+ char* if_name;
-+ }
-+
-+ enum IF_NAMESIZE = 16;
-+
-+ uint if_nametoindex(in char*);
-+ char* if_indextoname(uint, char*);
-+ if_nameindex_t* if_nameindex();
-+ void if_freenameindex(if_nameindex_t*);
-+}
- else version( CRuntime_Bionic )
- {
- enum IF_NAMESIZE = 16;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
deleted file mode 100644
index 01ef523408..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
+++ /dev/null
@@ -1,119 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/netdb.d.orig 2020-05-07 08:52:15.364683708 +0000
-+++ runtime/druntime/src/core/sys/posix/netdb.d
-@@ -488,6 +488,112 @@ else version( DragonFlyBSD )
- enum NI_NUMERICSCOPE = 0x40;
-
- }
-+else version( NetBSD )
-+{
-+ struct hostent
-+ {
-+ char* h_name;
-+ char** h_aliases;
-+ int h_addrtype;
-+ int h_length;
-+ char** h_addr_list;
-+ extern (D) char* h_addr() @property { return h_addr_list[0]; } // non-standard
-+ }
-+
-+ struct netent
-+ {
-+ char* n_name;
-+ char** n_aliases;
-+ int n_addrtype;
-+ uint32_t n_net;
-+/+ todo
-+#if (defined(__sparc__) && defined(_LP64)) || \
-+ (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
-+ int __n_pad0; /* ABI compatibility */
-+#endif
-+ uint32_t n_net; /*%< network # */
-+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
-+ (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
-+ int __n_pad0; /* ABI compatibility */
-+#endif
-++/
-+ }
-+
-+ struct protoent
-+ {
-+ char* p_name;
-+ char** p_aliases;
-+ int p_proto;
-+ }
-+
-+ struct servent
-+ {
-+ char* s_name;
-+ char** s_aliases;
-+ int s_port;
-+ char* s_proto;
-+ }
-+
-+ enum IPPORT_RESERVED = 1024;
-+
-+ //h_errno
-+
-+ enum HOST_NOT_FOUND = 1;
-+ enum NO_DATA = 4;
-+ enum NO_RECOVERY = 3;
-+ enum TRY_AGAIN = 2;
-+
-+ struct addrinfo
-+ {
-+ int ai_flags;
-+ int ai_family;
-+ int ai_socktype;
-+ int ai_protocol;
-+/+todo
-+#if defined(__sparc__) && defined(_LP64)
-+ int __ai_pad0; /* ABI compatibility */
-+#endif
-++/
-+ socklen_t ai_addrlen;
-+/+todo
-+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
-+ int __ai_pad0; /* ABI compatibility */
-+#endif
-++/
-+ char* ai_canonname;
-+ sockaddr* ai_addr;
-+ addrinfo* ai_next;
-+ }
-+
-+ enum AI_PASSIVE = 0x1;
-+ enum AI_CANONNAME = 0x2;
-+ enum AI_NUMERICHOST = 0x4;
-+ enum AI_NUMERICSERV = 0x8;
-+ enum AI_V4MAPPED = 0x800;
-+ enum AI_ALL = 0x100;
-+ enum AI_ADDRCONFIG = 0x400;
-+
-+ enum NI_NOFQDN = 0x1;
-+ enum NI_NUMERICHOST = 0x2;
-+ enum NI_NAMEREQD = 0x4;
-+ enum NI_NUMERICSERV = 0x8;
-+ enum NI_DGRAM = 0x10;
-+ enum NI_WITHSCOPEID = 0x00000020;
-+ enum NI_NUMERICSCOPE = 0x00000040;
-+ enum NI_MAXHOST = 1025; // non-standard
-+ enum NI_MAXSERV = 32; // non-standard
-+
-+ enum EAI_AGAIN = 2;
-+ enum EAI_BADFLAGS = 3;
-+ enum EAI_FAIL = 4;
-+ enum EAI_FAMILY = 5;
-+ enum EAI_MEMORY = 6;
-+ enum EAI_NONAME = 8;
-+ enum EAI_SERVICE = 9;
-+ enum EAI_SOCKTYPE = 10;
-+ enum EAI_SYSTEM = 11;
-+ enum EAI_OVERFLOW = 14;
-+}
- else version (Solaris)
- {
- struct hostent
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
deleted file mode 100644
index 7df6287e43..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
+++ /dev/null
@@ -1,206 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/netinet/in_.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/netinet/in_.d
-@@ -245,6 +245,42 @@ else version( DragonFlyBSD )
-
- //enum INET_ADDRSTRLEN = 16;
- }
-+else version( NetBSD )
-+{
-+
-+ struct sockaddr_in
-+ {
-+ ubyte sin_len;
-+ sa_family_t sin_family;
-+ in_port_t sin_port;
-+ in_addr sin_addr;
-+ ubyte[8] sin_zero;
-+ }
-+
-+ enum
-+ {
-+ IPPROTO_IP = 0,
-+ IPPROTO_ICMP = 1,
-+ IPPROTO_IGMP = 2,
-+ IPPROTO_GGP = 3,
-+ IPPROTO_TCP = 6,
-+ IPPROTO_PUP = 12,
-+ IPPROTO_UDP = 17,
-+ IPPROTO_IDP = 22,
-+ IPPROTO_ND = 77,
-+ IPPROTO_MAX = 256
-+ }
-+
-+ enum : uint
-+ {
-+ INADDR_ANY = 0x00000000,
-+ INADDR_BROADCAST = 0xffffffff,
-+ INADDR_LOOPBACK = 0x7f000001,
-+ INADDR_NONE = 0xffffffff
-+ }
-+
-+ //enum INET_ADDRSTRLEN = 16;
-+}
- else version( Solaris )
- {
- struct sockaddr_in
-@@ -895,6 +931,145 @@ else version( DragonFlyBSD )
- __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL;
- }
- }
-+else version( NetBSD )
-+{
-+ struct in6_addr
-+ {
-+ union
-+ {
-+ uint8_t[16] s6_addr;
-+ uint16_t[8] s6_addr16;
-+ uint32_t[4] s6_addr32;
-+ }
-+ }
-+
-+ struct sockaddr_in6
-+ {
-+ uint8_t sin6_len;
-+ sa_family_t sin6_family;
-+ in_port_t sin6_port;
-+ uint32_t sin6_flowinfo;
-+ in6_addr sin6_addr;
-+ uint32_t sin6_scope_id;
-+ }
-+
-+ extern __gshared immutable in6_addr in6addr_any;
-+ extern __gshared immutable in6_addr in6addr_loopback;
-+
-+ struct ipv6_mreq
-+ {
-+ in6_addr ipv6mr_multiaddr;
-+ uint ipv6mr_interface;
-+ }
-+
-+ enum : uint
-+ {
-+ IPPROTO_IPV6 = 41,
-+
-+ //INET6_ADDRSTRLEN = 46,
-+
-+ IPV6_JOIN_GROUP = 12,
-+ IPV6_LEAVE_GROUP = 13,
-+ IPV6_MULTICAST_HOPS = 10,
-+ IPV6_MULTICAST_IF = 9,
-+ IPV6_MULTICAST_LOOP = 11,
-+ IPV6_UNICAST_HOPS = 4,
-+ IPV6_V6ONLY = 27,
-+ }
-+
-+ private enum
-+ {
-+ __IPV6_ADDR_SCOPE_NODELOCAL = 0x01,
-+ __IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01,
-+ __IPV6_ADDR_SCOPE_LINKLOCAL = 0x02,
-+ __IPV6_ADDR_SCOPE_SITELOCAL = 0x05,
-+ __IPV6_ADDR_SCOPE_ORGLOCAL = 0x08,
-+ __IPV6_ADDR_SCOPE_GLOBAL = 0x0e,
-+ }
-+
-+ // macros
-+ extern (D) int IN6_IS_ADDR_UNSPECIFIED( in in6_addr* a ) pure
-+ {
-+ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) == 0);
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_LOOPBACK( in in6_addr* a ) pure
-+ {
-+ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) == ntohl(1));
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_V4COMPAT( in in6_addr* a ) pure
-+ {
-+ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) != 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) != ntohl(1));
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_V4MAPPED( in in6_addr* a ) pure
-+ {
-+ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
-+ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == ntohl(0x0000ffff));
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_LINKLOCAL( in in6_addr* a ) pure
-+ {
-+ return a.s6_addr[0] == 0xfe && (a.s6_addr[1] & 0xc0) == 0x80;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_SITELOCAL( in in6_addr* a ) pure
-+ {
-+ return a.s6_addr[0] == 0xfe && (a.s6_addr[1] & 0xc0) == 0xc0;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MULTICAST( in in6_addr* a ) pure
-+ {
-+ return a.s6_addr[0] == 0xff;
-+ }
-+
-+ extern (D) uint8_t __IPV6_ADDR_MC_SCOPE( in in6_addr* a ) pure
-+ {
-+ return a.s6_addr[1] & 0x0f;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MC_NODELOCAL( in in6_addr* a ) pure
-+ {
-+ return IN6_IS_ADDR_MULTICAST(a) &&
-+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MC_LINKLOCAL( in in6_addr* a ) pure
-+ {
-+ return IN6_IS_ADDR_MULTICAST(a) &&
-+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MC_SITELOCAL( in in6_addr* a ) pure
-+ {
-+ return IN6_IS_ADDR_MULTICAST(a) &&
-+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MC_ORGLOCAL( in in6_addr* a ) pure
-+ {
-+ return IN6_IS_ADDR_MULTICAST(a) &&
-+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL;
-+ }
-+
-+ extern (D) int IN6_IS_ADDR_MC_GLOBAL( in in6_addr* a ) pure
-+ {
-+ return IN6_IS_ADDR_MULTICAST(a) &&
-+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL;
-+ }
-+}
- else version( Solaris )
- {
- struct in6_addr
-@@ -1175,6 +1350,10 @@ else version( DragonFlyBSD )
- {
- enum uint IPPROTO_RAW = 255;
- }
-+else version ( NetBSD )
-+{
-+ enum uint IPPROTO_RAW = 255;
-+}
- else version( Solaris )
- {
- enum uint IPPROTO_RAW = 255;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
deleted file mode 100644
index a32fe75b1c..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/netinet/tcp.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/netinet/tcp.d
-@@ -38,6 +38,10 @@ else version( FreeBSD )
- {
- enum TCP_NODELAY = 1;
- }
-+else version( NetBSD )
-+{
-+ enum TCP_NODELAY = 1;
-+}
- else version( Solaris )
- {
- enum TCP_NODELAY = 1;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_poll.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
deleted file mode 100644
index 1c262fa1b4..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
+++ /dev/null
@@ -1,46 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/poll.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/poll.d
-@@ -177,6 +177,41 @@ else version( DragonFlyBSD )
-
- int poll(pollfd*, nfds_t, int);
- }
-+else version( NetBSD )
-+{
-+ alias uint nfds_t;
-+
-+ struct pollfd
-+ {
-+ int fd;
-+ short events;
-+ short revents;
-+ };
-+
-+ enum
-+ {
-+ POLLIN = 0x0001,
-+ POLLPRI = 0x0002,
-+ POLLOUT = 0x0004,
-+ POLLRDNORM = 0x0040,
-+ POLLWRNORM = POLLOUT,
-+ POLLRDBAND = 0x0080,
-+ POLLWRBAND = 0x0100,
-+ //POLLEXTEND = 0x0200,
-+ //POLLATTRIB = 0x0400,
-+ //POLLNLINK = 0x0800,
-+ //POLLWRITE = 0x1000,
-+ POLLERR = 0x0008,
-+ POLLHUP = 0x0010,
-+ POLLNVAL = 0x0020,
-+
-+ POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
-+ POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
-+ }
-+
-+ int poll(pollfd*, nfds_t, int);
-+}
-+
- else version( Solaris )
- {
- alias c_ulong nfds_t;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
deleted file mode 100644
index 3712a991ec..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
+++ /dev/null
@@ -1,205 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/pthread.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/pthread.d
-@@ -249,6 +249,85 @@ else version( DragonFlyBSD )
- enum PTHREAD_COND_INITIALIZER = null;
- enum PTHREAD_RWLOCK_INITIALIZER = null;
- }
-+else version( NetBSD )
-+{
-+ enum PRI_NONE = -1;
-+ enum
-+ {
-+ PTHREAD_INHERIT_SCHED = 0x0,
-+
-+ PTHREAD_CREATE_DETACHED = 1,
-+ PTHREAD_CREATE_JOINABLE = 0,
-+ PTHREAD_EXPLICIT_SCHED = 1,
-+ }
-+
-+ enum
-+ {
-+ PTHREAD_PROCESS_PRIVATE = 0,
-+ PTHREAD_PROCESS_SHARED = 1,
-+ }
-+
-+ enum
-+ {
-+ PTHREAD_CANCEL_ENABLE = 0,
-+ PTHREAD_CANCEL_DISABLE = 1,
-+ PTHREAD_CANCEL_DEFERRED = 0,
-+ PTHREAD_CANCEL_ASYNCHRONOUS = 1,
-+ }
-+
-+ enum PTHREAD_CANCELED = cast(void*) 1;
-+
-+ enum PTHREAD_DONE_INIT = 1;
-+
-+ struct _PTHREAD_MUTEX_INITIALIZER{
-+ enum f1 = 0x33330003;
-+ enum f2 = 0;
-+ enum f3 = [ 0, 0, 0 ];
-+ enum f4 = 0;
-+ enum f5 = [0, 0, 0 ];
-+ enum f6 = null;
-+ enum f7 = null;
-+ enum f8 = 0;
-+ enum f9 = null;
-+ }
-+ enum PTHREAD_MUTEX_INITIALIZER = _PTHREAD_MUTEX_INITIALIZER();
-+
-+ struct _PTHREAD_ONCE_INIT{
-+ enum f1 = PTHREAD_MUTEX_INITIALIZER;
-+ enum f2 = 0;
-+ }
-+ enum PTHREAD_ONCE_INIT = _PTHREAD_ONCE_INIT();
-+ struct _PTHREAD_COND_INITIALIZER{
-+ enum f1 = 0x55550005;
-+ enum f2 = 0;
-+ struct __PTHREAD_COND_INITIALIZER_S
-+ {
-+ enum p1 = null;
-+ enum p2 = null;
-+ enum p3 = null;
-+ enum p4 = null;
-+ }
-+ enum f3 = __PTHREAD_COND_INITIALIZER_S();
-+ }
-+ enum PTHREAD_COND_INITIALIZER = _PTHREAD_COND_INITIALIZER();
-+ struct _PTHREAD_RWLOCK_INITIALIZER
-+ {
-+ enum f1 = 0x99990009;
-+ enum f2 = 0;
-+ struct __PTHREAD_RWLOCK_INITIALIZER_S
-+ {
-+ enum p1 = null;
-+ enum p2 = null;
-+ }
-+
-+ enum f3 = __PTHREAD_RWLOCK_INITIALIZER_S();
-+ enum f4 = __PTHREAD_RWLOCK_INITIALIZER_S();
-+ enum f5 = 0;
-+ enum f6 = null;
-+ enum f7 = null;
-+ }
-+ enum PTHREAD_RWLOCK_INITIALIZER = _PTHREAD_RWLOCK_INITIALIZER();
-+}
- else version (Solaris)
- {
- enum
-@@ -589,6 +668,18 @@ else version( DragonFlyBSD )
- int pthread_barrierattr_init(pthread_barrierattr_t*);
- int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
- }
-+else version( NetBSD )
-+{
-+ enum PTHREAD_BARRIER_SERIAL_THREAD = 1234567;
-+
-+ int pthread_barrier_destroy(pthread_barrier_t*);
-+ int pthread_barrier_init(pthread_barrier_t*, in pthread_barrierattr_t*, uint);
-+ int pthread_barrier_wait(pthread_barrier_t*);
-+ int pthread_barrierattr_destroy(pthread_barrierattr_t*);
-+ int pthread_barrierattr_getpshared(in pthread_barrierattr_t*, int*);
-+ int pthread_barrierattr_init(pthread_barrierattr_t*);
-+ int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
-+}
- else version (OSX)
- {
- }
-@@ -655,6 +746,14 @@ else version( DragonFlyBSD )
- int pthread_spin_trylock(pthread_spinlock_t*);
- int pthread_spin_unlock(pthread_spinlock_t*);
- }
-+else version( NetBSD )
-+{
-+ int pthread_spin_init(pthread_spinlock_t*, int);
-+ int pthread_spin_destroy(pthread_spinlock_t*);
-+ int pthread_spin_lock(pthread_spinlock_t*);
-+ int pthread_spin_trylock(pthread_spinlock_t*);
-+ int pthread_spin_unlock(pthread_spinlock_t*);
-+}
- else version (OSX)
- {
- }
-@@ -756,6 +855,24 @@ else version( DragonFlyBSD )
- int pthread_mutexattr_settype(pthread_mutexattr_t*, int) @trusted;
- int pthread_setconcurrency(int);
- }
-+else version( NetBSD )
-+{
-+ enum
-+ {
-+ PTHREAD_MUTEX_NORMAL = 0,
-+ PTHREAD_MUTEX_ERRORCHECK = 1,
-+ PTHREAD_MUTEX_RECURSIVE = 2,
-+ PTHREAD_MUTEX_TYPE_MAX
-+ }
-+ enum PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_ERRORCHECK;
-+
-+ int pthread_attr_getguardsize(in pthread_attr_t*, size_t*);
-+ int pthread_attr_setguardsize(pthread_attr_t*, size_t);
-+ int pthread_getconcurrency();
-+ int pthread_mutexattr_gettype(pthread_mutexattr_t*, int*);
-+ int pthread_mutexattr_settype(pthread_mutexattr_t*, int) @trusted;
-+ int pthread_setconcurrency(int);
-+}
- else version (Solaris)
- {
- enum
-@@ -810,6 +927,10 @@ else version( DragonFlyBSD )
- {
- int pthread_getcpuclockid(pthread_t, clockid_t*);
- }
-+else version( NetBSD )
-+{
-+
-+}
- else version (OSX)
- {
- }
-@@ -858,6 +979,12 @@ else version( DragonFlyBSD )
- int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
- int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
- }
-+else version( NetBSD )
-+{
-+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
-+ int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
-+ int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
-+}
- else version (Solaris)
- {
- int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
-@@ -1097,6 +1224,15 @@ else version( DragonFlyBSD )
- int pthread_attr_setstackaddr(pthread_attr_t*, void*);
- int pthread_attr_setstacksize(pthread_attr_t*, size_t);
- }
-+else version( NetBSD )
-+{
-+ int pthread_attr_getstack(in pthread_attr_t*, void**, size_t*);
-+ int pthread_attr_getstackaddr(in pthread_attr_t*, void**);
-+ int pthread_attr_getstacksize(in pthread_attr_t*, size_t*);
-+ int pthread_attr_setstack(pthread_attr_t*, void*, size_t);
-+ int pthread_attr_setstackaddr(pthread_attr_t*, void*);
-+ int pthread_attr_setstacksize(pthread_attr_t*, size_t);
-+}
- else version (Solaris)
- {
- int pthread_attr_getstack(in pthread_attr_t*, void**, size_t*);
-@@ -1154,6 +1290,15 @@ else version( DragonFlyBSD )
- {
- int pthread_condattr_getpshared(in pthread_condattr_t*, int*);
- int pthread_condattr_setpshared(pthread_condattr_t*, int);
-+ int pthread_mutexattr_getpshared(in pthread_mutexattr_t*, int*);
-+ int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
-+ int pthread_rwlockattr_getpshared(in pthread_rwlockattr_t*, int*);
-+ int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
-+}
-+else version( NetBSD )
-+{
-+ int pthread_condattr_getpshared(in pthread_condattr_t*, int*);
-+ int pthread_condattr_setpshared(pthread_condattr_t*, int);
- int pthread_mutexattr_getpshared(in pthread_mutexattr_t*, int*);
- int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
- int pthread_rwlockattr_getpshared(in pthread_rwlockattr_t*, int*);
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
deleted file mode 100644
index ed8890f43a..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
+++ /dev/null
@@ -1,56 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/pwd.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/pwd.d
-@@ -102,6 +102,22 @@ else version( DragonFlyBSD )
- int pw_fields; /* internal: fields filled in */
- }
- }
-+else version( NetBSD )
-+{
-+ struct passwd
-+ {
-+ char* pw_name; /* user name */
-+ char* pw_passwd; /* encrypted password */
-+ uid_t pw_uid; /* user uid */
-+ gid_t pw_gid; /* user gid */
-+ time_t pw_change; /* password change time */
-+ char* pw_class; /* user access class */
-+ char* pw_gecos; /* Honeywell login info */
-+ char* pw_dir; /* home directory */
-+ char* pw_shell; /* default shell */
-+ time_t pw_expire; /* account expiration */
-+ }
-+}
- else version (Solaris)
- {
- struct passwd
-@@ -165,6 +181,13 @@ else version( DragonFlyBSD )
- int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
- int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
- }
-+else version( NetBSD )
-+{
-+ int __getpwnam_r50(in char*, passwd*, char*, size_t, passwd**);
-+ alias __getpwnam_r50 getpwnam_r;
-+ int __getpwuid_r50(uid_t, passwd*, char*, size_t, passwd**);
-+ alias __getpwuid_r50 getpwuid_r;
-+}
- else version (Solaris)
- {
- int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
-@@ -209,6 +232,12 @@ else version ( DragonFlyBSD )
- {
- void endpwent();
- passwd* getpwent();
-+ void setpwent();
-+}
-+else version ( NetBSD )
-+{
-+ void endpwent();
-+ passwd* getpwent();
- void setpwent();
- }
- else version (Solaris)
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sched.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
deleted file mode 100644
index 8ecfb0a97a..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
+++ /dev/null
@@ -1,48 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sched.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sched.d
-@@ -97,6 +97,17 @@ else version( DragonFlyBSD )
- enum SCHED_OTHER = 2;
- enum SCHED_RR = 3;
- }
-+else version( NetBSD )
-+{
-+ struct sched_param
-+ {
-+ int sched_priority;
-+ }
-+
-+ enum SCHED_FIFO = 1;
-+ enum SCHED_OTHER = 0;
-+ enum SCHED_RR = 2;
-+}
- else version (Solaris)
- {
- struct sched_param
-@@ -159,6 +170,10 @@ else version( DragonFlyBSD )
- {
- int sched_yield();
- }
-+else version( NetBSD )
-+{
-+ int sched_yield();
-+}
- else version (Solaris)
- {
- int sched_yield();
-@@ -203,6 +218,12 @@ else version( DragonFlyBSD )
- {
- int sched_get_priority_min(int);
- int sched_get_priority_max(int);
-+ int sched_rr_get_interval(pid_t, timespec*);
-+}
-+else version( NetBSD )
-+{
-+ int sched_get_priority_min(int);
-+ int sched_get_priority_max(int);
- int sched_rr_get_interval(pid_t, timespec*);
- }
- else version (Solaris)
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
deleted file mode 100644
index 5fc858dbba..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/semaphore.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/semaphore.d
-@@ -96,6 +96,12 @@ else version( DragonFlyBSD )
-
- enum SEM_FAILED = cast(sem_t*) null;
- }
-+else version( NetBSD )
-+{
-+ alias size_t sem_t;
-+
-+ enum SEM_FAILED = cast(sem_t*) null;
-+}
- else version (Solaris)
- {
- struct sem_t
-@@ -156,6 +162,10 @@ else version( DragonFlyBSD )
- {
- int sem_timedwait(sem_t*, in timespec*);
- }
-+else version ( NetBSD )
-+{
-+ int sem_timedwait(sem_t*, in timespec*);
-+}
- else version (Solaris)
- {
- int sem_timedwait(sem_t*, in timespec*);
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
deleted file mode 100644
index e55743a5b1..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
+++ /dev/null
@@ -1,56 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/setjmp.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/setjmp.d
-@@ -185,6 +185,26 @@ else version( DragonFlyBSD )
- int setjmp(ref jmp_buf);
- void longjmp(ref jmp_buf, int);
- }
-+else version( NetBSD )
-+{
-+ // <machine/setjmp.h>
-+ version( X86 )
-+ {
-+ enum _JBLEN = 13;
-+ struct _jmp_buf { int[_JBLEN + 1] _jb; }
-+ }
-+ else version( X86_64)
-+ {
-+ enum _JBLEN = 11;
-+ struct _jmp_buf { c_long[_JBLEN] _jb; }
-+ }
-+ else
-+ static assert(0);
-+ alias _jmp_buf[_JBLEN] jmp_buf;
-+
-+ int setjmp(ref jmp_buf);
-+ void longjmp(ref jmp_buf, int);
-+}
- else version( CRuntime_Bionic )
- {
- // <machine/setjmp.h>
-@@ -270,6 +290,24 @@ else version( DragonFlyBSD )
-
- int sigsetjmp(ref sigjmp_buf);
- void siglongjmp(ref sigjmp_buf, int);
-+}
-+else version( NetBSD )
-+{
-+ // <machine/setjmp.h>
-+ version( X86 )
-+ {
-+ struct _sigjmp_buf { int[_JBLEN + 1] _ssjb; }
-+ }
-+ else version( X86_64)
-+ {
-+ struct _sigjmp_buf { c_long[_JBLEN] _sjb; }
-+ }
-+ else
-+ static assert(0);
-+ alias _sigjmp_buf[_JBLEN + 1] sigjmp_buf;
-+
-+ int sigsetjmp(ref sigjmp_buf);
-+ void siglongjmp(ref sigjmp_buf, int);
- }
- else version( CRuntime_Bionic )
- {
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_signal.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
deleted file mode 100644
index 1dff30814c..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
+++ /dev/null
@@ -1,339 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/signal.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/signal.d
-@@ -423,6 +423,31 @@ else version( DragonFlyBSD )
- enum SIGUSR2 = 31;
- enum SIGURG = 16;
- }
-+else version( NetBSD )
-+{
-+ //SIGABRT (defined in core.stdc.signal)
-+ enum SIGALRM = 14;
-+ enum SIGBUS = 10;
-+ enum SIGCHLD = 20;
-+ enum SIGCONT = 19;
-+ //SIGFPE (defined in core.stdc.signal)
-+ enum SIGHUP = 1;
-+ //SIGILL (defined in core.stdc.signal)
-+ //SIGINT (defined in core.stdc.signal)
-+ enum SIGKILL = 9;
-+ enum SIGPIPE = 13;
-+ enum SIGQUIT = 3;
-+ //SIGSEGV (defined in core.stdc.signal)
-+ enum SIGSTOP = 17;
-+ //SIGTERM (defined in core.stdc.signal)
-+ enum SIGTSTP = 18;
-+ enum SIGTTIN = 21;
-+ enum SIGTTOU = 22;
-+ enum SIGUSR1 = 30;
-+ enum SIGUSR2 = 31;
-+ enum SIGURG = 16;
-+}
-+
- else version (Solaris)
- {
- enum SIGALRM = 14;
-@@ -494,6 +519,19 @@ else version( DragonFlyBSD )
- sigset_t sa_mask;
- }
- }
-+else version( NetBSD )
-+{
-+ struct sigaction_t
-+ {
-+ union
-+ {
-+ sigfn_t sa_handler;
-+ sigactfn_t sa_sigaction;
-+ }
-+ sigset_t sa_mask;
-+ int sa_flags;
-+ }
-+}
- else version (Solaris)
- {
- struct sigaction_t
-@@ -960,6 +998,100 @@ else version( DragonFlyBSD )
- int sigsuspend(in sigset_t *);
- int sigwait(in sigset_t*, int*);
- }
-+else version( NetBSD )
-+{
-+ enum SIG_HOLD = cast(sigfn_t2) 3;
-+
-+ struct sigset_t
-+ {
-+ uint[4] __bits;
-+ }
-+
-+ enum SA_NOCLDSTOP = 8;
-+
-+ enum SIG_BLOCK = 1;
-+ enum SIG_UNBLOCK = 2;
-+ enum SIG_SETMASK = 3;
-+
-+ union sigval_t {
-+ int sival_int;
-+ void *sival_ptr;
-+ };
-+ struct _rt{
-+ pid_t _pid;
-+ uid_t _uid;
-+ sigval_t _value;
-+ };
-+ struct _child{
-+ pid_t _pid;
-+ uid_t _uid;
-+ int _status;
-+ clock_t _utime;
-+ clock_t _stime;
-+ };
-+ struct _fault{
-+ void *_addr;
-+ int _trap;
-+ int _trap2;
-+ int _trap3;
-+ };
-+ struct _poll{
-+ long _band;
-+ int _fd;
-+ };
-+ union _reason{
-+ _rt rt;
-+ _child child;
-+ _fault fault;
-+ _poll poll;
-+ };
-+ struct _ksiginfo {
-+ int _signo;
-+ int _code;
-+ int _errno;
-+/+#ifdef _LP64
-+ /* In _LP64 the union starts on an 8-byte boundary. */
-+ int _pad;
-+#endif+/
-+ _reason reason;
-+ };
-+
-+
-+ union siginfo_t
-+ {
-+ ubyte[128] si_pad;/* Total size; for future expansion */
-+ _ksiginfo _info;
-+ @property ref c_long si_band() return { return _info.reason.poll._band; }
-+ }
-+
-+ enum SI_USER = 0;
-+ enum SI_QUEUE = -1;
-+ enum SI_TIMER = -2;
-+ enum SI_ASYNCIO = -3;
-+ enum SI_MESGQ = -4;
-+
-+ int kill(pid_t, int);
-+ int __sigaction14(int, in sigaction_t*, sigaction_t*);
-+ int __sigaddset14(sigset_t*, int);
-+ int __sigdelset14(sigset_t*, int);
-+ int __sigemptyset14(sigset_t *);
-+ int __sigfillset14(sigset_t *);
-+ int __sigismember14(in sigset_t *, int);
-+ int __sigpending14(sigset_t *);
-+ int __sigprocmask14(int, in sigset_t*, sigset_t*);
-+ int __sigsuspend14(in sigset_t *);
-+ int sigwait(in sigset_t*, int*);
-+
-+ alias __sigaction14 sigaction;
-+ alias __sigaddset14 sigaddset;
-+ alias __sigdelset14 sigdelset;
-+ alias __sigemptyset14 sigemptyset;
-+ alias __sigfillset14 sigfillset;
-+ alias __sigismember14 sigismember;
-+ alias __sigpending14 sigpending;
-+ alias __sigprocmask14 sigprocmask;
-+ alias __sigsuspend14 sigsuspend;
-+}
- else version (Solaris)
- {
- enum SIG_HOLD = cast(sigfn_t2)2;
-@@ -1860,6 +1992,130 @@ else version( DragonFlyBSD )
- int sigpause(int);
- int sigrelse(int);
- }
-+else version( NetBSD )
-+{
-+ // No SIGPOLL on *BSD
-+ enum SIGPROF = 27;
-+ enum SIGSYS = 12;
-+ enum SIGTRAP = 5;
-+ enum SIGVTALRM = 26;
-+ enum SIGXCPU = 24;
-+ enum SIGXFSZ = 25;
-+
-+ enum
-+ {
-+ SA_ONSTACK = 0x0001,
-+ SA_RESTART = 0x0002,
-+ SA_RESETHAND = 0x0004,
-+ SA_NODEFER = 0x0010,
-+ SA_NOCLDWAIT = 0x0020,
-+ SA_SIGINFO = 0x0040,
-+ }
-+
-+ enum
-+ {
-+ SS_ONSTACK = 0x0001,
-+ SS_DISABLE = 0x0004,
-+ }
-+
-+ enum MINSIGSTKSZ = 8192;
-+ enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
-+;
-+ //ucontext_t (defined in core.sys.posix.ucontext)
-+ //mcontext_t (defined in core.sys.posix.ucontext)
-+
-+ struct stack_t
-+ {
-+ void* ss_sp;
-+ size_t ss_size;
-+ int ss_flags;
-+ }
-+
-+ struct sigstack
-+ {
-+ void* ss_sp;
-+ int ss_onstack;
-+ }
-+
-+ enum
-+ {
-+ ILL_ILLOPC = 1,
-+ ILL_ILLOPN,
-+ ILL_ILLADR,
-+ ILL_ILLTRP,
-+ ILL_PRVOPC,
-+ ILL_PRVREG,
-+ ILL_COPROC,
-+ ILL_BADSTK,
-+ }
-+
-+ enum
-+ {
-+ BUS_ADRALN = 1,
-+ BUS_ADRERR,
-+ BUS_OBJERR,
-+ }
-+
-+ enum
-+ {
-+ SEGV_MAPERR = 1,
-+ SEGV_ACCERR,
-+ }
-+
-+ enum
-+ {
-+ FPE_INTOVF = 1,
-+ FPE_INTDIV,
-+ FPE_FLTDIV,
-+ FPE_FLTOVF,
-+ FPE_FLTUND,
-+ FPE_FLTRES,
-+ FPE_FLTINV,
-+ FPE_FLTSUB,
-+ }
-+
-+ enum
-+ {
-+ TRAP_BRKPT = 1,
-+ TRAP_TRACE,
-+ }
-+
-+ enum
-+ {
-+ CLD_EXITED = 1,
-+ CLD_KILLED,
-+ CLD_DUMPED,
-+ CLD_TRAPPED,
-+ CLD_STOPPED,
-+ CLD_CONTINUED,
-+ }
-+
-+ enum
-+ {
-+ POLL_IN = 1,
-+ POLL_OUT,
-+ POLL_MSG,
-+ POLL_ERR,
-+ POLL_PRI,
-+ POLL_HUP,
-+ }
-+
-+ //sigfn_t bsd_signal(int sig, sigfn_t func);
-+ sigfn_t sigset(int sig, sigfn_t func);
-+
-+ nothrow:
-+ @nogc:
-+ //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
-+ sigfn_t2 sigset(int sig, sigfn_t2 func);
-+
-+ int killpg(pid_t, int);
-+ int sigaltstack(in stack_t*, stack_t*);
-+ int sighold(int);
-+ int sigignore(int);
-+ int siginterrupt(int, int);
-+ int sigpause(int);
-+ int sigrelse(int);
-+}
- else version (Solaris)
- {
- enum SIGPOLL = 22;
-@@ -2199,6 +2455,14 @@ else version( DragonFlyBSD )
- c_long tv_nsec;
- }
- }
-+else version( NetBSD )
-+{
-+ struct timespec
-+ {
-+ time_t tv_sec;
-+ c_long tv_nsec;
-+ }
-+}
- else version (Solaris)
- {
- struct timespec
-@@ -2321,6 +2585,21 @@ else version( DragonFlyBSD )
- int sigtimedwait(in sigset_t*, siginfo_t*, in timespec*);
- int sigwaitinfo(in sigset_t*, siginfo_t*);
- }
-+else version( NetBSD )
-+{
-+ struct sigevent
-+ {
-+ int sigev_notify;
-+ int sigev_signo;
-+ sigval sigev_value;
-+ void function(sigval) sigev_notify_function;
-+ void /* pthread_attr_t */*sigev_notify_attributes;
-+ }
-+
-+ int sigqueue(pid_t, int, in sigval);
-+ int sigtimedwait(in sigset_t*, siginfo_t*, in timespec*);
-+ int sigwaitinfo(in sigset_t*, siginfo_t*);
-+}
- else version (OSX)
- {
- }
-@@ -2398,6 +2677,11 @@ else version( DragonFlyBSD )
- {
- int pthread_kill(pthread_t, int);
- int pthread_sigmask(int, in sigset_t*, sigset_t*);
-+}
-+else version( NetBSD )
-+{
-+ int pthread_kill(pthread_t, int);
-+ int pthread_sigmask(int, in sigset_t*, sigset_t*);
- }
- else version (Solaris)
- {
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
deleted file mode 100644
index 98990b7fd4..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/stdio.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/stdio.d
-@@ -272,6 +272,10 @@ version( FreeBSD )
- {
- enum P_tmpdir = "/var/tmp/";
- }
-+version( NetBSD )
-+{
-+ enum P_tmpdir = "/var/tmp/";
-+}
- version( Solaris )
- {
- enum P_tmpdir = "/var/tmp/";
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
deleted file mode 100644
index 0e44b80a45..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
+++ /dev/null
@@ -1,74 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/stdlib.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/stdlib.d
-@@ -95,6 +95,10 @@ else version( DragonFlyBSD )
- {
- int posix_memalign(void**, size_t, size_t);
- }
-+else version( NetBSD )
-+{
-+ int posix_memalign(void**, size_t, size_t);
-+}
- else version( Solaris )
- {
- int posix_memalign(void**, size_t, size_t);
-@@ -174,6 +178,10 @@ else version( DragonFlyBSD )
- {
- int rand_r(uint*);
- }
-+else version( NetBSD )
-+{
-+ int rand_r(uint*);
-+}
- else version( Solaris )
- {
- int rand_r(uint*);
-@@ -361,6 +369,47 @@ else version( DragonFlyBSD )
- {
- //WNOHANG (defined in core.sys.posix.sys.wait)
- //WUNTRACED (defined in core.sys.posix.sys.wait)
-+ //WEXITSTATUS (defined in core.sys.posix.sys.wait)
-+ //WIFEXITED (defined in core.sys.posix.sys.wait)
-+ //WIFSIGNALED (defined in core.sys.posix.sys.wait)
-+ //WIFSTOPPED (defined in core.sys.posix.sys.wait)
-+ //WSTOPSIG (defined in core.sys.posix.sys.wait)
-+ //WTERMSIG (defined in core.sys.posix.sys.wait)
-+
-+ c_long a64l(in char*);
-+ double drand48();
-+ //char* ecvt(double, int, int *, int *); // LEGACY
-+ double erand48(ref ushort[3]);
-+ //char* fcvt(double, int, int *, int *); // LEGACY
-+ //char* gcvt(double, int, char*); // LEGACY
-+ int getsubopt(char**, in char**, char**);
-+ int grantpt(int);
-+ char* initstate(uint, char*, size_t);
-+ c_long jrand48(ref ushort[3]);
-+ char* l64a(c_long);
-+ void lcong48(ref ushort[7]);
-+ c_long lrand48();
-+ char* mktemp(char*); // LEGACY
-+ int mkstemp(char*);
-+ char* mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
-+ c_long mrand48();
-+ c_long nrand48(ref ushort[3]);
-+ int posix_openpt(int);
-+ char* ptsname(int);
-+ int putenv(char*);
-+ c_long random();
-+ char* realpath(in char*, char*);
-+ ushort *seed48(ref ushort[3]);
-+ void setkey(in char*);
-+ char* setstate(in char*);
-+ void srand48(c_long);
-+ void srandom(uint);
-+ int unlockpt(int);
-+}
-+else version( NetBSD )
-+{
-+ //WNOHANG (defined in core.sys.posix.sys.wait)
-+ //WUNTRACED (defined in core.sys.posix.sys.wait)
- //WEXITSTATUS (defined in core.sys.posix.sys.wait)
- //WIFEXITED (defined in core.sys.posix.sys.wait)
- //WIFSIGNALED (defined in core.sys.posix.sys.wait)
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
deleted file mode 100644
index 8155ad2215..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
+++ /dev/null
@@ -1,25 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/ioctl.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/ioctl.d
-@@ -359,6 +359,18 @@ else version (FreeBSD)
-
- int ioctl(int, c_ulong, ...);
- }
-+else version (NetBSD)
-+{
-+ struct winsize
-+ {
-+ ushort ws_row;
-+ ushort ws_col;
-+ ushort ws_xpixel;
-+ ushort ws_ypixel;
-+ }
-+
-+ int ioctl(int, c_ulong, ...);
-+}
- else version (Solaris)
- {
- int ioctl(int fildes, int request, ...);
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
deleted file mode 100644
index 6dbf3727d9..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
+++ /dev/null
@@ -1,39 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/ipc.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/ipc.d
-@@ -115,6 +115,32 @@ else version( FreeBSD )
-
- key_t ftok(in char*, int);
- }
-+else version( NetBSD )
-+{
-+
-+ struct ipc_perm
-+ {
-+ uid_t cuid;
-+ gid_t cgid;
-+ uid_t uid;
-+ gid_t gid;
-+ mode_t mode;
-+ ushort seq;
-+ key_t key;
-+ }
-+
-+ enum IPC_CREAT = 0x0100; // 01000
-+ enum IPC_EXCL = 0x0200; // 02000
-+ enum IPC_NOWAIT = 0x0400; // 04000
-+
-+ enum key_t IPC_PRIVATE = 0;
-+
-+ enum IPC_RMID = 0;
-+ enum IPC_SET = 1;
-+ enum IPC_STAT = 2;
-+
-+ key_t ftok(in char*, int);
-+}
- else version( CRuntime_Bionic )
- {
- // All except ftok are from the linux kernel headers.
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
deleted file mode 100644
index e5dcbda13d..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
+++ /dev/null
@@ -1,121 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/mman.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/mman.d
-@@ -85,6 +85,16 @@ else version( DragonFlyBSD )
- enum POSIX_MADV_DONTNEED = 4;
- int posix_madvise(void *addr, size_t len, int advice);
- }
-+else version( NetBSD )
-+{
-+ enum POSIX_MADV_NORMAL = 0;
-+ enum POSIX_MADV_RANDOM = 1;
-+ enum POSIX_MADV_SEQUENTIAL = 2;
-+ enum POSIX_MADV_WILLNEED = 3;
-+ enum POSIX_MADV_DONTNEED = 4;
-+ int posix_madvise(void *addr, size_t len, int advice);
-+}
-+
- else version (Solaris)
- {
- }
-@@ -134,6 +144,13 @@ else version( DragonFlyBSD )
- enum PROT_WRITE = 0x02;
- enum PROT_EXEC = 0x04;
- }
-+else version( NetBSD )
-+{
-+ enum PROT_NONE = 0x00;
-+ enum PROT_READ = 0x01;
-+ enum PROT_WRITE = 0x02;
-+ enum PROT_EXEC = 0x04;
-+}
- else version (Solaris)
- {
- enum PROT_NONE = 0x00;
-@@ -185,6 +202,11 @@ else version( DragonFlyBSD )
- void* mmap(void*, size_t, int, int, int, off_t);
- int munmap(void*, size_t);
- }
-+else version( NetBSD )
-+{
-+ void* mmap(void*, size_t, int, int, int, off_t);
-+ int munmap(void*, size_t);
-+}
- else version (Solaris)
- {
- void* mmap(void*, size_t, int, int, int, off_t);
-@@ -354,6 +376,21 @@ else version( DragonFlyBSD )
-
- int msync(void*, size_t, int);
- }
-+else version( NetBSD )
-+{
-+ enum MAP_SHARED = 0x0001;
-+ enum MAP_PRIVATE = 0x0002;
-+ enum MAP_FIXED = 0x0010;
-+ enum MAP_ANON = 0x1000;
-+
-+ enum MAP_FAILED = cast(void*)-1;
-+
-+ enum MS_SYNC = 0x0000;
-+ enum MS_ASYNC = 0x0001;
-+ enum MS_INVALIDATE = 0x0002;
-+
-+ int msync(void*, size_t, int);
-+}
- else version (Solaris)
- {
- enum MAP_SHARED = 0x0001;
-@@ -477,6 +514,14 @@ else version( DragonFlyBSD )
- int mlockall(int);
- int munlockall();
- }
-+else version( NetBSD )
-+{
-+ enum MCL_CURRENT = 0x0001;
-+ enum MCL_FUTURE = 0x0002;
-+
-+ int mlockall(int);
-+ int munlockall();
-+}
- else version (Solaris)
- {
- enum MCL_CURRENT = 0x0001;
-@@ -526,6 +571,11 @@ else version( DragonFlyBSD )
- int mlock(in void*, size_t);
- int munlock(in void*, size_t);
- }
-+else version( NetBSD )
-+{
-+ int mlock(in void*, size_t);
-+ int munlock(in void*, size_t);
-+}
- else version (Solaris)
- {
- int mlock(in void*, size_t);
-@@ -564,6 +614,10 @@ else version( DragonFlyBSD )
- {
- int mprotect(void*, size_t, int);
- }
-+else version( NetBSD )
-+{
-+ int mprotect(void*, size_t, int);
-+}
- else version (Solaris)
- {
- int mprotect(void*, size_t, int);
-@@ -604,6 +658,11 @@ else version( DragonFlyBSD )
- {
- int shm_open(in char*, int, mode_t);
- int shm_unlink(in char*);
-+}
-+else version( NetBSD )
-+{
-+ int shm_open(in char*, int, mode_t);
-+ int shm_unlink(in char*);
- }
- else version (Solaris)
- {
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
deleted file mode 100644
index 3e10623004..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
+++ /dev/null
@@ -1,84 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/resource.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/resource.d
-@@ -292,6 +292,64 @@ else version (DragonFlyBSD)
- RLIMIT_AS = 10,
- }
- }
-+else version (NetBSD)
-+{
-+ enum
-+ {
-+ PRIO_PROCESS = 0,
-+ PRIO_PGRP = 1,
-+ PRIO_USER = 2,
-+ }
-+
-+ alias long rlim_t;
-+
-+ enum
-+ {
-+ RLIM_INFINITY = (cast(rlim_t)((cast(ulong) 1 << 63) - 1)),
-+ // FreeBSD explicitly does not define the following:
-+ //RLIM_SAVED_MAX,
-+ //RLIM_SAVED_CUR,
-+ }
-+
-+ enum
-+ {
-+ RUSAGE_SELF = 0,
-+ RUSAGE_CHILDREN = -1,
-+ }
-+
-+ struct rusage
-+ {
-+ timeval ru_utime;
-+ timeval ru_stime;
-+ c_long ru_maxrss;
-+ alias ru_ixrss ru_first;
-+ c_long ru_ixrss;
-+ c_long ru_idrss;
-+ c_long ru_isrss;
-+ c_long ru_minflt;
-+ c_long ru_majflt;
-+ c_long ru_nswap;
-+ c_long ru_inblock;
-+ c_long ru_oublock;
-+ c_long ru_msgsnd;
-+ c_long ru_msgrcv;
-+ c_long ru_nsignals;
-+ c_long ru_nvcsw;
-+ c_long ru_nivcsw;
-+ alias ru_nivcsw ru_last;
-+ }
-+
-+ enum
-+ {
-+ RLIMIT_CORE = 4,
-+ RLIMIT_CPU = 0,
-+ RLIMIT_DATA = 2,
-+ RLIMIT_FSIZE = 1,
-+ RLIMIT_NOFILE = 8,
-+ RLIMIT_STACK = 3,
-+ RLIMIT_AS = 10,
-+ }
-+}
- else version (Solaris)
- {
- enum
-@@ -473,6 +531,12 @@ else version (DragonFlyBSD)
- {
- int getrlimit(int, rlimit*);
- int getrusage(int, rusage*);
-+ int setrlimit(int, in rlimit*);
-+}
-+else version (NetBSD)
-+{
-+ int getrlimit(int, rlimit*);
-+ int getrusage(int, rusage*);
- int setrlimit(int, in rlimit*);
- }
- else version (Solaris)
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
deleted file mode 100644
index 832f675267..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
+++ /dev/null
@@ -1,62 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/select.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/select.d
-@@ -218,6 +218,55 @@ else version( FreeBSD )
- int pselect(int, fd_set*, fd_set*, fd_set*, in timespec*, in sigset_t*);
- int select(int, fd_set*, fd_set*, fd_set*, timeval*);
- }
-+else version( NetBSD )
-+{
-+ private
-+ {
-+ alias c_ulong __fd_mask;
-+ enum _NFDBITS = __fd_mask.sizeof * 8;
-+ }
-+
-+ enum uint FD_SETSIZE = 256;
-+
-+ struct fd_set
-+ {
-+ __fd_mask[(FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS] __fds_bits;
-+ }
-+
-+ extern (D) __fd_mask __fdset_mask(uint n)
-+ {
-+ return cast(__fd_mask) 1 << (n % _NFDBITS);
-+ }
-+
-+ extern (D) void FD_CLR( int n, fd_set* p )
-+ {
-+ p.__fds_bits[n / _NFDBITS] &= ~__fdset_mask(n);
-+ }
-+
-+ extern (D) bool FD_ISSET( int n, const(fd_set)* p )
-+ {
-+ return (p.__fds_bits[n / _NFDBITS] & __fdset_mask(n)) != 0;
-+ }
-+
-+ extern (D) void FD_SET( int n, fd_set* p )
-+ {
-+ p.__fds_bits[n / _NFDBITS] |= __fdset_mask(n);
-+ }
-+
-+ extern (D) void FD_ZERO( fd_set* p )
-+ {
-+ fd_set *_p;
-+ size_t _n;
-+
-+ _p = p;
-+ _n = (FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS;
-+ while (_n > 0)
-+ _p.__fds_bits[--_n] = 0;
-+ }
-+
-+ int pselect(int, fd_set*, fd_set*, fd_set*, in timespec*, in sigset_t*);
-+ int select(int, fd_set*, fd_set*, fd_set*, timeval*);
-+}
- else version (Solaris)
- {
- private
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
deleted file mode 100644
index 3a39b4ea49..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
+++ /dev/null
@@ -1,39 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/shm.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/shm.d
-@@ -121,6 +121,32 @@ else version( FreeBSD )
- int shmdt(in void*);
- int shmget(key_t, size_t, int);
- }
-+else version( NetBSD )
-+{
-+ enum SHM_RDONLY = 0x01000; // 010000
-+ enum SHM_RND = 0x02000; // 020000
-+ enum SHMLBA = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
-+
-+ alias c_ulong shmatt_t;
-+
-+ struct shmid_ds
-+ {
-+ ipc_perm shm_perm;
-+ size_t shm_segsz;
-+ pid_t shm_lpid;
-+ pid_t shm_cpid;
-+ short shm_nattch;
-+ time_t shm_atime;
-+ time_t shm_dtime;
-+ time_t shm_ctime;
-+ void* shm_internal;
-+ }
-+
-+ void* shmat(int, in void*, int);
-+ int shmctl(int, int, shmid_ds*);
-+ int shmdt(in void*);
-+ int shmget(key_t, size_t, int);
-+}
- else version( OSX )
- {
-
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
deleted file mode 100644
index 9cd98b5ba8..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
+++ /dev/null
@@ -1,240 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/socket.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/socket.d
-@@ -1230,6 +1230,205 @@ else version( DragonFlyBSD )
- int socketpair(int, int, int, ref int[2]);
- // void pfctlinput(int, struct sockaddr *);
- }
-+else version( NetBSD )
-+{
-+ alias uint socklen_t;
-+ alias ubyte sa_family_t;
-+
-+ struct sockaddr
-+ {
-+ ubyte sa_len;
-+ sa_family_t sa_family;
-+ byte[14] sa_data;
-+ }
-+
-+ private
-+ {
-+ enum _SS_ALIGNSIZE = long.sizeof;
-+ enum _SS_MAXSIZE = 128;
-+ enum _SS_PAD1SIZE = _SS_ALIGNSIZE - ubyte.sizeof - sa_family_t.sizeof;
-+ enum _SS_PAD2SIZE = _SS_MAXSIZE - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1SIZE - _SS_ALIGNSIZE;
-+ }
-+
-+ struct sockaddr_storage
-+ {
-+ ubyte ss_len;
-+ sa_family_t ss_family;
-+ byte[_SS_PAD1SIZE] __ss_pad1;
-+ long __ss_align;
-+ byte[_SS_PAD2SIZE] __ss_pad2;
-+ }
-+
-+ struct msghdr
-+ {
-+ void* msg_name;
-+ socklen_t msg_namelen;
-+ iovec* msg_iov;
-+ int msg_iovlen;
-+ void* msg_control;
-+ socklen_t msg_controllen;
-+ int msg_flags;
-+ }
-+
-+ struct cmsghdr
-+ {
-+ socklen_t cmsg_len;
-+ int cmsg_level;
-+ int cmsg_type;
-+ }
-+
-+ enum : uint
-+ {
-+ SCM_RIGHTS = 0x01
-+ }
-+
-+ private // <machine/param.h>
-+ {
-+ enum _ALIGNBYTES = /+c_int+/ int.sizeof - 1;
-+ extern (D) size_t _ALIGN( size_t p ) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
-+ }
-+
-+ extern (D) ubyte* CMSG_DATA( cmsghdr* cmsg )
-+ {
-+ return cast(ubyte*) cmsg + _ALIGN( cmsghdr.sizeof );
-+ }
-+
-+ extern (D) cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
-+ {
-+ if( cmsg == null )
-+ {
-+ return CMSG_FIRSTHDR( mhdr );
-+ }
-+ else
-+ {
-+ if( cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ) + _ALIGN( cmsghdr.sizeof ) >
-+ cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen )
-+ return null;
-+ else
-+ return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ));
-+ }
-+ }
-+
-+ extern (D) cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
-+ {
-+ return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
-+ }
-+
-+ struct linger
-+ {
-+ int l_onoff;
-+ int l_linger;
-+ }
-+
-+ enum
-+ {
-+ SOCK_DGRAM = 2,
-+ SOCK_RDM = 4,
-+ SOCK_SEQPACKET = 5,
-+ SOCK_STREAM = 1
-+ }
-+
-+ enum : uint
-+ {
-+ SOL_SOCKET = 0xffff
-+ }
-+
-+ enum : uint
-+ {
-+ SO_DEBUG = 0x0001, /* turn on debugging info recording */
-+ SO_ACCEPTCONN = 0x0002, /* socket has had listen() */
-+ SO_REUSEADDR = 0x0004, /* allow local address reuse */
-+ SO_KEEPALIVE = 0x0008, /* keep connections alive */
-+ SO_DONTROUTE = 0x0010, /* just use interface addresses */
-+ SO_BROADCAST = 0x0020, /* permit sending of broadcast msgs */
-+ SO_USELOOPBACK = 0x0040, /* bypass hardware when possible */
-+ SO_LINGER = 0x0080, /* linger on close if data present */
-+ SO_OOBINLINE = 0x0100, /* leave received OOB data in line */
-+ SO_REUSEPORT = 0x0200, /* allow local address & port reuse */
-+ /* SO_OTIMESTAMP 0x0400 */
-+ SO_NOSIGPIPE = 0x0800, /* no SIGPIPE from EPIPE */
-+ SO_ACCEPTFILTER = 0x1000, /* there is an accept filter */
-+ SO_TIMESTAMP = 0x2000, /* timestamp received dgram traffic */
-+
-+ /*
-+ * Additional options, not kept in so_options.
-+ */
-+ SO_SNDBUF = 0x1001, /* send buffer size */
-+ SO_RCVBUF = 0x1002, /* receive buffer size */
-+ SO_SNDLOWAT = 0x1003, /* send low-water mark */
-+ SO_RCVLOWAT = 0x1004, /* receive low-water mark */
-+ /* SO_OSNDTIMEO 0x1005 */
-+ /* SO_ORCVTIMEO 0x1006 */
-+ SO_ERROR = 0x1007, /* get error status and clear */
-+ SO_TYPE = 0x1008, /* get socket type */
-+ SO_OVERFLOWED = 0x1009, /* datagrams: return packets dropped */
-+
-+ SO_NOHEADER = 0x100a, /* user supplies no header to kernel;
-+ * kernel removes header and supplies
-+ * payload
-+ */
-+ SO_SNDTIMEO = 0x100b, /* send timeout */
-+ SO_RCVTIMEO = 0x100c /* receive timeout */
-+
-+ }
-+
-+ enum
-+ {
-+ SOMAXCONN = 128
-+ }
-+
-+ enum : uint
-+ {
-+ MSG_OOB = 0x0001, /* process out-of-band data */
-+ MSG_PEEK = 0x0002, /* peek at incoming message */
-+ MSG_DONTROUTE = 0x0004, /* send without using routing tables */
-+ MSG_EOR = 0x0008, /* data completes record */
-+ MSG_TRUNC = 0x0010, /* data discarded before delivery */
-+ MSG_CTRUNC = 0x0020, /* control data lost before delivery */
-+ MSG_WAITALL = 0x0040, /* wait for full request or error */
-+ MSG_DONTWAIT = 0x0080, /* this message should be nonblocking */
-+ MSG_BCAST = 0x0100, /* this message was rcvd using link-level brdcst */
-+ MSG_MCAST = 0x0200, /* this message was rcvd using link-level mcast */
-+ MSG_NOSIGNAL = 0x0400 /* do not generate SIGPIPE on EOF */
-+
-+
-+ }
-+
-+ enum
-+ {
-+ AF_APPLETALK = 16,
-+ AF_INET = 2,
-+ AF_IPX = 23,
-+ AF_UNIX = 1,
-+ AF_UNSPEC = 0
-+ }
-+
-+ enum
-+ {
-+ SHUT_RD = 0,
-+ SHUT_WR = 1,
-+ SHUT_RDWR = 2
-+ }
-+
-+ int accept(int, sockaddr*, socklen_t*);
-+ int bind(int, in sockaddr*, socklen_t);
-+ int connect(int, in sockaddr*, socklen_t);
-+ int getpeername(int, sockaddr*, socklen_t*);
-+ int getsockname(int, sockaddr*, socklen_t*);
-+ int getsockopt(int, int, int, void*, socklen_t*);
-+ int listen(int, int);
-+ ssize_t recv(int, void*, size_t, int);
-+ ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
-+ ssize_t recvmsg(int, msghdr*, int);
-+ ssize_t send(int, in void*, size_t, int);
-+ ssize_t sendmsg(int, in msghdr*, int);
-+ ssize_t sendto(int, in void*, size_t, int, in sockaddr*, socklen_t);
-+ int setsockopt(int, int, int, in void*, socklen_t);
-+ int shutdown(int, int);
-+ int socket(int, int, int);
-+ int sockatmark(int);
-+ int socketpair(int, int, int, ref int[2]);
-+}
- else version (Solaris)
- {
- alias uint socklen_t;
-@@ -1657,6 +1856,13 @@ else version( DragonFlyBSD )
- AF_INET6 = 28
- }
- }
-+else version( NetBSD )
-+{
-+ enum
-+ {
-+ AF_INET6 = 24
-+ }
-+}
- else version (Solaris)
- {
- enum
-@@ -1708,6 +1914,13 @@ else version( DragonFlyBSD )
- {
- enum
- {
-+ SOCK_RAW = 3
-+ }
-+}
-+else version( NetBSD )
-+{
-+ enum
-+ {
- SOCK_RAW = 3
- }
- }
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
deleted file mode 100644
index a7e47946c4..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
+++ /dev/null
@@ -1,113 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/stat.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/stat.d
-@@ -839,6 +839,70 @@ else version( DragonFlyBSD )
- extern (D) bool S_ISLNK( mode_t mode ) { return S_ISTYPE( mode, S_IFLNK ); }
- extern (D) bool S_ISSOCK( mode_t mode ) { return S_ISTYPE( mode, S_IFSOCK ); }
- }
-+else version( NetBSD )
-+{
-+ struct stat_t
-+ {
-+ dev_t st_dev; /* inode's device */
-+ mode_t st_mode; /* inode protection mode */
-+ ino_t st_ino; /* inode's number */
-+ nlink_t st_nlink; /* number of hard links */
-+ uid_t st_uid; /* user ID of the file's owner */
-+ gid_t st_gid; /* group ID of the file's group */
-+ dev_t st_rdev; /* device type */
-+
-+ time_t st_atime; /* time of last access */
-+ long st_atimensec; /* nsec of last access */
-+ time_t st_mtime; /* time of last data modification */
-+ long st_mtimensec; /* nsec of last data modification */
-+ time_t st_ctime; /* time of last file status change */
-+ long st_ctimensec; /* nsec of last file status change */
-+ time_t st_birthtime; /* time of creation */
-+ long st_birthtimensec; /* nsec of time of creation */
-+
-+ off_t st_size; /* file size, in bytes */
-+ blkcnt_t st_blocks; /* blocks allocated for file */
-+ blksize_t st_blksize; /* optimal blocksize for I/O */
-+ uint32_t st_flags; /* user defined flags for file */
-+ uint32_t st_gen; /* file generation number */
-+ uint32_t[2] st_spare;
-+ }
-+
-+ enum S_IRUSR = 0x100; // octal 0000400
-+ enum S_IWUSR = 0x080; // octal 0000200
-+ enum S_IXUSR = 0x040; // octal 0000100
-+ enum S_IRWXU = 0x1C0; // octal 0000700
-+
-+ enum S_IRGRP = 0x020; // octal 0000040
-+ enum S_IWGRP = 0x010; // octal 0000020
-+ enum S_IXGRP = 0x008; // octal 0000010
-+ enum S_IRWXG = 0x038; // octal 0000070
-+
-+ enum S_IROTH = 0x4; // 0000004
-+ enum S_IWOTH = 0x2; // 0000002
-+ enum S_IXOTH = 0x1; // 0000001
-+ enum S_IRWXO = 0x7; // 0000007
-+
-+ enum S_ISUID = 0x800; // octal 0004000
-+ enum S_ISGID = 0x400; // octal 0002000
-+ enum S_ISVTX = 0x200; // octal 0001000
-+
-+ private
-+ {
-+ extern (D) bool S_ISTYPE( mode_t mode, uint mask )
-+ {
-+ return ( mode & S_IFMT ) == mask;
-+ }
-+ }
-+
-+ extern (D) bool S_ISBLK( mode_t mode ) { return S_ISTYPE( mode, S_IFBLK ); }
-+ extern (D) bool S_ISCHR( mode_t mode ) { return S_ISTYPE( mode, S_IFCHR ); }
-+ extern (D) bool S_ISDIR( mode_t mode ) { return S_ISTYPE( mode, S_IFDIR ); }
-+ extern (D) bool S_ISFIFO( mode_t mode ) { return S_ISTYPE( mode, S_IFIFO ); }
-+ extern (D) bool S_ISREG( mode_t mode ) { return S_ISTYPE( mode, S_IFREG ); }
-+ extern (D) bool S_ISLNK( mode_t mode ) { return S_ISTYPE( mode, S_IFLNK ); }
-+ extern (D) bool S_ISSOCK( mode_t mode ) { return S_ISTYPE( mode, S_IFSOCK ); }
-+}
- else version (Solaris)
- {
- private enum _ST_FSTYPSZ = 16;
-@@ -1200,6 +1264,15 @@ else version( DragonFlyBSD )
- int lstat(in char*, stat_t*);
- int stat(in char*, stat_t*);
- }
-+else version( NetBSD )
-+{
-+ int __fstat50(int, stat_t*);
-+ int __lstat50(in char*, stat_t*);
-+ int __stat50(in char*, stat_t*);
-+ alias __fstat50 fstat;
-+ alias __lstat50 lstat;
-+ alias __stat50 stat;
-+}
- else version( CRuntime_Bionic )
- {
- int fstat(int, stat_t*) @trusted;
-@@ -1273,6 +1346,19 @@ else version( DragonFlyBSD )
- {
- enum S_IFMT = 0xF000; // octal 0170000
- enum S_IFBLK = 0x6000; // octal 0060000
-+ enum S_IFCHR = 0x2000; // octal 0020000
-+ enum S_IFIFO = 0x1000; // octal 0010000
-+ enum S_IFREG = 0x8000; // octal 0100000
-+ enum S_IFDIR = 0x4000; // octal 0040000
-+ enum S_IFLNK = 0xA000; // octal 0120000
-+ enum S_IFSOCK = 0xC000; // octal 0140000
-+
-+ int mknod(in char*, mode_t, dev_t);
-+}
-+else version( NetBSD )
-+{
-+ enum S_IFMT = 0xF000; // octal 0170000
-+ enum S_IFBLK = 0x6000; // octal 0060000
- enum S_IFCHR = 0x2000; // octal 0020000
- enum S_IFIFO = 0x1000; // octal 0010000
- enum S_IFREG = 0x8000; // octal 0100000
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
deleted file mode 100644
index 39b1d13008..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/sys/time.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/time.d
-@@ -149,6 +149,27 @@ else version( DragonFlyBSD )
- int setitimer(int, in itimerval*, itimerval*);
- int utimes(in char*, ref const(timeval)[2]);
- }
-+else version( NetBSD )
-+{
-+ struct timeval
-+ {
-+ time_t tv_sec;
-+ suseconds_t tv_usec;
-+ }
-+
-+ struct itimerval
-+ {
-+ timeval it_interval;
-+ timeval it_value;
-+ }
-+
-+
-+ int getitimer(int, itimerval*);
-+ int gettimeofday(timeval*, void*); // timezone_t* is normally void*
-+ int setitimer(int, in itimerval*, itimerval*);
-+ int utimes(in char*, ref const(timeval)[2]);
-+}
-+
- else version (Solaris)
- {
- struct timeval
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
deleted file mode 100644
index 4a7d76c327..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/uio.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/uio.d
-@@ -70,6 +70,17 @@ else version( FreeBSD )
- ssize_t readv(int, in iovec*, int);
- ssize_t writev(int, in iovec*, int);
- }
-+else version( NetBSD )
-+{
-+ struct iovec
-+ {
-+ void* iov_base;
-+ size_t iov_len;
-+ }
-+
-+ ssize_t readv(int, in iovec*, int);
-+ ssize_t writev(int, in iovec*, int);
-+}
- else version (Solaris)
- {
- struct iovec
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
deleted file mode 100644
index 3abe868e85..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/un.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/un.d
-@@ -60,6 +60,15 @@ else version( FreeBSD )
- byte[104] sun_path;
- }
- }
-+else version( NetBSD )
-+{
-+ struct sockaddr_un
-+ {
-+ ubyte sun_len;
-+ sa_family_t sun_family;
-+ byte[104] sun_path;
-+ }
-+}
- else version( Solaris )
- {
- struct sockaddr_un
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
deleted file mode 100644
index 48d4014920..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/utsname.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/utsname.d
-@@ -53,6 +53,22 @@ else version(FreeBSD)
-
- int uname(utsname* __name);
- }
-+else version(NetBSD)
-+{
-+ private enum utsNameLength = 256;
-+
-+ struct utsname
-+ {
-+ char[utsNameLength] sysname;
-+ char[utsNameLength] nodename;
-+ char[utsNameLength] release;
-+ // The field name is version but version is a keyword in D.
-+ char[utsNameLength] update;
-+ char[utsNameLength] machine;
-+ }
-+
-+ int uname(utsname* __name);
-+}
- else version(CRuntime_Bionic)
- {
- private enum SYS_NMLN = 65;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
deleted file mode 100644
index d0534b2a26..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/sys/wait.d.orig 2020-05-07 08:52:17.154678602 +0000
-+++ runtime/druntime/src/core/sys/posix/sys/wait.d
-@@ -255,6 +255,11 @@ else version (DragonFlyBSD)
- enum WCONTINUED = 4;
- enum WNOWAIT = 8;
- }
-+else version (NetBSD)
-+{
-+ enum WSTOPPED = WUNTRACED;
-+ enum WNOWAIT = 0x0010000;
-+}
- else version (Solaris)
- {
- enum WEXITED = 1;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
deleted file mode 100644
index e77f8c417c..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
+++ /dev/null
@@ -1,78 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/syslog.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/syslog.d
-@@ -202,6 +202,71 @@ else version( FreeBSD )
- void syslog (int __pri, const char *__fmt, ...);
- void closelog();
- }
-+else version( NetBSD )
-+{
-+ //http://fxr.watson.org/fxr/source/sys/syslog.h
-+
-+ //PRIORITY
-+ enum {
-+ LOG_EMERG = 0, /* system is unusable */
-+ LOG_ALERT = 1, /* action must be taken immediately */
-+ LOG_CRIT = 2, /* critical conditions */
-+ LOG_ERR = 3, /* error conditions */
-+ LOG_WARNING = 4, /* warning conditions */
-+ LOG_NOTICE = 5, /* normal but significant condition */
-+ LOG_INFO = 6, /* informational */
-+ LOG_DEBUG = 7, /* debug-level messages */
-+ };
-+
-+ //OPTIONS
-+ enum {
-+ LOG_PID = 0x01, /* log the pid with each message */
-+ LOG_CONS = 0x02, /* log on the console if errors in sending */
-+ LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */
-+ LOG_NDELAY = 0x08, /* don't delay open */
-+ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */
-+ LOG_PERROR = 0x20, /* log to stderr as well */
-+ };
-+
-+ //FACILITY
-+ enum {
-+ LOG_KERN = (0<<3), /* kernel messages */
-+ LOG_USER = (1<<3), /* random user-level messages */
-+ LOG_MAIL = (2<<3), /* mail system */
-+ LOG_DAEMON = (3<<3), /* system daemons */
-+ LOG_AUTH = (4<<3), /* security/authorization messages */
-+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */
-+ LOG_LPR = (6<<3), /* line printer subsystem */
-+ LOG_NEWS = (7<<3), /* network news subsystem */
-+ LOG_UUCP = (8<<3), /* UUCP subsystem */
-+ LOG_CRON = (9<<3), /* clock daemon */
-+ LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
-+ LOG_FTP = (11<<3), /* ftp daemon */
-+ LOG_NTP = (12<<3), /* NTP subsystem */
-+ LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
-+ LOG_CONSOLE = (14<<3), /* /dev/console output */
-+
-+ /* other codes through 15 reserved for system use */
-+ LOG_LOCAL0 = (16<<3), /* reserved for local use */
-+ LOG_LOCAL1 = (17<<3), /* reserved for local use */
-+ LOG_LOCAL2 = (18<<3), /* reserved for local use */
-+ LOG_LOCAL3 = (19<<3), /* reserved for local use */
-+ LOG_LOCAL4 = (20<<3), /* reserved for local use */
-+ LOG_LOCAL5 = (21<<3), /* reserved for local use */
-+ LOG_LOCAL6 = (22<<3), /* reserved for local use */
-+ LOG_LOCAL7 = (23<<3), /* reserved for local use */
-+
-+ LOG_NFACILITIES = 24, /* current number of facilities */
-+ };
-+
-+ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */
-+ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */
-+
-+ void openlog (const char *, int __option, int __facility);
-+ int setlogmask (int __mask);
-+ void syslog (int __pri, const char *__fmt, ...);
-+ void closelog();
-+}
- else version( Solaris )
- {
- //http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_termios.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
deleted file mode 100644
index 7c0510188b..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
+++ /dev/null
@@ -1,47 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/termios.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/termios.d
-@@ -638,6 +638,40 @@ version( CRuntime_Glibc )
-
- pid_t tcgetsid(int);
- }
-+else version( NetBSD )
-+{
-+ enum IXANY = 0x00000800;
-+
-+ enum ONLCR = 0x00000002;
-+ enum OCRNL = 0x00000010;
-+ enum ONOCR = 0x00000020;
-+ enum ONLRET = 0x00000040;
-+ //enum OFILL
-+ //enum NLDLY
-+ //enum NL0
-+ //enum NL1
-+ //enum CRDLY
-+ //enum CR0
-+ //enum CR1
-+ //enum CR2
-+ //enum CR3
-+ enum TABDLY = 0x00000004;
-+ enum TAB0 = 0x00000000;
-+ //enum TAB1
-+ //enum TAB2
-+ enum TAB3 = 0x00000004;
-+ //enum BSDLY
-+ //enum BS0
-+ //enum BS1
-+ //enum VTDLY
-+ //enum VT0
-+ //enum VT1
-+ //enum FFDLY
-+ //enum FF0
-+ //enum FF1
-+
-+ pid_t tcgetsid(int);
-+}
-
- else version (OSX)
- {
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_time.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_time.d
deleted file mode 100644
index 8865ff41b4..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_time.d
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/time.d.orig 2020-05-07 08:52:17.274678259 +0000
-+++ runtime/druntime/src/core/sys/posix/time.d
-@@ -60,6 +60,10 @@ else version( NetBSD )
- {
- time_t timegm(tm*); // non-standard
- }
-+else version( NetBSD )
-+{
-+ time_t timegm(tm*); // non-standard
-+}
- else version (Solaris)
- {
- time_t timegm(tm*); // non-standard
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
deleted file mode 100644
index 8439192e6a..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
+++ /dev/null
@@ -1,67 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/ucontext.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/ucontext.d
-@@ -766,6 +766,62 @@ else version( DragonFlyBSD )
- int[4] __spare__;
- }
- }
-+else version( NetBSD )
-+{
-+
-+ version( X86_64 )
-+ {
-+ enum { NGREG = 26 };
-+ alias __greg_t = ulong;
-+ alias __gregset_t = __greg_t[NGREG];
-+ alias __fpregset_t = align(8)ubyte[512];
-+
-+ struct mcontext_t {
-+ __gregset_t __gregs;
-+ __greg_t _mc_tlsbase;
-+ __fpregset_t __fpregs;
-+ }
-+ }
-+ else version( X86 )
-+ {
-+ enum { NGREG = 19 };
-+ alias __greg_t = ulong;
-+ alias __gregset_t = __greg_t[_NGREG];
-+ struct __fpregset_t{
-+ union __fp_reg_set{
-+ struct __fpchip_state{
-+ int[27] __fp_state; /* Environment and registers */
-+ } ; /* x87 regs in fsave format */
-+ struct __fp_xmm_state{
-+ ubyte[512] __fp_xmm;
-+ } ; /* x87 and xmm regs in fxsave format */
-+ int[128] __fp_fpregs;
-+ };
-+ __fpregset_t __fp_reg_set;
-+ int[33] __fp_pad; /* Historic padding */
-+ };
-+
-+ struct mcontext_t {
-+ __gregset_t __gregs;
-+ __fpregset_t __fpregs;
-+ __greg_t _mc_tlsbase;
-+ }
-+ }
-+
-+ struct ucontext_t
-+ {
-+ uint uc_flags; /* properties */
-+ ucontext_t * uc_link; /* context to resume */
-+ sigset_t uc_sigmask; /* signals blocked in this context */
-+ stack_t uc_stack; /* the stack used by this context */
-+ mcontext_t uc_mcontext; /* machine state */
-+ /+ todo #if defined(_UC_MACHINE_PAD)
-+ long __uc_pad[_UC_MACHINE_PAD];
-+ #endif
-+ +/
-+
-+ }
-+}
- else version ( Solaris )
- {
- alias uint[4] upad128_t;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
deleted file mode 100644
index 0a11df858f..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
+++ /dev/null
@@ -1,192 +0,0 @@
-$NetBSD$
-
---- runtime/druntime/src/core/sys/posix/unistd.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/unistd.d
-@@ -121,6 +121,11 @@ else version( DragonFlyBSD )
- off_t lseek(int, off_t, int) @trusted;
- int ftruncate(int, off_t) @trusted;
- }
-+else version( NetBSD )
-+{
-+ off_t lseek(int, off_t, int) @trusted;
-+ int ftruncate(int, off_t) @trusted;
-+}
- else version( Solaris )
- {
- version ( D_LP64 )
-@@ -968,6 +973,143 @@ else version( DragonFlyBSD )
- _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14,
- }
- }
-+else version( NetBSD )
-+{
-+ enum F_OK = 0;
-+ enum R_OK = 0x04;
-+ enum W_OK = 0x02;
-+ enum X_OK = 0x01;
-+
-+ enum F_ULOCK = 0;
-+ enum F_LOCK = 1;
-+ enum F_TLOCK = 2;
-+ enum F_TEST = 3;
-+
-+ enum
-+ {
-+ _SC_ARG_MAX = 1,
-+ _SC_CHILD_MAX = 2,
-+ _O_SC_CLK_TCK = 3,
-+ _SC_NGROUPS_MAX = 4,
-+ _SC_OPEN_MAX = 5,
-+ _SC_JOB_CONTROL = 6,
-+ _SC_SAVED_IDS = 7,
-+ _SC_VERSION = 8,
-+ _SC_BC_BASE_MAX = 9,
-+ _SC_BC_DIM_MAX = 10,
-+ _SC_BC_SCALE_MAX = 11,
-+ _SC_BC_STRING_MAX = 12,
-+ _SC_COLL_WEIGHTS_MAX = 13,
-+ _SC_EXPR_NEST_MAX = 14,
-+ _SC_LINE_MAX = 15,
-+ _SC_RE_DUP_MAX = 16,
-+ _SC_2_VERSION = 17,
-+ _SC_2_C_BIND = 18,
-+ _SC_2_C_DEV = 19,
-+ _SC_2_CHAR_TERM = 20,
-+ _SC_2_FORT_DEV = 21,
-+ _SC_2_FORT_RUN = 22,
-+ _SC_2_LOCALEDEF = 23,
-+ _SC_2_SW_DEV = 24,
-+ _SC_2_UPE = 25,
-+ _SC_STREAM_MAX = 26,
-+ _SC_TZNAME_MAX = 27,
-+ _SC_PAGESIZE = 28,
-+ _SC_FSYNC = 29,
-+ _SC_XOPEN_SHM = 30,
-+ _SC_SYNCHRONIZED_IO = 31,
-+ _SC_IOV_MAX = 32,
-+ _SC_MAPPED_FILES = 33,
-+ _SC_MEMLOCK = 34,
-+ _SC_MEMLOCK_RANGE = 35,
-+ _SC_MEMORY_PROTECTION = 36,
-+ _SC_LOGIN_NAME_MAX = 37,
-+ _SC_MONOTONIC_CLOCK = 38,
-+ _SC_CLK_TCK = 39,
-+ _SC_ATEXIT_MAX = 40,
-+ _SC_THREADS = 41,
-+ _SC_SEMAPHORES = 42,
-+ _SC_BARRIERS = 43,
-+ _SC_TIMERS = 44,
-+ _SC_SPIN_LOCKS = 45,
-+ _SC_READER_WRITER_LOCKS = 46,
-+ _SC_GETGR_R_SIZE_MAX = 47,
-+ _SC_GETPW_R_SIZE_MAX = 48,
-+ _SC_CLOCK_SELECTION = 49,
-+ _SC_ASYNCHRONOUS_IO = 50,
-+ _SC_AIO_LISTIO_MAX = 51,
-+ _SC_AIO_MAX = 52,
-+ _SC_MESSAGE_PASSING = 53,
-+ _SC_MQ_OPEN_MAX = 54,
-+ _SC_MQ_PRIO_MAX = 55,
-+ _SC_PRIORITY_SCHEDULING = 56,
-+ _SC_THREAD_DESTRUCTOR_ITERATIONS = 57,
-+ _SC_THREAD_KEYS_MAX = 58,
-+ _SC_THREAD_STACK_MIN = 59,
-+ _SC_THREAD_THREADS_MAX = 60,
-+ _SC_THREAD_ATTR_STACKADDR = 61,
-+ _SC_THREAD_ATTR_STACKSIZE = 62,
-+ _SC_THREAD_PRIORITY_SCHEDULING = 63,
-+ _SC_THREAD_PRIO_INHERIT = 64,
-+ _SC_THREAD_PRIO_PROTECT = 65,
-+ _SC_THREAD_PROCESS_SHARED = 66,
-+ _SC_THREAD_SAFE_FUNCTIONS = 67,
-+ _SC_TTY_NAME_MAX = 68,
-+ _SC_HOST_NAME_MAX = 69,
-+ _SC_PASS_MAX = 70,
-+ _SC_REGEXP = 71,
-+ _SC_SHELL = 72,
-+ _SC_SYMLOOP_MAX = 73,
-+
-+ /* Actually, they are not supported or implemented yet */
-+ _SC_V6_ILP32_OFF32 = 74,
-+ _SC_V6_ILP32_OFFBIG = 75,
-+ _SC_V6_LP64_OFF64 = 76,
-+ _SC_V6_LPBIG_OFFBIG = 77,
-+ _SC_2_PBS = 80,
-+ _SC_2_PBS_ACCOUNTING = 81,
-+ _SC_2_PBS_CHECKPOINT = 82,
-+ _SC_2_PBS_LOCATE = 83,
-+ _SC_2_PBS_MESSAGE = 84,
-+ _SC_2_PBS_TRACK = 85,
-+
-+ /* These are implemented */
-+ _SC_SPAWN = 86,
-+ _SC_SHARED_MEMORY_OBJECTS = 87,
-+
-+ /* Extensions found in Solaris and Linux. */
-+ _SC_PHYS_PAGES = 121,
-+
-+ /* Commonly provided sysconf() extensions */
-+ _SC_NPROCESSORS_CONF = 1001,
-+ _SC_NPROCESSORS_ONLN = 1002,
-+ /* Native variables */
-+ _SC_SCHED_RT_TS = 2001,
-+ _SC_SCHED_PRI_MIN = 2002,
-+ _SC_SCHED_PRI_MAX = 2003
-+
-+ }
-+
-+ enum _SC_PAGE_SIZE = _SC_PAGESIZE;
-+
-+ enum
-+ {
-+ _CS_PATH = 1,
-+ _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2,
-+ _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3,
-+ _CS_POSIX_V6_ILP32_OFF32_LIBS = 4,
-+ _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5,
-+ _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6,
-+ _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7,
-+ _CS_POSIX_V6_LP64_OFF64_CFLAGS = 8,
-+ _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9,
-+ _CS_POSIX_V6_LP64_OFF64_LIBS = 10,
-+ _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11,
-+ _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12,
-+ _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13,
-+ _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14,
-+ }
-+}
- else version( CRuntime_Bionic )
- {
- enum F_OK = 0;
-@@ -1428,6 +1570,31 @@ else version( DragonFlyBSD )
- {
- char* crypt(in char*, in char*);
- //char* ctermid(char*);
-+ void encrypt(ref char[64], int) @trusted;
-+ int fchdir(int) @trusted;
-+ c_long gethostid() @trusted;
-+ int getpgid(pid_t) @trusted;
-+ int getsid(pid_t) @trusted;
-+ char* getwd(char*); // LEGACY
-+ int lchown(in char*, uid_t, gid_t);
-+ int lockf(int, int, off_t) @trusted;
-+ int nice(int) @trusted;
-+ ssize_t pread(int, void*, size_t, off_t);
-+ ssize_t pwrite(int, in void*, size_t, off_t);
-+ int setpgrp(pid_t, pid_t) @trusted;
-+ int setregid(gid_t, gid_t) @trusted;
-+ int setreuid(uid_t, uid_t) @trusted;
-+ void swab(in void*, void*, ssize_t);
-+ void sync() @trusted;
-+ int truncate(in char*, off_t);
-+ useconds_t ualarm(useconds_t, useconds_t) @trusted;
-+ int usleep(useconds_t) @trusted;
-+ pid_t vfork();
-+}
-+else version( NetBSD )
-+{
-+ char* crypt(in char*, in char*);
-+ //char* ctermid(char*);
- void encrypt(ref char[64], int) @trusted;
- int fchdir(int) @trusted;
- c_long gethostid() @trusted;
diff --git a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_utime.d b/ldc/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
deleted file mode 100644
index 7f2abe9650..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/sys/posix/utime.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/sys/posix/utime.d
-@@ -65,6 +65,16 @@ else version( FreeBSD )
-
- int utime(in char*, in utimbuf*);
- }
-+else version( NetBSD )
-+{
-+ struct utimbuf
-+ {
-+ time_t actime;
-+ time_t modtime;
-+ }
-+
-+ int utime(in char*, in utimbuf*);
-+}
- else version( Solaris )
- {
- struct utimbuf
diff --git a/ldc/patches/patch-runtime_druntime_src_core_thread.d b/ldc/patches/patch-runtime_druntime_src_core_thread.d
deleted file mode 100644
index a4523a4a59..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_thread.d
+++ /dev/null
@@ -1,98 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/thread.d.orig 2018-08-23 23:29:55.000000000 +0000
-+++ runtime/druntime/src/core/thread.d
-@@ -588,7 +588,6 @@ class Thread
- // General Actions
- ///////////////////////////////////////////////////////////////////////////
-
--
- /**
- * Starts the thread and invokes the function or delegate passed upon
- * construction.
-@@ -886,6 +885,12 @@ class Thread
- */
- __gshared const int PRIORITY_DEFAULT;
-
-+ version(NetBSD)
-+ {
-+ //NetBSD does not support priority for default policy
-+ // and it is not possible change policy without root access
-+ int fakePriority = int.max;
-+ }
-
- /**
- * Gets the scheduling priority for the associated thread.
-@@ -902,6 +907,10 @@ class Thread
- {
- return GetThreadPriority( m_hndl );
- }
-+ else version(NetBSD)
-+ {
-+ return fakePriority==int.max? PRIORITY_DEFAULT : fakePriority;
-+ }
- else version( Posix )
- {
- int policy;
-@@ -966,6 +975,10 @@ class Thread
- if (priocntl(idtype_t.P_LWPID, P_MYID, PC_SETPARMS, &pcparm) == -1)
- throw new ThreadException( "Unable to set scheduling class" );
- }
-+ else version(NetBSD)
-+ {
-+ fakePriority = val;
-+ }
- else version( Posix )
- {
- static if(__traits(compiles, pthread_setschedprio))
-@@ -991,6 +1004,7 @@ class Thread
- throw new ThreadException("Unable to set thread priority");
- }
- param.sched_priority = val;
-+
- if (auto err = pthread_setschedparam(m_addr, policy, ¶m))
- {
- // ignore error if thread is not running => Bugzilla 8960
-@@ -3213,6 +3227,7 @@ nothrow:
- version (CRuntime_Glibc) int pthread_getattr_np(pthread_t thread, pthread_attr_t* attr);
- version (FreeBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
- version (DragonFlyBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
-+ version (NetBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
- version (Solaris) int thr_stksegment(stack_t* stk);
- version (CRuntime_Bionic) int pthread_getattr_np(pthread_t thid, pthread_attr_t* attr);
- }
-@@ -3351,6 +3366,17 @@ private void* getStackBottom() nothrow
- pthread_attr_destroy(&attr);
- return addr + size;
- }
-+ else version (NetBSD)
-+ {
-+ pthread_attr_t attr;
-+ void* addr; size_t size;
-+
-+ pthread_attr_init(&attr);
-+ pthread_attr_get_np(pthread_self(), &attr);
-+ pthread_attr_getstack(&attr, &addr, &size);
-+ pthread_attr_destroy(&attr);
-+ return addr + size;
-+ }
- else version (Solaris)
- {
- stack_t stk;
-@@ -3940,6 +3966,14 @@ version( LDC )
- version( ARM ) version = CheckFiberMigration;
- version( AArch64 ) version = CheckFiberMigration;
- }
-+
-+ version ( NetBSD )
-+ {
-+ version( ARM ) version = CheckFiberMigration;
-+ version( AArch64 ) version = CheckFiberMigration;
-+ version( X86 ) version = CheckFiberMigration;
-+ version( x86_64 ) version = CHeckFiberMigration;
-+ }
- }
-
- // Fiber support for SjLj style exceptions
diff --git a/ldc/patches/patch-runtime_druntime_src_core_time.d b/ldc/patches/patch-runtime_druntime_src_core_time.d
deleted file mode 100644
index c1035211e9..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_core_time.d
+++ /dev/null
@@ -1,38 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/core/time.d.orig 2016-02-13 20:02:16.000000000 +0000
-+++ runtime/druntime/src/core/time.d
-@@ -304,6 +304,13 @@ else version(FreeBSD) enum ClockType
- uptimeCoarse = 9,
- uptimePrecise = 10,
- }
-+else version(NetBSD) enum ClockType
-+{
-+ normal = 0,
-+ coarse = 2,
-+ precise = 3,
-+ second = 6,
-+}
- else version(Solaris) enum ClockType
- {
- normal = 0,
-@@ -359,6 +366,17 @@ version(Posix)
- case second: assert(0);
- }
- }
-+ else version(NetBSD)
-+ {
-+ import core.sys.netbsd.time;
-+ with(ClockType) final switch(clockType)
-+ {
-+ case coarse: return CLOCK_MONOTONIC;
-+ case normal: return CLOCK_MONOTONIC;
-+ case precise: return CLOCK_MONOTONIC;
-+ case second: assert(0);
-+ }
-+ }
- else version(Solaris)
- {
- import core.sys.solaris.time;
diff --git a/ldc/patches/patch-runtime_druntime_src_gc_os.d b/ldc/patches/patch-runtime_druntime_src_gc_os.d
deleted file mode 100644
index 36eeb1a2de..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_gc_os.d
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/gc/os.d.orig 2020-05-07 08:52:17.834676660 +0000
-+++ runtime/druntime/src/gc/os.d
-@@ -32,6 +32,7 @@ else version (Posix)
- import core.sys.posix.sys.mman;
- version (FreeBSD) import core.sys.freebsd.sys.mman : MAP_ANON;
- version (DragonFlyBSD) import core.sys.dragonflybsd.sys.mman : MAP_ANON;
-+ version (NetBSD) import core.sys.netbsd.sys.mman : MAP_ANON;
- version (CRuntime_Glibc) import core.sys.linux.sys.mman : MAP_ANON;
- version (OSX) import core.sys.osx.sys.mman : MAP_ANON;
- import core.stdc.stdlib;
diff --git a/ldc/patches/patch-runtime_druntime_src_rt_bss__section.c b/ldc/patches/patch-runtime_druntime_src_rt_bss__section.c
deleted file mode 100644
index 9b67cc9727..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_rt_bss__section.c
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/rt/bss_section.c.orig 2020-05-07 08:52:17.914676431 +0000
-+++ runtime/druntime/src/rt/bss_section.c
-@@ -10,7 +10,7 @@
- /* These symbols are defined in the linker script and bracket the
- * .bss, .lbss, .lrodata and .ldata sections.
- */
--#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
-+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
- // Need to use weak linkage to workaround a bug in ld.bfd (Bugzilla 13025).
- extern int __attribute__((weak)) __bss_start, _end;
-
diff --git a/ldc/patches/patch-runtime_druntime_src_rt_sections.d b/ldc/patches/patch-runtime_druntime_src_rt_sections.d
deleted file mode 100644
index 0fd7fd6c12..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_rt_sections.d
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/rt/sections.d.orig 2020-05-07 08:52:18.074675974 +0000
-+++ runtime/druntime/src/rt/sections.d
-@@ -18,6 +18,8 @@ else version (FreeBSD)
- public import rt.sections_elf_shared;
- else version (DragonFlyBSD)
- public import rt.sections_elf_shared;
-+else version (NetBSD)
-+ public import rt.sections_elf_shared;
- else version (Solaris)
- public import rt.sections_solaris;
- else version (OSX)
diff --git a/ldc/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d b/ldc/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
deleted file mode 100644
index 6ded5cc1fe..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
+++ /dev/null
@@ -1,67 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/rt/sections_elf_shared.d.orig 2020-05-07 08:52:18.174675688 +0000
-+++ runtime/druntime/src/rt/sections_elf_shared.d
-@@ -13,6 +13,7 @@ module rt.sections_elf_shared;
- version (CRuntime_Glibc) enum SharedELF = true;
- else version (FreeBSD) enum SharedELF = true;
- else version (DragonFlyBSD) enum SharedELF = true;
-+else version (NetBSD) enum SharedELF = true;
- else enum SharedELF = false;
- static if (SharedELF):
-
-@@ -39,6 +40,12 @@ else version (DragonFlyBSD)
- import core.sys.dragonflybsd.sys.elf;
- import core.sys.dragonflybsd.sys.link_elf;
- }
-+else version (NetBSD)
-+{
-+ import core.sys.netbsd.dlfcn;
-+ import core.sys.netbsd.sys.elf;
-+ import core.sys.netbsd.sys.link_elf;
-+}
- else
- {
- static assert(0, "unimplemented");
-@@ -123,6 +130,7 @@ __gshared bool _isRuntimeInitialized;
-
- version (FreeBSD) private __gshared void* dummy_ref;
- version (DragonFlyBSD) private __gshared void* dummy_ref;
-+version (NetBSD) private __gshared void* dummy_ref;
-
- /****
- * Gets called on program startup just before GC is initialized.
-@@ -253,6 +261,7 @@ private:
- // start of linked list for ModuleInfo references
- version (FreeBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
- version (DragonFlyBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
-+version (NetBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
-
- version (Shared)
- {
-@@ -661,6 +670,8 @@ nothrow:
- strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
- else version (DragonFlyBSD)
- strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
-+ else version (NetBSD)
-+ strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
- else
- static assert(0, "unimplemented");
- break;
-@@ -814,12 +825,14 @@ version (linux) import core.sys.linux.er
- // should be in core.sys.freebsd.stdlib
- version (FreeBSD) extern(C) const(char)* getprogname() nothrow @nogc;
- version (DragonFlyBSD) extern(C) const(char)* getprogname() nothrow @nogc;
-+version (NetBSD) extern(C) const(char)* getprogname() nothrow @nogc;
-
- @property const(char)* progname() nothrow @nogc
- {
- version (linux) return program_invocation_name;
- version (FreeBSD) return getprogname();
- version (DragonFlyBSD) return getprogname();
-+ version (NetBSD) return getprogname();
- }
-
- nothrow
diff --git a/ldc/patches/patch-runtime_druntime_src_rt_sections__ldc.d b/ldc/patches/patch-runtime_druntime_src_rt_sections__ldc.d
deleted file mode 100644
index 46709d51cf..0000000000
--- a/ldc/patches/patch-runtime_druntime_src_rt_sections__ldc.d
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/src/rt/sections_ldc.d.orig 2020-05-07 08:52:18.254675459 +0000
-+++ runtime/druntime/src/rt/sections_ldc.d
-@@ -19,6 +19,7 @@ module rt.sections_ldc;
- version (linux) {}
- else version (FreeBSD) {}
- else version (DragonFlyBSD) {}
-+else version (NetBSD) {}
- else version(LDC):
-
- import core.stdc.stdlib : alloca;
diff --git a/ldc/patches/patch-runtime_druntime_test_shared_src_load.d b/ldc/patches/patch-runtime_druntime_test_shared_src_load.d
deleted file mode 100644
index 7b8fa46ee7..0000000000
--- a/ldc/patches/patch-runtime_druntime_test_shared_src_load.d
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
-
---- runtime/druntime/test/shared/src/load.d.orig 2020-05-07 08:52:18.324675259 +0000
-+++ runtime/druntime/test/shared/src/load.d
-@@ -3,6 +3,7 @@ import core.runtime, core.stdc.stdio, co
- version (linux) import core.sys.linux.dlfcn;
- else version (FreeBSD) import core.sys.freebsd.dlfcn;
- else version (DragonFlyBSD) import core.sys.dragonflybsd.dlfcn;
-+else version (NetBSD) import core.sys.netbsd.dlfcn;
- else static assert(0, "unimplemented");
-
- void loadSym(T)(void* handle, ref T val, const char* mangle)
diff --git a/ldc/patches/patch-runtime_phobos_osmodel.mak b/ldc/patches/patch-runtime_phobos_osmodel.mak
deleted file mode 100644
index 3d93276de5..0000000000
--- a/ldc/patches/patch-runtime_phobos_osmodel.mak
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- runtime/phobos/osmodel.mak.orig 2018-08-23 23:30:04.000000000 +0000
-+++ runtime/phobos/osmodel.mak
-@@ -12,6 +12,9 @@ ifeq (,$(OS))
- ifeq (FreeBSD,$(uname_S))
- OS:=freebsd
- endif
-+ ifeq (NetBSD,$(uname_S))
-+ OS:=netbsd
-+ endif
- ifeq (OpenBSD,$(uname_S))
- OS:=openbsd
- endif
diff --git a/ldc/patches/patch-runtime_phobos_std_complex.d b/ldc/patches/patch-runtime_phobos_std_complex.d
deleted file mode 100644
index 328b37127b..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_complex.d
+++ /dev/null
@@ -1,36 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/complex.d.orig 2016-02-13 20:04:46.000000000 +0000
-+++ runtime/phobos/std/complex.d
-@@ -758,8 +758,9 @@ Complex!T sin(T)(Complex!T z) @safe pur
-
- unittest
- {
-+ import std.math: feqrel;
- assert(sin(complex(0.0)) == 0.0);
-- assert(sin(complex(2.0L, 0)) == std.math.sin(2.0L));
-+ assert(feqrel(sin(complex(2.0L, 0)).re, std.math.sin(2.0L)) > real.mant_dig-10);
- }
-
-
-@@ -776,7 +777,7 @@ unittest{
- import std.math;
- import std.complex;
- assert(cos(complex(0.0)) == 1.0);
-- assert(cos(complex(1.3L)) == std.math.cos(1.3L));
-+ assert(feqrel(cos(complex(1.3L)).re, std.math.cos(1.3L)) >= real.mant_dig-12);
- assert(cos(complex(0, 5.2L)) == cosh(5.2L));
- }
-
-@@ -801,7 +802,8 @@ unittest
- assert(expi(0.0L) == 1.0L);
- auto z1 = expi(1.234);
- auto z2 = std.math.expi(1.234);
-- assert(z1.re == z2.re && z1.im == z2.im);
-+ import std.math : approxEqual;
-+ assert(approxEqual(z1.re, z2.re) && approxEqual(z1.im, z2.im));
- }
-
-
diff --git a/ldc/patches/patch-runtime_phobos_std_conv.d b/ldc/patches/patch-runtime_phobos_std_conv.d
deleted file mode 100644
index 69783a21cb..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_conv.d
+++ /dev/null
@@ -1,25 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/conv.d.orig 2020-05-07 08:52:18.564674573 +0000
-+++ runtime/phobos/std/conv.d
-@@ -2756,7 +2756,17 @@ unittest
-
- // min and max
- real r = to!real(to!string(real.min_normal));
-- assert(to!string(r) == to!string(real.min_normal));
-+ version(NetBSD)
-+ {
-+ // NetBSD notice
-+ // to!string returns 3.3621e-4932L. It is less than real.min_normal and it is subnormal value
-+ // Simple C code
-+ // long double rd = 3.3621e-4932L;
-+ // printf("%Le\n", rd);
-+ // has unexpected result: 1.681050e-4932
-+ } else {
-+ assert(to!string(r) == to!string(real.min_normal));
-+ }
- r = to!real(to!string(real.max));
- assert(to!string(r) == to!string(real.max));
-
diff --git a/ldc/patches/patch-runtime_phobos_std_datetime.d b/ldc/patches/patch-runtime_phobos_std_datetime.d
deleted file mode 100644
index 9b0221c7db..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_datetime.d
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/datetime.d.orig 2020-05-07 08:52:18.694674201 +0000
-+++ runtime/phobos/std/datetime.d
-@@ -26532,6 +26532,7 @@ auto tz = TimeZone.getTimeZone("America/
- {
- version(FreeBSD) enum utcZone = "Etc/UTC";
- else version(DragonFlyBSD) enum utcZone = "UTC";
-+ else version(NetBSD) enum utcZone = "UTC";
- else version(linux) enum utcZone = "UTC";
- else version(OSX) enum utcZone = "UTC";
- else version(Solaris) enum utcZone = "UTC";
diff --git a/ldc/patches/patch-runtime_phobos_std_file.d b/ldc/patches/patch-runtime_phobos_std_file.d
deleted file mode 100644
index 0908076d6a..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_file.d
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/file.d.orig 2018-08-23 23:30:04.000000000 +0000
-+++ runtime/phobos/std/file.d
-@@ -1826,6 +1826,9 @@ version (OSX)
- else version (FreeBSD)
- private extern (C) int sysctl (const int* name, uint namelen, void* oldp,
- size_t* oldlenp, const void* newp, size_t newlen);
-+else version (NetBSD)
-+ private extern (C) int sysctl (const int* name, uint namelen, void* oldp,
-+ size_t* oldlenp, const void* newp, size_t newlen);
-
- /**
- * Returns the full path of the current executable.
-@@ -1899,6 +1902,10 @@ else version (FreeBSD)
- {
- return readLink("/proc/curproc/file");
- }
-+ else version (NetBSD)
-+ {
-+ return readLink("/proc/self/exe");
-+ }
- else version (Solaris)
- {
- import core.sys.posix.unistd : getpid;
diff --git a/ldc/patches/patch-runtime_phobos_std_math.d b/ldc/patches/patch-runtime_phobos_std_math.d
deleted file mode 100644
index 15ec4940b4..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_math.d
+++ /dev/null
@@ -1,91 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/math.d.orig 2018-08-23 23:30:04.000000000 +0000
-+++ runtime/phobos/std/math.d
-@@ -752,7 +752,8 @@ ireal sin(ireal y) @safe pure nothrow @n
- @safe pure nothrow @nogc unittest
- {
- assert(sin(0.0+0.0i) == 0.0);
-- assert(sin(2.0+0.0i) == sin(2.0L) );
-+ assert(sin(2.0+0.0i).im == 0.0L );
-+ assert(feqrel(sin(2.0+0.0i).re, sin(2.0L)) > real.mant_dig-10 );
- }
-
- /***********************************
-@@ -777,7 +778,8 @@ real cos(ireal y) @safe pure nothrow @no
- @safe pure nothrow @nogc unittest
- {
- assert(cos(0.0+0.0i)==1.0);
-- assert(cos(1.3L+0.0i)==cos(1.3L));
-+ assert(cos(1.3L+0.0i).im == 0.0L );
-+ assert(feqrel(cos(1.3L+0.0i).re, cos(1.3L)) >= real.mant_dig-12 );
- assert(cos(5.2Li)== cosh(5.2L));
- }
-
-@@ -1032,7 +1034,7 @@ Lret: {}
-
- unittest
- {
-- assert(equalsDigit(tan(PI / 3), std.math.sqrt(3.0), useDigits));
-+ assert(feqrel(tan(PI / 3), std.math.sqrt(3.0)) > real.mant_dig-15 );
- }
-
- /***************
-@@ -2579,7 +2581,8 @@ creal expi(real y) @trusted pure nothrow
- ///
- @safe pure nothrow @nogc unittest
- {
-- assert(expi(1.3e5L) == cos(1.3e5L) + sin(1.3e5L) * 1i);
-+ assert(feqrel(expi(1.3e5L).re, (cos(1.3e5L) + sin(1.3e5L) * 1i).re)> real.mant_dig-15);
-+ assert(feqrel(expi(1.3e5L).im, (cos(1.3e5L) + sin(1.3e5L) * 1i).im)> real.mant_dig-15);
- assert(expi(0.0L) == 1L + 0.0Li);
- }
-
-@@ -3694,8 +3697,8 @@ real log2(real x) @safe pure nothrow @no
- ///
- unittest
- {
-- // check if values are equal to 19 decimal digits of precision
-- assert(equalsDigit(log2(1024.0L), 10, 19));
-+ // check if values are equal except last 10 mantis bits
-+ assert(feqrel(log2(1024.0L), 10) > real.mant_dig-10);
- }
-
- /*****************************************
-@@ -7639,6 +7642,34 @@ private real polyImpl(real x, in real[]
- {
- asm pure nothrow @nogc // assembler by W. Bright
- {
-+ // EDX = (A.length - 1) * real.sizeof
-+ mov ECX,A[EBP] ; // ECX = A.length
-+ dec ECX ;
-+ lea EDX,[ECX*8] ;
-+ lea EDX,[EDX][ECX*4] ;
-+ add EDX,A+4[EBP] ;
-+ fld real ptr [EDX] ; // ST0 = coeff[ECX]
-+ jecxz return_ST ;
-+ fld x[EBP] ; // ST0 = x
-+ fxch ST(1) ; // ST1 = x, ST0 = r
-+ align 4 ;
-+ L2: fmul ST,ST(1) ; // r *= x
-+ fld real ptr -12[EDX] ;
-+ sub EDX,12 ; // deg--
-+ faddp ST(1),ST ;
-+ dec ECX ;
-+ jne L2 ;
-+ fxch ST(1) ; // ST1 = r, ST0 = x
-+ fstp ST(0) ; // dump x
-+ align 4 ;
-+ return_ST: ;
-+ ;
-+ }
-+ }
-+ else version (NetBSD)
-+ {
-+ asm pure nothrow @nogc // assembler by W. Bright
-+ {
- // EDX = (A.length - 1) * real.sizeof
- mov ECX,A[EBP] ; // ECX = A.length
- dec ECX ;
diff --git a/ldc/patches/patch-runtime_phobos_std_numeric.d b/ldc/patches/patch-runtime_phobos_std_numeric.d
deleted file mode 100644
index 95aac14c77..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_numeric.d
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/numeric.d.orig 2016-02-13 20:04:46.000000000 +0000
-+++ runtime/phobos/std/numeric.d
-@@ -1687,7 +1687,8 @@ unittest
- assert(sumOfLog2s(new double[0]) == 0);
- assert(sumOfLog2s([0.0L]) == -real.infinity);
- assert(sumOfLog2s([-0.0L]) == -real.infinity);
-- assert(sumOfLog2s([2.0L]) == 1);
-+ import std.math;
-+ assert(approxEqual(sumOfLog2s([2.0L]), 1));
- assert(sumOfLog2s([-2.0L]).isNaN());
- assert(sumOfLog2s([real.nan]).isNaN());
- assert(sumOfLog2s([-real.nan]).isNaN());
diff --git a/ldc/patches/patch-runtime_phobos_std_parallelism.d b/ldc/patches/patch-runtime_phobos_std_parallelism.d
deleted file mode 100644
index 9d9f683ba6..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_parallelism.d
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/parallelism.d.orig 2016-02-13 20:04:46.000000000 +0000
-+++ runtime/phobos/std/parallelism.d
-@@ -99,6 +99,11 @@ else version(FreeBSD)
- {
- version = useSysctlbyname;
- }
-+else version(NetBSD)
-+{
-+ version = useSysctlbyname;
-+}
-+
-
- version(Windows)
- {
-@@ -172,6 +177,10 @@ else version(useSysctlbyname)
- {
- auto nameStr = "hw.ncpu\0".ptr;
- }
-+ else version(NetBSD)
-+ {
-+ auto nameStr = "hw.ncpu\0".ptr;
-+ }
-
- uint ans;
- size_t len = uint.sizeof;
diff --git a/ldc/patches/patch-runtime_phobos_std_socket.d b/ldc/patches/patch-runtime_phobos_std_socket.d
deleted file mode 100644
index 9c84a3f014..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_socket.d
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/socket.d.orig 2016-02-13 20:04:46.000000000 +0000
-+++ runtime/phobos/std/socket.d
-@@ -189,6 +189,14 @@ string formatSocketError(int err) @trust
- else
- return "Socket error " ~ to!string(err);
- }
-+ else version (NetBSD)
-+ {
-+ auto errs = strerror_r(err, buf.ptr, buf.length);
-+ if (errs == 0)
-+ cs = buf.ptr;
-+ else
-+ return "Socket error " ~ to!string(err);
-+ }
- else version (Solaris)
- {
- auto errs = strerror_r(err, buf.ptr, buf.length);
diff --git a/ldc/patches/patch-runtime_phobos_std_stdio.d b/ldc/patches/patch-runtime_phobos_std_stdio.d
deleted file mode 100644
index 776b35282b..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_stdio.d
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/stdio.d.orig 2016-02-13 20:04:46.000000000 +0000
-+++ runtime/phobos/std/stdio.d
-@@ -68,6 +68,12 @@ version (FreeBSD)
- version = HAS_GETDELIM;
- }
-
-+version (NetBSD)
-+{
-+ version = GENERIC_IO;
-+ version = HAS_GETDELIM;
-+}
-+
- version (Solaris)
- {
- version = GENERIC_IO;
diff --git a/ldc/patches/patch-runtime_phobos_std_system.d b/ldc/patches/patch-runtime_phobos_std_system.d
deleted file mode 100644
index 51930f99ff..0000000000
--- a/ldc/patches/patch-runtime_phobos_std_system.d
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD$
-
-Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
-
---- runtime/phobos/std/system.d.orig 2020-05-07 08:52:19.304672455 +0000
-+++ runtime/phobos/std/system.d
-@@ -35,6 +35,7 @@ immutable
- osx, /// Mac OS X
- freeBSD, /// FreeBSD
- dragonFlyBSD, /// DragonFlyBSD
-+ netBSD, /// NetBSD
- solaris, /// Solaris
- android, /// Android
- otherPosix /// Other Posix Systems
-@@ -48,6 +49,7 @@ immutable
- else version(OSX) OS os = OS.osx;
- else version(FreeBSD) OS os = OS.freeBSD;
- else version(DragonFlyBSD) OS os = OS.dragonFlyBSD;
-+ else version(NetBSD) OS os = OS.netBSD;
- else version(Posix) OS os = OS.otherPosix;
- else static assert(0, "Unknown OS.");
-
diff --git a/ldc017/DESCR b/ldc017/DESCR
new file mode 100644
index 0000000000..79a999ac8b
--- /dev/null
+++ b/ldc017/DESCR
@@ -0,0 +1,4 @@
+The LDC project aims to provide a portable D programming language
+compiler with modern optimization and code generation capabilities.
+The compiler uses the official DMD frontend to support the latest D2
+version and relies on the LLVM Core libraries for code generation.
diff --git a/ldc017/Makefile b/ldc017/Makefile
new file mode 100644
index 0000000000..1c1b2d7522
--- /dev/null
+++ b/ldc017/Makefile
@@ -0,0 +1,39 @@
+# $NetBSD$
+
+PKGNAME= ldc-0.17.6
+PKGREVISION= 1
+DISTNAME= ${PKGNAME_NOREV}-src
+GITHUB_RELEASE= v${PKGVERSION_NOREV}
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GITHUB:=ldc-developers/}
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://github.com/ldc-developers/ldc/
+COMMENT= D compiler based on LLVM
+LICENSE= modified-bsd \
+ AND (artistic OR gnu-gpl-v1) \
+ AND (artistic OR gnu-gpl-v2 OR gnu-gpl-v3) \
+ AND gnu-lgpl-v2.1 \
+ AND modified-bsd \
+ AND boost-license
+#TODO: The modified-bsd two lines above should be
+# University of Illinois Open Source License.
+# They are similar, but I am not sure if they are equivalent.
+
+USE_CMAKE= yes
+USE_LANGUAGES= c c++
+
+CMAKE_ARGS+= -DLLVM_CONFIG=${LLVM_CONFIG_PATH}
+
+EGDIR= ${PREFIX}/share/examples/${PKGBASE}
+
+CONF_FILES= ${EGDIR}/ldc2.conf ${PKG_SYSCONFDIR}/ldc2.conf
+
+post-install:
+ ${MKDIR} -p ${DESTDIR}${EGDIR} \
+ && ${MV} ${DESTDIR}${PREFIX}/etc/ldc2.conf \
+ ${DESTDIR}${EGDIR}
+
+.include "../../wip/libLLVM38/buildlink3.mk"
+.include "../../devel/libconfig/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/ldc017/PLIST b/ldc017/PLIST
new file mode 100644
index 0000000000..72abc79d5d
--- /dev/null
+++ b/ldc017/PLIST
@@ -0,0 +1,335 @@
+@comment $NetBSD$
+bin/ldc2
+bin/ldmd2
+etc/bash_completion.d/ldc2
+include/d/core/atomic.d
+include/d/core/bitop.d
+include/d/core/checkedint.d
+include/d/core/cpuid.d
+include/d/core/demangle.d
+include/d/core/exception.d
+include/d/core/internal/convert.d
+include/d/core/internal/hash.d
+include/d/core/internal/traits.d
+include/d/core/math.d
+include/d/core/memory.d
+include/d/core/runtime.d
+include/d/core/simd.d
+include/d/core/stdc/complex.d
+include/d/core/stdc/config.d
+include/d/core/stdc/ctype.d
+include/d/core/stdc/errno.c
+include/d/core/stdc/errno.d
+include/d/core/stdc/fenv.d
+include/d/core/stdc/float_.d
+include/d/core/stdc/inttypes.d
+include/d/core/stdc/limits.d
+include/d/core/stdc/locale.d
+include/d/core/stdc/math.d
+include/d/core/stdc/signal.d
+include/d/core/stdc/stdarg.d
+include/d/core/stdc/stddef.d
+include/d/core/stdc/stdint.d
+include/d/core/stdc/stdio.d
+include/d/core/stdc/stdlib.d
+include/d/core/stdc/string.d
+include/d/core/stdc/tgmath.d
+include/d/core/stdc/time.d
+include/d/core/stdc/wchar_.d
+include/d/core/stdc/wctype.d
+include/d/core/sync/barrier.d
+include/d/core/sync/condition.d
+include/d/core/sync/config.d
+include/d/core/sync/exception.d
+include/d/core/sync/mutex.d
+include/d/core/sync/rwmutex.d
+include/d/core/sync/semaphore.d
+include/d/core/sys/dragonflybsd/dlfcn.d
+include/d/core/sys/dragonflybsd/execinfo.d
+include/d/core/sys/dragonflybsd/netinet/in_.d
+include/d/core/sys/dragonflybsd/pthread_np.d
+include/d/core/sys/dragonflybsd/sys/_bitset.d
+include/d/core/sys/dragonflybsd/sys/_cpuset.d
+include/d/core/sys/dragonflybsd/sys/cdefs.d
+include/d/core/sys/dragonflybsd/sys/elf.d
+include/d/core/sys/dragonflybsd/sys/elf32.d
+include/d/core/sys/dragonflybsd/sys/elf64.d
+include/d/core/sys/dragonflybsd/sys/elf_common.d
+include/d/core/sys/dragonflybsd/sys/event.d
+include/d/core/sys/dragonflybsd/sys/link_elf.d
+include/d/core/sys/dragonflybsd/sys/mman.d
+include/d/core/sys/dragonflybsd/time.d
+include/d/core/sys/freebsd/dlfcn.d
+include/d/core/sys/freebsd/execinfo.d
+include/d/core/sys/freebsd/sys/cdefs.d
+include/d/core/sys/freebsd/sys/elf.d
+include/d/core/sys/freebsd/sys/elf32.d
+include/d/core/sys/freebsd/sys/elf64.d
+include/d/core/sys/freebsd/sys/elf_common.d
+include/d/core/sys/freebsd/sys/event.d
+include/d/core/sys/freebsd/sys/link_elf.d
+include/d/core/sys/freebsd/sys/mman.d
+include/d/core/sys/freebsd/time.d
+include/d/core/sys/linux/config.d
+include/d/core/sys/linux/dlfcn.d
+include/d/core/sys/linux/elf.d
+include/d/core/sys/linux/epoll.d
+include/d/core/sys/linux/errno.d
+include/d/core/sys/linux/execinfo.d
+include/d/core/sys/linux/link.d
+include/d/core/sys/linux/stdio.d
+include/d/core/sys/linux/sys/inotify.d
+include/d/core/sys/linux/sys/mman.d
+include/d/core/sys/linux/sys/signalfd.d
+include/d/core/sys/linux/sys/sysinfo.d
+include/d/core/sys/linux/sys/xattr.d
+include/d/core/sys/linux/termios.d
+include/d/core/sys/linux/time.d
+include/d/core/sys/linux/tipc.d
+include/d/core/sys/osx/execinfo.d
+include/d/core/sys/osx/mach/dyld.d
+include/d/core/sys/osx/mach/getsect.d
+include/d/core/sys/osx/mach/kern_return.d
+include/d/core/sys/osx/mach/loader.d
+include/d/core/sys/osx/mach/port.d
+include/d/core/sys/osx/mach/semaphore.d
+include/d/core/sys/osx/mach/thread_act.d
+include/d/core/sys/osx/pthread.d
+include/d/core/sys/osx/sys/cdefs.d
+include/d/core/sys/osx/sys/event.d
+include/d/core/sys/osx/sys/mman.d
+include/d/core/sys/posix/arpa/inet.d
+include/d/core/sys/posix/config.d
+include/d/core/sys/posix/dirent.d
+include/d/core/sys/posix/dlfcn.d
+include/d/core/sys/posix/fcntl.d
+include/d/core/sys/posix/grp.d
+include/d/core/sys/posix/inttypes.d
+include/d/core/sys/posix/net/if_.d
+include/d/core/sys/posix/netdb.d
+include/d/core/sys/posix/netinet/in_.d
+include/d/core/sys/posix/netinet/tcp.d
+include/d/core/sys/posix/poll.d
+include/d/core/sys/posix/pthread.d
+include/d/core/sys/posix/pwd.d
+include/d/core/sys/posix/sched.d
+include/d/core/sys/posix/semaphore.d
+include/d/core/sys/posix/setjmp.d
+include/d/core/sys/posix/signal.d
+include/d/core/sys/posix/stdio.d
+include/d/core/sys/posix/stdlib.d
+include/d/core/sys/posix/sys/ioctl.d
+include/d/core/sys/posix/sys/ipc.d
+include/d/core/sys/posix/sys/mman.d
+include/d/core/sys/posix/sys/msg.d
+include/d/core/sys/posix/sys/resource.d
+include/d/core/sys/posix/sys/select.d
+include/d/core/sys/posix/sys/shm.d
+include/d/core/sys/posix/sys/socket.d
+include/d/core/sys/posix/sys/stat.d
+include/d/core/sys/posix/sys/statvfs.d
+include/d/core/sys/posix/sys/time.d
+include/d/core/sys/posix/sys/types.d
+include/d/core/sys/posix/sys/uio.d
+include/d/core/sys/posix/sys/un.d
+include/d/core/sys/posix/sys/utsname.d
+include/d/core/sys/posix/sys/wait.d
+include/d/core/sys/posix/syslog.d
+include/d/core/sys/posix/termios.d
+include/d/core/sys/posix/time.d
+include/d/core/sys/posix/ucontext.d
+include/d/core/sys/posix/unistd.d
+include/d/core/sys/posix/utime.d
+include/d/core/sys/solaris/dlfcn.d
+include/d/core/sys/solaris/elf.d
+include/d/core/sys/solaris/execinfo.d
+include/d/core/sys/solaris/libelf.d
+include/d/core/sys/solaris/link.d
+include/d/core/sys/solaris/sys/elf.d
+include/d/core/sys/solaris/sys/elf_386.d
+include/d/core/sys/solaris/sys/elf_SPARC.d
+include/d/core/sys/solaris/sys/elf_amd64.d
+include/d/core/sys/solaris/sys/elf_notes.d
+include/d/core/sys/solaris/sys/elftypes.d
+include/d/core/sys/solaris/sys/link.d
+include/d/core/sys/solaris/sys/priocntl.d
+include/d/core/sys/solaris/sys/procset.d
+include/d/core/sys/solaris/sys/types.d
+include/d/core/sys/solaris/time.d
+include/d/core/sys/windows/com.d
+include/d/core/sys/windows/dbghelp.d
+include/d/core/sys/windows/dll.d
+include/d/core/sys/windows/stacktrace.d
+include/d/core/sys/windows/stat.d
+include/d/core/sys/windows/threadaux.d
+include/d/core/sys/windows/windows.d
+include/d/core/sys/windows/winsock2.d
+include/d/core/thread.d
+include/d/core/threadasm.S
+include/d/core/time.d
+include/d/core/vararg.d
+include/d/etc/c/curl.d
+include/d/etc/c/odbc/sql.d
+include/d/etc/c/odbc/sqlext.d
+include/d/etc/c/odbc/sqltypes.d
+include/d/etc/c/odbc/sqlucode.d
+include/d/etc/c/sqlite3.d
+include/d/etc/c/zlib.d
+include/d/etc/linux/memoryerror.d
+include/d/ldc/arm_unwind.c
+include/d/ldc/arrayinit.d
+include/d/ldc/attributes.d
+include/d/ldc/eh/common.d
+include/d/ldc/eh/fixedpool.d
+include/d/ldc/eh/libunwind.d
+include/d/ldc/eh/win32.d
+include/d/ldc/eh/win64.d
+include/d/ldc/eh_asm.S
+include/d/ldc/gccbuiltins_aarch64.di
+include/d/ldc/internal/vararg.di
+include/d/ldc/intrinsics.di
+include/d/ldc/llvmasm.di
+include/d/ldc/msvc.c
+include/d/ldc/object.d
+include/d/ldc/osx_tls.c
+include/d/ldc/simd.di
+include/d/std/algorithm/comparison.d
+include/d/std/algorithm/internal.d
+include/d/std/algorithm/iteration.d
+include/d/std/algorithm/mutation.d
+include/d/std/algorithm/package.d
+include/d/std/algorithm/searching.d
+include/d/std/algorithm/setops.d
+include/d/std/algorithm/sorting.d
+include/d/std/array.d
+include/d/std/ascii.d
+include/d/std/base64.d
+include/d/std/bigint.d
+include/d/std/bitmanip.d
+include/d/std/c/fenv.d
+include/d/std/c/freebsd/socket.d
+include/d/std/c/linux/linux.d
+include/d/std/c/linux/linuxextern.d
+include/d/std/c/linux/pthread.d
+include/d/std/c/linux/socket.d
+include/d/std/c/linux/termios.d
+include/d/std/c/linux/tipc.d
+include/d/std/c/locale.d
+include/d/std/c/math.d
+include/d/std/c/osx/socket.d
+include/d/std/c/process.d
+include/d/std/c/stdarg.d
+include/d/std/c/stddef.d
+include/d/std/c/stdio.d
+include/d/std/c/stdlib.d
+include/d/std/c/string.d
+include/d/std/c/time.d
+include/d/std/c/wcharh.d
+include/d/std/c/windows/com.d
+include/d/std/c/windows/stat.d
+include/d/std/c/windows/windows.d
+include/d/std/c/windows/winsock.d
+include/d/std/compiler.d
+include/d/std/complex.d
+include/d/std/concurrency.d
+include/d/std/container/array.d
+include/d/std/container/binaryheap.d
+include/d/std/container/dlist.d
+include/d/std/container/package.d
+include/d/std/container/rbtree.d
+include/d/std/container/slist.d
+include/d/std/container/util.d
+include/d/std/conv.d
+include/d/std/cstream.d
+include/d/std/csv.d
+include/d/std/datetime.d
+include/d/std/demangle.d
+include/d/std/digest/crc.d
+include/d/std/digest/digest.d
+include/d/std/digest/md.d
+include/d/std/digest/ripemd.d
+include/d/std/digest/sha.d
+include/d/std/encoding.d
+include/d/std/exception.d
+include/d/std/experimental/logger/core.d
+include/d/std/experimental/logger/filelogger.d
+include/d/std/experimental/logger/multilogger.d
+include/d/std/experimental/logger/nulllogger.d
+include/d/std/experimental/logger/package.d
+include/d/std/file.d
+include/d/std/format.d
+include/d/std/functional.d
+include/d/std/getopt.d
+include/d/std/internal/cstring.d
+include/d/std/internal/digest/sha_SSSE3.d
+include/d/std/internal/math/biguintcore.d
+include/d/std/internal/math/biguintnoasm.d
+include/d/std/internal/math/biguintx86.d
+include/d/std/internal/math/errorfunction.d
+include/d/std/internal/math/gammafunction.d
+include/d/std/internal/processinit.d
+include/d/std/internal/scopebuffer.d
+include/d/std/internal/test/dummyrange.d
+include/d/std/internal/unicode_comp.d
+include/d/std/internal/unicode_decomp.d
+include/d/std/internal/unicode_grapheme.d
+include/d/std/internal/unicode_norm.d
+include/d/std/internal/unicode_tables.d
+include/d/std/internal/windows/advapi32.d
+include/d/std/json.d
+include/d/std/math.d
+include/d/std/mathspecial.d
+include/d/std/meta.d
+include/d/std/metastrings.d
+include/d/std/mmfile.d
+include/d/std/net/curl.d
+include/d/std/net/isemail.d
+include/d/std/numeric.d
+include/d/std/outbuffer.d
+include/d/std/parallelism.d
+include/d/std/path.d
+include/d/std/process.d
+include/d/std/random.d
+include/d/std/range/interfaces.d
+include/d/std/range/package.d
+include/d/std/range/primitives.d
+include/d/std/regex/internal/backtracking.d
+include/d/std/regex/internal/generator.d
+include/d/std/regex/internal/ir.d
+include/d/std/regex/internal/kickstart.d
+include/d/std/regex/internal/parser.d
+include/d/std/regex/internal/tests.d
+include/d/std/regex/internal/thompson.d
+include/d/std/regex/package.d
+include/d/std/signals.d
+include/d/std/socket.d
+include/d/std/socketstream.d
+include/d/std/stdint.d
+include/d/std/stdio.d
+include/d/std/stdiobase.d
+include/d/std/stream.d
+include/d/std/string.d
+include/d/std/syserror.d
+include/d/std/system.d
+include/d/std/traits.d
+include/d/std/typecons.d
+include/d/std/typelist.d
+include/d/std/typetuple.d
+include/d/std/uni.d
+include/d/std/uri.d
+include/d/std/utf.d
+include/d/std/uuid.d
+include/d/std/variant.d
+include/d/std/windows/charset.d
+include/d/std/windows/iunknown.d
+include/d/std/windows/registry.d
+include/d/std/windows/syserror.d
+include/d/std/xml.d
+include/d/std/zip.d
+include/d/std/zlib.d
+lib/libdruntime-ldc-debug.a
+lib/libdruntime-ldc.a
+lib/libphobos2-ldc-debug.a
+lib/libphobos2-ldc.a
+share/examples/ldc/ldc2.conf
+@pkgdir include/d/etc/c/zlib
diff --git a/ldc017/distinfo b/ldc017/distinfo
new file mode 100644
index 0000000000..bc42425a8a
--- /dev/null
+++ b/ldc017/distinfo
@@ -0,0 +1,74 @@
+$NetBSD$
+
+SHA1 (ldc-0.17.6-src.tar.gz) = b702484fc38feded05e5f42c34ce66d0d14db139
+RMD160 (ldc-0.17.6-src.tar.gz) = 2e77c5c50fef02c6d6ae912dad478d3043389560
+SHA512 (ldc-0.17.6-src.tar.gz) = 433a3582bb5214004a676741d7483ed87066b47b8bfec4633796ca5a717c78ea54ee7b9c2ce1cf7bc399082802f15133d28cb4884b879326d224f48687af68e3
+Size (ldc-0.17.6-src.tar.gz) = 4986528 bytes
+SHA1 (patch-runtime_CMakeLists.txt) = a3521c5d824e9d832ed3b183147ff6c9050d2b4a
+SHA1 (patch-runtime_druntime_osmodel.mak) = 547cec590e69a96909894361affc464b250ceb7d
+SHA1 (patch-runtime_druntime_src_core_runtime.d) = cade769b1da2d7abe71533cc85bafffc06938046
+SHA1 (patch-runtime_druntime_src_core_stdc_errno.d) = 55e14f8d16928f97a03d6a45858d9dfa873f9094
+SHA1 (patch-runtime_druntime_src_core_stdc_fenv.d) = 1c9ac3e39e6539f6468cdece973f5ac4a4151c0e
+SHA1 (patch-runtime_druntime_src_core_stdc_locale.d) = cb0d3424dfbe61570e446ea04d1298bba5123f83
+SHA1 (patch-runtime_druntime_src_core_stdc_math.d) = 575c6169f92c72ba1bac9a3a0775467f090f19b2
+SHA1 (patch-runtime_druntime_src_core_stdc_stdio.d) = bde2de27d32a24513871cc6d06f1e0cea4db0933
+SHA1 (patch-runtime_druntime_src_core_stdc_stdlib.d) = 5c4815141e1ffd5b2033524d3cf11fd423379afd
+SHA1 (patch-runtime_druntime_src_core_stdc_string.d) = 7b32050fbc38700ec9b258f4c7ed497ed8d6cde2
+SHA1 (patch-runtime_druntime_src_core_stdc_tgmath.d) = 4d8945b639362035b9bc45d325e50291e77a0eaa
+SHA1 (patch-runtime_druntime_src_core_stdc_time.d) = 949dd115a983c378c411e205c0d5f4d5e7d295eb
+SHA1 (patch-runtime_druntime_src_core_sys_posix_arpa_inet.d) = 2cf8ad42ebae1a238b2e11daab7daddde1b908f1
+SHA1 (patch-runtime_druntime_src_core_sys_posix_dirent.d) = 2355ef250f2401a6542b6a9ff5df5362520f4eeb
+SHA1 (patch-runtime_druntime_src_core_sys_posix_dlfcn.d) = 10e243b140b50fddd2304f343a28d778fca4ee75
+SHA1 (patch-runtime_druntime_src_core_sys_posix_fcntl.d) = bfab0d7bdfc9a55795668884aac77fac7f9b9e3b
+SHA1 (patch-runtime_druntime_src_core_sys_posix_grp.d) = 9fe4d406ed4b49b9291900934e287bf95c9824d4
+SHA1 (patch-runtime_druntime_src_core_sys_posix_net_if__.d) = 56ccad60f480a0052224b07978050057174724c1
+SHA1 (patch-runtime_druntime_src_core_sys_posix_netdb.d) = 028ad42939529e2d6c2bed61cf07dbb44c8c68c3
+SHA1 (patch-runtime_druntime_src_core_sys_posix_netinet_in__.d) = 73177953d3f720762690312f3914d389081a5e66
+SHA1 (patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d) = cef34601e8c65692a828ced8b0ccdc381611d4c8
+SHA1 (patch-runtime_druntime_src_core_sys_posix_poll.d) = ba528e4bc0bc6437cd537d17abe6a7eea69b1adf
+SHA1 (patch-runtime_druntime_src_core_sys_posix_pthread.d) = 652e533f8b484ba440c507df17351de21291de43
+SHA1 (patch-runtime_druntime_src_core_sys_posix_pwd.d) = 9be61a4dc40f7f6aed896d34a99e3c69e317fe3c
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sched.d) = 31575d0885a7f778e24698e5246e79687d27c534
+SHA1 (patch-runtime_druntime_src_core_sys_posix_semaphore.d) = 543678a528f1ac31f0413086971e15860ef4860a
+SHA1 (patch-runtime_druntime_src_core_sys_posix_setjmp.d) = ff1cc78d36171e2ec510a0328653edbd015fbc40
+SHA1 (patch-runtime_druntime_src_core_sys_posix_signal.d) = ea412381a7a239877a90d379a219bde5926ce7a1
+SHA1 (patch-runtime_druntime_src_core_sys_posix_stdio.d) = 4ed539032bcf8fb4626e9b1933e01c82afbe4476
+SHA1 (patch-runtime_druntime_src_core_sys_posix_stdlib.d) = 82d9dbf6dbb2970e87b78f6f29567b87da83e21e
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d) = 5cbe309208ce02b0e2b39fc8794452c16fc905d6
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_ipc.d) = b3f63a86b25104cf281927993f119c42e0729cc3
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_mman.d) = ecdd0d0caedd9d268e1784318db9f46cca4c683d
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_resource.d) = cdf348a19e93d60bece85f2df176042b317f0929
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_select.d) = 5a8c8a580f6fd79ad81d98ce2a7e0eaefce67c8b
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_shm.d) = 0e3c3c2bd97d9d1053aba468db1580566d93733e
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_socket.d) = 4d18fe407850b77e8d1ce5de48c02d6439b5d4b6
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_stat.d) = dd8f7735a59bab989c3d26a28d7dca15a86b70a0
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_time.d) = c162669540f8cceb9e3cae943cc9047d85a8e12d
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_uio.d) = 313aa166c0905d5230a9d54322b79bd47d2b7181
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_un.d) = 267e89401dfe63c64d81292d87e9d2a01aab4d11
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_utsname.d) = 30092b5586b66f3b5da4623ae51829af66fd837d
+SHA1 (patch-runtime_druntime_src_core_sys_posix_sys_wait.d) = f77e2fd7c73d25669021669596a83ac567e93983
+SHA1 (patch-runtime_druntime_src_core_sys_posix_syslog.d) = 04da01b67b6248fdbad4d7e3a8f05c11fabfdcab
+SHA1 (patch-runtime_druntime_src_core_sys_posix_termios.d) = 75406c3e698d3cc89a5bea48a1fc0f7215ffbc37
+SHA1 (patch-runtime_druntime_src_core_sys_posix_time.d) = aa3f5090c798096f838f21acf819747485130129
+SHA1 (patch-runtime_druntime_src_core_sys_posix_ucontext.d) = 07801bd15648a0f0bd76dad4763768addbc6261e
+SHA1 (patch-runtime_druntime_src_core_sys_posix_unistd.d) = f3cb6cbd02f0cad76460faa1293247199794bbd7
+SHA1 (patch-runtime_druntime_src_core_sys_posix_utime.d) = 2099425c3687f79d945103029432499368ea209b
+SHA1 (patch-runtime_druntime_src_core_thread.d) = 61230088ba3327b6e98573d9edca1af82035e634
+SHA1 (patch-runtime_druntime_src_core_time.d) = bf3555fcc057b0e3b76a3a9cd265137cdeec90d0
+SHA1 (patch-runtime_druntime_src_gc_os.d) = 4ffdfe958a2a42d832828fb85817fbaea2ef94fe
+SHA1 (patch-runtime_druntime_src_rt_bss__section.c) = fdd58f4255abc77f68eb9203df5a7951235c0871
+SHA1 (patch-runtime_druntime_src_rt_sections.d) = 72a0e4a3afc7fc36bd79f20793347ffd4906569d
+SHA1 (patch-runtime_druntime_src_rt_sections__elf__shared.d) = 1bb42fa3b890c7befefdb535481afa8904558d68
+SHA1 (patch-runtime_druntime_src_rt_sections__ldc.d) = c41ae450fcb85b40040d208d1328da0f7cb1ac1d
+SHA1 (patch-runtime_druntime_test_shared_src_load.d) = 804c00808e2e32d12834412d61ca5139d449f16c
+SHA1 (patch-runtime_phobos_osmodel.mak) = 075d6bdec960fa7c1de1db57df671d951479a9cb
+SHA1 (patch-runtime_phobos_std_complex.d) = d559b11fe05bdceaf1306591f76f6a737a23ac65
+SHA1 (patch-runtime_phobos_std_conv.d) = ae959c9db96c693dfd3a2e1de38572b7e7c4edc7
+SHA1 (patch-runtime_phobos_std_datetime.d) = a14f6f093737969dde0f8bb98d98bf7faadd6328
+SHA1 (patch-runtime_phobos_std_file.d) = 5d302b37936210a34b057184fa7bd7dffcdafacf
+SHA1 (patch-runtime_phobos_std_math.d) = c80ad1bc880e69ce6876e0e309ed511eb704c166
+SHA1 (patch-runtime_phobos_std_numeric.d) = cae1a1ea5576f7a035c7a4823cf5b190a79b3c9e
+SHA1 (patch-runtime_phobos_std_parallelism.d) = f5a6a8613178fd8531a15941a85b38085c29145b
+SHA1 (patch-runtime_phobos_std_socket.d) = 9dd63f526c89b81e80c4bc839a2ed7563602af9d
+SHA1 (patch-runtime_phobos_std_stdio.d) = dc0602eaa116c9da6706b7d89902f5783e75aefc
+SHA1 (patch-runtime_phobos_std_system.d) = 52292a046f338630962b3c700c717b32d4cc3a0c
diff --git a/ldc017/patches/patch-runtime_CMakeLists.txt b/ldc017/patches/patch-runtime_CMakeLists.txt
new file mode 100644
index 0000000000..85a5849204
--- /dev/null
+++ b/ldc017/patches/patch-runtime_CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- runtime/CMakeLists.txt.orig 2018-08-23 23:29:39.000000000 +0000
++++ runtime/CMakeLists.txt
+@@ -575,7 +575,7 @@ set(DRUNTIME_PACKAGES core etc ldc)
+
+ install(FILES ${RUNTIME_DIR}/src/object.d DESTINATION ${INCLUDE_INSTALL_DIR}/ldc)
+ foreach(p ${DRUNTIME_PACKAGES})
+- install(DIRECTORY ${RUNTIME_DIR}/src/${p} DESTINATION ${INCLUDE_INSTALL_DIR})
++ install(DIRECTORY ${RUNTIME_DIR}/src/${p} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT copy-files PATTERN "*.orig" EXCLUDE)
+ endforeach()
+ if(PHOBOS2_DIR)
+ install(DIRECTORY ${PHOBOS2_DIR}/std DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.d")
diff --git a/ldc017/patches/patch-runtime_druntime_osmodel.mak b/ldc017/patches/patch-runtime_druntime_osmodel.mak
new file mode 100644
index 0000000000..53b93b090c
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_osmodel.mak
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- runtime/druntime/osmodel.mak.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/osmodel.mak
+@@ -15,6 +15,9 @@ ifeq (,$(OS))
+ ifeq (OpenBSD,$(uname_S))
+ OS:=openbsd
+ endif
++ ifeq (NetBSD,$(uname_S))
++ OS:=netbsd
++ endif
+ ifeq (Solaris,$(uname_S))
+ OS:=solaris
+ endif
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_runtime.d b/ldc017/patches/patch-runtime_druntime_src_core_runtime.d
new file mode 100644
index 0000000000..bbeaa13401
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_runtime.d
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/runtime.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/runtime.d
+@@ -666,6 +666,18 @@ Throwable.TraceInfo defaultTraceHandler(
+ symEnd = eptr - buf.ptr;
+ }
+ }
++ else version( NetBSD )
++ {
++ // format is: 0x00000000 <_D6module4funcAFZv+0x78> at module
++ auto bptr = cast(char*) memchr( buf.ptr, '<', buf.length );
++ auto eptr = cast(char*) memchr( buf.ptr, '+', buf.length );
++
++ if( bptr++ && eptr )
++ {
++ symBeg = bptr - buf.ptr;
++ symEnd = eptr - buf.ptr;
++ }
++ }
+ else version( Solaris )
+ {
+ // format is object'symbol+offset [pc]
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_errno.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_errno.d
new file mode 100644
index 0000000000..f9bce6567c
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_errno.d
@@ -0,0 +1,143 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/stdc/errno.d.orig 2020-05-07 08:52:13.684688490 +0000
++++ runtime/druntime/src/core/stdc/errno.d
+@@ -1414,6 +1414,138 @@ else version( DragonFlyBSD )
+ enum EASYNC = 99;
+ enum ELAST = 99;
+ }
++else version (NetBSD)
++{
++ enum EPERM = 1 /** Operation not permitted */;
++ enum ENOENT = 2 /** No such file or directory */;
++ enum ESRCH = 3 /** No such process */;
++ enum EINTR = 4 /** Interrupted system call */;
++ enum EIO = 5 /** Input/output error */;
++ enum ENXIO = 6 /** Device not configured */;
++ enum E2BIG = 7 /** Argument list too long */;
++ enum ENOEXEC = 8 /** Exec format error */;
++ enum EBADF = 9 /** Bad file descriptor */;
++ enum ECHILD = 10 /** No child processes */;
++ enum EDEADLK = 11 /** Resource deadlock avoided */;
++ /* 11 was EAGAIN */
++ enum ENOMEM = 12 /** Cannot allocate memory */;
++ enum EACCES = 13 /** Permission denied */;
++ enum EFAULT = 14 /** Bad address */;
++ enum ENOTBLK = 15 /** Block device required */;
++ enum EBUSY = 16 /** Device busy */;
++ enum EEXIST = 17 /** File exists */;
++ enum EXDEV = 18 /** Cross-device link */;
++ enum ENODEV = 19 /** Operation not supported by device */;
++ enum ENOTDIR = 20 /** Not a directory */;
++ enum EISDIR = 21 /** Is a directory */;
++ enum EINVAL = 22 /** Invalid argument */;
++ enum ENFILE = 23 /** Too many open files in system */;
++ enum EMFILE = 24 /** Too many open files */;
++ enum ENOTTY = 25 /** Inappropriate ioctl for device */;
++ enum ETXTBSY = 26 /** Text file busy */;
++ enum EFBIG = 27 /** File too large */;
++ enum ENOSPC = 28 /** No space left on device */;
++ enum ESPIPE = 29 /** Illegal seek */;
++ enum EROFS = 30 /** Read-only file system */;
++ enum EMLINK = 31 /** Too many links */;
++ enum EPIPE = 32 /** Broken pipe */;
++ /* math software */
++ enum EDOM = 33 /** Numerical argument out of domain */;
++ enum ERANGE = 34 /** Result too large or too small */;
++
++ /* non-blocking and interrupt i/o */
++ enum EAGAIN = 35 /** Resource temporarily unavailable */;
++ enum EWOULDBLOCK = EAGAIN /** Operation would block */;
++ enum EINPROGRESS = 36 /** Operation now in progress */;
++ enum EALREADY = 37 /** Operation already in progress */;
++
++ /* ipc/network software -- argument errors */
++ enum ENOTSOCK = 38 /** Socket operation on non-socket */;
++ enum EDESTADDRREQ = 39 /** Destination address required */;
++ enum EMSGSIZE = 40 /** Message too long */;
++ enum EPROTOTYPE = 41 /** Protocol wrong type for socket */;
++ enum ENOPROTOOPT = 42 /** Protocol option not available */;
++ enum EPROTONOSUPPORT = 43 /** Protocol not supported */;
++ enum ESOCKTNOSUPPORT = 44 /** Socket type not supported */;
++ enum EOPNOTSUPP = 45 /** Operation not supported */;
++ enum EPFNOSUPPORT = 46 /** Protocol family not supported */;
++ enum EAFNOSUPPORT = 47 /** Address family not supported by protocol family */;
++ enum EADDRINUSE = 48 /** Address already in use */;
++ enum EADDRNOTAVAIL = 49 /** Can't assign requested address */;
++
++ /* ipc/network software -- operational errors */
++ enum ENETDOWN = 50 /** Network is down */;
++ enum ENETUNREACH = 51 /** Network is unreachable */;
++ enum ENETRESET = 52 /** Network dropped connection on reset */;
++ enum ECONNABORTED = 53 /** Software caused connection abort */;
++ enum ECONNRESET = 54 /** Connection reset by peer */;
++ enum ENOBUFS = 55 /** No buffer space available */;
++ enum EISCONN = 56 /** Socket is already connected */;
++ enum ENOTCONN = 57 /** Socket is not connected */;
++ enum ESHUTDOWN = 58 /** Can't send after socket shutdown */;
++ enum ETOOMANYREFS = 59 /** Too many references: can't splice */;
++ enum ETIMEDOUT = 60 /** Operation timed out */;
++ enum ECONNREFUSED = 61 /** Connection refused */;
++ enum ELOOP = 62 /** Too many levels of symbolic links */;
++ enum ENAMETOOLONG = 63 /** File name too long */;
++
++ /* should be rearranged */
++ enum EHOSTDOWN = 64 /** Host is down */;
++ enum EHOSTUNREACH = 65 /** No route to host */;
++ enum ENOTEMPTY = 66 /** Directory not empty */;
++
++ /* quotas & mush */
++ enum EPROCLIM = 67 /** Too many processes */;
++ enum EUSERS = 68 /** Too many users */;
++ enum EDQUOT = 69 /** Disc quota exceeded */;
++
++ /* Network File System */
++ enum ESTALE = 70 /** Stale NFS file handle */;
++ enum EREMOTE = 71 /** Too many levels of remote in path */;
++ enum EBADRPC = 72 /** RPC struct is bad */;
++ enum ERPCMISMATCH = 73 /** RPC version wrong */;
++ enum EPROGUNAVAIL = 74 /** RPC prog. not avail */;
++ enum EPROGMISMATCH = 75 /** Program version wrong */;
++ enum EPROCUNAVAIL = 76 /** Bad procedure for program */;
++
++ enum ENOLCK = 77 /** No locks available */;
++ enum ENOSYS = 78 /** Function not implemented */;
++
++ enum EFTYPE = 79 /** Inappropriate file type or format */;
++ enum EAUTH = 80 /** Authentication error */;
++ enum ENEEDAUTH = 81 /** Need authenticator */;
++
++ /* SystemV IPC */
++ enum EIDRM = 82 /** Identifier removed */;
++ enum ENOMSG = 83 /** No message of desired type */;
++ enum EOVERFLOW = 84 /** Value too large to be stored in data type */;
++ /* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */
++ enum EILSEQ = 85 /** Illegal byte sequence */;
++
++ /* From IEEE Std 1003.1-2001 */
++ /* Base, Realtime, Threads or Thread Priority Scheduling option errors */
++ enum ENOTSUP = 86 /** Not supported */;
++
++ /* Realtime option errors */
++ enum ECANCELED = 87 /** Operation canceled */;
++
++ /* Realtime, XSI STREAMS option errors */
++ enum EBADMSG = 88 /** Bad or Corrupt message */;
++
++ /* XSI STREAMS option errors */
++ enum ENODATA = 89 /** No message available */;
++ enum ENOSR = 90 /** No STREAM resources */;
++ enum ENOSTR = 91 /** Not a STREAM */;
++ enum ETIME = 92 /** STREAM ioctl timeout */;
++
++ /* File system extended attribute errors */
++ enum ENOATTR = 93 /** Attribute not found */;
++
++ /* Realtime, XSI STREAMS option errors */
++ enum EMULTIHOP = 94 /** Multihop attempted */;
++ enum ENOLINK = 95 /** Link has been severed */;
++ enum EPROTO = 96 /** Protocol error */;
++}
+ else version (Solaris)
+ {
+ enum EPERM = 1 /** Not super-user */;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_fenv.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_fenv.d
new file mode 100644
index 0000000000..67a163d267
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_fenv.d
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/stdc/fenv.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/stdc/fenv.d
+@@ -338,6 +338,12 @@ else version( DragonFlyBSD )
+ ///
+ enum FE_DFL_ENV = &__fe_dfl_env;
+ }
++else version( NetBSD )
++{
++ private extern const fenv_t __fe_dfl_env;
++ ///
++ enum FE_DFL_ENV = &__fe_dfl_env;
++}
+ else version( CRuntime_Bionic )
+ {
+ private extern const fenv_t __fe_dfl_env;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_locale.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_locale.d
new file mode 100644
index 0000000000..7dc7e1386d
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_locale.d
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/stdc/locale.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/stdc/locale.d
+@@ -126,6 +126,23 @@ else version(FreeBSD)
+ ///
+ enum LC_MESSAGES = 6;
+ }
++else version(NetBSD)
++{
++ ///
++ enum LC_ALL = 0;
++ ///
++ enum LC_COLLATE = 1;
++ ///
++ enum LC_CTYPE = 2;
++ ///
++ enum LC_MONETARY = 3;
++ ///
++ enum LC_NUMERIC = 4;
++ ///
++ enum LC_TIME = 5;
++ ///
++ enum LC_MESSAGES = 6;
++}
+ else version(Solaris)
+ {
+ enum LC_CTYPE = 0;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_math.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_math.d
new file mode 100644
index 0000000000..a4f8eed327
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_math.d
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/stdc/math.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/stdc/math.d
+@@ -52,6 +52,13 @@ else version (DragonFlyBSD)
+ ///
+ enum int FP_ILOGBNAN = int.max;
+ }
++version ( NetBSD )
++{
++ ///
++ enum int FP_ILOGB0 = -int.max;
++ ///
++ enum int FP_ILOGBNAN = int.max;
++}
+ else version (CRuntime_Bionic)
+ {
+ ///
+@@ -1521,7 +1528,7 @@ else version( FreeBSD )
+ }
+ else
+ {
+- ///
++ ///
+ real acosl(real x);
+ ///
+ real asinl(real x);
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdio.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdio.d
new file mode 100644
index 0000000000..a38cbaec64
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdio.d
@@ -0,0 +1,53 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/stdc/stdio.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/stdc/stdio.d
+@@ -29,6 +29,10 @@ private
+ {
+ import core.sys.posix.sys.types;
+ }
++ version (NetBSD)
++ {
++ import core.sys.posix.sys.types;
++ }
+ }
+
+ extern (C):
+@@ -209,6 +213,37 @@ else version ( DragonFlyBSD )
+ long _mbstateL;
+ }
+ }
++else version ( NetBSD )
++{
++ enum
++ {
++ ///
++ BUFSIZ = 1024,
++ ///
++ EOF = -1,
++ ///
++ FOPEN_MAX = 20,
++ ///
++ FILENAME_MAX = 1024,
++ ///
++ TMP_MAX = 308915776,
++ ///
++ L_tmpnam = 1024
++ }
++
++ struct __sbuf
++ {
++ ubyte *_base;
++ int _size;
++ }
++
++ union __mbstate_t // <sys/_types.h>
++ {
++ char[128] _mbstate8;
++ long _mbstateL;
++ }
++}
++
+ else version (Solaris)
+ {
+ enum
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdlib.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
new file mode 100644
index 0000000000..0e3d92a2a5
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_stdlib.d
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/stdc/stdlib.d.orig 2020-05-07 08:52:13.934687779 +0000
++++ runtime/druntime/src/core/stdc/stdlib.d
+@@ -67,6 +67,7 @@ else version(CRuntime_Glibc) enum RAND_
+ else version(OSX) enum RAND_MAX = 0x7fffffff;
+ else version(FreeBSD) enum RAND_MAX = 0x7fffffff;
+ else version(DragonFlyBSD) enum RAND_MAX = 0x7fffffff;
++else version(NetBSD) enum RAND_MAX = 0x7fffffff;
+ else version(Solaris) enum RAND_MAX = 0x7fff;
+ else version(CRuntime_Bionic) enum RAND_MAX = 0x7fffffff;
+ else static assert( false, "Unsupported platform" );
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_string.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_string.d
new file mode 100644
index 0000000000..d0ccf84536
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_string.d
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/stdc/string.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/stdc/string.d
+@@ -80,6 +80,10 @@ else version (FreeBSD)
+ {
+ int strerror_r(int errnum, char* buf, size_t buflen);
+ }
++else version (NetBSD)
++{
++ int strerror_r(int errnum, char* buf, size_t buflen);
++}
+ else version (Solaris)
+ {
+ int strerror_r(int errnum, char* buf, size_t buflen);
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_tgmath.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
new file mode 100644
index 0000000000..9c1aff8b77
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_tgmath.d
@@ -0,0 +1,561 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/stdc/tgmath.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/stdc/tgmath.d
+@@ -571,6 +571,554 @@ version( FreeBSD )
+ // alias core.stdc.complex.crealf creal;
+ // alias core.stdc.complex.creall creal;
+ }
++version( NetBSD )
++{
++ ///
++ alias core.stdc.math.acos acos;
++ ///
++ alias core.stdc.math.acosf acos;
++ ///
++ alias core.stdc.math.acosl acos;
++
++ ///
++ alias core.stdc.complex.cacos acos;
++ ///
++ alias core.stdc.complex.cacosf acos;
++ ///
++ alias core.stdc.complex.cacosl acos;
++
++ ///
++ alias core.stdc.math.asin asin;
++ ///
++ alias core.stdc.math.asinf asin;
++ ///
++ alias core.stdc.math.asinl asin;
++
++ ///
++ alias core.stdc.complex.casin asin;
++ ///
++ alias core.stdc.complex.casinf asin;
++ ///
++ alias core.stdc.complex.casinl asin;
++
++ ///
++ alias core.stdc.math.atan atan;
++ ///
++ alias core.stdc.math.atanf atan;
++ ///
++ alias core.stdc.math.atanl atan;
++
++ ///
++ alias core.stdc.complex.catan atan;
++ ///
++ alias core.stdc.complex.catanf atan;
++ ///
++ alias core.stdc.complex.catanl atan;
++
++ ///
++ alias core.stdc.math.atan2 atan2;
++ ///
++ alias core.stdc.math.atan2f atan2;
++ ///
++ alias core.stdc.math.atan2l atan2;
++
++ ///
++ alias core.stdc.math.cos cos;
++ ///
++ alias core.stdc.math.cosf cos;
++ ///
++ alias core.stdc.math.cosl cos;
++
++ ///
++ alias core.stdc.complex.ccos cos;
++ ///
++ alias core.stdc.complex.ccosf cos;
++ ///
++ alias core.stdc.complex.ccosl cos;
++
++ ///
++ alias core.stdc.math.sin sin;
++ ///
++ alias core.stdc.math.sinf sin;
++ ///
++ alias core.stdc.math.sinl sin;
++
++ ///
++ alias core.stdc.complex.csin csin;
++ ///
++ alias core.stdc.complex.csinf csin;
++ ///
++ alias core.stdc.complex.csinl csin;
++
++ ///
++ alias core.stdc.math.tan tan;
++ ///
++ alias core.stdc.math.tanf tan;
++ ///
++ alias core.stdc.math.tanl tan;
++
++ ///
++ alias core.stdc.complex.ctan tan;
++ ///
++ alias core.stdc.complex.ctanf tan;
++ ///
++ alias core.stdc.complex.ctanl tan;
++
++ ///
++ alias core.stdc.math.acosh acosh;
++ ///
++ alias core.stdc.math.acoshf acosh;
++ ///
++ alias core.stdc.math.acoshl acosh;
++
++ ///
++ alias core.stdc.complex.cacosh acosh;
++ ///
++ alias core.stdc.complex.cacoshf acosh;
++ ///
++ alias core.stdc.complex.cacoshl acosh;
++
++ ///
++ alias core.stdc.math.asinh asinh;
++ ///
++ alias core.stdc.math.asinhf asinh;
++ ///
++ alias core.stdc.math.asinhl asinh;
++
++ ///
++ alias core.stdc.complex.casinh asinh;
++ ///
++ alias core.stdc.complex.casinhf asinh;
++ ///
++ alias core.stdc.complex.casinhl asinh;
++
++ ///
++ alias core.stdc.math.atanh atanh;
++ ///
++ alias core.stdc.math.atanhf atanh;
++ ///
++ alias core.stdc.math.atanhl atanh;
++
++ ///
++ alias core.stdc.complex.catanh atanh;
++ ///
++ alias core.stdc.complex.catanhf atanh;
++ ///
++ alias core.stdc.complex.catanhl atanh;
++
++ ///
++ alias core.stdc.math.cosh cosh;
++ ///
++ alias core.stdc.math.coshf cosh;
++ ///
++ alias core.stdc.math.coshl cosh;
++
++ ///
++ alias core.stdc.complex.ccosh cosh;
++ ///
++ alias core.stdc.complex.ccoshf cosh;
++ ///
++ alias core.stdc.complex.ccoshl cosh;
++
++ ///
++ alias core.stdc.math.sinh sinh;
++ ///
++ alias core.stdc.math.sinhf sinh;
++ ///
++ alias core.stdc.math.sinhl sinh;
++
++ ///
++ alias core.stdc.complex.csinh sinh;
++ ///
++ alias core.stdc.complex.csinhf sinh;
++ ///
++ alias core.stdc.complex.csinhl sinh;
++
++ ///
++ alias core.stdc.math.tanh tanh;
++ ///
++ alias core.stdc.math.tanhf tanh;
++ ///
++ alias core.stdc.math.tanhl tanh;
++
++ ///
++ alias core.stdc.complex.ctanh tanh;
++ ///
++ alias core.stdc.complex.ctanhf tanh;
++ ///
++ alias core.stdc.complex.ctanhl tanh;
++
++ ///
++ alias core.stdc.math.exp exp;
++ ///
++ alias core.stdc.math.expf exp;
++ ///
++ alias core.stdc.math.expl exp;
++
++ ///
++ alias core.stdc.complex.cexp exp;
++ ///
++ alias core.stdc.complex.cexpf exp;
++ ///
++ alias core.stdc.complex.cexpl exp;
++
++ ///
++ alias core.stdc.math.exp2 exp2;
++ ///
++ alias core.stdc.math.exp2f exp2;
++ ///
++ alias core.stdc.math.exp2l exp2;
++
++ ///
++ alias core.stdc.math.expm1 expm1;
++ ///
++ alias core.stdc.math.expm1f expm1;
++ ///
++ alias core.stdc.math.expm1l expm1;
++
++ ///
++ alias core.stdc.math.frexp frexp;
++ ///
++ alias core.stdc.math.frexpf frexp;
++ ///
++ alias core.stdc.math.frexpl frexp;
++
++ ///
++ alias core.stdc.math.ilogb ilogb;
++ ///
++ alias core.stdc.math.ilogbf ilogb;
++ ///
++ alias core.stdc.math.ilogbl ilogb;
++
++ ///
++ alias core.stdc.math.ldexp ldexp;
++ ///
++ alias core.stdc.math.ldexpf ldexp;
++ ///
++ alias core.stdc.math.ldexpl ldexp;
++
++ ///
++ alias core.stdc.math.log log;
++ ///
++ alias core.stdc.math.logf log;
++ ///
++ alias core.stdc.math.logl log;
++
++ ///
++ alias core.stdc.complex.clog log;
++ ///
++ alias core.stdc.complex.clogf log;
++ ///
++ alias core.stdc.complex.clogl log;
++
++ ///
++ alias core.stdc.math.log10 log10;
++ ///
++ alias core.stdc.math.log10f log10;
++ ///
++ alias core.stdc.math.log10l log10;
++
++ ///
++ alias core.stdc.math.log1p log1p;
++ ///
++ alias core.stdc.math.log1pf log1p;
++ ///
++ alias core.stdc.math.log1pl log1p;
++
++ ///
++ alias core.stdc.math.log2 log2;
++ ///
++ alias core.stdc.math.log2f log2;
++ ///
++ alias core.stdc.math.log2l log2;
++
++ ///
++ alias core.stdc.math.logb logb;
++ ///
++ alias core.stdc.math.logbf logb;
++ ///
++ alias core.stdc.math.logbl logb;
++
++ ///
++ alias core.stdc.math.modf modf;
++ ///
++ alias core.stdc.math.modff modf;
++// alias core.stdc.math.modfl modf;
++
++ ///
++ alias core.stdc.math.scalbn scalbn;
++ ///
++ alias core.stdc.math.scalbnf scalbn;
++ ///
++ alias core.stdc.math.scalbnl scalbn;
++
++ ///
++ alias core.stdc.math.scalbln scalbln;
++ ///
++ alias core.stdc.math.scalblnf scalbln;
++ ///
++ alias core.stdc.math.scalblnl scalbln;
++
++ ///
++ alias core.stdc.math.cbrt cbrt;
++ ///
++ alias core.stdc.math.cbrtf cbrt;
++ ///
++ alias core.stdc.math.cbrtl cbrt;
++
++ ///
++ alias core.stdc.math.fabs fabs;
++ ///
++ alias core.stdc.math.fabsf fabs;
++ ///
++ alias core.stdc.math.fabsl fabs;
++
++ ///
++ alias core.stdc.complex.cabs fabs;
++ ///
++ alias core.stdc.complex.cabsf fabs;
++ ///
++ alias core.stdc.complex.cabsl fabs;
++
++ ///
++ alias core.stdc.math.hypot hypot;
++ ///
++ alias core.stdc.math.hypotf hypot;
++ ///
++ alias core.stdc.math.hypotl hypot;
++
++ ///
++ alias core.stdc.math.pow pow;
++ ///
++ alias core.stdc.math.powf pow;
++ ///
++ alias core.stdc.math.powl pow;
++
++ ///
++ alias core.stdc.complex.cpow pow;
++ ///
++ alias core.stdc.complex.cpowf pow;
++ ///
++ alias core.stdc.complex.cpowl pow;
++
++ ///
++ alias core.stdc.math.sqrt sqrt;
++ ///
++ alias core.stdc.math.sqrtf sqrt;
++ ///
++ alias core.stdc.math.sqrtl sqrt;
++
++ ///
++ alias core.stdc.complex.csqrt sqrt;
++ ///
++ alias core.stdc.complex.csqrtf sqrt;
++ ///
++ alias core.stdc.complex.csqrtl sqrt;
++
++ ///
++ alias core.stdc.math.erf erf;
++ ///
++ alias core.stdc.math.erff erf;
++ ///
++ alias core.stdc.math.erfl erf;
++
++ ///
++ alias core.stdc.math.erfc erfc;
++ ///
++ alias core.stdc.math.erfcf erfc;
++ ///
++ alias core.stdc.math.erfcl erfc;
++
++ ///
++ alias core.stdc.math.lgamma lgamma;
++ ///
++ alias core.stdc.math.lgammaf lgamma;
++ ///
++ alias core.stdc.math.lgammal lgamma;
++
++ ///
++ alias core.stdc.math.tgamma tgamma;
++ ///
++ alias core.stdc.math.tgammaf tgamma;
++ ///
++ alias core.stdc.math.tgammal tgamma;
++
++ ///
++ alias core.stdc.math.ceil ceil;
++ ///
++ alias core.stdc.math.ceilf ceil;
++ ///
++ alias core.stdc.math.ceill ceil;
++
++ ///
++ alias core.stdc.math.floor floor;
++ ///
++ alias core.stdc.math.floorf floor;
++ ///
++ alias core.stdc.math.floorl floor;
++
++ ///
++ alias core.stdc.math.nearbyint nearbyint;
++ ///
++ alias core.stdc.math.nearbyintf nearbyint;
++ ///
++ alias core.stdc.math.nearbyintl nearbyint;
++
++ ///
++ alias core.stdc.math.rint rint;
++ ///
++ alias core.stdc.math.rintf rint;
++ ///
++ alias core.stdc.math.rintl rint;
++
++ ///
++ alias core.stdc.math.lrint lrint;
++ ///
++ alias core.stdc.math.lrintf lrint;
++ ///
++ alias core.stdc.math.lrintl lrint;
++
++ ///
++ alias core.stdc.math.llrint llrint;
++ ///
++ alias core.stdc.math.llrintf llrint;
++ ///
++ alias core.stdc.math.llrintl llrint;
++
++ ///
++ alias core.stdc.math.round round;
++ ///
++ alias core.stdc.math.roundf round;
++ ///
++ alias core.stdc.math.roundl round;
++
++ ///
++ alias core.stdc.math.lround lround;
++ ///
++ alias core.stdc.math.lroundf lround;
++ ///
++ alias core.stdc.math.lroundl lround;
++
++ ///
++ alias core.stdc.math.llround llroundl;
++ ///
++ alias core.stdc.math.llroundf llroundl;
++ ///
++ alias core.stdc.math.llroundl llroundl;
++
++ ///
++ alias core.stdc.math.trunc trunc;
++ ///
++ alias core.stdc.math.truncf trunc;
++ ///
++ alias core.stdc.math.truncl trunc;
++
++ ///
++ alias core.stdc.math.fmod fmod;
++ ///
++ alias core.stdc.math.fmodf fmod;
++ ///
++ alias core.stdc.math.fmodl fmod;
++
++ ///
++ alias core.stdc.math.remainder remainder;
++ ///
++ alias core.stdc.math.remainderf remainder;
++ ///
++ alias core.stdc.math.remainderl remainder;
++
++ ///
++ alias core.stdc.math.remquo remquo;
++ ///
++ alias core.stdc.math.remquof remquo;
++ ///
++ alias core.stdc.math.remquol remquo;
++
++ ///
++ alias core.stdc.math.copysign copysign;
++ ///
++ alias core.stdc.math.copysignf copysign;
++ ///
++ alias core.stdc.math.copysignl copysign;
++
++// alias core.stdc.math.nan nan;
++// alias core.stdc.math.nanf nan;
++// alias core.stdc.math.nanl nan;
++
++ ///
++ alias core.stdc.math.nextafter nextafter;
++ ///
++ alias core.stdc.math.nextafterf nextafter;
++ ///
++ alias core.stdc.math.nextafterl nextafter;
++
++ ///
++ alias core.stdc.math.nexttoward nexttoward;
++ ///
++ alias core.stdc.math.nexttowardf nexttoward;
++ ///
++ alias core.stdc.math.nexttowardl nexttoward;
++
++ ///
++ alias core.stdc.math.fdim fdim;
++ ///
++ alias core.stdc.math.fdimf fdim;
++ ///
++ alias core.stdc.math.fdiml fdim;
++
++ ///
++ alias core.stdc.math.fmax fmax;
++ ///
++ alias core.stdc.math.fmaxf fmax;
++ ///
++ alias core.stdc.math.fmaxl fmax;
++
++ ///
++ alias core.stdc.math.fmin fmin;
++ ///
++ alias core.stdc.math.fmin fmin;
++ ///
++ alias core.stdc.math.fminl fmin;
++
++ ///
++ alias core.stdc.math.fma fma;
++ ///
++ alias core.stdc.math.fmaf fma;
++ ///
++ alias core.stdc.math.fmal fma;
++
++ ///
++ alias core.stdc.complex.carg carg;
++ ///
++ alias core.stdc.complex.cargf carg;
++ ///
++ alias core.stdc.complex.cargl carg;
++
++ ///
++ alias core.stdc.complex.cimag cimag;
++ ///
++ alias core.stdc.complex.cimagf cimag;
++ ///
++ alias core.stdc.complex.cimagl cimag;
++
++ ///
++ alias core.stdc.complex.conj conj;
++ ///
++ alias core.stdc.complex.conjf conj;
++ ///
++ alias core.stdc.complex.conjl conj;
++
++ ///
++ alias core.stdc.complex.cproj cproj;
++ ///
++ alias core.stdc.complex.cprojf cproj;
++ ///
++ alias core.stdc.complex.cprojl cproj;
++
++// alias core.stdc.complex.creal creal;
++// alias core.stdc.complex.crealf creal;
++// alias core.stdc.complex.creall creal;
++}
+ else
+ {
+ ///
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_stdc_time.d b/ldc017/patches/patch-runtime_druntime_src_core_stdc_time.d
new file mode 100644
index 0000000000..a8b30accf6
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_stdc_time.d
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/stdc/time.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/stdc/time.d
+@@ -86,6 +86,10 @@ else version( DragonFlyBSD )
+ {
+ enum clock_t CLOCKS_PER_SEC = 128;
+ }
++else version( NetBSD )
++{
++ enum clock_t CLOCKS_PER_SEC = 100;
++}
+ else version (CRuntime_Glibc)
+ {
+ enum clock_t CLOCKS_PER_SEC = 1_000_000;
+@@ -153,6 +157,13 @@ else version( DragonFlyBSD )
+ {
+ ///
+ void tzset(); // non-standard
++ ///
++ extern __gshared const(char)*[2] tzname; // non-standard
++}
++else version( NetBSD )
++{
++ ///
++ void tzset(); // non-standard
+ ///
+ extern __gshared const(char)*[2] tzname; // non-standard
+ }
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
new file mode 100644
index 0000000000..15844c4c96
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_arpa_inet.d
@@ -0,0 +1,50 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/arpa/inet.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/arpa/inet.d
+@@ -173,6 +173,32 @@ else version( Solaris )
+ const(char)* inet_ntop(int, in void*, char*, socklen_t);
+ int inet_pton(int, in char*, void*);
+ }
++else version( NetBSD )
++{
++ alias uint16_t in_port_t;
++ alias uint32_t in_addr_t;
++
++ struct in_addr
++ {
++ in_addr_t s_addr;
++ }
++
++ enum INET_ADDRSTRLEN = 16;
++
++ @trusted pure
++ {
++ uint32_t htonl(uint32_t);
++ uint16_t htons(uint16_t);
++ uint32_t ntohl(uint32_t);
++ uint16_t ntohs(uint16_t);
++ }
++
++ in_addr_t inet_addr(in char*);
++ char* inet_ntoa(in_addr);
++ const(char)* inet_ntop(int, in void*, char*, socklen_t);
++ int inet_pton(int, in char*, void*);
++}
++
+ else version( Solaris )
+ {
+ alias uint16_t in_port_t;
+@@ -264,6 +290,10 @@ else version( DragonFlyBSD )
+ {
+ enum INET6_ADDRSTRLEN = 46;
+ }
++else version ( NetBSD )
++{
++ enum INET6_ADDRSTRLEN = 46;
++}
+ else version( Solaris )
+ {
+ enum INET6_ADDRSTRLEN = 46;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
new file mode 100644
index 0000000000..882acd4441
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dirent.d
@@ -0,0 +1,90 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/dirent.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/dirent.d
+@@ -172,6 +172,36 @@ else version( DragonFlyBSD )
+
+ dirent* readdir(DIR*);
+ }
++else version( NetBSD )
++{
++ enum
++ {
++ DT_UNKNOWN = 0,
++ DT_FIFO = 1,
++ DT_CHR = 2,
++ DT_DIR = 4,
++ DT_BLK = 6,
++ DT_REG = 8,
++ DT_LNK = 10,
++ DT_SOCK = 12,
++ DT_WHT = 14
++ }
++
++
++ struct dirent
++ {
++ ulong d_fileno;
++ ushort d_reclen;
++ ushort d_namlen;
++ ubyte d_type;
++ char[512] d_name;
++ }
++
++ alias void* DIR;
++
++ dirent* __readdir30(DIR*);
++ alias __readdir30 readdir;
++}
+ else version (Solaris)
+ {
+ struct dirent
+@@ -243,11 +273,20 @@ else
+ static assert(false, "Unsupported platform");
+ }
+
++version( NetBSD )
++{
++ DIR* __opendir30(in char*);
++ alias __opendir30 opendir;
++}
++else
++{
++ DIR* opendir(in char*);
++}
+ int closedir(DIR*);
+-DIR* opendir(in char*);
+ //dirent* readdir(DIR*);
+ void rewinddir(DIR*);
+
++
+ //
+ // Thread-Safe Functions (TSF)
+ //
+@@ -279,6 +318,12 @@ else version( DragonFlyBSD )
+ {
+ int readdir_r(DIR*, dirent*, dirent**);
+ }
++else version( NetBSD )
++{
++ int __readdir_r30(DIR*, dirent*, dirent**);
++ alias __readdir_r30 readdir_r;
++}
++
+ else version (Solaris)
+ {
+ static if (__USE_LARGEFILE64)
+@@ -322,6 +367,11 @@ else version( DragonFlyBSD )
+ {
+ void seekdir(DIR*, c_long);
+ c_long telldir(DIR*);
++}
++else version( NetBSD )
++{
++ void seekdir(DIR*, c_long);
++ c_long telldir(DIR*);
+ }
+ else version (OSX)
+ {
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
new file mode 100644
index 0000000000..381d458abb
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_dlfcn.d
@@ -0,0 +1,36 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/dlfcn.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/dlfcn.d
+@@ -165,6 +165,29 @@ else version( FreeBSD )
+ void* dli_saddr;
+ }
+ }
++else version( NetBSD )
++{
++ enum RTLD_LAZY = 1;
++ enum RTLD_NOW = 2;
++ enum RTLD_GLOBAL = 0x100;
++ enum RTLD_LOCAL = 0x200;
++ enum RTLD_NODELETE = 0x01000; /* Do not remove members. */
++ enum RTLD_NOLOAD = 0x02000;
++
++ int dlclose(void*);
++ char* dlerror();
++ void* dlopen(in char*, int);
++ void* dlsym(void*, in char*);
++ int dladdr(const(void)* addr, Dl_info* info);
++
++ struct Dl_info
++ {
++ const(char)* dli_fname;
++ void* dli_fbase;
++ const(char)* dli_sname;
++ void* dli_saddr;
++ }
++}
+ else version( Solaris )
+ {
+ enum RTLD_LAZY = 1;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
new file mode 100644
index 0000000000..898f985f49
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_fcntl.d
@@ -0,0 +1,66 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/fcntl.d.orig 2020-05-07 08:52:15.234684078 +0000
++++ runtime/druntime/src/core/sys/posix/fcntl.d
+@@ -462,6 +462,59 @@ else version( DragonFlyBSD )
+ //int fcntl(int, int, ...); /*defined below*/
+ //int flock(int, int);
+ }
++else version( NetBSD )
++{
++ enum F_DUPFD = 0;
++ enum F_GETFD = 1;
++ enum F_SETFD = 2;
++ enum F_GETFL = 3;
++ enum F_SETFL = 4;
++ enum F_GETOWN = 5;
++ enum F_SETOWN = 6;
++ enum F_GETLK = 7;
++ enum F_SETLK = 8;
++ enum F_SETLKW = 9;
++ enum F_CLOSEM = 10;
++ enum F_MAXFD = 11;
++ enum F_DUPFD_CLOEXEC= 12;
++ enum F_GETNOSIGPIPE = 13;
++ enum F_SETNOSIGPIPE = 14;
++
++ enum FD_CLOEXEC = 1;
++
++ enum F_RDLCK = 1;
++ enum F_UNLCK = 2;
++ enum F_WRLCK = 3;
++
++ enum O_CREAT = 0x0200;
++ enum O_EXCL = 0x0800;
++ enum O_NOCTTY = 0x8000;
++ enum O_TRUNC = 0x0400;
++
++ enum O_RDONLY = 0x0000;
++ enum O_WRONLY = 0x0001;
++ enum O_RDWR = 0x0002;
++ enum O_ACCMODE = 0x0003;
++
++ enum O_NONBLOCK = 0x0004;
++ enum O_APPEND = 0x0008;
++ enum O_SYNC = 0x0080;
++ //enum O_DSYNC
++ //enum O_RSYNC
++
++ struct flock
++ {
++ off_t l_start;
++ off_t l_len;
++ pid_t l_pid;
++ short l_type;
++ short l_whence;
++ }
++
++
++ int creat(in char*, mode_t);
++ int open(in char*, int, ...);
++}
+ else version (Solaris)
+ {
+ enum F_DUPFD = 0;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_grp.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
new file mode 100644
index 0000000000..fcac08bc63
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_grp.d
@@ -0,0 +1,48 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/grp.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/grp.d
+@@ -78,6 +78,16 @@ else version( DragonFlyBSD )
+ char** gr_mem;
+ }
+ }
++else version( NetBSD )
++{
++ struct group
++ {
++ char* gr_name;
++ char* gr_passwd;
++ gid_t gr_gid;
++ char** gr_mem;
++ }
++}
+ else version( Solaris )
+ {
+ struct group
+@@ -134,6 +144,11 @@ else version( DragonFlyBSD )
+ int getgrnam_r(in char*, group*, char*, size_t, group**);
+ int getgrgid_r(gid_t, group*, char*, size_t, group**);
+ }
++else version( NetBSD )
++{
++ int getgrnam_r(in char*, group*, char*, size_t, group**);
++ int getgrgid_r(gid_t, group*, char*, size_t, group**);
++}
+ else version( Solaris )
+ {
+ int getgrnam_r(in char*, group*, char*, int, group**);
+@@ -178,6 +193,12 @@ else version( DragonFlyBSD )
+ {
+ group* getgrent();
+ @trusted void endgrent();
++ @trusted void setgrent();
++}
++else version( NetBSD )
++{
++ group* getgrent();
++ @trusted void endgrent();
+ @trusted void setgrent();
+ }
+ else version( Solaris )
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
new file mode 100644
index 0000000000..b2e51a2eab
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_net_if__.d
@@ -0,0 +1,28 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/net/if_.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/net/if_.d
+@@ -82,6 +82,21 @@ else version( FreeBSD )
+ if_nameindex_t* if_nameindex();
+ void if_freenameindex(if_nameindex_t*);
+ }
++else version( NetBSD )
++{
++ struct if_nameindex_t
++ {
++ uint if_index;
++ char* if_name;
++ }
++
++ enum IF_NAMESIZE = 16;
++
++ uint if_nametoindex(in char*);
++ char* if_indextoname(uint, char*);
++ if_nameindex_t* if_nameindex();
++ void if_freenameindex(if_nameindex_t*);
++}
+ else version( CRuntime_Bionic )
+ {
+ enum IF_NAMESIZE = 16;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
new file mode 100644
index 0000000000..01ef523408
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netdb.d
@@ -0,0 +1,119 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/netdb.d.orig 2020-05-07 08:52:15.364683708 +0000
++++ runtime/druntime/src/core/sys/posix/netdb.d
+@@ -488,6 +488,112 @@ else version( DragonFlyBSD )
+ enum NI_NUMERICSCOPE = 0x40;
+
+ }
++else version( NetBSD )
++{
++ struct hostent
++ {
++ char* h_name;
++ char** h_aliases;
++ int h_addrtype;
++ int h_length;
++ char** h_addr_list;
++ extern (D) char* h_addr() @property { return h_addr_list[0]; } // non-standard
++ }
++
++ struct netent
++ {
++ char* n_name;
++ char** n_aliases;
++ int n_addrtype;
++ uint32_t n_net;
++/+ todo
++#if (defined(__sparc__) && defined(_LP64)) || \
++ (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
++ int __n_pad0; /* ABI compatibility */
++#endif
++ uint32_t n_net; /*%< network # */
++#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
++ (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
++ int __n_pad0; /* ABI compatibility */
++#endif
+++/
++ }
++
++ struct protoent
++ {
++ char* p_name;
++ char** p_aliases;
++ int p_proto;
++ }
++
++ struct servent
++ {
++ char* s_name;
++ char** s_aliases;
++ int s_port;
++ char* s_proto;
++ }
++
++ enum IPPORT_RESERVED = 1024;
++
++ //h_errno
++
++ enum HOST_NOT_FOUND = 1;
++ enum NO_DATA = 4;
++ enum NO_RECOVERY = 3;
++ enum TRY_AGAIN = 2;
++
++ struct addrinfo
++ {
++ int ai_flags;
++ int ai_family;
++ int ai_socktype;
++ int ai_protocol;
++/+todo
++#if defined(__sparc__) && defined(_LP64)
++ int __ai_pad0; /* ABI compatibility */
++#endif
+++/
++ socklen_t ai_addrlen;
++/+todo
++#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
++ int __ai_pad0; /* ABI compatibility */
++#endif
+++/
++ char* ai_canonname;
++ sockaddr* ai_addr;
++ addrinfo* ai_next;
++ }
++
++ enum AI_PASSIVE = 0x1;
++ enum AI_CANONNAME = 0x2;
++ enum AI_NUMERICHOST = 0x4;
++ enum AI_NUMERICSERV = 0x8;
++ enum AI_V4MAPPED = 0x800;
++ enum AI_ALL = 0x100;
++ enum AI_ADDRCONFIG = 0x400;
++
++ enum NI_NOFQDN = 0x1;
++ enum NI_NUMERICHOST = 0x2;
++ enum NI_NAMEREQD = 0x4;
++ enum NI_NUMERICSERV = 0x8;
++ enum NI_DGRAM = 0x10;
++ enum NI_WITHSCOPEID = 0x00000020;
++ enum NI_NUMERICSCOPE = 0x00000040;
++ enum NI_MAXHOST = 1025; // non-standard
++ enum NI_MAXSERV = 32; // non-standard
++
++ enum EAI_AGAIN = 2;
++ enum EAI_BADFLAGS = 3;
++ enum EAI_FAIL = 4;
++ enum EAI_FAMILY = 5;
++ enum EAI_MEMORY = 6;
++ enum EAI_NONAME = 8;
++ enum EAI_SERVICE = 9;
++ enum EAI_SOCKTYPE = 10;
++ enum EAI_SYSTEM = 11;
++ enum EAI_OVERFLOW = 14;
++}
+ else version (Solaris)
+ {
+ struct hostent
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
new file mode 100644
index 0000000000..7df6287e43
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_in__.d
@@ -0,0 +1,206 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/netinet/in_.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/netinet/in_.d
+@@ -245,6 +245,42 @@ else version( DragonFlyBSD )
+
+ //enum INET_ADDRSTRLEN = 16;
+ }
++else version( NetBSD )
++{
++
++ struct sockaddr_in
++ {
++ ubyte sin_len;
++ sa_family_t sin_family;
++ in_port_t sin_port;
++ in_addr sin_addr;
++ ubyte[8] sin_zero;
++ }
++
++ enum
++ {
++ IPPROTO_IP = 0,
++ IPPROTO_ICMP = 1,
++ IPPROTO_IGMP = 2,
++ IPPROTO_GGP = 3,
++ IPPROTO_TCP = 6,
++ IPPROTO_PUP = 12,
++ IPPROTO_UDP = 17,
++ IPPROTO_IDP = 22,
++ IPPROTO_ND = 77,
++ IPPROTO_MAX = 256
++ }
++
++ enum : uint
++ {
++ INADDR_ANY = 0x00000000,
++ INADDR_BROADCAST = 0xffffffff,
++ INADDR_LOOPBACK = 0x7f000001,
++ INADDR_NONE = 0xffffffff
++ }
++
++ //enum INET_ADDRSTRLEN = 16;
++}
+ else version( Solaris )
+ {
+ struct sockaddr_in
+@@ -895,6 +931,145 @@ else version( DragonFlyBSD )
+ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL;
+ }
+ }
++else version( NetBSD )
++{
++ struct in6_addr
++ {
++ union
++ {
++ uint8_t[16] s6_addr;
++ uint16_t[8] s6_addr16;
++ uint32_t[4] s6_addr32;
++ }
++ }
++
++ struct sockaddr_in6
++ {
++ uint8_t sin6_len;
++ sa_family_t sin6_family;
++ in_port_t sin6_port;
++ uint32_t sin6_flowinfo;
++ in6_addr sin6_addr;
++ uint32_t sin6_scope_id;
++ }
++
++ extern __gshared immutable in6_addr in6addr_any;
++ extern __gshared immutable in6_addr in6addr_loopback;
++
++ struct ipv6_mreq
++ {
++ in6_addr ipv6mr_multiaddr;
++ uint ipv6mr_interface;
++ }
++
++ enum : uint
++ {
++ IPPROTO_IPV6 = 41,
++
++ //INET6_ADDRSTRLEN = 46,
++
++ IPV6_JOIN_GROUP = 12,
++ IPV6_LEAVE_GROUP = 13,
++ IPV6_MULTICAST_HOPS = 10,
++ IPV6_MULTICAST_IF = 9,
++ IPV6_MULTICAST_LOOP = 11,
++ IPV6_UNICAST_HOPS = 4,
++ IPV6_V6ONLY = 27,
++ }
++
++ private enum
++ {
++ __IPV6_ADDR_SCOPE_NODELOCAL = 0x01,
++ __IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01,
++ __IPV6_ADDR_SCOPE_LINKLOCAL = 0x02,
++ __IPV6_ADDR_SCOPE_SITELOCAL = 0x05,
++ __IPV6_ADDR_SCOPE_ORGLOCAL = 0x08,
++ __IPV6_ADDR_SCOPE_GLOBAL = 0x0e,
++ }
++
++ // macros
++ extern (D) int IN6_IS_ADDR_UNSPECIFIED( in in6_addr* a ) pure
++ {
++ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) == 0);
++ }
++
++ extern (D) int IN6_IS_ADDR_LOOPBACK( in in6_addr* a ) pure
++ {
++ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) == ntohl(1));
++ }
++
++ extern (D) int IN6_IS_ADDR_V4COMPAT( in in6_addr* a ) pure
++ {
++ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) != 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[12]) != ntohl(1));
++ }
++
++ extern (D) int IN6_IS_ADDR_V4MAPPED( in in6_addr* a ) pure
++ {
++ return (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[0]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[4]) == 0) &&
++ (*cast(const uint32_t*) cast(const void*) (&a.s6_addr[8]) == ntohl(0x0000ffff));
++ }
++
++ extern (D) int IN6_IS_ADDR_LINKLOCAL( in in6_addr* a ) pure
++ {
++ return a.s6_addr[0] == 0xfe && (a.s6_addr[1] & 0xc0) == 0x80;
++ }
++
++ extern (D) int IN6_IS_ADDR_SITELOCAL( in in6_addr* a ) pure
++ {
++ return a.s6_addr[0] == 0xfe && (a.s6_addr[1] & 0xc0) == 0xc0;
++ }
++
++ extern (D) int IN6_IS_ADDR_MULTICAST( in in6_addr* a ) pure
++ {
++ return a.s6_addr[0] == 0xff;
++ }
++
++ extern (D) uint8_t __IPV6_ADDR_MC_SCOPE( in in6_addr* a ) pure
++ {
++ return a.s6_addr[1] & 0x0f;
++ }
++
++ extern (D) int IN6_IS_ADDR_MC_NODELOCAL( in in6_addr* a ) pure
++ {
++ return IN6_IS_ADDR_MULTICAST(a) &&
++ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL;
++ }
++
++ extern (D) int IN6_IS_ADDR_MC_LINKLOCAL( in in6_addr* a ) pure
++ {
++ return IN6_IS_ADDR_MULTICAST(a) &&
++ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL;
++ }
++
++ extern (D) int IN6_IS_ADDR_MC_SITELOCAL( in in6_addr* a ) pure
++ {
++ return IN6_IS_ADDR_MULTICAST(a) &&
++ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL;
++ }
++
++ extern (D) int IN6_IS_ADDR_MC_ORGLOCAL( in in6_addr* a ) pure
++ {
++ return IN6_IS_ADDR_MULTICAST(a) &&
++ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL;
++ }
++
++ extern (D) int IN6_IS_ADDR_MC_GLOBAL( in in6_addr* a ) pure
++ {
++ return IN6_IS_ADDR_MULTICAST(a) &&
++ __IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL;
++ }
++}
+ else version( Solaris )
+ {
+ struct in6_addr
+@@ -1175,6 +1350,10 @@ else version( DragonFlyBSD )
+ {
+ enum uint IPPROTO_RAW = 255;
+ }
++else version ( NetBSD )
++{
++ enum uint IPPROTO_RAW = 255;
++}
+ else version( Solaris )
+ {
+ enum uint IPPROTO_RAW = 255;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
new file mode 100644
index 0000000000..a32fe75b1c
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_netinet_tcp.d
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/netinet/tcp.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/netinet/tcp.d
+@@ -38,6 +38,10 @@ else version( FreeBSD )
+ {
+ enum TCP_NODELAY = 1;
+ }
++else version( NetBSD )
++{
++ enum TCP_NODELAY = 1;
++}
+ else version( Solaris )
+ {
+ enum TCP_NODELAY = 1;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_poll.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
new file mode 100644
index 0000000000..1c262fa1b4
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_poll.d
@@ -0,0 +1,46 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/poll.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/poll.d
+@@ -177,6 +177,41 @@ else version( DragonFlyBSD )
+
+ int poll(pollfd*, nfds_t, int);
+ }
++else version( NetBSD )
++{
++ alias uint nfds_t;
++
++ struct pollfd
++ {
++ int fd;
++ short events;
++ short revents;
++ };
++
++ enum
++ {
++ POLLIN = 0x0001,
++ POLLPRI = 0x0002,
++ POLLOUT = 0x0004,
++ POLLRDNORM = 0x0040,
++ POLLWRNORM = POLLOUT,
++ POLLRDBAND = 0x0080,
++ POLLWRBAND = 0x0100,
++ //POLLEXTEND = 0x0200,
++ //POLLATTRIB = 0x0400,
++ //POLLNLINK = 0x0800,
++ //POLLWRITE = 0x1000,
++ POLLERR = 0x0008,
++ POLLHUP = 0x0010,
++ POLLNVAL = 0x0020,
++
++ POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
++ POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
++ }
++
++ int poll(pollfd*, nfds_t, int);
++}
++
+ else version( Solaris )
+ {
+ alias c_ulong nfds_t;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
new file mode 100644
index 0000000000..3712a991ec
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pthread.d
@@ -0,0 +1,205 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/pthread.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/pthread.d
+@@ -249,6 +249,85 @@ else version( DragonFlyBSD )
+ enum PTHREAD_COND_INITIALIZER = null;
+ enum PTHREAD_RWLOCK_INITIALIZER = null;
+ }
++else version( NetBSD )
++{
++ enum PRI_NONE = -1;
++ enum
++ {
++ PTHREAD_INHERIT_SCHED = 0x0,
++
++ PTHREAD_CREATE_DETACHED = 1,
++ PTHREAD_CREATE_JOINABLE = 0,
++ PTHREAD_EXPLICIT_SCHED = 1,
++ }
++
++ enum
++ {
++ PTHREAD_PROCESS_PRIVATE = 0,
++ PTHREAD_PROCESS_SHARED = 1,
++ }
++
++ enum
++ {
++ PTHREAD_CANCEL_ENABLE = 0,
++ PTHREAD_CANCEL_DISABLE = 1,
++ PTHREAD_CANCEL_DEFERRED = 0,
++ PTHREAD_CANCEL_ASYNCHRONOUS = 1,
++ }
++
++ enum PTHREAD_CANCELED = cast(void*) 1;
++
++ enum PTHREAD_DONE_INIT = 1;
++
++ struct _PTHREAD_MUTEX_INITIALIZER{
++ enum f1 = 0x33330003;
++ enum f2 = 0;
++ enum f3 = [ 0, 0, 0 ];
++ enum f4 = 0;
++ enum f5 = [0, 0, 0 ];
++ enum f6 = null;
++ enum f7 = null;
++ enum f8 = 0;
++ enum f9 = null;
++ }
++ enum PTHREAD_MUTEX_INITIALIZER = _PTHREAD_MUTEX_INITIALIZER();
++
++ struct _PTHREAD_ONCE_INIT{
++ enum f1 = PTHREAD_MUTEX_INITIALIZER;
++ enum f2 = 0;
++ }
++ enum PTHREAD_ONCE_INIT = _PTHREAD_ONCE_INIT();
++ struct _PTHREAD_COND_INITIALIZER{
++ enum f1 = 0x55550005;
++ enum f2 = 0;
++ struct __PTHREAD_COND_INITIALIZER_S
++ {
++ enum p1 = null;
++ enum p2 = null;
++ enum p3 = null;
++ enum p4 = null;
++ }
++ enum f3 = __PTHREAD_COND_INITIALIZER_S();
++ }
++ enum PTHREAD_COND_INITIALIZER = _PTHREAD_COND_INITIALIZER();
++ struct _PTHREAD_RWLOCK_INITIALIZER
++ {
++ enum f1 = 0x99990009;
++ enum f2 = 0;
++ struct __PTHREAD_RWLOCK_INITIALIZER_S
++ {
++ enum p1 = null;
++ enum p2 = null;
++ }
++
++ enum f3 = __PTHREAD_RWLOCK_INITIALIZER_S();
++ enum f4 = __PTHREAD_RWLOCK_INITIALIZER_S();
++ enum f5 = 0;
++ enum f6 = null;
++ enum f7 = null;
++ }
++ enum PTHREAD_RWLOCK_INITIALIZER = _PTHREAD_RWLOCK_INITIALIZER();
++}
+ else version (Solaris)
+ {
+ enum
+@@ -589,6 +668,18 @@ else version( DragonFlyBSD )
+ int pthread_barrierattr_init(pthread_barrierattr_t*);
+ int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
+ }
++else version( NetBSD )
++{
++ enum PTHREAD_BARRIER_SERIAL_THREAD = 1234567;
++
++ int pthread_barrier_destroy(pthread_barrier_t*);
++ int pthread_barrier_init(pthread_barrier_t*, in pthread_barrierattr_t*, uint);
++ int pthread_barrier_wait(pthread_barrier_t*);
++ int pthread_barrierattr_destroy(pthread_barrierattr_t*);
++ int pthread_barrierattr_getpshared(in pthread_barrierattr_t*, int*);
++ int pthread_barrierattr_init(pthread_barrierattr_t*);
++ int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
++}
+ else version (OSX)
+ {
+ }
+@@ -655,6 +746,14 @@ else version( DragonFlyBSD )
+ int pthread_spin_trylock(pthread_spinlock_t*);
+ int pthread_spin_unlock(pthread_spinlock_t*);
+ }
++else version( NetBSD )
++{
++ int pthread_spin_init(pthread_spinlock_t*, int);
++ int pthread_spin_destroy(pthread_spinlock_t*);
++ int pthread_spin_lock(pthread_spinlock_t*);
++ int pthread_spin_trylock(pthread_spinlock_t*);
++ int pthread_spin_unlock(pthread_spinlock_t*);
++}
+ else version (OSX)
+ {
+ }
+@@ -756,6 +855,24 @@ else version( DragonFlyBSD )
+ int pthread_mutexattr_settype(pthread_mutexattr_t*, int) @trusted;
+ int pthread_setconcurrency(int);
+ }
++else version( NetBSD )
++{
++ enum
++ {
++ PTHREAD_MUTEX_NORMAL = 0,
++ PTHREAD_MUTEX_ERRORCHECK = 1,
++ PTHREAD_MUTEX_RECURSIVE = 2,
++ PTHREAD_MUTEX_TYPE_MAX
++ }
++ enum PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_ERRORCHECK;
++
++ int pthread_attr_getguardsize(in pthread_attr_t*, size_t*);
++ int pthread_attr_setguardsize(pthread_attr_t*, size_t);
++ int pthread_getconcurrency();
++ int pthread_mutexattr_gettype(pthread_mutexattr_t*, int*);
++ int pthread_mutexattr_settype(pthread_mutexattr_t*, int) @trusted;
++ int pthread_setconcurrency(int);
++}
+ else version (Solaris)
+ {
+ enum
+@@ -810,6 +927,10 @@ else version( DragonFlyBSD )
+ {
+ int pthread_getcpuclockid(pthread_t, clockid_t*);
+ }
++else version( NetBSD )
++{
++
++}
+ else version (OSX)
+ {
+ }
+@@ -858,6 +979,12 @@ else version( DragonFlyBSD )
+ int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
+ int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
+ }
++else version( NetBSD )
++{
++ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
++ int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
++ int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
++}
+ else version (Solaris)
+ {
+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
+@@ -1097,6 +1224,15 @@ else version( DragonFlyBSD )
+ int pthread_attr_setstackaddr(pthread_attr_t*, void*);
+ int pthread_attr_setstacksize(pthread_attr_t*, size_t);
+ }
++else version( NetBSD )
++{
++ int pthread_attr_getstack(in pthread_attr_t*, void**, size_t*);
++ int pthread_attr_getstackaddr(in pthread_attr_t*, void**);
++ int pthread_attr_getstacksize(in pthread_attr_t*, size_t*);
++ int pthread_attr_setstack(pthread_attr_t*, void*, size_t);
++ int pthread_attr_setstackaddr(pthread_attr_t*, void*);
++ int pthread_attr_setstacksize(pthread_attr_t*, size_t);
++}
+ else version (Solaris)
+ {
+ int pthread_attr_getstack(in pthread_attr_t*, void**, size_t*);
+@@ -1154,6 +1290,15 @@ else version( DragonFlyBSD )
+ {
+ int pthread_condattr_getpshared(in pthread_condattr_t*, int*);
+ int pthread_condattr_setpshared(pthread_condattr_t*, int);
++ int pthread_mutexattr_getpshared(in pthread_mutexattr_t*, int*);
++ int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
++ int pthread_rwlockattr_getpshared(in pthread_rwlockattr_t*, int*);
++ int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
++}
++else version( NetBSD )
++{
++ int pthread_condattr_getpshared(in pthread_condattr_t*, int*);
++ int pthread_condattr_setpshared(pthread_condattr_t*, int);
+ int pthread_mutexattr_getpshared(in pthread_mutexattr_t*, int*);
+ int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
+ int pthread_rwlockattr_getpshared(in pthread_rwlockattr_t*, int*);
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
new file mode 100644
index 0000000000..ed8890f43a
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_pwd.d
@@ -0,0 +1,56 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/pwd.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/pwd.d
+@@ -102,6 +102,22 @@ else version( DragonFlyBSD )
+ int pw_fields; /* internal: fields filled in */
+ }
+ }
++else version( NetBSD )
++{
++ struct passwd
++ {
++ char* pw_name; /* user name */
++ char* pw_passwd; /* encrypted password */
++ uid_t pw_uid; /* user uid */
++ gid_t pw_gid; /* user gid */
++ time_t pw_change; /* password change time */
++ char* pw_class; /* user access class */
++ char* pw_gecos; /* Honeywell login info */
++ char* pw_dir; /* home directory */
++ char* pw_shell; /* default shell */
++ time_t pw_expire; /* account expiration */
++ }
++}
+ else version (Solaris)
+ {
+ struct passwd
+@@ -165,6 +181,13 @@ else version( DragonFlyBSD )
+ int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
+ int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
+ }
++else version( NetBSD )
++{
++ int __getpwnam_r50(in char*, passwd*, char*, size_t, passwd**);
++ alias __getpwnam_r50 getpwnam_r;
++ int __getpwuid_r50(uid_t, passwd*, char*, size_t, passwd**);
++ alias __getpwuid_r50 getpwuid_r;
++}
+ else version (Solaris)
+ {
+ int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
+@@ -209,6 +232,12 @@ else version ( DragonFlyBSD )
+ {
+ void endpwent();
+ passwd* getpwent();
++ void setpwent();
++}
++else version ( NetBSD )
++{
++ void endpwent();
++ passwd* getpwent();
+ void setpwent();
+ }
+ else version (Solaris)
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sched.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
new file mode 100644
index 0000000000..8ecfb0a97a
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sched.d
@@ -0,0 +1,48 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sched.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sched.d
+@@ -97,6 +97,17 @@ else version( DragonFlyBSD )
+ enum SCHED_OTHER = 2;
+ enum SCHED_RR = 3;
+ }
++else version( NetBSD )
++{
++ struct sched_param
++ {
++ int sched_priority;
++ }
++
++ enum SCHED_FIFO = 1;
++ enum SCHED_OTHER = 0;
++ enum SCHED_RR = 2;
++}
+ else version (Solaris)
+ {
+ struct sched_param
+@@ -159,6 +170,10 @@ else version( DragonFlyBSD )
+ {
+ int sched_yield();
+ }
++else version( NetBSD )
++{
++ int sched_yield();
++}
+ else version (Solaris)
+ {
+ int sched_yield();
+@@ -203,6 +218,12 @@ else version( DragonFlyBSD )
+ {
+ int sched_get_priority_min(int);
+ int sched_get_priority_max(int);
++ int sched_rr_get_interval(pid_t, timespec*);
++}
++else version( NetBSD )
++{
++ int sched_get_priority_min(int);
++ int sched_get_priority_max(int);
+ int sched_rr_get_interval(pid_t, timespec*);
+ }
+ else version (Solaris)
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
new file mode 100644
index 0000000000..5fc858dbba
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_semaphore.d
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/semaphore.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/semaphore.d
+@@ -96,6 +96,12 @@ else version( DragonFlyBSD )
+
+ enum SEM_FAILED = cast(sem_t*) null;
+ }
++else version( NetBSD )
++{
++ alias size_t sem_t;
++
++ enum SEM_FAILED = cast(sem_t*) null;
++}
+ else version (Solaris)
+ {
+ struct sem_t
+@@ -156,6 +162,10 @@ else version( DragonFlyBSD )
+ {
+ int sem_timedwait(sem_t*, in timespec*);
+ }
++else version ( NetBSD )
++{
++ int sem_timedwait(sem_t*, in timespec*);
++}
+ else version (Solaris)
+ {
+ int sem_timedwait(sem_t*, in timespec*);
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
new file mode 100644
index 0000000000..e55743a5b1
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_setjmp.d
@@ -0,0 +1,56 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/setjmp.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/setjmp.d
+@@ -185,6 +185,26 @@ else version( DragonFlyBSD )
+ int setjmp(ref jmp_buf);
+ void longjmp(ref jmp_buf, int);
+ }
++else version( NetBSD )
++{
++ // <machine/setjmp.h>
++ version( X86 )
++ {
++ enum _JBLEN = 13;
++ struct _jmp_buf { int[_JBLEN + 1] _jb; }
++ }
++ else version( X86_64)
++ {
++ enum _JBLEN = 11;
++ struct _jmp_buf { c_long[_JBLEN] _jb; }
++ }
++ else
++ static assert(0);
++ alias _jmp_buf[_JBLEN] jmp_buf;
++
++ int setjmp(ref jmp_buf);
++ void longjmp(ref jmp_buf, int);
++}
+ else version( CRuntime_Bionic )
+ {
+ // <machine/setjmp.h>
+@@ -270,6 +290,24 @@ else version( DragonFlyBSD )
+
+ int sigsetjmp(ref sigjmp_buf);
+ void siglongjmp(ref sigjmp_buf, int);
++}
++else version( NetBSD )
++{
++ // <machine/setjmp.h>
++ version( X86 )
++ {
++ struct _sigjmp_buf { int[_JBLEN + 1] _ssjb; }
++ }
++ else version( X86_64)
++ {
++ struct _sigjmp_buf { c_long[_JBLEN] _sjb; }
++ }
++ else
++ static assert(0);
++ alias _sigjmp_buf[_JBLEN + 1] sigjmp_buf;
++
++ int sigsetjmp(ref sigjmp_buf);
++ void siglongjmp(ref sigjmp_buf, int);
+ }
+ else version( CRuntime_Bionic )
+ {
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_signal.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
new file mode 100644
index 0000000000..1dff30814c
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_signal.d
@@ -0,0 +1,339 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/signal.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/signal.d
+@@ -423,6 +423,31 @@ else version( DragonFlyBSD )
+ enum SIGUSR2 = 31;
+ enum SIGURG = 16;
+ }
++else version( NetBSD )
++{
++ //SIGABRT (defined in core.stdc.signal)
++ enum SIGALRM = 14;
++ enum SIGBUS = 10;
++ enum SIGCHLD = 20;
++ enum SIGCONT = 19;
++ //SIGFPE (defined in core.stdc.signal)
++ enum SIGHUP = 1;
++ //SIGILL (defined in core.stdc.signal)
++ //SIGINT (defined in core.stdc.signal)
++ enum SIGKILL = 9;
++ enum SIGPIPE = 13;
++ enum SIGQUIT = 3;
++ //SIGSEGV (defined in core.stdc.signal)
++ enum SIGSTOP = 17;
++ //SIGTERM (defined in core.stdc.signal)
++ enum SIGTSTP = 18;
++ enum SIGTTIN = 21;
++ enum SIGTTOU = 22;
++ enum SIGUSR1 = 30;
++ enum SIGUSR2 = 31;
++ enum SIGURG = 16;
++}
++
+ else version (Solaris)
+ {
+ enum SIGALRM = 14;
+@@ -494,6 +519,19 @@ else version( DragonFlyBSD )
+ sigset_t sa_mask;
+ }
+ }
++else version( NetBSD )
++{
++ struct sigaction_t
++ {
++ union
++ {
++ sigfn_t sa_handler;
++ sigactfn_t sa_sigaction;
++ }
++ sigset_t sa_mask;
++ int sa_flags;
++ }
++}
+ else version (Solaris)
+ {
+ struct sigaction_t
+@@ -960,6 +998,100 @@ else version( DragonFlyBSD )
+ int sigsuspend(in sigset_t *);
+ int sigwait(in sigset_t*, int*);
+ }
++else version( NetBSD )
++{
++ enum SIG_HOLD = cast(sigfn_t2) 3;
++
++ struct sigset_t
++ {
++ uint[4] __bits;
++ }
++
++ enum SA_NOCLDSTOP = 8;
++
++ enum SIG_BLOCK = 1;
++ enum SIG_UNBLOCK = 2;
++ enum SIG_SETMASK = 3;
++
++ union sigval_t {
++ int sival_int;
++ void *sival_ptr;
++ };
++ struct _rt{
++ pid_t _pid;
++ uid_t _uid;
++ sigval_t _value;
++ };
++ struct _child{
++ pid_t _pid;
++ uid_t _uid;
++ int _status;
++ clock_t _utime;
++ clock_t _stime;
++ };
++ struct _fault{
++ void *_addr;
++ int _trap;
++ int _trap2;
++ int _trap3;
++ };
++ struct _poll{
++ long _band;
++ int _fd;
++ };
++ union _reason{
++ _rt rt;
++ _child child;
++ _fault fault;
++ _poll poll;
++ };
++ struct _ksiginfo {
++ int _signo;
++ int _code;
++ int _errno;
++/+#ifdef _LP64
++ /* In _LP64 the union starts on an 8-byte boundary. */
++ int _pad;
++#endif+/
++ _reason reason;
++ };
++
++
++ union siginfo_t
++ {
++ ubyte[128] si_pad;/* Total size; for future expansion */
++ _ksiginfo _info;
++ @property ref c_long si_band() return { return _info.reason.poll._band; }
++ }
++
++ enum SI_USER = 0;
++ enum SI_QUEUE = -1;
++ enum SI_TIMER = -2;
++ enum SI_ASYNCIO = -3;
++ enum SI_MESGQ = -4;
++
++ int kill(pid_t, int);
++ int __sigaction14(int, in sigaction_t*, sigaction_t*);
++ int __sigaddset14(sigset_t*, int);
++ int __sigdelset14(sigset_t*, int);
++ int __sigemptyset14(sigset_t *);
++ int __sigfillset14(sigset_t *);
++ int __sigismember14(in sigset_t *, int);
++ int __sigpending14(sigset_t *);
++ int __sigprocmask14(int, in sigset_t*, sigset_t*);
++ int __sigsuspend14(in sigset_t *);
++ int sigwait(in sigset_t*, int*);
++
++ alias __sigaction14 sigaction;
++ alias __sigaddset14 sigaddset;
++ alias __sigdelset14 sigdelset;
++ alias __sigemptyset14 sigemptyset;
++ alias __sigfillset14 sigfillset;
++ alias __sigismember14 sigismember;
++ alias __sigpending14 sigpending;
++ alias __sigprocmask14 sigprocmask;
++ alias __sigsuspend14 sigsuspend;
++}
+ else version (Solaris)
+ {
+ enum SIG_HOLD = cast(sigfn_t2)2;
+@@ -1860,6 +1992,130 @@ else version( DragonFlyBSD )
+ int sigpause(int);
+ int sigrelse(int);
+ }
++else version( NetBSD )
++{
++ // No SIGPOLL on *BSD
++ enum SIGPROF = 27;
++ enum SIGSYS = 12;
++ enum SIGTRAP = 5;
++ enum SIGVTALRM = 26;
++ enum SIGXCPU = 24;
++ enum SIGXFSZ = 25;
++
++ enum
++ {
++ SA_ONSTACK = 0x0001,
++ SA_RESTART = 0x0002,
++ SA_RESETHAND = 0x0004,
++ SA_NODEFER = 0x0010,
++ SA_NOCLDWAIT = 0x0020,
++ SA_SIGINFO = 0x0040,
++ }
++
++ enum
++ {
++ SS_ONSTACK = 0x0001,
++ SS_DISABLE = 0x0004,
++ }
++
++ enum MINSIGSTKSZ = 8192;
++ enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
++;
++ //ucontext_t (defined in core.sys.posix.ucontext)
++ //mcontext_t (defined in core.sys.posix.ucontext)
++
++ struct stack_t
++ {
++ void* ss_sp;
++ size_t ss_size;
++ int ss_flags;
++ }
++
++ struct sigstack
++ {
++ void* ss_sp;
++ int ss_onstack;
++ }
++
++ enum
++ {
++ ILL_ILLOPC = 1,
++ ILL_ILLOPN,
++ ILL_ILLADR,
++ ILL_ILLTRP,
++ ILL_PRVOPC,
++ ILL_PRVREG,
++ ILL_COPROC,
++ ILL_BADSTK,
++ }
++
++ enum
++ {
++ BUS_ADRALN = 1,
++ BUS_ADRERR,
++ BUS_OBJERR,
++ }
++
++ enum
++ {
++ SEGV_MAPERR = 1,
++ SEGV_ACCERR,
++ }
++
++ enum
++ {
++ FPE_INTOVF = 1,
++ FPE_INTDIV,
++ FPE_FLTDIV,
++ FPE_FLTOVF,
++ FPE_FLTUND,
++ FPE_FLTRES,
++ FPE_FLTINV,
++ FPE_FLTSUB,
++ }
++
++ enum
++ {
++ TRAP_BRKPT = 1,
++ TRAP_TRACE,
++ }
++
++ enum
++ {
++ CLD_EXITED = 1,
++ CLD_KILLED,
++ CLD_DUMPED,
++ CLD_TRAPPED,
++ CLD_STOPPED,
++ CLD_CONTINUED,
++ }
++
++ enum
++ {
++ POLL_IN = 1,
++ POLL_OUT,
++ POLL_MSG,
++ POLL_ERR,
++ POLL_PRI,
++ POLL_HUP,
++ }
++
++ //sigfn_t bsd_signal(int sig, sigfn_t func);
++ sigfn_t sigset(int sig, sigfn_t func);
++
++ nothrow:
++ @nogc:
++ //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
++ sigfn_t2 sigset(int sig, sigfn_t2 func);
++
++ int killpg(pid_t, int);
++ int sigaltstack(in stack_t*, stack_t*);
++ int sighold(int);
++ int sigignore(int);
++ int siginterrupt(int, int);
++ int sigpause(int);
++ int sigrelse(int);
++}
+ else version (Solaris)
+ {
+ enum SIGPOLL = 22;
+@@ -2199,6 +2455,14 @@ else version( DragonFlyBSD )
+ c_long tv_nsec;
+ }
+ }
++else version( NetBSD )
++{
++ struct timespec
++ {
++ time_t tv_sec;
++ c_long tv_nsec;
++ }
++}
+ else version (Solaris)
+ {
+ struct timespec
+@@ -2321,6 +2585,21 @@ else version( DragonFlyBSD )
+ int sigtimedwait(in sigset_t*, siginfo_t*, in timespec*);
+ int sigwaitinfo(in sigset_t*, siginfo_t*);
+ }
++else version( NetBSD )
++{
++ struct sigevent
++ {
++ int sigev_notify;
++ int sigev_signo;
++ sigval sigev_value;
++ void function(sigval) sigev_notify_function;
++ void /* pthread_attr_t */*sigev_notify_attributes;
++ }
++
++ int sigqueue(pid_t, int, in sigval);
++ int sigtimedwait(in sigset_t*, siginfo_t*, in timespec*);
++ int sigwaitinfo(in sigset_t*, siginfo_t*);
++}
+ else version (OSX)
+ {
+ }
+@@ -2398,6 +2677,11 @@ else version( DragonFlyBSD )
+ {
+ int pthread_kill(pthread_t, int);
+ int pthread_sigmask(int, in sigset_t*, sigset_t*);
++}
++else version( NetBSD )
++{
++ int pthread_kill(pthread_t, int);
++ int pthread_sigmask(int, in sigset_t*, sigset_t*);
+ }
+ else version (Solaris)
+ {
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
new file mode 100644
index 0000000000..98990b7fd4
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdio.d
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/stdio.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/stdio.d
+@@ -272,6 +272,10 @@ version( FreeBSD )
+ {
+ enum P_tmpdir = "/var/tmp/";
+ }
++version( NetBSD )
++{
++ enum P_tmpdir = "/var/tmp/";
++}
+ version( Solaris )
+ {
+ enum P_tmpdir = "/var/tmp/";
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
new file mode 100644
index 0000000000..0e44b80a45
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_stdlib.d
@@ -0,0 +1,74 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/stdlib.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/stdlib.d
+@@ -95,6 +95,10 @@ else version( DragonFlyBSD )
+ {
+ int posix_memalign(void**, size_t, size_t);
+ }
++else version( NetBSD )
++{
++ int posix_memalign(void**, size_t, size_t);
++}
+ else version( Solaris )
+ {
+ int posix_memalign(void**, size_t, size_t);
+@@ -174,6 +178,10 @@ else version( DragonFlyBSD )
+ {
+ int rand_r(uint*);
+ }
++else version( NetBSD )
++{
++ int rand_r(uint*);
++}
+ else version( Solaris )
+ {
+ int rand_r(uint*);
+@@ -361,6 +369,47 @@ else version( DragonFlyBSD )
+ {
+ //WNOHANG (defined in core.sys.posix.sys.wait)
+ //WUNTRACED (defined in core.sys.posix.sys.wait)
++ //WEXITSTATUS (defined in core.sys.posix.sys.wait)
++ //WIFEXITED (defined in core.sys.posix.sys.wait)
++ //WIFSIGNALED (defined in core.sys.posix.sys.wait)
++ //WIFSTOPPED (defined in core.sys.posix.sys.wait)
++ //WSTOPSIG (defined in core.sys.posix.sys.wait)
++ //WTERMSIG (defined in core.sys.posix.sys.wait)
++
++ c_long a64l(in char*);
++ double drand48();
++ //char* ecvt(double, int, int *, int *); // LEGACY
++ double erand48(ref ushort[3]);
++ //char* fcvt(double, int, int *, int *); // LEGACY
++ //char* gcvt(double, int, char*); // LEGACY
++ int getsubopt(char**, in char**, char**);
++ int grantpt(int);
++ char* initstate(uint, char*, size_t);
++ c_long jrand48(ref ushort[3]);
++ char* l64a(c_long);
++ void lcong48(ref ushort[7]);
++ c_long lrand48();
++ char* mktemp(char*); // LEGACY
++ int mkstemp(char*);
++ char* mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
++ c_long mrand48();
++ c_long nrand48(ref ushort[3]);
++ int posix_openpt(int);
++ char* ptsname(int);
++ int putenv(char*);
++ c_long random();
++ char* realpath(in char*, char*);
++ ushort *seed48(ref ushort[3]);
++ void setkey(in char*);
++ char* setstate(in char*);
++ void srand48(c_long);
++ void srandom(uint);
++ int unlockpt(int);
++}
++else version( NetBSD )
++{
++ //WNOHANG (defined in core.sys.posix.sys.wait)
++ //WUNTRACED (defined in core.sys.posix.sys.wait)
+ //WEXITSTATUS (defined in core.sys.posix.sys.wait)
+ //WIFEXITED (defined in core.sys.posix.sys.wait)
+ //WIFSIGNALED (defined in core.sys.posix.sys.wait)
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
new file mode 100644
index 0000000000..8155ad2215
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ioctl.d
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/ioctl.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/ioctl.d
+@@ -359,6 +359,18 @@ else version (FreeBSD)
+
+ int ioctl(int, c_ulong, ...);
+ }
++else version (NetBSD)
++{
++ struct winsize
++ {
++ ushort ws_row;
++ ushort ws_col;
++ ushort ws_xpixel;
++ ushort ws_ypixel;
++ }
++
++ int ioctl(int, c_ulong, ...);
++}
+ else version (Solaris)
+ {
+ int ioctl(int fildes, int request, ...);
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
new file mode 100644
index 0000000000..6dbf3727d9
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_ipc.d
@@ -0,0 +1,39 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/ipc.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/ipc.d
+@@ -115,6 +115,32 @@ else version( FreeBSD )
+
+ key_t ftok(in char*, int);
+ }
++else version( NetBSD )
++{
++
++ struct ipc_perm
++ {
++ uid_t cuid;
++ gid_t cgid;
++ uid_t uid;
++ gid_t gid;
++ mode_t mode;
++ ushort seq;
++ key_t key;
++ }
++
++ enum IPC_CREAT = 0x0100; // 01000
++ enum IPC_EXCL = 0x0200; // 02000
++ enum IPC_NOWAIT = 0x0400; // 04000
++
++ enum key_t IPC_PRIVATE = 0;
++
++ enum IPC_RMID = 0;
++ enum IPC_SET = 1;
++ enum IPC_STAT = 2;
++
++ key_t ftok(in char*, int);
++}
+ else version( CRuntime_Bionic )
+ {
+ // All except ftok are from the linux kernel headers.
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
new file mode 100644
index 0000000000..e5dcbda13d
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_mman.d
@@ -0,0 +1,121 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/mman.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/mman.d
+@@ -85,6 +85,16 @@ else version( DragonFlyBSD )
+ enum POSIX_MADV_DONTNEED = 4;
+ int posix_madvise(void *addr, size_t len, int advice);
+ }
++else version( NetBSD )
++{
++ enum POSIX_MADV_NORMAL = 0;
++ enum POSIX_MADV_RANDOM = 1;
++ enum POSIX_MADV_SEQUENTIAL = 2;
++ enum POSIX_MADV_WILLNEED = 3;
++ enum POSIX_MADV_DONTNEED = 4;
++ int posix_madvise(void *addr, size_t len, int advice);
++}
++
+ else version (Solaris)
+ {
+ }
+@@ -134,6 +144,13 @@ else version( DragonFlyBSD )
+ enum PROT_WRITE = 0x02;
+ enum PROT_EXEC = 0x04;
+ }
++else version( NetBSD )
++{
++ enum PROT_NONE = 0x00;
++ enum PROT_READ = 0x01;
++ enum PROT_WRITE = 0x02;
++ enum PROT_EXEC = 0x04;
++}
+ else version (Solaris)
+ {
+ enum PROT_NONE = 0x00;
+@@ -185,6 +202,11 @@ else version( DragonFlyBSD )
+ void* mmap(void*, size_t, int, int, int, off_t);
+ int munmap(void*, size_t);
+ }
++else version( NetBSD )
++{
++ void* mmap(void*, size_t, int, int, int, off_t);
++ int munmap(void*, size_t);
++}
+ else version (Solaris)
+ {
+ void* mmap(void*, size_t, int, int, int, off_t);
+@@ -354,6 +376,21 @@ else version( DragonFlyBSD )
+
+ int msync(void*, size_t, int);
+ }
++else version( NetBSD )
++{
++ enum MAP_SHARED = 0x0001;
++ enum MAP_PRIVATE = 0x0002;
++ enum MAP_FIXED = 0x0010;
++ enum MAP_ANON = 0x1000;
++
++ enum MAP_FAILED = cast(void*)-1;
++
++ enum MS_SYNC = 0x0000;
++ enum MS_ASYNC = 0x0001;
++ enum MS_INVALIDATE = 0x0002;
++
++ int msync(void*, size_t, int);
++}
+ else version (Solaris)
+ {
+ enum MAP_SHARED = 0x0001;
+@@ -477,6 +514,14 @@ else version( DragonFlyBSD )
+ int mlockall(int);
+ int munlockall();
+ }
++else version( NetBSD )
++{
++ enum MCL_CURRENT = 0x0001;
++ enum MCL_FUTURE = 0x0002;
++
++ int mlockall(int);
++ int munlockall();
++}
+ else version (Solaris)
+ {
+ enum MCL_CURRENT = 0x0001;
+@@ -526,6 +571,11 @@ else version( DragonFlyBSD )
+ int mlock(in void*, size_t);
+ int munlock(in void*, size_t);
+ }
++else version( NetBSD )
++{
++ int mlock(in void*, size_t);
++ int munlock(in void*, size_t);
++}
+ else version (Solaris)
+ {
+ int mlock(in void*, size_t);
+@@ -564,6 +614,10 @@ else version( DragonFlyBSD )
+ {
+ int mprotect(void*, size_t, int);
+ }
++else version( NetBSD )
++{
++ int mprotect(void*, size_t, int);
++}
+ else version (Solaris)
+ {
+ int mprotect(void*, size_t, int);
+@@ -604,6 +658,11 @@ else version( DragonFlyBSD )
+ {
+ int shm_open(in char*, int, mode_t);
+ int shm_unlink(in char*);
++}
++else version( NetBSD )
++{
++ int shm_open(in char*, int, mode_t);
++ int shm_unlink(in char*);
+ }
+ else version (Solaris)
+ {
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
new file mode 100644
index 0000000000..3e10623004
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_resource.d
@@ -0,0 +1,84 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/resource.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/resource.d
+@@ -292,6 +292,64 @@ else version (DragonFlyBSD)
+ RLIMIT_AS = 10,
+ }
+ }
++else version (NetBSD)
++{
++ enum
++ {
++ PRIO_PROCESS = 0,
++ PRIO_PGRP = 1,
++ PRIO_USER = 2,
++ }
++
++ alias long rlim_t;
++
++ enum
++ {
++ RLIM_INFINITY = (cast(rlim_t)((cast(ulong) 1 << 63) - 1)),
++ // FreeBSD explicitly does not define the following:
++ //RLIM_SAVED_MAX,
++ //RLIM_SAVED_CUR,
++ }
++
++ enum
++ {
++ RUSAGE_SELF = 0,
++ RUSAGE_CHILDREN = -1,
++ }
++
++ struct rusage
++ {
++ timeval ru_utime;
++ timeval ru_stime;
++ c_long ru_maxrss;
++ alias ru_ixrss ru_first;
++ c_long ru_ixrss;
++ c_long ru_idrss;
++ c_long ru_isrss;
++ c_long ru_minflt;
++ c_long ru_majflt;
++ c_long ru_nswap;
++ c_long ru_inblock;
++ c_long ru_oublock;
++ c_long ru_msgsnd;
++ c_long ru_msgrcv;
++ c_long ru_nsignals;
++ c_long ru_nvcsw;
++ c_long ru_nivcsw;
++ alias ru_nivcsw ru_last;
++ }
++
++ enum
++ {
++ RLIMIT_CORE = 4,
++ RLIMIT_CPU = 0,
++ RLIMIT_DATA = 2,
++ RLIMIT_FSIZE = 1,
++ RLIMIT_NOFILE = 8,
++ RLIMIT_STACK = 3,
++ RLIMIT_AS = 10,
++ }
++}
+ else version (Solaris)
+ {
+ enum
+@@ -473,6 +531,12 @@ else version (DragonFlyBSD)
+ {
+ int getrlimit(int, rlimit*);
+ int getrusage(int, rusage*);
++ int setrlimit(int, in rlimit*);
++}
++else version (NetBSD)
++{
++ int getrlimit(int, rlimit*);
++ int getrusage(int, rusage*);
+ int setrlimit(int, in rlimit*);
+ }
+ else version (Solaris)
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
new file mode 100644
index 0000000000..832f675267
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_select.d
@@ -0,0 +1,62 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/select.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/select.d
+@@ -218,6 +218,55 @@ else version( FreeBSD )
+ int pselect(int, fd_set*, fd_set*, fd_set*, in timespec*, in sigset_t*);
+ int select(int, fd_set*, fd_set*, fd_set*, timeval*);
+ }
++else version( NetBSD )
++{
++ private
++ {
++ alias c_ulong __fd_mask;
++ enum _NFDBITS = __fd_mask.sizeof * 8;
++ }
++
++ enum uint FD_SETSIZE = 256;
++
++ struct fd_set
++ {
++ __fd_mask[(FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS] __fds_bits;
++ }
++
++ extern (D) __fd_mask __fdset_mask(uint n)
++ {
++ return cast(__fd_mask) 1 << (n % _NFDBITS);
++ }
++
++ extern (D) void FD_CLR( int n, fd_set* p )
++ {
++ p.__fds_bits[n / _NFDBITS] &= ~__fdset_mask(n);
++ }
++
++ extern (D) bool FD_ISSET( int n, const(fd_set)* p )
++ {
++ return (p.__fds_bits[n / _NFDBITS] & __fdset_mask(n)) != 0;
++ }
++
++ extern (D) void FD_SET( int n, fd_set* p )
++ {
++ p.__fds_bits[n / _NFDBITS] |= __fdset_mask(n);
++ }
++
++ extern (D) void FD_ZERO( fd_set* p )
++ {
++ fd_set *_p;
++ size_t _n;
++
++ _p = p;
++ _n = (FD_SETSIZE + (_NFDBITS - 1)) / _NFDBITS;
++ while (_n > 0)
++ _p.__fds_bits[--_n] = 0;
++ }
++
++ int pselect(int, fd_set*, fd_set*, fd_set*, in timespec*, in sigset_t*);
++ int select(int, fd_set*, fd_set*, fd_set*, timeval*);
++}
+ else version (Solaris)
+ {
+ private
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
new file mode 100644
index 0000000000..3a39b4ea49
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_shm.d
@@ -0,0 +1,39 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/shm.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/shm.d
+@@ -121,6 +121,32 @@ else version( FreeBSD )
+ int shmdt(in void*);
+ int shmget(key_t, size_t, int);
+ }
++else version( NetBSD )
++{
++ enum SHM_RDONLY = 0x01000; // 010000
++ enum SHM_RND = 0x02000; // 020000
++ enum SHMLBA = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
++
++ alias c_ulong shmatt_t;
++
++ struct shmid_ds
++ {
++ ipc_perm shm_perm;
++ size_t shm_segsz;
++ pid_t shm_lpid;
++ pid_t shm_cpid;
++ short shm_nattch;
++ time_t shm_atime;
++ time_t shm_dtime;
++ time_t shm_ctime;
++ void* shm_internal;
++ }
++
++ void* shmat(int, in void*, int);
++ int shmctl(int, int, shmid_ds*);
++ int shmdt(in void*);
++ int shmget(key_t, size_t, int);
++}
+ else version( OSX )
+ {
+
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
new file mode 100644
index 0000000000..9cd98b5ba8
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_socket.d
@@ -0,0 +1,240 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/socket.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/socket.d
+@@ -1230,6 +1230,205 @@ else version( DragonFlyBSD )
+ int socketpair(int, int, int, ref int[2]);
+ // void pfctlinput(int, struct sockaddr *);
+ }
++else version( NetBSD )
++{
++ alias uint socklen_t;
++ alias ubyte sa_family_t;
++
++ struct sockaddr
++ {
++ ubyte sa_len;
++ sa_family_t sa_family;
++ byte[14] sa_data;
++ }
++
++ private
++ {
++ enum _SS_ALIGNSIZE = long.sizeof;
++ enum _SS_MAXSIZE = 128;
++ enum _SS_PAD1SIZE = _SS_ALIGNSIZE - ubyte.sizeof - sa_family_t.sizeof;
++ enum _SS_PAD2SIZE = _SS_MAXSIZE - ubyte.sizeof - sa_family_t.sizeof - _SS_PAD1SIZE - _SS_ALIGNSIZE;
++ }
++
++ struct sockaddr_storage
++ {
++ ubyte ss_len;
++ sa_family_t ss_family;
++ byte[_SS_PAD1SIZE] __ss_pad1;
++ long __ss_align;
++ byte[_SS_PAD2SIZE] __ss_pad2;
++ }
++
++ struct msghdr
++ {
++ void* msg_name;
++ socklen_t msg_namelen;
++ iovec* msg_iov;
++ int msg_iovlen;
++ void* msg_control;
++ socklen_t msg_controllen;
++ int msg_flags;
++ }
++
++ struct cmsghdr
++ {
++ socklen_t cmsg_len;
++ int cmsg_level;
++ int cmsg_type;
++ }
++
++ enum : uint
++ {
++ SCM_RIGHTS = 0x01
++ }
++
++ private // <machine/param.h>
++ {
++ enum _ALIGNBYTES = /+c_int+/ int.sizeof - 1;
++ extern (D) size_t _ALIGN( size_t p ) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; }
++ }
++
++ extern (D) ubyte* CMSG_DATA( cmsghdr* cmsg )
++ {
++ return cast(ubyte*) cmsg + _ALIGN( cmsghdr.sizeof );
++ }
++
++ extern (D) cmsghdr* CMSG_NXTHDR( msghdr* mhdr, cmsghdr* cmsg )
++ {
++ if( cmsg == null )
++ {
++ return CMSG_FIRSTHDR( mhdr );
++ }
++ else
++ {
++ if( cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ) + _ALIGN( cmsghdr.sizeof ) >
++ cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen )
++ return null;
++ else
++ return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN( cmsg.cmsg_len ));
++ }
++ }
++
++ extern (D) cmsghdr* CMSG_FIRSTHDR( msghdr* mhdr )
++ {
++ return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null;
++ }
++
++ struct linger
++ {
++ int l_onoff;
++ int l_linger;
++ }
++
++ enum
++ {
++ SOCK_DGRAM = 2,
++ SOCK_RDM = 4,
++ SOCK_SEQPACKET = 5,
++ SOCK_STREAM = 1
++ }
++
++ enum : uint
++ {
++ SOL_SOCKET = 0xffff
++ }
++
++ enum : uint
++ {
++ SO_DEBUG = 0x0001, /* turn on debugging info recording */
++ SO_ACCEPTCONN = 0x0002, /* socket has had listen() */
++ SO_REUSEADDR = 0x0004, /* allow local address reuse */
++ SO_KEEPALIVE = 0x0008, /* keep connections alive */
++ SO_DONTROUTE = 0x0010, /* just use interface addresses */
++ SO_BROADCAST = 0x0020, /* permit sending of broadcast msgs */
++ SO_USELOOPBACK = 0x0040, /* bypass hardware when possible */
++ SO_LINGER = 0x0080, /* linger on close if data present */
++ SO_OOBINLINE = 0x0100, /* leave received OOB data in line */
++ SO_REUSEPORT = 0x0200, /* allow local address & port reuse */
++ /* SO_OTIMESTAMP 0x0400 */
++ SO_NOSIGPIPE = 0x0800, /* no SIGPIPE from EPIPE */
++ SO_ACCEPTFILTER = 0x1000, /* there is an accept filter */
++ SO_TIMESTAMP = 0x2000, /* timestamp received dgram traffic */
++
++ /*
++ * Additional options, not kept in so_options.
++ */
++ SO_SNDBUF = 0x1001, /* send buffer size */
++ SO_RCVBUF = 0x1002, /* receive buffer size */
++ SO_SNDLOWAT = 0x1003, /* send low-water mark */
++ SO_RCVLOWAT = 0x1004, /* receive low-water mark */
++ /* SO_OSNDTIMEO 0x1005 */
++ /* SO_ORCVTIMEO 0x1006 */
++ SO_ERROR = 0x1007, /* get error status and clear */
++ SO_TYPE = 0x1008, /* get socket type */
++ SO_OVERFLOWED = 0x1009, /* datagrams: return packets dropped */
++
++ SO_NOHEADER = 0x100a, /* user supplies no header to kernel;
++ * kernel removes header and supplies
++ * payload
++ */
++ SO_SNDTIMEO = 0x100b, /* send timeout */
++ SO_RCVTIMEO = 0x100c /* receive timeout */
++
++ }
++
++ enum
++ {
++ SOMAXCONN = 128
++ }
++
++ enum : uint
++ {
++ MSG_OOB = 0x0001, /* process out-of-band data */
++ MSG_PEEK = 0x0002, /* peek at incoming message */
++ MSG_DONTROUTE = 0x0004, /* send without using routing tables */
++ MSG_EOR = 0x0008, /* data completes record */
++ MSG_TRUNC = 0x0010, /* data discarded before delivery */
++ MSG_CTRUNC = 0x0020, /* control data lost before delivery */
++ MSG_WAITALL = 0x0040, /* wait for full request or error */
++ MSG_DONTWAIT = 0x0080, /* this message should be nonblocking */
++ MSG_BCAST = 0x0100, /* this message was rcvd using link-level brdcst */
++ MSG_MCAST = 0x0200, /* this message was rcvd using link-level mcast */
++ MSG_NOSIGNAL = 0x0400 /* do not generate SIGPIPE on EOF */
++
++
++ }
++
++ enum
++ {
++ AF_APPLETALK = 16,
++ AF_INET = 2,
++ AF_IPX = 23,
++ AF_UNIX = 1,
++ AF_UNSPEC = 0
++ }
++
++ enum
++ {
++ SHUT_RD = 0,
++ SHUT_WR = 1,
++ SHUT_RDWR = 2
++ }
++
++ int accept(int, sockaddr*, socklen_t*);
++ int bind(int, in sockaddr*, socklen_t);
++ int connect(int, in sockaddr*, socklen_t);
++ int getpeername(int, sockaddr*, socklen_t*);
++ int getsockname(int, sockaddr*, socklen_t*);
++ int getsockopt(int, int, int, void*, socklen_t*);
++ int listen(int, int);
++ ssize_t recv(int, void*, size_t, int);
++ ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*);
++ ssize_t recvmsg(int, msghdr*, int);
++ ssize_t send(int, in void*, size_t, int);
++ ssize_t sendmsg(int, in msghdr*, int);
++ ssize_t sendto(int, in void*, size_t, int, in sockaddr*, socklen_t);
++ int setsockopt(int, int, int, in void*, socklen_t);
++ int shutdown(int, int);
++ int socket(int, int, int);
++ int sockatmark(int);
++ int socketpair(int, int, int, ref int[2]);
++}
+ else version (Solaris)
+ {
+ alias uint socklen_t;
+@@ -1657,6 +1856,13 @@ else version( DragonFlyBSD )
+ AF_INET6 = 28
+ }
+ }
++else version( NetBSD )
++{
++ enum
++ {
++ AF_INET6 = 24
++ }
++}
+ else version (Solaris)
+ {
+ enum
+@@ -1708,6 +1914,13 @@ else version( DragonFlyBSD )
+ {
+ enum
+ {
++ SOCK_RAW = 3
++ }
++}
++else version( NetBSD )
++{
++ enum
++ {
+ SOCK_RAW = 3
+ }
+ }
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
new file mode 100644
index 0000000000..a7e47946c4
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_stat.d
@@ -0,0 +1,113 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/stat.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/stat.d
+@@ -839,6 +839,70 @@ else version( DragonFlyBSD )
+ extern (D) bool S_ISLNK( mode_t mode ) { return S_ISTYPE( mode, S_IFLNK ); }
+ extern (D) bool S_ISSOCK( mode_t mode ) { return S_ISTYPE( mode, S_IFSOCK ); }
+ }
++else version( NetBSD )
++{
++ struct stat_t
++ {
++ dev_t st_dev; /* inode's device */
++ mode_t st_mode; /* inode protection mode */
++ ino_t st_ino; /* inode's number */
++ nlink_t st_nlink; /* number of hard links */
++ uid_t st_uid; /* user ID of the file's owner */
++ gid_t st_gid; /* group ID of the file's group */
++ dev_t st_rdev; /* device type */
++
++ time_t st_atime; /* time of last access */
++ long st_atimensec; /* nsec of last access */
++ time_t st_mtime; /* time of last data modification */
++ long st_mtimensec; /* nsec of last data modification */
++ time_t st_ctime; /* time of last file status change */
++ long st_ctimensec; /* nsec of last file status change */
++ time_t st_birthtime; /* time of creation */
++ long st_birthtimensec; /* nsec of time of creation */
++
++ off_t st_size; /* file size, in bytes */
++ blkcnt_t st_blocks; /* blocks allocated for file */
++ blksize_t st_blksize; /* optimal blocksize for I/O */
++ uint32_t st_flags; /* user defined flags for file */
++ uint32_t st_gen; /* file generation number */
++ uint32_t[2] st_spare;
++ }
++
++ enum S_IRUSR = 0x100; // octal 0000400
++ enum S_IWUSR = 0x080; // octal 0000200
++ enum S_IXUSR = 0x040; // octal 0000100
++ enum S_IRWXU = 0x1C0; // octal 0000700
++
++ enum S_IRGRP = 0x020; // octal 0000040
++ enum S_IWGRP = 0x010; // octal 0000020
++ enum S_IXGRP = 0x008; // octal 0000010
++ enum S_IRWXG = 0x038; // octal 0000070
++
++ enum S_IROTH = 0x4; // 0000004
++ enum S_IWOTH = 0x2; // 0000002
++ enum S_IXOTH = 0x1; // 0000001
++ enum S_IRWXO = 0x7; // 0000007
++
++ enum S_ISUID = 0x800; // octal 0004000
++ enum S_ISGID = 0x400; // octal 0002000
++ enum S_ISVTX = 0x200; // octal 0001000
++
++ private
++ {
++ extern (D) bool S_ISTYPE( mode_t mode, uint mask )
++ {
++ return ( mode & S_IFMT ) == mask;
++ }
++ }
++
++ extern (D) bool S_ISBLK( mode_t mode ) { return S_ISTYPE( mode, S_IFBLK ); }
++ extern (D) bool S_ISCHR( mode_t mode ) { return S_ISTYPE( mode, S_IFCHR ); }
++ extern (D) bool S_ISDIR( mode_t mode ) { return S_ISTYPE( mode, S_IFDIR ); }
++ extern (D) bool S_ISFIFO( mode_t mode ) { return S_ISTYPE( mode, S_IFIFO ); }
++ extern (D) bool S_ISREG( mode_t mode ) { return S_ISTYPE( mode, S_IFREG ); }
++ extern (D) bool S_ISLNK( mode_t mode ) { return S_ISTYPE( mode, S_IFLNK ); }
++ extern (D) bool S_ISSOCK( mode_t mode ) { return S_ISTYPE( mode, S_IFSOCK ); }
++}
+ else version (Solaris)
+ {
+ private enum _ST_FSTYPSZ = 16;
+@@ -1200,6 +1264,15 @@ else version( DragonFlyBSD )
+ int lstat(in char*, stat_t*);
+ int stat(in char*, stat_t*);
+ }
++else version( NetBSD )
++{
++ int __fstat50(int, stat_t*);
++ int __lstat50(in char*, stat_t*);
++ int __stat50(in char*, stat_t*);
++ alias __fstat50 fstat;
++ alias __lstat50 lstat;
++ alias __stat50 stat;
++}
+ else version( CRuntime_Bionic )
+ {
+ int fstat(int, stat_t*) @trusted;
+@@ -1273,6 +1346,19 @@ else version( DragonFlyBSD )
+ {
+ enum S_IFMT = 0xF000; // octal 0170000
+ enum S_IFBLK = 0x6000; // octal 0060000
++ enum S_IFCHR = 0x2000; // octal 0020000
++ enum S_IFIFO = 0x1000; // octal 0010000
++ enum S_IFREG = 0x8000; // octal 0100000
++ enum S_IFDIR = 0x4000; // octal 0040000
++ enum S_IFLNK = 0xA000; // octal 0120000
++ enum S_IFSOCK = 0xC000; // octal 0140000
++
++ int mknod(in char*, mode_t, dev_t);
++}
++else version( NetBSD )
++{
++ enum S_IFMT = 0xF000; // octal 0170000
++ enum S_IFBLK = 0x6000; // octal 0060000
+ enum S_IFCHR = 0x2000; // octal 0020000
+ enum S_IFIFO = 0x1000; // octal 0010000
+ enum S_IFREG = 0x8000; // octal 0100000
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
new file mode 100644
index 0000000000..39b1d13008
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_time.d
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/sys/time.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/time.d
+@@ -149,6 +149,27 @@ else version( DragonFlyBSD )
+ int setitimer(int, in itimerval*, itimerval*);
+ int utimes(in char*, ref const(timeval)[2]);
+ }
++else version( NetBSD )
++{
++ struct timeval
++ {
++ time_t tv_sec;
++ suseconds_t tv_usec;
++ }
++
++ struct itimerval
++ {
++ timeval it_interval;
++ timeval it_value;
++ }
++
++
++ int getitimer(int, itimerval*);
++ int gettimeofday(timeval*, void*); // timezone_t* is normally void*
++ int setitimer(int, in itimerval*, itimerval*);
++ int utimes(in char*, ref const(timeval)[2]);
++}
++
+ else version (Solaris)
+ {
+ struct timeval
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
new file mode 100644
index 0000000000..4a7d76c327
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_uio.d
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/uio.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/uio.d
+@@ -70,6 +70,17 @@ else version( FreeBSD )
+ ssize_t readv(int, in iovec*, int);
+ ssize_t writev(int, in iovec*, int);
+ }
++else version( NetBSD )
++{
++ struct iovec
++ {
++ void* iov_base;
++ size_t iov_len;
++ }
++
++ ssize_t readv(int, in iovec*, int);
++ ssize_t writev(int, in iovec*, int);
++}
+ else version (Solaris)
+ {
+ struct iovec
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
new file mode 100644
index 0000000000..3abe868e85
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_un.d
@@ -0,0 +1,22 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/un.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/un.d
+@@ -60,6 +60,15 @@ else version( FreeBSD )
+ byte[104] sun_path;
+ }
+ }
++else version( NetBSD )
++{
++ struct sockaddr_un
++ {
++ ubyte sun_len;
++ sa_family_t sun_family;
++ byte[104] sun_path;
++ }
++}
+ else version( Solaris )
+ {
+ struct sockaddr_un
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
new file mode 100644
index 0000000000..48d4014920
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_utsname.d
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/utsname.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/sys/utsname.d
+@@ -53,6 +53,22 @@ else version(FreeBSD)
+
+ int uname(utsname* __name);
+ }
++else version(NetBSD)
++{
++ private enum utsNameLength = 256;
++
++ struct utsname
++ {
++ char[utsNameLength] sysname;
++ char[utsNameLength] nodename;
++ char[utsNameLength] release;
++ // The field name is version but version is a keyword in D.
++ char[utsNameLength] update;
++ char[utsNameLength] machine;
++ }
++
++ int uname(utsname* __name);
++}
+ else version(CRuntime_Bionic)
+ {
+ private enum SYS_NMLN = 65;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
new file mode 100644
index 0000000000..d0534b2a26
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_sys_wait.d
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/sys/wait.d.orig 2020-05-07 08:52:17.154678602 +0000
++++ runtime/druntime/src/core/sys/posix/sys/wait.d
+@@ -255,6 +255,11 @@ else version (DragonFlyBSD)
+ enum WCONTINUED = 4;
+ enum WNOWAIT = 8;
+ }
++else version (NetBSD)
++{
++ enum WSTOPPED = WUNTRACED;
++ enum WNOWAIT = 0x0010000;
++}
+ else version (Solaris)
+ {
+ enum WEXITED = 1;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
new file mode 100644
index 0000000000..e77f8c417c
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_syslog.d
@@ -0,0 +1,78 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/syslog.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/syslog.d
+@@ -202,6 +202,71 @@ else version( FreeBSD )
+ void syslog (int __pri, const char *__fmt, ...);
+ void closelog();
+ }
++else version( NetBSD )
++{
++ //http://fxr.watson.org/fxr/source/sys/syslog.h
++
++ //PRIORITY
++ enum {
++ LOG_EMERG = 0, /* system is unusable */
++ LOG_ALERT = 1, /* action must be taken immediately */
++ LOG_CRIT = 2, /* critical conditions */
++ LOG_ERR = 3, /* error conditions */
++ LOG_WARNING = 4, /* warning conditions */
++ LOG_NOTICE = 5, /* normal but significant condition */
++ LOG_INFO = 6, /* informational */
++ LOG_DEBUG = 7, /* debug-level messages */
++ };
++
++ //OPTIONS
++ enum {
++ LOG_PID = 0x01, /* log the pid with each message */
++ LOG_CONS = 0x02, /* log on the console if errors in sending */
++ LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */
++ LOG_NDELAY = 0x08, /* don't delay open */
++ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */
++ LOG_PERROR = 0x20, /* log to stderr as well */
++ };
++
++ //FACILITY
++ enum {
++ LOG_KERN = (0<<3), /* kernel messages */
++ LOG_USER = (1<<3), /* random user-level messages */
++ LOG_MAIL = (2<<3), /* mail system */
++ LOG_DAEMON = (3<<3), /* system daemons */
++ LOG_AUTH = (4<<3), /* security/authorization messages */
++ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */
++ LOG_LPR = (6<<3), /* line printer subsystem */
++ LOG_NEWS = (7<<3), /* network news subsystem */
++ LOG_UUCP = (8<<3), /* UUCP subsystem */
++ LOG_CRON = (9<<3), /* clock daemon */
++ LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
++ LOG_FTP = (11<<3), /* ftp daemon */
++ LOG_NTP = (12<<3), /* NTP subsystem */
++ LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
++ LOG_CONSOLE = (14<<3), /* /dev/console output */
++
++ /* other codes through 15 reserved for system use */
++ LOG_LOCAL0 = (16<<3), /* reserved for local use */
++ LOG_LOCAL1 = (17<<3), /* reserved for local use */
++ LOG_LOCAL2 = (18<<3), /* reserved for local use */
++ LOG_LOCAL3 = (19<<3), /* reserved for local use */
++ LOG_LOCAL4 = (20<<3), /* reserved for local use */
++ LOG_LOCAL5 = (21<<3), /* reserved for local use */
++ LOG_LOCAL6 = (22<<3), /* reserved for local use */
++ LOG_LOCAL7 = (23<<3), /* reserved for local use */
++
++ LOG_NFACILITIES = 24, /* current number of facilities */
++ };
++
++ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */
++ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */
++
++ void openlog (const char *, int __option, int __facility);
++ int setlogmask (int __mask);
++ void syslog (int __pri, const char *__fmt, ...);
++ void closelog();
++}
+ else version( Solaris )
+ {
+ //http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_termios.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
new file mode 100644
index 0000000000..7c0510188b
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_termios.d
@@ -0,0 +1,47 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/termios.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/termios.d
+@@ -638,6 +638,40 @@ version( CRuntime_Glibc )
+
+ pid_t tcgetsid(int);
+ }
++else version( NetBSD )
++{
++ enum IXANY = 0x00000800;
++
++ enum ONLCR = 0x00000002;
++ enum OCRNL = 0x00000010;
++ enum ONOCR = 0x00000020;
++ enum ONLRET = 0x00000040;
++ //enum OFILL
++ //enum NLDLY
++ //enum NL0
++ //enum NL1
++ //enum CRDLY
++ //enum CR0
++ //enum CR1
++ //enum CR2
++ //enum CR3
++ enum TABDLY = 0x00000004;
++ enum TAB0 = 0x00000000;
++ //enum TAB1
++ //enum TAB2
++ enum TAB3 = 0x00000004;
++ //enum BSDLY
++ //enum BS0
++ //enum BS1
++ //enum VTDLY
++ //enum VT0
++ //enum VT1
++ //enum FFDLY
++ //enum FF0
++ //enum FF1
++
++ pid_t tcgetsid(int);
++}
+
+ else version (OSX)
+ {
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_time.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_time.d
new file mode 100644
index 0000000000..8865ff41b4
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_time.d
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/time.d.orig 2020-05-07 08:52:17.274678259 +0000
++++ runtime/druntime/src/core/sys/posix/time.d
+@@ -60,6 +60,10 @@ else version( NetBSD )
+ {
+ time_t timegm(tm*); // non-standard
+ }
++else version( NetBSD )
++{
++ time_t timegm(tm*); // non-standard
++}
+ else version (Solaris)
+ {
+ time_t timegm(tm*); // non-standard
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
new file mode 100644
index 0000000000..8439192e6a
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_ucontext.d
@@ -0,0 +1,67 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/ucontext.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/ucontext.d
+@@ -766,6 +766,62 @@ else version( DragonFlyBSD )
+ int[4] __spare__;
+ }
+ }
++else version( NetBSD )
++{
++
++ version( X86_64 )
++ {
++ enum { NGREG = 26 };
++ alias __greg_t = ulong;
++ alias __gregset_t = __greg_t[NGREG];
++ alias __fpregset_t = align(8)ubyte[512];
++
++ struct mcontext_t {
++ __gregset_t __gregs;
++ __greg_t _mc_tlsbase;
++ __fpregset_t __fpregs;
++ }
++ }
++ else version( X86 )
++ {
++ enum { NGREG = 19 };
++ alias __greg_t = ulong;
++ alias __gregset_t = __greg_t[_NGREG];
++ struct __fpregset_t{
++ union __fp_reg_set{
++ struct __fpchip_state{
++ int[27] __fp_state; /* Environment and registers */
++ } ; /* x87 regs in fsave format */
++ struct __fp_xmm_state{
++ ubyte[512] __fp_xmm;
++ } ; /* x87 and xmm regs in fxsave format */
++ int[128] __fp_fpregs;
++ };
++ __fpregset_t __fp_reg_set;
++ int[33] __fp_pad; /* Historic padding */
++ };
++
++ struct mcontext_t {
++ __gregset_t __gregs;
++ __fpregset_t __fpregs;
++ __greg_t _mc_tlsbase;
++ }
++ }
++
++ struct ucontext_t
++ {
++ uint uc_flags; /* properties */
++ ucontext_t * uc_link; /* context to resume */
++ sigset_t uc_sigmask; /* signals blocked in this context */
++ stack_t uc_stack; /* the stack used by this context */
++ mcontext_t uc_mcontext; /* machine state */
++ /+ todo #if defined(_UC_MACHINE_PAD)
++ long __uc_pad[_UC_MACHINE_PAD];
++ #endif
++ +/
++
++ }
++}
+ else version ( Solaris )
+ {
+ alias uint[4] upad128_t;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
new file mode 100644
index 0000000000..0a11df858f
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_unistd.d
@@ -0,0 +1,192 @@
+$NetBSD$
+
+--- runtime/druntime/src/core/sys/posix/unistd.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/unistd.d
+@@ -121,6 +121,11 @@ else version( DragonFlyBSD )
+ off_t lseek(int, off_t, int) @trusted;
+ int ftruncate(int, off_t) @trusted;
+ }
++else version( NetBSD )
++{
++ off_t lseek(int, off_t, int) @trusted;
++ int ftruncate(int, off_t) @trusted;
++}
+ else version( Solaris )
+ {
+ version ( D_LP64 )
+@@ -968,6 +973,143 @@ else version( DragonFlyBSD )
+ _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14,
+ }
+ }
++else version( NetBSD )
++{
++ enum F_OK = 0;
++ enum R_OK = 0x04;
++ enum W_OK = 0x02;
++ enum X_OK = 0x01;
++
++ enum F_ULOCK = 0;
++ enum F_LOCK = 1;
++ enum F_TLOCK = 2;
++ enum F_TEST = 3;
++
++ enum
++ {
++ _SC_ARG_MAX = 1,
++ _SC_CHILD_MAX = 2,
++ _O_SC_CLK_TCK = 3,
++ _SC_NGROUPS_MAX = 4,
++ _SC_OPEN_MAX = 5,
++ _SC_JOB_CONTROL = 6,
++ _SC_SAVED_IDS = 7,
++ _SC_VERSION = 8,
++ _SC_BC_BASE_MAX = 9,
++ _SC_BC_DIM_MAX = 10,
++ _SC_BC_SCALE_MAX = 11,
++ _SC_BC_STRING_MAX = 12,
++ _SC_COLL_WEIGHTS_MAX = 13,
++ _SC_EXPR_NEST_MAX = 14,
++ _SC_LINE_MAX = 15,
++ _SC_RE_DUP_MAX = 16,
++ _SC_2_VERSION = 17,
++ _SC_2_C_BIND = 18,
++ _SC_2_C_DEV = 19,
++ _SC_2_CHAR_TERM = 20,
++ _SC_2_FORT_DEV = 21,
++ _SC_2_FORT_RUN = 22,
++ _SC_2_LOCALEDEF = 23,
++ _SC_2_SW_DEV = 24,
++ _SC_2_UPE = 25,
++ _SC_STREAM_MAX = 26,
++ _SC_TZNAME_MAX = 27,
++ _SC_PAGESIZE = 28,
++ _SC_FSYNC = 29,
++ _SC_XOPEN_SHM = 30,
++ _SC_SYNCHRONIZED_IO = 31,
++ _SC_IOV_MAX = 32,
++ _SC_MAPPED_FILES = 33,
++ _SC_MEMLOCK = 34,
++ _SC_MEMLOCK_RANGE = 35,
++ _SC_MEMORY_PROTECTION = 36,
++ _SC_LOGIN_NAME_MAX = 37,
++ _SC_MONOTONIC_CLOCK = 38,
++ _SC_CLK_TCK = 39,
++ _SC_ATEXIT_MAX = 40,
++ _SC_THREADS = 41,
++ _SC_SEMAPHORES = 42,
++ _SC_BARRIERS = 43,
++ _SC_TIMERS = 44,
++ _SC_SPIN_LOCKS = 45,
++ _SC_READER_WRITER_LOCKS = 46,
++ _SC_GETGR_R_SIZE_MAX = 47,
++ _SC_GETPW_R_SIZE_MAX = 48,
++ _SC_CLOCK_SELECTION = 49,
++ _SC_ASYNCHRONOUS_IO = 50,
++ _SC_AIO_LISTIO_MAX = 51,
++ _SC_AIO_MAX = 52,
++ _SC_MESSAGE_PASSING = 53,
++ _SC_MQ_OPEN_MAX = 54,
++ _SC_MQ_PRIO_MAX = 55,
++ _SC_PRIORITY_SCHEDULING = 56,
++ _SC_THREAD_DESTRUCTOR_ITERATIONS = 57,
++ _SC_THREAD_KEYS_MAX = 58,
++ _SC_THREAD_STACK_MIN = 59,
++ _SC_THREAD_THREADS_MAX = 60,
++ _SC_THREAD_ATTR_STACKADDR = 61,
++ _SC_THREAD_ATTR_STACKSIZE = 62,
++ _SC_THREAD_PRIORITY_SCHEDULING = 63,
++ _SC_THREAD_PRIO_INHERIT = 64,
++ _SC_THREAD_PRIO_PROTECT = 65,
++ _SC_THREAD_PROCESS_SHARED = 66,
++ _SC_THREAD_SAFE_FUNCTIONS = 67,
++ _SC_TTY_NAME_MAX = 68,
++ _SC_HOST_NAME_MAX = 69,
++ _SC_PASS_MAX = 70,
++ _SC_REGEXP = 71,
++ _SC_SHELL = 72,
++ _SC_SYMLOOP_MAX = 73,
++
++ /* Actually, they are not supported or implemented yet */
++ _SC_V6_ILP32_OFF32 = 74,
++ _SC_V6_ILP32_OFFBIG = 75,
++ _SC_V6_LP64_OFF64 = 76,
++ _SC_V6_LPBIG_OFFBIG = 77,
++ _SC_2_PBS = 80,
++ _SC_2_PBS_ACCOUNTING = 81,
++ _SC_2_PBS_CHECKPOINT = 82,
++ _SC_2_PBS_LOCATE = 83,
++ _SC_2_PBS_MESSAGE = 84,
++ _SC_2_PBS_TRACK = 85,
++
++ /* These are implemented */
++ _SC_SPAWN = 86,
++ _SC_SHARED_MEMORY_OBJECTS = 87,
++
++ /* Extensions found in Solaris and Linux. */
++ _SC_PHYS_PAGES = 121,
++
++ /* Commonly provided sysconf() extensions */
++ _SC_NPROCESSORS_CONF = 1001,
++ _SC_NPROCESSORS_ONLN = 1002,
++ /* Native variables */
++ _SC_SCHED_RT_TS = 2001,
++ _SC_SCHED_PRI_MIN = 2002,
++ _SC_SCHED_PRI_MAX = 2003
++
++ }
++
++ enum _SC_PAGE_SIZE = _SC_PAGESIZE;
++
++ enum
++ {
++ _CS_PATH = 1,
++ _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2,
++ _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3,
++ _CS_POSIX_V6_ILP32_OFF32_LIBS = 4,
++ _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5,
++ _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6,
++ _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7,
++ _CS_POSIX_V6_LP64_OFF64_CFLAGS = 8,
++ _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9,
++ _CS_POSIX_V6_LP64_OFF64_LIBS = 10,
++ _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11,
++ _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12,
++ _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13,
++ _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14,
++ }
++}
+ else version( CRuntime_Bionic )
+ {
+ enum F_OK = 0;
+@@ -1428,6 +1570,31 @@ else version( DragonFlyBSD )
+ {
+ char* crypt(in char*, in char*);
+ //char* ctermid(char*);
++ void encrypt(ref char[64], int) @trusted;
++ int fchdir(int) @trusted;
++ c_long gethostid() @trusted;
++ int getpgid(pid_t) @trusted;
++ int getsid(pid_t) @trusted;
++ char* getwd(char*); // LEGACY
++ int lchown(in char*, uid_t, gid_t);
++ int lockf(int, int, off_t) @trusted;
++ int nice(int) @trusted;
++ ssize_t pread(int, void*, size_t, off_t);
++ ssize_t pwrite(int, in void*, size_t, off_t);
++ int setpgrp(pid_t, pid_t) @trusted;
++ int setregid(gid_t, gid_t) @trusted;
++ int setreuid(uid_t, uid_t) @trusted;
++ void swab(in void*, void*, ssize_t);
++ void sync() @trusted;
++ int truncate(in char*, off_t);
++ useconds_t ualarm(useconds_t, useconds_t) @trusted;
++ int usleep(useconds_t) @trusted;
++ pid_t vfork();
++}
++else version( NetBSD )
++{
++ char* crypt(in char*, in char*);
++ //char* ctermid(char*);
+ void encrypt(ref char[64], int) @trusted;
+ int fchdir(int) @trusted;
+ c_long gethostid() @trusted;
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_utime.d b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
new file mode 100644
index 0000000000..7f2abe9650
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_sys_posix_utime.d
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/sys/posix/utime.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/sys/posix/utime.d
+@@ -65,6 +65,16 @@ else version( FreeBSD )
+
+ int utime(in char*, in utimbuf*);
+ }
++else version( NetBSD )
++{
++ struct utimbuf
++ {
++ time_t actime;
++ time_t modtime;
++ }
++
++ int utime(in char*, in utimbuf*);
++}
+ else version( Solaris )
+ {
+ struct utimbuf
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_thread.d b/ldc017/patches/patch-runtime_druntime_src_core_thread.d
new file mode 100644
index 0000000000..a4523a4a59
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_thread.d
@@ -0,0 +1,98 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/thread.d.orig 2018-08-23 23:29:55.000000000 +0000
++++ runtime/druntime/src/core/thread.d
+@@ -588,7 +588,6 @@ class Thread
+ // General Actions
+ ///////////////////////////////////////////////////////////////////////////
+
+-
+ /**
+ * Starts the thread and invokes the function or delegate passed upon
+ * construction.
+@@ -886,6 +885,12 @@ class Thread
+ */
+ __gshared const int PRIORITY_DEFAULT;
+
++ version(NetBSD)
++ {
++ //NetBSD does not support priority for default policy
++ // and it is not possible change policy without root access
++ int fakePriority = int.max;
++ }
+
+ /**
+ * Gets the scheduling priority for the associated thread.
+@@ -902,6 +907,10 @@ class Thread
+ {
+ return GetThreadPriority( m_hndl );
+ }
++ else version(NetBSD)
++ {
++ return fakePriority==int.max? PRIORITY_DEFAULT : fakePriority;
++ }
+ else version( Posix )
+ {
+ int policy;
+@@ -966,6 +975,10 @@ class Thread
+ if (priocntl(idtype_t.P_LWPID, P_MYID, PC_SETPARMS, &pcparm) == -1)
+ throw new ThreadException( "Unable to set scheduling class" );
+ }
++ else version(NetBSD)
++ {
++ fakePriority = val;
++ }
+ else version( Posix )
+ {
+ static if(__traits(compiles, pthread_setschedprio))
+@@ -991,6 +1004,7 @@ class Thread
+ throw new ThreadException("Unable to set thread priority");
+ }
+ param.sched_priority = val;
++
+ if (auto err = pthread_setschedparam(m_addr, policy, ¶m))
+ {
+ // ignore error if thread is not running => Bugzilla 8960
+@@ -3213,6 +3227,7 @@ nothrow:
+ version (CRuntime_Glibc) int pthread_getattr_np(pthread_t thread, pthread_attr_t* attr);
+ version (FreeBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
+ version (DragonFlyBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
++ version (NetBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr);
+ version (Solaris) int thr_stksegment(stack_t* stk);
+ version (CRuntime_Bionic) int pthread_getattr_np(pthread_t thid, pthread_attr_t* attr);
+ }
+@@ -3351,6 +3366,17 @@ private void* getStackBottom() nothrow
+ pthread_attr_destroy(&attr);
+ return addr + size;
+ }
++ else version (NetBSD)
++ {
++ pthread_attr_t attr;
++ void* addr; size_t size;
++
++ pthread_attr_init(&attr);
++ pthread_attr_get_np(pthread_self(), &attr);
++ pthread_attr_getstack(&attr, &addr, &size);
++ pthread_attr_destroy(&attr);
++ return addr + size;
++ }
+ else version (Solaris)
+ {
+ stack_t stk;
+@@ -3940,6 +3966,14 @@ version( LDC )
+ version( ARM ) version = CheckFiberMigration;
+ version( AArch64 ) version = CheckFiberMigration;
+ }
++
++ version ( NetBSD )
++ {
++ version( ARM ) version = CheckFiberMigration;
++ version( AArch64 ) version = CheckFiberMigration;
++ version( X86 ) version = CheckFiberMigration;
++ version( x86_64 ) version = CHeckFiberMigration;
++ }
+ }
+
+ // Fiber support for SjLj style exceptions
diff --git a/ldc017/patches/patch-runtime_druntime_src_core_time.d b/ldc017/patches/patch-runtime_druntime_src_core_time.d
new file mode 100644
index 0000000000..c1035211e9
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_core_time.d
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/core/time.d.orig 2016-02-13 20:02:16.000000000 +0000
++++ runtime/druntime/src/core/time.d
+@@ -304,6 +304,13 @@ else version(FreeBSD) enum ClockType
+ uptimeCoarse = 9,
+ uptimePrecise = 10,
+ }
++else version(NetBSD) enum ClockType
++{
++ normal = 0,
++ coarse = 2,
++ precise = 3,
++ second = 6,
++}
+ else version(Solaris) enum ClockType
+ {
+ normal = 0,
+@@ -359,6 +366,17 @@ version(Posix)
+ case second: assert(0);
+ }
+ }
++ else version(NetBSD)
++ {
++ import core.sys.netbsd.time;
++ with(ClockType) final switch(clockType)
++ {
++ case coarse: return CLOCK_MONOTONIC;
++ case normal: return CLOCK_MONOTONIC;
++ case precise: return CLOCK_MONOTONIC;
++ case second: assert(0);
++ }
++ }
+ else version(Solaris)
+ {
+ import core.sys.solaris.time;
diff --git a/ldc017/patches/patch-runtime_druntime_src_gc_os.d b/ldc017/patches/patch-runtime_druntime_src_gc_os.d
new file mode 100644
index 0000000000..36eeb1a2de
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_gc_os.d
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/gc/os.d.orig 2020-05-07 08:52:17.834676660 +0000
++++ runtime/druntime/src/gc/os.d
+@@ -32,6 +32,7 @@ else version (Posix)
+ import core.sys.posix.sys.mman;
+ version (FreeBSD) import core.sys.freebsd.sys.mman : MAP_ANON;
+ version (DragonFlyBSD) import core.sys.dragonflybsd.sys.mman : MAP_ANON;
++ version (NetBSD) import core.sys.netbsd.sys.mman : MAP_ANON;
+ version (CRuntime_Glibc) import core.sys.linux.sys.mman : MAP_ANON;
+ version (OSX) import core.sys.osx.sys.mman : MAP_ANON;
+ import core.stdc.stdlib;
diff --git a/ldc017/patches/patch-runtime_druntime_src_rt_bss__section.c b/ldc017/patches/patch-runtime_druntime_src_rt_bss__section.c
new file mode 100644
index 0000000000..9b67cc9727
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_rt_bss__section.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/rt/bss_section.c.orig 2020-05-07 08:52:17.914676431 +0000
++++ runtime/druntime/src/rt/bss_section.c
+@@ -10,7 +10,7 @@
+ /* These symbols are defined in the linker script and bracket the
+ * .bss, .lbss, .lrodata and .ldata sections.
+ */
+-#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
+ // Need to use weak linkage to workaround a bug in ld.bfd (Bugzilla 13025).
+ extern int __attribute__((weak)) __bss_start, _end;
+
diff --git a/ldc017/patches/patch-runtime_druntime_src_rt_sections.d b/ldc017/patches/patch-runtime_druntime_src_rt_sections.d
new file mode 100644
index 0000000000..0fd7fd6c12
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_rt_sections.d
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/rt/sections.d.orig 2020-05-07 08:52:18.074675974 +0000
++++ runtime/druntime/src/rt/sections.d
+@@ -18,6 +18,8 @@ else version (FreeBSD)
+ public import rt.sections_elf_shared;
+ else version (DragonFlyBSD)
+ public import rt.sections_elf_shared;
++else version (NetBSD)
++ public import rt.sections_elf_shared;
+ else version (Solaris)
+ public import rt.sections_solaris;
+ else version (OSX)
diff --git a/ldc017/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d b/ldc017/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
new file mode 100644
index 0000000000..6ded5cc1fe
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_rt_sections__elf__shared.d
@@ -0,0 +1,67 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/rt/sections_elf_shared.d.orig 2020-05-07 08:52:18.174675688 +0000
++++ runtime/druntime/src/rt/sections_elf_shared.d
+@@ -13,6 +13,7 @@ module rt.sections_elf_shared;
+ version (CRuntime_Glibc) enum SharedELF = true;
+ else version (FreeBSD) enum SharedELF = true;
+ else version (DragonFlyBSD) enum SharedELF = true;
++else version (NetBSD) enum SharedELF = true;
+ else enum SharedELF = false;
+ static if (SharedELF):
+
+@@ -39,6 +40,12 @@ else version (DragonFlyBSD)
+ import core.sys.dragonflybsd.sys.elf;
+ import core.sys.dragonflybsd.sys.link_elf;
+ }
++else version (NetBSD)
++{
++ import core.sys.netbsd.dlfcn;
++ import core.sys.netbsd.sys.elf;
++ import core.sys.netbsd.sys.link_elf;
++}
+ else
+ {
+ static assert(0, "unimplemented");
+@@ -123,6 +130,7 @@ __gshared bool _isRuntimeInitialized;
+
+ version (FreeBSD) private __gshared void* dummy_ref;
+ version (DragonFlyBSD) private __gshared void* dummy_ref;
++version (NetBSD) private __gshared void* dummy_ref;
+
+ /****
+ * Gets called on program startup just before GC is initialized.
+@@ -253,6 +261,7 @@ private:
+ // start of linked list for ModuleInfo references
+ version (FreeBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
+ version (DragonFlyBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
++version (NetBSD) deprecated extern (C) __gshared void* _Dmodule_ref;
+
+ version (Shared)
+ {
+@@ -661,6 +670,8 @@ nothrow:
+ strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
+ else version (DragonFlyBSD)
+ strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
++ else version (NetBSD)
++ strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
+ else
+ static assert(0, "unimplemented");
+ break;
+@@ -814,12 +825,14 @@ version (linux) import core.sys.linux.er
+ // should be in core.sys.freebsd.stdlib
+ version (FreeBSD) extern(C) const(char)* getprogname() nothrow @nogc;
+ version (DragonFlyBSD) extern(C) const(char)* getprogname() nothrow @nogc;
++version (NetBSD) extern(C) const(char)* getprogname() nothrow @nogc;
+
+ @property const(char)* progname() nothrow @nogc
+ {
+ version (linux) return program_invocation_name;
+ version (FreeBSD) return getprogname();
+ version (DragonFlyBSD) return getprogname();
++ version (NetBSD) return getprogname();
+ }
+
+ nothrow
diff --git a/ldc017/patches/patch-runtime_druntime_src_rt_sections__ldc.d b/ldc017/patches/patch-runtime_druntime_src_rt_sections__ldc.d
new file mode 100644
index 0000000000..46709d51cf
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_src_rt_sections__ldc.d
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/src/rt/sections_ldc.d.orig 2020-05-07 08:52:18.254675459 +0000
++++ runtime/druntime/src/rt/sections_ldc.d
+@@ -19,6 +19,7 @@ module rt.sections_ldc;
+ version (linux) {}
+ else version (FreeBSD) {}
+ else version (DragonFlyBSD) {}
++else version (NetBSD) {}
+ else version(LDC):
+
+ import core.stdc.stdlib : alloca;
diff --git a/ldc017/patches/patch-runtime_druntime_test_shared_src_load.d b/ldc017/patches/patch-runtime_druntime_test_shared_src_load.d
new file mode 100644
index 0000000000..7b8fa46ee7
--- /dev/null
+++ b/ldc017/patches/patch-runtime_druntime_test_shared_src_load.d
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/druntime/tree/netbsd
+
+--- runtime/druntime/test/shared/src/load.d.orig 2020-05-07 08:52:18.324675259 +0000
++++ runtime/druntime/test/shared/src/load.d
+@@ -3,6 +3,7 @@ import core.runtime, core.stdc.stdio, co
+ version (linux) import core.sys.linux.dlfcn;
+ else version (FreeBSD) import core.sys.freebsd.dlfcn;
+ else version (DragonFlyBSD) import core.sys.dragonflybsd.dlfcn;
++else version (NetBSD) import core.sys.netbsd.dlfcn;
+ else static assert(0, "unimplemented");
+
+ void loadSym(T)(void* handle, ref T val, const char* mangle)
diff --git a/ldc017/patches/patch-runtime_phobos_osmodel.mak b/ldc017/patches/patch-runtime_phobos_osmodel.mak
new file mode 100644
index 0000000000..3d93276de5
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_osmodel.mak
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- runtime/phobos/osmodel.mak.orig 2018-08-23 23:30:04.000000000 +0000
++++ runtime/phobos/osmodel.mak
+@@ -12,6 +12,9 @@ ifeq (,$(OS))
+ ifeq (FreeBSD,$(uname_S))
+ OS:=freebsd
+ endif
++ ifeq (NetBSD,$(uname_S))
++ OS:=netbsd
++ endif
+ ifeq (OpenBSD,$(uname_S))
+ OS:=openbsd
+ endif
diff --git a/ldc017/patches/patch-runtime_phobos_std_complex.d b/ldc017/patches/patch-runtime_phobos_std_complex.d
new file mode 100644
index 0000000000..328b37127b
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_complex.d
@@ -0,0 +1,36 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/complex.d.orig 2016-02-13 20:04:46.000000000 +0000
++++ runtime/phobos/std/complex.d
+@@ -758,8 +758,9 @@ Complex!T sin(T)(Complex!T z) @safe pur
+
+ unittest
+ {
++ import std.math: feqrel;
+ assert(sin(complex(0.0)) == 0.0);
+- assert(sin(complex(2.0L, 0)) == std.math.sin(2.0L));
++ assert(feqrel(sin(complex(2.0L, 0)).re, std.math.sin(2.0L)) > real.mant_dig-10);
+ }
+
+
+@@ -776,7 +777,7 @@ unittest{
+ import std.math;
+ import std.complex;
+ assert(cos(complex(0.0)) == 1.0);
+- assert(cos(complex(1.3L)) == std.math.cos(1.3L));
++ assert(feqrel(cos(complex(1.3L)).re, std.math.cos(1.3L)) >= real.mant_dig-12);
+ assert(cos(complex(0, 5.2L)) == cosh(5.2L));
+ }
+
+@@ -801,7 +802,8 @@ unittest
+ assert(expi(0.0L) == 1.0L);
+ auto z1 = expi(1.234);
+ auto z2 = std.math.expi(1.234);
+- assert(z1.re == z2.re && z1.im == z2.im);
++ import std.math : approxEqual;
++ assert(approxEqual(z1.re, z2.re) && approxEqual(z1.im, z2.im));
+ }
+
+
diff --git a/ldc017/patches/patch-runtime_phobos_std_conv.d b/ldc017/patches/patch-runtime_phobos_std_conv.d
new file mode 100644
index 0000000000..69783a21cb
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_conv.d
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/conv.d.orig 2020-05-07 08:52:18.564674573 +0000
++++ runtime/phobos/std/conv.d
+@@ -2756,7 +2756,17 @@ unittest
+
+ // min and max
+ real r = to!real(to!string(real.min_normal));
+- assert(to!string(r) == to!string(real.min_normal));
++ version(NetBSD)
++ {
++ // NetBSD notice
++ // to!string returns 3.3621e-4932L. It is less than real.min_normal and it is subnormal value
++ // Simple C code
++ // long double rd = 3.3621e-4932L;
++ // printf("%Le\n", rd);
++ // has unexpected result: 1.681050e-4932
++ } else {
++ assert(to!string(r) == to!string(real.min_normal));
++ }
+ r = to!real(to!string(real.max));
+ assert(to!string(r) == to!string(real.max));
+
diff --git a/ldc017/patches/patch-runtime_phobos_std_datetime.d b/ldc017/patches/patch-runtime_phobos_std_datetime.d
new file mode 100644
index 0000000000..9b0221c7db
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_datetime.d
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/datetime.d.orig 2020-05-07 08:52:18.694674201 +0000
++++ runtime/phobos/std/datetime.d
+@@ -26532,6 +26532,7 @@ auto tz = TimeZone.getTimeZone("America/
+ {
+ version(FreeBSD) enum utcZone = "Etc/UTC";
+ else version(DragonFlyBSD) enum utcZone = "UTC";
++ else version(NetBSD) enum utcZone = "UTC";
+ else version(linux) enum utcZone = "UTC";
+ else version(OSX) enum utcZone = "UTC";
+ else version(Solaris) enum utcZone = "UTC";
diff --git a/ldc017/patches/patch-runtime_phobos_std_file.d b/ldc017/patches/patch-runtime_phobos_std_file.d
new file mode 100644
index 0000000000..0908076d6a
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_file.d
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/file.d.orig 2018-08-23 23:30:04.000000000 +0000
++++ runtime/phobos/std/file.d
+@@ -1826,6 +1826,9 @@ version (OSX)
+ else version (FreeBSD)
+ private extern (C) int sysctl (const int* name, uint namelen, void* oldp,
+ size_t* oldlenp, const void* newp, size_t newlen);
++else version (NetBSD)
++ private extern (C) int sysctl (const int* name, uint namelen, void* oldp,
++ size_t* oldlenp, const void* newp, size_t newlen);
+
+ /**
+ * Returns the full path of the current executable.
+@@ -1899,6 +1902,10 @@ else version (FreeBSD)
+ {
+ return readLink("/proc/curproc/file");
+ }
++ else version (NetBSD)
++ {
++ return readLink("/proc/self/exe");
++ }
+ else version (Solaris)
+ {
+ import core.sys.posix.unistd : getpid;
diff --git a/ldc017/patches/patch-runtime_phobos_std_math.d b/ldc017/patches/patch-runtime_phobos_std_math.d
new file mode 100644
index 0000000000..15ec4940b4
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_math.d
@@ -0,0 +1,91 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/math.d.orig 2018-08-23 23:30:04.000000000 +0000
++++ runtime/phobos/std/math.d
+@@ -752,7 +752,8 @@ ireal sin(ireal y) @safe pure nothrow @n
+ @safe pure nothrow @nogc unittest
+ {
+ assert(sin(0.0+0.0i) == 0.0);
+- assert(sin(2.0+0.0i) == sin(2.0L) );
++ assert(sin(2.0+0.0i).im == 0.0L );
++ assert(feqrel(sin(2.0+0.0i).re, sin(2.0L)) > real.mant_dig-10 );
+ }
+
+ /***********************************
+@@ -777,7 +778,8 @@ real cos(ireal y) @safe pure nothrow @no
+ @safe pure nothrow @nogc unittest
+ {
+ assert(cos(0.0+0.0i)==1.0);
+- assert(cos(1.3L+0.0i)==cos(1.3L));
++ assert(cos(1.3L+0.0i).im == 0.0L );
++ assert(feqrel(cos(1.3L+0.0i).re, cos(1.3L)) >= real.mant_dig-12 );
+ assert(cos(5.2Li)== cosh(5.2L));
+ }
+
+@@ -1032,7 +1034,7 @@ Lret: {}
+
+ unittest
+ {
+- assert(equalsDigit(tan(PI / 3), std.math.sqrt(3.0), useDigits));
++ assert(feqrel(tan(PI / 3), std.math.sqrt(3.0)) > real.mant_dig-15 );
+ }
+
+ /***************
+@@ -2579,7 +2581,8 @@ creal expi(real y) @trusted pure nothrow
+ ///
+ @safe pure nothrow @nogc unittest
+ {
+- assert(expi(1.3e5L) == cos(1.3e5L) + sin(1.3e5L) * 1i);
++ assert(feqrel(expi(1.3e5L).re, (cos(1.3e5L) + sin(1.3e5L) * 1i).re)> real.mant_dig-15);
++ assert(feqrel(expi(1.3e5L).im, (cos(1.3e5L) + sin(1.3e5L) * 1i).im)> real.mant_dig-15);
+ assert(expi(0.0L) == 1L + 0.0Li);
+ }
+
+@@ -3694,8 +3697,8 @@ real log2(real x) @safe pure nothrow @no
+ ///
+ unittest
+ {
+- // check if values are equal to 19 decimal digits of precision
+- assert(equalsDigit(log2(1024.0L), 10, 19));
++ // check if values are equal except last 10 mantis bits
++ assert(feqrel(log2(1024.0L), 10) > real.mant_dig-10);
+ }
+
+ /*****************************************
+@@ -7639,6 +7642,34 @@ private real polyImpl(real x, in real[]
+ {
+ asm pure nothrow @nogc // assembler by W. Bright
+ {
++ // EDX = (A.length - 1) * real.sizeof
++ mov ECX,A[EBP] ; // ECX = A.length
++ dec ECX ;
++ lea EDX,[ECX*8] ;
++ lea EDX,[EDX][ECX*4] ;
++ add EDX,A+4[EBP] ;
++ fld real ptr [EDX] ; // ST0 = coeff[ECX]
++ jecxz return_ST ;
++ fld x[EBP] ; // ST0 = x
++ fxch ST(1) ; // ST1 = x, ST0 = r
++ align 4 ;
++ L2: fmul ST,ST(1) ; // r *= x
++ fld real ptr -12[EDX] ;
++ sub EDX,12 ; // deg--
++ faddp ST(1),ST ;
++ dec ECX ;
++ jne L2 ;
++ fxch ST(1) ; // ST1 = r, ST0 = x
++ fstp ST(0) ; // dump x
++ align 4 ;
++ return_ST: ;
++ ;
++ }
++ }
++ else version (NetBSD)
++ {
++ asm pure nothrow @nogc // assembler by W. Bright
++ {
+ // EDX = (A.length - 1) * real.sizeof
+ mov ECX,A[EBP] ; // ECX = A.length
+ dec ECX ;
diff --git a/ldc017/patches/patch-runtime_phobos_std_numeric.d b/ldc017/patches/patch-runtime_phobos_std_numeric.d
new file mode 100644
index 0000000000..95aac14c77
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_numeric.d
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/numeric.d.orig 2016-02-13 20:04:46.000000000 +0000
++++ runtime/phobos/std/numeric.d
+@@ -1687,7 +1687,8 @@ unittest
+ assert(sumOfLog2s(new double[0]) == 0);
+ assert(sumOfLog2s([0.0L]) == -real.infinity);
+ assert(sumOfLog2s([-0.0L]) == -real.infinity);
+- assert(sumOfLog2s([2.0L]) == 1);
++ import std.math;
++ assert(approxEqual(sumOfLog2s([2.0L]), 1));
+ assert(sumOfLog2s([-2.0L]).isNaN());
+ assert(sumOfLog2s([real.nan]).isNaN());
+ assert(sumOfLog2s([-real.nan]).isNaN());
diff --git a/ldc017/patches/patch-runtime_phobos_std_parallelism.d b/ldc017/patches/patch-runtime_phobos_std_parallelism.d
new file mode 100644
index 0000000000..9d9f683ba6
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_parallelism.d
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/parallelism.d.orig 2016-02-13 20:04:46.000000000 +0000
++++ runtime/phobos/std/parallelism.d
+@@ -99,6 +99,11 @@ else version(FreeBSD)
+ {
+ version = useSysctlbyname;
+ }
++else version(NetBSD)
++{
++ version = useSysctlbyname;
++}
++
+
+ version(Windows)
+ {
+@@ -172,6 +177,10 @@ else version(useSysctlbyname)
+ {
+ auto nameStr = "hw.ncpu\0".ptr;
+ }
++ else version(NetBSD)
++ {
++ auto nameStr = "hw.ncpu\0".ptr;
++ }
+
+ uint ans;
+ size_t len = uint.sizeof;
diff --git a/ldc017/patches/patch-runtime_phobos_std_socket.d b/ldc017/patches/patch-runtime_phobos_std_socket.d
new file mode 100644
index 0000000000..9c84a3f014
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_socket.d
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/socket.d.orig 2016-02-13 20:04:46.000000000 +0000
++++ runtime/phobos/std/socket.d
+@@ -189,6 +189,14 @@ string formatSocketError(int err) @trust
+ else
+ return "Socket error " ~ to!string(err);
+ }
++ else version (NetBSD)
++ {
++ auto errs = strerror_r(err, buf.ptr, buf.length);
++ if (errs == 0)
++ cs = buf.ptr;
++ else
++ return "Socket error " ~ to!string(err);
++ }
+ else version (Solaris)
+ {
+ auto errs = strerror_r(err, buf.ptr, buf.length);
diff --git a/ldc017/patches/patch-runtime_phobos_std_stdio.d b/ldc017/patches/patch-runtime_phobos_std_stdio.d
new file mode 100644
index 0000000000..776b35282b
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_stdio.d
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/stdio.d.orig 2016-02-13 20:04:46.000000000 +0000
++++ runtime/phobos/std/stdio.d
+@@ -68,6 +68,12 @@ version (FreeBSD)
+ version = HAS_GETDELIM;
+ }
+
++version (NetBSD)
++{
++ version = GENERIC_IO;
++ version = HAS_GETDELIM;
++}
++
+ version (Solaris)
+ {
+ version = GENERIC_IO;
diff --git a/ldc017/patches/patch-runtime_phobos_std_system.d b/ldc017/patches/patch-runtime_phobos_std_system.d
new file mode 100644
index 0000000000..51930f99ff
--- /dev/null
+++ b/ldc017/patches/patch-runtime_phobos_std_system.d
@@ -0,0 +1,22 @@
+$NetBSD$
+
+Stolen from https://github.com/nrTQgc/phobos/tree/netbsd
+
+--- runtime/phobos/std/system.d.orig 2020-05-07 08:52:19.304672455 +0000
++++ runtime/phobos/std/system.d
+@@ -35,6 +35,7 @@ immutable
+ osx, /// Mac OS X
+ freeBSD, /// FreeBSD
+ dragonFlyBSD, /// DragonFlyBSD
++ netBSD, /// NetBSD
+ solaris, /// Solaris
+ android, /// Android
+ otherPosix /// Other Posix Systems
+@@ -48,6 +49,7 @@ immutable
+ else version(OSX) OS os = OS.osx;
+ else version(FreeBSD) OS os = OS.freeBSD;
+ else version(DragonFlyBSD) OS os = OS.dragonFlyBSD;
++ else version(NetBSD) OS os = OS.netBSD;
+ else version(Posix) OS os = OS.otherPosix;
+ else static assert(0, "Unknown OS.");
+
Home |
Main Index |
Thread Index |
Old Index