pkgsrc-Changes archive

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

CVS commit: pkgsrc/lang/zig



Module Name:    pkgsrc
Committed By:   maya
Date:           Sun Feb 17 12:33:40 UTC 2019

Added Files:
        pkgsrc/lang/zig: DESCR Makefile PLIST distinfo
        pkgsrc/lang/zig/files: std_c_netbsd.zig std_os_netbsd_errno.zig
            std_os_netbsd_index.zig
        pkgsrc/lang/zig/patches: patch-CMakeLists.txt
            patch-src-self-hosted_libc__installation.zig patch-src_analyze.cpp
            patch-src_codegen.cpp patch-src_link.cpp patch-src_os.cpp
            patch-src_os.hpp patch-src_target.cpp patch-std_c_index.zig
            patch-std_debug_index.zig patch-std_event_fs.zig
            patch-std_event_loop.zig patch-std_heap.zig patch-std_os_file.zig
            patch-std_os_get__app__data__dir.zig patch-std_os_get__user__id.zig
            patch-std_os_index.zig patch-std_os_path.zig patch-std_os_time.zig

Log Message:
Add zig 0.3.0.20190217

Zig is an open-source programming language designed for robustness,
optimality, and clarity.

* Robust - behavior is correct even for edge cases such as out
  of memory.
* Optimal - write programs the best way they can
  behave and perform.
* Clear - precisely communicate your intent
  to the compiler and other programmers. The language imposes a
  low overhead to reading code.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/zig/DESCR pkgsrc/lang/zig/Makefile \
    pkgsrc/lang/zig/PLIST pkgsrc/lang/zig/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/zig/files/std_c_netbsd.zig \
    pkgsrc/lang/zig/files/std_os_netbsd_errno.zig \
    pkgsrc/lang/zig/files/std_os_netbsd_index.zig
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/zig/patches/patch-CMakeLists.txt \
    pkgsrc/lang/zig/patches/patch-src-self-hosted_libc__installation.zig \
    pkgsrc/lang/zig/patches/patch-src_analyze.cpp \
    pkgsrc/lang/zig/patches/patch-src_codegen.cpp \
    pkgsrc/lang/zig/patches/patch-src_link.cpp \
    pkgsrc/lang/zig/patches/patch-src_os.cpp \
    pkgsrc/lang/zig/patches/patch-src_os.hpp \
    pkgsrc/lang/zig/patches/patch-src_target.cpp \
    pkgsrc/lang/zig/patches/patch-std_c_index.zig \
    pkgsrc/lang/zig/patches/patch-std_debug_index.zig \
    pkgsrc/lang/zig/patches/patch-std_event_fs.zig \
    pkgsrc/lang/zig/patches/patch-std_event_loop.zig \
    pkgsrc/lang/zig/patches/patch-std_heap.zig \
    pkgsrc/lang/zig/patches/patch-std_os_file.zig \
    pkgsrc/lang/zig/patches/patch-std_os_get__app__data__dir.zig \
    pkgsrc/lang/zig/patches/patch-std_os_get__user__id.zig \
    pkgsrc/lang/zig/patches/patch-std_os_index.zig \
    pkgsrc/lang/zig/patches/patch-std_os_path.zig \
    pkgsrc/lang/zig/patches/patch-std_os_time.zig

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/lang/zig/DESCR
diff -u /dev/null pkgsrc/lang/zig/DESCR:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/DESCR       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,10 @@
+Zig is an open-source programming language designed for robustness,
+optimality, and clarity.
+
+* Robust - behavior is correct even for edge cases such as out
+  of memory.
+* Optimal - write programs the best way they can
+  behave and perform.
+* Clear - precisely communicate your intent
+  to the compiler and other programmers. The language imposes a
+  low overhead to reading code.
Index: pkgsrc/lang/zig/Makefile
diff -u /dev/null pkgsrc/lang/zig/Makefile:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/Makefile    Sun Feb 17 12:33:40 2019
@@ -0,0 +1,29 @@
+# $NetBSD: Makefile,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+DISTNAME=      zig-0.3.0+8d2a9029
+PKGNAME=       zig-0.3.0.20190217
+CATEGORIES=    lang
+MASTER_SITES=  https://ziglang.org/builds/
+EXTRACT_SUFX=  .tar.xz
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      https://ziglang.org/
+COMMENT=       Programming language designed for robustness and clarity
+LICENSE=       mit
+
+USE_CMAKE=     yes
+USE_LANGUAGES= c c++
+
+CHECK_PORTABILITY_SKIP+=       ci/azure/macos_script
+BUILDLINK_TRANSFORM+=          rm:-Werror
+
+post-patch:
+       ${CP} ${FILESDIR}/std_c_netbsd.zig ${WRKSRC}/std/c/netbsd.zig
+       ${MKDIR} ${WRKSRC}/std/os/netbsd
+       ${CP} ${FILESDIR}/std_os_netbsd_index.zig ${WRKSRC}/std/os/netbsd/index.zig
+       ${CP} ${FILESDIR}/std_os_netbsd_errno.zig ${WRKSRC}/std/os/netbsd/errno.zig
+
+.include "../../lang/clang/buildlink3.mk"
+.include "../../lang/llvm/buildlink3.mk"
+.include "../../devel/lld/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/lang/zig/PLIST
diff -u /dev/null pkgsrc/lang/zig/PLIST:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/PLIST       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,364 @@
+@comment $NetBSD: PLIST,v 1.1 2019/02/17 12:33:40 maya Exp $
+bin/zig
+lib/zig/include/__clang_cuda_builtin_vars.h
+lib/zig/include/__clang_cuda_cmath.h
+lib/zig/include/__clang_cuda_complex_builtins.h
+lib/zig/include/__clang_cuda_device_functions.h
+lib/zig/include/__clang_cuda_intrinsics.h
+lib/zig/include/__clang_cuda_libdevice_declares.h
+lib/zig/include/__clang_cuda_math_forward_declares.h
+lib/zig/include/__clang_cuda_runtime_wrapper.h
+lib/zig/include/__stddef_max_align_t.h
+lib/zig/include/__wmmintrin_aes.h
+lib/zig/include/__wmmintrin_pclmul.h
+lib/zig/include/adxintrin.h
+lib/zig/include/altivec.h
+lib/zig/include/ammintrin.h
+lib/zig/include/arm64intr.h
+lib/zig/include/arm_acle.h
+lib/zig/include/arm_fp16.h
+lib/zig/include/arm_neon.h
+lib/zig/include/armintr.h
+lib/zig/include/avx2intrin.h
+lib/zig/include/avx512bitalgintrin.h
+lib/zig/include/avx512bwintrin.h
+lib/zig/include/avx512cdintrin.h
+lib/zig/include/avx512dqintrin.h
+lib/zig/include/avx512erintrin.h
+lib/zig/include/avx512fintrin.h
+lib/zig/include/avx512ifmaintrin.h
+lib/zig/include/avx512ifmavlintrin.h
+lib/zig/include/avx512pfintrin.h
+lib/zig/include/avx512vbmi2intrin.h
+lib/zig/include/avx512vbmiintrin.h
+lib/zig/include/avx512vbmivlintrin.h
+lib/zig/include/avx512vlbitalgintrin.h
+lib/zig/include/avx512vlbwintrin.h
+lib/zig/include/avx512vlcdintrin.h
+lib/zig/include/avx512vldqintrin.h
+lib/zig/include/avx512vlintrin.h
+lib/zig/include/avx512vlvbmi2intrin.h
+lib/zig/include/avx512vlvnniintrin.h
+lib/zig/include/avx512vnniintrin.h
+lib/zig/include/avx512vpopcntdqintrin.h
+lib/zig/include/avx512vpopcntdqvlintrin.h
+lib/zig/include/avxintrin.h
+lib/zig/include/bmi2intrin.h
+lib/zig/include/bmiintrin.h
+lib/zig/include/cetintrin.h
+lib/zig/include/cldemoteintrin.h
+lib/zig/include/clflushoptintrin.h
+lib/zig/include/clwbintrin.h
+lib/zig/include/clzerointrin.h
+lib/zig/include/cpuid.h
+lib/zig/include/cuda_wrappers/algorithm
+lib/zig/include/cuda_wrappers/complex
+lib/zig/include/cuda_wrappers/new
+lib/zig/include/emmintrin.h
+lib/zig/include/f16cintrin.h
+lib/zig/include/float.h
+lib/zig/include/fma4intrin.h
+lib/zig/include/fmaintrin.h
+lib/zig/include/fxsrintrin.h
+lib/zig/include/gfniintrin.h
+lib/zig/include/htmintrin.h
+lib/zig/include/htmxlintrin.h
+lib/zig/include/ia32intrin.h
+lib/zig/include/immintrin.h
+lib/zig/include/intrin.h
+lib/zig/include/inttypes.h
+lib/zig/include/invpcidintrin.h
+lib/zig/include/iso646.h
+lib/zig/include/limits.h
+lib/zig/include/lwpintrin.h
+lib/zig/include/lzcntintrin.h
+lib/zig/include/mm3dnow.h
+lib/zig/include/mm_malloc.h
+lib/zig/include/mmintrin.h
+lib/zig/include/module.modulemap
+lib/zig/include/movdirintrin.h
+lib/zig/include/msa.h
+lib/zig/include/mwaitxintrin.h
+lib/zig/include/nmmintrin.h
+lib/zig/include/opencl-c.h
+lib/zig/include/pconfigintrin.h
+lib/zig/include/pkuintrin.h
+lib/zig/include/pmmintrin.h
+lib/zig/include/popcntintrin.h
+lib/zig/include/prfchwintrin.h
+lib/zig/include/ptwriteintrin.h
+lib/zig/include/rdseedintrin.h
+lib/zig/include/rtmintrin.h
+lib/zig/include/s390intrin.h
+lib/zig/include/sgxintrin.h
+lib/zig/include/shaintrin.h
+lib/zig/include/smmintrin.h
+lib/zig/include/stdalign.h
+lib/zig/include/stdarg.h
+lib/zig/include/stdatomic.h
+lib/zig/include/stdbool.h
+lib/zig/include/stddef.h
+lib/zig/include/stdint.h
+lib/zig/include/stdnoreturn.h
+lib/zig/include/tbmintrin.h
+lib/zig/include/tgmath.h
+lib/zig/include/tmmintrin.h
+lib/zig/include/unwind.h
+lib/zig/include/vadefs.h
+lib/zig/include/vaesintrin.h
+lib/zig/include/varargs.h
+lib/zig/include/vecintrin.h
+lib/zig/include/vpclmulqdqintrin.h
+lib/zig/include/waitpkgintrin.h
+lib/zig/include/wbnoinvdintrin.h
+lib/zig/include/wmmintrin.h
+lib/zig/include/x86intrin.h
+lib/zig/include/xmmintrin.h
+lib/zig/include/xopintrin.h
+lib/zig/include/xsavecintrin.h
+lib/zig/include/xsaveintrin.h
+lib/zig/include/xsaveoptintrin.h
+lib/zig/include/xsavesintrin.h
+lib/zig/include/xtestintrin.h
+lib/zig/std/array_list.zig
+lib/zig/std/atomic/index.zig
+lib/zig/std/atomic/int.zig
+lib/zig/std/atomic/queue.zig
+lib/zig/std/atomic/stack.zig
+lib/zig/std/base64.zig
+lib/zig/std/buf_map.zig
+lib/zig/std/buf_set.zig
+lib/zig/std/buffer.zig
+lib/zig/std/build.zig
+lib/zig/std/c/darwin.zig
+lib/zig/std/c/freebsd.zig
+lib/zig/std/c/index.zig
+lib/zig/std/c/linux.zig
+lib/zig/std/c/netbsd.zig
+lib/zig/std/c/windows.zig
+lib/zig/std/coff.zig
+lib/zig/std/crypto/blake2.zig
+lib/zig/std/crypto/chacha20.zig
+lib/zig/std/crypto/hmac.zig
+lib/zig/std/crypto/index.zig
+lib/zig/std/crypto/md5.zig
+lib/zig/std/crypto/poly1305.zig
+lib/zig/std/crypto/sha1.zig
+lib/zig/std/crypto/sha2.zig
+lib/zig/std/crypto/sha3.zig
+lib/zig/std/crypto/x25519.zig
+lib/zig/std/cstr.zig
+lib/zig/std/debug/failing_allocator.zig
+lib/zig/std/debug/index.zig
+lib/zig/std/dwarf.zig
+lib/zig/std/dynamic_library.zig
+lib/zig/std/elf.zig
+lib/zig/std/empty.zig
+lib/zig/std/event.zig
+lib/zig/std/event/channel.zig
+lib/zig/std/event/fs.zig
+lib/zig/std/event/future.zig
+lib/zig/std/event/group.zig
+lib/zig/std/event/io.zig
+lib/zig/std/event/lock.zig
+lib/zig/std/event/locked.zig
+lib/zig/std/event/loop.zig
+lib/zig/std/event/net.zig
+lib/zig/std/event/rwlock.zig
+lib/zig/std/event/rwlocked.zig
+lib/zig/std/fmt/errol/enum3.zig
+lib/zig/std/fmt/errol/index.zig
+lib/zig/std/fmt/errol/lookup.zig
+lib/zig/std/fmt/index.zig
+lib/zig/std/fmt/parse_float.zig
+lib/zig/std/hash/adler.zig
+lib/zig/std/hash/crc.zig
+lib/zig/std/hash/fnv.zig
+lib/zig/std/hash/index.zig
+lib/zig/std/hash/siphash.zig
+lib/zig/std/hash_map.zig
+lib/zig/std/heap.zig
+lib/zig/std/index.zig
+lib/zig/std/io.zig
+lib/zig/std/io/seekable_stream.zig
+lib/zig/std/json.zig
+lib/zig/std/lazy_init.zig
+lib/zig/std/linked_list.zig
+lib/zig/std/macho.zig
+lib/zig/std/math/acos.zig
+lib/zig/std/math/acosh.zig
+lib/zig/std/math/asin.zig
+lib/zig/std/math/asinh.zig
+lib/zig/std/math/atan.zig
+lib/zig/std/math/atan2.zig
+lib/zig/std/math/atanh.zig
+lib/zig/std/math/big/index.zig
+lib/zig/std/math/big/int.zig
+lib/zig/std/math/cbrt.zig
+lib/zig/std/math/ceil.zig
+lib/zig/std/math/complex/abs.zig
+lib/zig/std/math/complex/acos.zig
+lib/zig/std/math/complex/acosh.zig
+lib/zig/std/math/complex/arg.zig
+lib/zig/std/math/complex/asin.zig
+lib/zig/std/math/complex/asinh.zig
+lib/zig/std/math/complex/atan.zig
+lib/zig/std/math/complex/atanh.zig
+lib/zig/std/math/complex/conj.zig
+lib/zig/std/math/complex/cos.zig
+lib/zig/std/math/complex/cosh.zig
+lib/zig/std/math/complex/exp.zig
+lib/zig/std/math/complex/index.zig
+lib/zig/std/math/complex/ldexp.zig
+lib/zig/std/math/complex/log.zig
+lib/zig/std/math/complex/pow.zig
+lib/zig/std/math/complex/proj.zig
+lib/zig/std/math/complex/sin.zig
+lib/zig/std/math/complex/sinh.zig
+lib/zig/std/math/complex/sqrt.zig
+lib/zig/std/math/complex/tan.zig
+lib/zig/std/math/complex/tanh.zig
+lib/zig/std/math/copysign.zig
+lib/zig/std/math/cos.zig
+lib/zig/std/math/cosh.zig
+lib/zig/std/math/exp.zig
+lib/zig/std/math/exp2.zig
+lib/zig/std/math/expm1.zig
+lib/zig/std/math/expo2.zig
+lib/zig/std/math/fabs.zig
+lib/zig/std/math/floor.zig
+lib/zig/std/math/fma.zig
+lib/zig/std/math/frexp.zig
+lib/zig/std/math/hypot.zig
+lib/zig/std/math/ilogb.zig
+lib/zig/std/math/index.zig
+lib/zig/std/math/inf.zig
+lib/zig/std/math/isfinite.zig
+lib/zig/std/math/isinf.zig
+lib/zig/std/math/isnan.zig
+lib/zig/std/math/isnormal.zig
+lib/zig/std/math/ln.zig
+lib/zig/std/math/log.zig
+lib/zig/std/math/log10.zig
+lib/zig/std/math/log1p.zig
+lib/zig/std/math/log2.zig
+lib/zig/std/math/modf.zig
+lib/zig/std/math/nan.zig
+lib/zig/std/math/pow.zig
+lib/zig/std/math/powi.zig
+lib/zig/std/math/round.zig
+lib/zig/std/math/scalbn.zig
+lib/zig/std/math/signbit.zig
+lib/zig/std/math/sin.zig
+lib/zig/std/math/sinh.zig
+lib/zig/std/math/sqrt.zig
+lib/zig/std/math/tan.zig
+lib/zig/std/math/tanh.zig
+lib/zig/std/math/trunc.zig
+lib/zig/std/mem.zig
+lib/zig/std/meta/index.zig
+lib/zig/std/meta/trait.zig
+lib/zig/std/mutex.zig
+lib/zig/std/net.zig
+lib/zig/std/os/child_process.zig
+lib/zig/std/os/darwin.zig
+lib/zig/std/os/darwin/errno.zig
+lib/zig/std/os/epoch.zig
+lib/zig/std/os/file.zig
+lib/zig/std/os/freebsd/errno.zig
+lib/zig/std/os/freebsd/index.zig
+lib/zig/std/os/get_app_data_dir.zig
+lib/zig/std/os/get_user_id.zig
+lib/zig/std/os/index.zig
+lib/zig/std/os/linux/arm64.zig
+lib/zig/std/os/linux/errno.zig
+lib/zig/std/os/linux/index.zig
+lib/zig/std/os/linux/vdso.zig
+lib/zig/std/os/linux/x86_64.zig
+lib/zig/std/os/netbsd/errno.zig
+lib/zig/std/os/netbsd/index.zig
+lib/zig/std/os/path.zig
+lib/zig/std/os/time.zig
+lib/zig/std/os/uefi.zig
+lib/zig/std/os/windows/advapi32.zig
+lib/zig/std/os/windows/error.zig
+lib/zig/std/os/windows/index.zig
+lib/zig/std/os/windows/kernel32.zig
+lib/zig/std/os/windows/ntdll.zig
+lib/zig/std/os/windows/ole32.zig
+lib/zig/std/os/windows/shell32.zig
+lib/zig/std/os/windows/tls.zig
+lib/zig/std/os/windows/util.zig
+lib/zig/std/os/zen.zig
+lib/zig/std/pdb.zig
+lib/zig/std/rand/index.zig
+lib/zig/std/rand/ziggurat.zig
+lib/zig/std/segmented_list.zig
+lib/zig/std/sort.zig
+lib/zig/std/special/bootstrap.zig
+lib/zig/std/special/bootstrap_lib.zig
+lib/zig/std/special/build_runner.zig
+lib/zig/std/special/builtin.zig
+lib/zig/std/special/compiler_rt/addXf3.zig
+lib/zig/std/special/compiler_rt/aulldiv.zig
+lib/zig/std/special/compiler_rt/aullrem.zig
+lib/zig/std/special/compiler_rt/comparetf2.zig
+lib/zig/std/special/compiler_rt/divti3.zig
+lib/zig/std/special/compiler_rt/extendXfYf2.zig
+lib/zig/std/special/compiler_rt/fixdfdi.zig
+lib/zig/std/special/compiler_rt/fixdfsi.zig
+lib/zig/std/special/compiler_rt/fixdfti.zig
+lib/zig/std/special/compiler_rt/fixint.zig
+lib/zig/std/special/compiler_rt/fixsfdi.zig
+lib/zig/std/special/compiler_rt/fixsfsi.zig
+lib/zig/std/special/compiler_rt/fixsfti.zig
+lib/zig/std/special/compiler_rt/fixtfdi.zig
+lib/zig/std/special/compiler_rt/fixtfsi.zig
+lib/zig/std/special/compiler_rt/fixtfti.zig
+lib/zig/std/special/compiler_rt/fixuint.zig
+lib/zig/std/special/compiler_rt/fixunsdfdi.zig
+lib/zig/std/special/compiler_rt/fixunsdfsi.zig
+lib/zig/std/special/compiler_rt/fixunsdfti.zig
+lib/zig/std/special/compiler_rt/fixunssfdi.zig
+lib/zig/std/special/compiler_rt/fixunssfsi.zig
+lib/zig/std/special/compiler_rt/fixunssfti.zig
+lib/zig/std/special/compiler_rt/fixunstfdi.zig
+lib/zig/std/special/compiler_rt/fixunstfsi.zig
+lib/zig/std/special/compiler_rt/fixunstfti.zig
+lib/zig/std/special/compiler_rt/floattidf.zig
+lib/zig/std/special/compiler_rt/floattisf.zig
+lib/zig/std/special/compiler_rt/floattitf.zig
+lib/zig/std/special/compiler_rt/floatunditf.zig
+lib/zig/std/special/compiler_rt/floatunsitf.zig
+lib/zig/std/special/compiler_rt/floatuntidf.zig
+lib/zig/std/special/compiler_rt/floatuntisf.zig
+lib/zig/std/special/compiler_rt/floatuntitf.zig
+lib/zig/std/special/compiler_rt/index.zig
+lib/zig/std/special/compiler_rt/muloti4.zig
+lib/zig/std/special/compiler_rt/multi3.zig
+lib/zig/std/special/compiler_rt/truncXfYf2.zig
+lib/zig/std/special/compiler_rt/udivmod.zig
+lib/zig/std/special/compiler_rt/udivmoddi4.zig
+lib/zig/std/special/compiler_rt/udivmodti4.zig
+lib/zig/std/special/compiler_rt/udivti3.zig
+lib/zig/std/special/compiler_rt/umodti3.zig
+lib/zig/std/special/fmt/arg.zig
+lib/zig/std/special/fmt/errmsg.zig
+lib/zig/std/special/fmt/main.zig
+lib/zig/std/special/fmt_runner.zig
+lib/zig/std/special/init-exe/build.zig
+lib/zig/std/special/init-exe/src/main.zig
+lib/zig/std/special/init-lib/build.zig
+lib/zig/std/special/init-lib/src/main.zig
+lib/zig/std/special/panic.zig
+lib/zig/std/special/test_runner.zig
+lib/zig/std/spinlock.zig
+lib/zig/std/statically_initialized_mutex.zig
+lib/zig/std/testing.zig
+lib/zig/std/unicode.zig
+lib/zig/std/zig/ast.zig
+lib/zig/std/zig/index.zig
+lib/zig/std/zig/parse.zig
+lib/zig/std/zig/parse_string_literal.zig
+lib/zig/std/zig/render.zig
+lib/zig/std/zig/tokenizer.zig
Index: pkgsrc/lang/zig/distinfo
diff -u /dev/null pkgsrc/lang/zig/distinfo:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/distinfo    Sun Feb 17 12:33:40 2019
@@ -0,0 +1,25 @@
+$NetBSD: distinfo,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+SHA1 (zig-0.3.0+8d2a9029.tar.xz) = feb0fa613fe2618f3821c6da34a22f922eab320e
+RMD160 (zig-0.3.0+8d2a9029.tar.xz) = 7389eba74fc0d4e22c62e6bb66d94124e96539f4
+SHA512 (zig-0.3.0+8d2a9029.tar.xz) = 036f0499bbff5f0e55c27c151a1b0e028f895cd52683c664e227ff9875cf5989dbb6d0ea754744a47715a601cb9a9b06912bca911dc02e4195944f386e331995
+Size (zig-0.3.0+8d2a9029.tar.xz) = 2407768 bytes
+SHA1 (patch-CMakeLists.txt) = 550474426ed0db48da88331aab746b2c445010b9
+SHA1 (patch-src-self-hosted_libc__installation.zig) = c38b2b0f5dfe879c660f1f148a0a9f765f0faa3f
+SHA1 (patch-src_analyze.cpp) = 217f0f97e8f87cbc82800926b333bdd8b464a037
+SHA1 (patch-src_codegen.cpp) = a931d048856fdd88bc874d488d06546d8c0b9ed5
+SHA1 (patch-src_link.cpp) = 86c03aa8b51c3d2e3db2e894819ad9be063d57bc
+SHA1 (patch-src_os.cpp) = 6cf8da29be026f2f27284366e22861a87e26941e
+SHA1 (patch-src_os.hpp) = 0b79d1ec64b3d7c38a9b2a11ec109c0221e59871
+SHA1 (patch-src_target.cpp) = ff482758b378e0be8060d3b61e94420609de41ac
+SHA1 (patch-std_c_index.zig) = f9de821e37c0e8ae0393c6ac1570c74c4ac6faac
+SHA1 (patch-std_debug_index.zig) = 0abd1b5c7cc6bdfed7afc2cf6b30fa45856af566
+SHA1 (patch-std_event_fs.zig) = 2e00bc3091414620813ef980ce0e4ffd15fd19c3
+SHA1 (patch-std_event_loop.zig) = 93cb9faddf3235d1a521e6691231bbca0d9a9c47
+SHA1 (patch-std_heap.zig) = 3fc05b17612b7d54e1bdfdfcaecff87756bde74d
+SHA1 (patch-std_os_file.zig) = e24a5bc859dfe570ee1113670877384eb2826225
+SHA1 (patch-std_os_get__app__data__dir.zig) = 0da532e6d1d6d8c832c3b7e5f996df7923079f28
+SHA1 (patch-std_os_get__user__id.zig) = 432dc624afca19932138bf4a2c9234749dd48423
+SHA1 (patch-std_os_index.zig) = 84eb9d8ec5c85865a8ad86c0e1891866bfbe4173
+SHA1 (patch-std_os_path.zig) = 63616b927b611f0e26e157e4c51630e7155977ba
+SHA1 (patch-std_os_time.zig) = c13daf2e8e0f5a6c1a68a9cabe098de673df21a3

Index: pkgsrc/lang/zig/files/std_c_netbsd.zig
diff -u /dev/null pkgsrc/lang/zig/files/std_c_netbsd.zig:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/files/std_c_netbsd.zig      Sun Feb 17 12:33:40 2019
@@ -0,0 +1,116 @@
+extern "c" fn __errno() *c_int;
+pub const _errno = __errno;
+
+pub extern "c" fn kqueue() c_int;
+pub extern "c" fn kevent(
+    kq: c_int,
+    changelist: [*]const Kevent,
+    nchanges: c_int,
+    eventlist: [*]Kevent,
+    nevents: c_int,
+    timeout: ?*const timespec,
+) c_int;
+pub extern "c" fn sysctl(name: [*]c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
+pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
+pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int;
+pub extern "c" fn getdirentries(fd: c_int, buf_ptr: [*]u8, nbytes: usize, basep: *i64) usize;
+pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
+pub extern "c" fn pipe2(arg0: *[2]c_int, arg1: u32) c_int;
+pub extern "c" fn preadv(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize;
+pub extern "c" fn pwritev(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize;
+pub extern "c" fn openat(fd: c_int, path: ?[*]const u8, flags: c_int) c_int;
+pub extern "c" fn setgid(ruid: c_uint, euid: c_uint) c_int;
+pub extern "c" fn setuid(uid: c_uint) c_int;
+pub extern "c" fn kill(pid: c_int, sig: c_int) c_int;
+pub extern "c" fn clock_gettime(clk_id: c_int, tp: *timespec) c_int;
+pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int;
+
+/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
+pub const Kevent = extern struct {
+    ident: usize,
+    filter: i32,
+    flags: u32,
+    fflags: u32,
+    data: i64,
+    udata: usize,
+};
+
+pub const pthread_attr_t = extern struct {
+    pta_magic: u32,
+    pta_flags: c_int,
+    pta_private: *c_void,
+};
+
+pub const msghdr = extern struct {
+    msg_name: *u8,
+    msg_namelen: socklen_t,
+    msg_iov: *iovec,
+    msg_iovlen: i32,
+    __pad1: i32,
+    msg_control: *u8,
+    msg_controllen: socklen_t,
+    __pad2: socklen_t,
+    msg_flags: i32,
+};
+
+pub const Stat = extern struct {
+    dev: u64,
+    mode: u32,
+    ino: u64,
+    nlink: usize,
+
+    uid: u32,
+    gid: u32,
+    rdev: u64,
+
+    atim: timespec,
+    mtim: timespec,
+    ctim: timespec,
+    birthtim: timespec,
+
+    size: i64,
+    blocks: i64,
+    blksize: isize,
+    flags: u32,
+    gen: u32,
+    __spare: [2]u32,
+};
+
+pub const timespec = extern struct {
+    tv_sec: i64,
+    tv_nsec: isize,
+};
+
+pub const dirent = extern struct {
+    d_fileno: u64,
+    d_reclen: u16,
+    d_namlen: u16,
+    d_type: u8,
+    d_off: i64,
+    d_name: [512]u8,
+};
+
+pub const in_port_t = u16;
+pub const sa_family_t = u8;
+
+pub const sockaddr = extern union {
+    in: sockaddr_in,
+    in6: sockaddr_in6,
+};
+
+pub const sockaddr_in = extern struct {
+    len: u8,
+    family: sa_family_t,
+    port: in_port_t,
+    addr: u32,
+    zero: [8]u8,
+};
+
+pub const sockaddr_in6 = extern struct {
+    len: u8,
+    family: sa_family_t,
+    port: in_port_t,
+    flowinfo: u32,
+    addr: [16]u8,
+    scope_id: u32,
+};
Index: pkgsrc/lang/zig/files/std_os_netbsd_errno.zig
diff -u /dev/null pkgsrc/lang/zig/files/std_os_netbsd_errno.zig:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/files/std_os_netbsd_errno.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,134 @@
+pub const EPERM = 1; // Operation not permitted
+pub const ENOENT = 2; // No such file or directory
+pub const ESRCH = 3; // No such process
+pub const EINTR = 4; // Interrupted system call
+pub const EIO = 5; // Input/output error
+pub const ENXIO = 6; // Device not configured
+pub const E2BIG = 7; // Argument list too long
+pub const ENOEXEC = 8; // Exec format error
+pub const EBADF = 9; // Bad file descriptor
+pub const ECHILD = 10; // No child processes
+pub const EDEADLK = 11; // Resource deadlock avoided
+// 11 was EAGAIN
+pub const ENOMEM = 12; // Cannot allocate memory
+pub const EACCES = 13; // Permission denied
+pub const EFAULT = 14; // Bad address
+pub const ENOTBLK = 15; // Block device required
+pub const EBUSY = 16; // Device busy
+pub const EEXIST = 17; // File exists
+pub const EXDEV = 18; // Cross-device link
+pub const ENODEV = 19; // Operation not supported by device
+pub const ENOTDIR = 20; // Not a directory
+pub const EISDIR = 21; // Is a directory
+pub const EINVAL = 22; // Invalid argument
+pub const ENFILE = 23; // Too many open files in system
+pub const EMFILE = 24; // Too many open files
+pub const ENOTTY = 25; // Inappropriate ioctl for device
+pub const ETXTBSY = 26; // Text file busy
+pub const EFBIG = 27; // File too large
+pub const ENOSPC = 28; // No space left on device
+pub const ESPIPE = 29; // Illegal seek
+pub const EROFS = 30; // Read-only file system
+pub const EMLINK = 31; // Too many links
+pub const EPIPE = 32; // Broken pipe
+
+// math software
+pub const EDOM = 33; // Numerical argument out of domain
+pub const ERANGE = 34; // Result too large or too small
+
+// non-blocking and interrupt i/o
+pub const EAGAIN = 35; // Resource temporarily unavailable
+pub const EWOULDBLOCK = EAGAIN; // Operation would block
+pub const EINPROGRESS = 36; // Operation now in progress
+pub const EALREADY = 37; // Operation already in progress
+
+// ipc/network software -- argument errors
+pub const ENOTSOCK = 38; // Socket operation on non-socket
+pub const EDESTADDRREQ = 39; // Destination address required
+pub const EMSGSIZE = 40; // Message too long
+pub const EPROTOTYPE = 41; // Protocol wrong type for socket
+pub const ENOPROTOOPT = 42; // Protocol option not available
+pub const EPROTONOSUPPORT = 43; // Protocol not supported
+pub const ESOCKTNOSUPPORT = 44; // Socket type not supported
+pub const EOPNOTSUPP = 45; // Operation not supported
+pub const EPFNOSUPPORT = 46; // Protocol family not supported
+pub const EAFNOSUPPORT = 47; // Address family not supported by protocol family
+pub const EADDRINUSE = 48; // Address already in use
+pub const EADDRNOTAVAIL = 49; // Can't assign requested address
+
+// ipc/network software -- operational errors
+pub const ENETDOWN = 50; // Network is down
+pub const ENETUNREACH = 51; // Network is unreachable
+pub const ENETRESET = 52; // Network dropped connection on reset
+pub const ECONNABORTED = 53; // Software caused connection abort
+pub const ECONNRESET = 54; // Connection reset by peer
+pub const ENOBUFS = 55; // No buffer space available
+pub const EISCONN = 56; // Socket is already connected
+pub const ENOTCONN = 57; // Socket is not connected
+pub const ESHUTDOWN = 58; // Can't send after socket shutdown
+pub const ETOOMANYREFS = 59; // Too many references: can't splice
+pub const ETIMEDOUT = 60; // Operation timed out
+pub const ECONNREFUSED = 61; // Connection refused
+
+pub const ELOOP = 62; // Too many levels of symbolic links
+pub const ENAMETOOLONG = 63; // File name too long
+
+// should be rearranged
+pub const EHOSTDOWN = 64; // Host is down
+pub const EHOSTUNREACH = 65; // No route to host
+pub const ENOTEMPTY = 66; // Directory not empty
+
+// quotas & mush
+pub const EPROCLIM = 67; // Too many processes
+pub const EUSERS = 68; // Too many users
+pub const EDQUOT = 69; // Disc quota exceeded
+
+// Network File System
+pub const ESTALE = 70; // Stale NFS file handle
+pub const EREMOTE = 71; // Too many levels of remote in path
+pub const EBADRPC = 72; // RPC struct is bad
+pub const ERPCMISMATCH = 73; // RPC version wrong
+pub const EPROGUNAVAIL = 74; // RPC prog. not avail
+pub const EPROGMISMATCH = 75; // Program version wrong
+pub const EPROCUNAVAIL = 76; // Bad procedure for program
+
+pub const ENOLCK = 77; // No locks available
+pub const ENOSYS = 78; // Function not implemented
+
+pub const EFTYPE = 79; // Inappropriate file type or format
+pub const EAUTH = 80; // Authentication error
+pub const ENEEDAUTH = 81; // Need authenticator
+
+// SystemV IPC
+pub const EIDRM = 82; // Identifier removed
+pub const ENOMSG = 83; // No message of desired type
+pub const EOVERFLOW = 84; // Value too large to be stored in data type
+
+// Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995
+pub const EILSEQ = 85; // Illegal byte sequence
+
+// From IEEE Std 1003.1-2001
+// Base, Realtime, Threads or Thread Priority Scheduling option errors
+pub const ENOTSUP = 86; // Not supported
+
+// Realtime option errors
+pub const ECANCELED = 87; // Operation canceled
+
+// Realtime, XSI STREAMS option errors
+pub const EBADMSG = 88; // Bad or Corrupt message
+
+// XSI STREAMS option errors
+pub const ENODATA = 89; // No message available
+pub const ENOSR = 90; // No STREAM resources
+pub const ENOSTR = 91; // Not a STREAM
+pub const ETIME = 92; // STREAM ioctl timeout
+
+// File system extended attribute errors
+pub const ENOATTR = 93; // Attribute not found
+
+// Realtime, XSI STREAMS option errors
+pub const EMULTIHOP = 94; // Multihop attempted
+pub const ENOLINK = 95; // Link has been severed
+pub const EPROTO = 96; // Protocol error
+
+pub const ELAST = 96; // Must equal largest errno
Index: pkgsrc/lang/zig/files/std_os_netbsd_index.zig
diff -u /dev/null pkgsrc/lang/zig/files/std_os_netbsd_index.zig:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/files/std_os_netbsd_index.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,728 @@
+const builtin = @import("builtin");
+
+pub use @import("errno.zig");
+
+const std = @import("../../index.zig");
+const c = std.c;
+
+const assert = std.debug.assert;
+const maxInt = std.math.maxInt;
+pub const Kevent = c.Kevent;
+
+pub const CTL_KERN = 1;
+pub const CTL_DEBUG = 5;
+
+pub const KERN_PROC_ARGS = 48; // struct: process argv/env
+pub const KERN_PROC_PATHNAME = 5; // path to executable
+
+pub const PATH_MAX = 1024;
+
+pub const STDIN_FILENO = 0;
+pub const STDOUT_FILENO = 1;
+pub const STDERR_FILENO = 2;
+
+pub const PROT_NONE = 0;
+pub const PROT_READ = 1;
+pub const PROT_WRITE = 2;
+pub const PROT_EXEC = 4;
+
+pub const CLOCK_REALTIME = 0;
+pub const CLOCK_VIRTUAL = 1;
+pub const CLOCK_PROF = 2;
+pub const CLOCK_MONOTONIC = 3;
+pub const CLOCK_THREAD_CPUTIME_ID = 0x20000000;
+pub const CLOCK_PROCESS_CPUTIME_ID = 0x40000000;
+
+pub const MAP_FAILED = maxInt(usize);
+pub const MAP_SHARED = 0x0001;
+pub const MAP_PRIVATE = 0x0002;
+pub const MAP_REMAPDUP = 0x0004;
+pub const MAP_FIXED = 0x0010;
+pub const MAP_RENAME = 0x0020;
+pub const MAP_NORESERVE = 0x0040;
+pub const MAP_INHERIT = 0x0080;
+pub const MAP_HASSEMAPHORE = 0x0200;
+pub const MAP_TRYFIXED = 0x0400;
+pub const MAP_WIRED = 0x0800;
+
+pub const MAP_FILE = 0x0000;
+pub const MAP_NOSYNC = 0x0800;
+pub const MAP_ANON = 0x1000;
+pub const MAP_ANONYMOUS = MAP_ANON;
+pub const MAP_STACK = 0x2000;
+
+pub const WNOHANG = 0x00000001;
+pub const WUNTRACED = 0x00000002;
+pub const WSTOPPED = WUNTRACED;
+pub const WCONTINUED = 0x00000010;
+pub const WNOWAIT = 0x00010000;
+pub const WEXITED = 0x00000020;
+pub const WTRAPPED = 0x00000040;
+
+pub const SA_ONSTACK = 0x0001;
+pub const SA_RESTART = 0x0002;
+pub const SA_RESETHAND = 0x0004;
+pub const SA_NOCLDSTOP = 0x0008;
+pub const SA_NODEFER = 0x0010;
+pub const SA_NOCLDWAIT = 0x0020;
+pub const SA_SIGINFO = 0x0040;
+
+pub const SIGHUP = 1;
+pub const SIGINT = 2;
+pub const SIGQUIT = 3;
+pub const SIGILL = 4;
+pub const SIGTRAP = 5;
+pub const SIGABRT = 6;
+pub const SIGIOT = SIGABRT;
+pub const SIGEMT = 7;
+pub const SIGFPE = 8;
+pub const SIGKILL = 9;
+pub const SIGBUS = 10;
+pub const SIGSEGV = 11;
+pub const SIGSYS = 12;
+pub const SIGPIPE = 13;
+pub const SIGALRM = 14;
+pub const SIGTERM = 15;
+pub const SIGURG = 16;
+pub const SIGSTOP = 17;
+pub const SIGTSTP = 18;
+pub const SIGCONT = 19;
+pub const SIGCHLD = 20;
+pub const SIGTTIN = 21;
+pub const SIGTTOU = 22;
+pub const SIGIO = 23;
+pub const SIGXCPU = 24;
+pub const SIGXFSZ = 25;
+pub const SIGVTALRM = 26;
+pub const SIGPROF = 27;
+pub const SIGWINCH = 28;
+pub const SIGINFO = 29;
+pub const SIGUSR1 = 30;
+pub const SIGUSR2 = 31;
+pub const SIGPWR = 32;
+
+pub const SIGRTMIN = 33;
+pub const SIGRTMAX = 63;
+
+// access function
+pub const F_OK = 0; // test for existence of file
+pub const X_OK = 1; // test for execute or search permission
+pub const W_OK = 2; // test for write permission
+pub const R_OK = 4; // test for read permission
+
+
+pub const O_RDONLY = 0x0000;
+pub const O_WRONLY = 0x0001;
+pub const O_RDWR = 0x0002;
+pub const O_ACCMODE = 0x0003;
+
+pub const O_CREAT = 0x0200;
+pub const O_EXCL = 0x0800;
+pub const O_NOCTTY = 0x8000;
+pub const O_TRUNC = 0x0400;
+pub const O_APPEND = 0x0008;
+pub const O_NONBLOCK = 0x0004;
+pub const O_DSYNC = 0x00010000;
+pub const O_SYNC = 0x0080;
+pub const O_RSYNC = 0x00020000;
+pub const O_DIRECTORY = 0x00080000;
+pub const O_NOFOLLOW = 0x00000100;
+pub const O_CLOEXEC = 0x00400000;
+
+pub const O_ASYNC = 0x0040;
+pub const O_DIRECT = 0x00080000;
+pub const O_LARGEFILE = 0;
+pub const O_NOATIME = 0;
+pub const O_PATH = 0;
+pub const O_TMPFILE = 0;
+pub const O_NDELAY = O_NONBLOCK;
+
+pub const F_DUPFD = 0;
+pub const F_GETFD = 1;
+pub const F_SETFD = 2;
+pub const F_GETFL = 3;
+pub const F_SETFL = 4;
+
+pub const F_GETOWN = 5;
+pub const F_SETOWN = 6;
+
+pub const F_GETLK = 7;
+pub const F_SETLK = 8;
+pub const F_SETLKW = 9;
+
+pub const SEEK_SET = 0;
+pub const SEEK_CUR = 1;
+pub const SEEK_END = 2;
+
+pub const SIG_BLOCK = 1;
+pub const SIG_UNBLOCK = 2;
+pub const SIG_SETMASK = 3;
+
+pub const SOCK_STREAM = 1;
+pub const SOCK_DGRAM = 2;
+pub const SOCK_RAW = 3;
+pub const SOCK_RDM = 4;
+pub const SOCK_SEQPACKET = 5;
+
+pub const SOCK_CLOEXEC = 0x10000000;
+pub const SOCK_NONBLOCK = 0x20000000;
+
+pub const PROTO_ip = 0;
+pub const PROTO_icmp = 1;
+pub const PROTO_igmp = 2;
+pub const PROTO_ggp = 3;
+pub const PROTO_ipencap = 4;
+pub const PROTO_tcp = 6;
+pub const PROTO_egp = 8;
+pub const PROTO_pup = 12;
+pub const PROTO_udp = 17;
+pub const PROTO_xns_idp = 22;
+pub const PROTO_iso_tp4 = 29;
+pub const PROTO_ipv6 = 41;
+pub const PROTO_ipv6_route = 43;
+pub const PROTO_ipv6_frag = 44;
+pub const PROTO_rsvp = 46;
+pub const PROTO_gre = 47;
+pub const PROTO_esp = 50;
+pub const PROTO_ah = 51;
+pub const PROTO_ipv6_icmp = 58;
+pub const PROTO_ipv6_nonxt = 59;
+pub const PROTO_ipv6_opts = 60;
+pub const PROTO_encap = 98;
+pub const PROTO_pim = 103;
+pub const PROTO_raw = 255;
+
+pub const PF_UNSPEC = 0;
+pub const PF_LOCAL = 1;
+pub const PF_UNIX = PF_LOCAL;
+pub const PF_FILE = PF_LOCAL;
+pub const PF_INET = 2;
+pub const PF_APPLETALK = 16;
+pub const PF_INET6 = 24;
+pub const PF_DECnet = 12;
+pub const PF_KEY = 29;
+pub const PF_ROUTE = 34;
+pub const PF_SNA = 11;
+pub const PF_MPLS = 33;
+pub const PF_CAN = 35;
+pub const PF_BLUETOOTH = 31;
+pub const PF_ISDN = 26;
+pub const PF_MAX = 37;
+
+pub const AF_UNSPEC = PF_UNSPEC;
+pub const AF_LOCAL = PF_LOCAL;
+pub const AF_UNIX = AF_LOCAL;
+pub const AF_FILE = AF_LOCAL;
+pub const AF_INET = PF_INET;
+pub const AF_APPLETALK = PF_APPLETALK;
+pub const AF_INET6 = PF_INET6;
+pub const AF_KEY = PF_KEY;
+pub const AF_ROUTE = PF_ROUTE;
+pub const AF_SNA = PF_SNA;
+pub const AF_MPLS = PF_MPLS;
+pub const AF_CAN = PF_CAN;
+pub const AF_BLUETOOTH = PF_BLUETOOTH;
+pub const AF_ISDN = PF_ISDN;
+pub const AF_MAX = PF_MAX;
+
+pub const DT_UNKNOWN = 0;
+pub const DT_FIFO = 1;
+pub const DT_CHR = 2;
+pub const DT_DIR = 4;
+pub const DT_BLK = 6;
+pub const DT_REG = 8;
+pub const DT_LNK = 10;
+pub const DT_SOCK = 12;
+pub const DT_WHT = 14;
+
+/// add event to kq (implies enable)
+pub const EV_ADD = 0x0001;
+
+/// delete event from kq
+pub const EV_DELETE = 0x0002;
+
+/// enable event
+pub const EV_ENABLE = 0x0004;
+
+/// disable event (not reported)
+pub const EV_DISABLE = 0x0008;
+
+/// only report one occurrence
+pub const EV_ONESHOT = 0x0010;
+
+/// clear event state after reporting
+pub const EV_CLEAR = 0x0020;
+
+/// force immediate event output
+/// ... with or without EV_ERROR
+/// ... use KEVENT_FLAG_ERROR_EVENTS
+///     on syscalls supporting flags
+pub const EV_RECEIPT = 0x0040;
+
+/// disable event after reporting
+pub const EV_DISPATCH = 0x0080;
+
+pub const EVFILT_READ = 0;
+pub const EVFILT_WRITE = 1;
+
+/// attached to aio requests
+pub const EVFILT_AIO = 2;
+
+/// attached to vnodes
+pub const EVFILT_VNODE = 3;
+
+/// attached to struct proc
+pub const EVFILT_PROC = 4;
+
+/// attached to struct proc
+pub const EVFILT_SIGNAL = 5;
+
+/// timers
+pub const EVFILT_TIMER = 6;
+
+/// Filesystem events
+pub const EVFILT_FS = 7;
+
+/// XXX no EVFILT_USER, but what is it
+pub const EVFILT_USER = 0;
+
+/// On input, NOTE_TRIGGER causes the event to be triggered for output.
+pub const NOTE_TRIGGER = 0x08000000;
+
+/// low water mark
+pub const NOTE_LOWAT = 0x00000001;
+
+/// vnode was removed
+pub const NOTE_DELETE = 0x00000001;
+
+/// data contents changed
+pub const NOTE_WRITE = 0x00000002;
+
+/// size increased
+pub const NOTE_EXTEND = 0x00000004;
+
+/// attributes changed
+pub const NOTE_ATTRIB = 0x00000008;
+
+/// link count changed
+pub const NOTE_LINK = 0x00000010;
+
+/// vnode was renamed
+pub const NOTE_RENAME = 0x00000020;
+
+/// vnode access was revoked
+pub const NOTE_REVOKE = 0x00000040;
+
+/// process exited
+pub const NOTE_EXIT = 0x80000000;
+
+/// process forked
+pub const NOTE_FORK = 0x40000000;
+
+/// process exec'd
+pub const NOTE_EXEC = 0x20000000;
+
+/// mask for signal & exit status
+pub const NOTE_PDATAMASK = 0x000fffff;
+pub const NOTE_PCTRLMASK = 0xf0000000;
+
+pub const TIOCCBRK = 0x2000747a;
+pub const TIOCCDTR = 0x20007478;
+pub const TIOCCONS = 0x80047462;
+pub const TIOCDCDTIMESTAMP = 0x40107458;
+pub const TIOCDRAIN = 0x2000745e;
+pub const TIOCEXCL = 0x2000740d;
+pub const TIOCEXT = 0x80047460;
+pub const TIOCFLAG_CDTRCTS = 0x10;
+pub const TIOCFLAG_CLOCAL = 0x2;
+pub const TIOCFLAG_CRTSCTS = 0x4;
+pub const TIOCFLAG_MDMBUF = 0x8;
+pub const TIOCFLAG_SOFTCAR = 0x1;
+pub const TIOCFLUSH = 0x80047410;
+pub const TIOCGETA = 0x402c7413;
+pub const TIOCGETD = 0x4004741a;
+pub const TIOCGFLAGS = 0x4004745d;
+pub const TIOCGLINED = 0x40207442;
+pub const TIOCGPGRP = 0x40047477;
+pub const TIOCGQSIZE = 0x40047481;
+pub const TIOCGRANTPT = 0x20007447;
+pub const TIOCGSID = 0x40047463;
+pub const TIOCGSIZE = 0x40087468;
+pub const TIOCGWINSZ = 0x40087468;
+pub const TIOCMBIC = 0x8004746b;
+pub const TIOCMBIS = 0x8004746c;
+pub const TIOCMGET = 0x4004746a;
+pub const TIOCMSET = 0x8004746d;
+pub const TIOCM_CAR = 0x40;
+pub const TIOCM_CD = 0x40;
+pub const TIOCM_CTS = 0x20;
+pub const TIOCM_DSR = 0x100;
+pub const TIOCM_DTR = 0x2;
+pub const TIOCM_LE = 0x1;
+pub const TIOCM_RI = 0x80;
+pub const TIOCM_RNG = 0x80;
+pub const TIOCM_RTS = 0x4;
+pub const TIOCM_SR = 0x10;
+pub const TIOCM_ST = 0x8;
+pub const TIOCNOTTY = 0x20007471;
+pub const TIOCNXCL = 0x2000740e;
+pub const TIOCOUTQ = 0x40047473;
+pub const TIOCPKT = 0x80047470;
+pub const TIOCPKT_DATA = 0x0;
+pub const TIOCPKT_DOSTOP = 0x20;
+pub const TIOCPKT_FLUSHREAD = 0x1;
+pub const TIOCPKT_FLUSHWRITE = 0x2;
+pub const TIOCPKT_IOCTL = 0x40;
+pub const TIOCPKT_NOSTOP = 0x10;
+pub const TIOCPKT_START = 0x8;
+pub const TIOCPKT_STOP = 0x4;
+pub const TIOCPTMGET = 0x40287446;
+pub const TIOCPTSNAME = 0x40287448;
+pub const TIOCRCVFRAME = 0x80087445;
+pub const TIOCREMOTE = 0x80047469;
+pub const TIOCSBRK = 0x2000747b;
+pub const TIOCSCTTY = 0x20007461;
+pub const TIOCSDTR = 0x20007479;
+pub const TIOCSETA = 0x802c7414;
+pub const TIOCSETAF = 0x802c7416;
+pub const TIOCSETAW = 0x802c7415;
+pub const TIOCSETD = 0x8004741b;
+pub const TIOCSFLAGS = 0x8004745c;
+pub const TIOCSIG = 0x2000745f;
+pub const TIOCSLINED = 0x80207443;
+pub const TIOCSPGRP = 0x80047476;
+pub const TIOCSQSIZE = 0x80047480;
+pub const TIOCSSIZE = 0x80087467;
+pub const TIOCSTART = 0x2000746e;
+pub const TIOCSTAT = 0x80047465;
+pub const TIOCSTI = 0x80017472;
+pub const TIOCSTOP = 0x2000746f;
+pub const TIOCSWINSZ = 0x80087467;
+pub const TIOCUCNTL = 0x80047466;
+pub const TIOCXMTFRAME = 0x80087444;
+
+pub const sockaddr = c.sockaddr;
+pub const sockaddr_in = c.sockaddr_in;
+pub const sockaddr_in6 = c.sockaddr_in6;
+
+fn unsigned(s: i32) u32 {
+    return @bitCast(u32, s);
+}
+fn signed(s: u32) i32 {
+    return @bitCast(i32, s);
+}
+pub fn WEXITSTATUS(s: i32) i32 {
+    return signed((unsigned(s) >> 8) & 0xff);
+}
+pub fn WTERMSIG(s: i32) i32 {
+    return signed(unsigned(s) & 0x7f);
+}
+pub fn WSTOPSIG(s: i32) i32 {
+    return WEXITSTATUS(s);
+}
+pub fn WIFEXITED(s: i32) bool {
+    return WTERMSIG(s) == 0;
+}
+
+pub fn WIFCONTINUED(s: i32) bool {
+    return ((s & 0x7f) == 0xffff);
+}
+
+pub fn WIFSTOPPED(s: i32) bool {
+    return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s));
+}
+
+pub fn WIFSIGNALED(s: i32) bool {
+    return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s);
+}
+
+pub const winsize = extern struct {
+    ws_row: u16,
+    ws_col: u16,
+    ws_xpixel: u16,
+    ws_ypixel: u16,
+};
+
+/// Get the errno from a syscall return value, or 0 for no error.
+pub fn getErrno(r: usize) usize {
+    const signed_r = @bitCast(isize, r);
+    return if (signed_r > -4096 and signed_r < 0) @intCast(usize, -signed_r) else 0;
+}
+
+pub fn dup2(old: i32, new: i32) usize {
+    return errnoWrap(c.dup2(old, new));
+}
+
+pub fn chdir(path: [*]const u8) usize {
+    return errnoWrap(c.chdir(path));
+}
+
+pub fn execve(path: [*]const u8, argv: [*]const ?[*]const u8, envp: [*]const ?[*]const u8) usize {
+    return errnoWrap(c.execve(path, argv, envp));
+}
+
+pub fn fork() usize {
+    return errnoWrap(c.fork());
+}
+
+pub fn access(path: [*]const u8, mode: u32) usize {
+    return errnoWrap(c.access(path, mode));
+}
+
+pub fn getcwd(buf: [*]u8, size: usize) usize {
+    return if (c.getcwd(buf, size) == null) @bitCast(usize, -isize(c._errno().*)) else 0;
+}
+
+pub fn getdents(fd: i32, dirp: [*]u8, count: usize) usize {
+    return errnoWrap(@bitCast(isize, c.getdents(fd, drip, count)));
+}
+
+pub fn getdirentries(fd: i32, buf_ptr: [*]u8, buf_len: usize, basep: *i64) usize {
+    return errnoWrap(@bitCast(isize, c.getdirentries(fd, buf_ptr, buf_len, basep)));
+}
+
+pub fn realpath(noalias filename: [*]const u8, noalias resolved_name: [*]u8) usize {
+    return if (c.realpath(filename, resolved_name) == null) @bitCast(usize, -isize(c._errno().*)) else 0;
+}
+
+pub fn isatty(fd: i32) bool {
+    return c.isatty(fd) != 0;
+}
+
+pub fn readlink(noalias path: [*]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize {
+    return errnoWrap(c.readlink(path, buf_ptr, buf_len));
+}
+
+pub fn mkdir(path: [*]const u8, mode: u32) usize {
+    return errnoWrap(c.mkdir(path, mode));
+}
+
+pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: isize) usize {
+    const ptr_result = c.mmap(
+        @ptrCast(?*c_void, address),
+        length,
+        @bitCast(c_int, @intCast(c_uint, prot)),
+        @bitCast(c_int, c_uint(flags)),
+        fd,
+        offset,
+    );
+    const isize_result = @bitCast(isize, @ptrToInt(ptr_result));
+    return errnoWrap(isize_result);
+}
+
+pub fn munmap(address: usize, length: usize) usize {
+    return errnoWrap(c.munmap(@intToPtr(*c_void, address), length));
+}
+
+pub fn read(fd: i32, buf: [*]u8, nbyte: usize) usize {
+    return errnoWrap(c.read(fd, @ptrCast(*c_void, buf), nbyte));
+}
+
+pub fn rmdir(path: [*]const u8) usize {
+    return errnoWrap(c.rmdir(path));
+}
+
+pub fn symlink(existing: [*]const u8, new: [*]const u8) usize {
+    return errnoWrap(c.symlink(existing, new));
+}
+
+pub fn pread(fd: i32, buf: [*]u8, nbyte: usize, offset: u64) usize {
+    return errnoWrap(c.pread(fd, @ptrCast(*c_void, buf), nbyte, offset));
+}
+
+pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: usize) usize {
+    return errnoWrap(c.preadv(fd, @ptrCast(*const c_void, iov), @intCast(c_int, count), offset));
+}
+
+pub fn pipe(fd: *[2]i32) usize {
+    return pipe2(fd, 0);
+}
+
+pub fn pipe2(fd: *[2]i32, flags: u32) usize {
+    comptime assert(i32.bit_count == c_int.bit_count);
+    return errnoWrap(c.pipe2(@ptrCast(*[2]c_int, fd), flags));
+}
+
+pub fn write(fd: i32, buf: [*]const u8, nbyte: usize) usize {
+    return errnoWrap(c.write(fd, @ptrCast(*const c_void, buf), nbyte));
+}
+
+pub fn pwrite(fd: i32, buf: [*]const u8, nbyte: usize, offset: u64) usize {
+    return errnoWrap(c.pwrite(fd, @ptrCast(*const c_void, buf), nbyte, offset));
+}
+
+pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: usize) usize {
+    return errnoWrap(c.pwritev(fd, @ptrCast(*const c_void, iov), @intCast(c_int, count), offset));
+}
+
+pub fn rename(old: [*]const u8, new: [*]const u8) usize {
+    return errnoWrap(c.rename(old, new));
+}
+
+pub fn open(path: [*]const u8, flags: u32, mode: usize) usize {
+    return errnoWrap(c.open(path, @bitCast(c_int, flags), mode));
+}
+
+pub fn create(path: [*]const u8, perm: usize) usize {
+    return arch.syscall2(SYS_creat, @ptrToInt(path), perm);
+}
+
+pub fn openat(dirfd: i32, path: [*]const u8, flags: usize, mode: usize) usize {
+    return errnoWrap(c.openat(@bitCast(usize, isize(dirfd)), @ptrToInt(path), flags, mode));
+}
+
+pub fn close(fd: i32) usize {
+    return errnoWrap(c.close(fd));
+}
+
+pub fn lseek(fd: i32, offset: isize, whence: c_int) usize {
+    return errnoWrap(c.lseek(fd, offset, whence));
+}
+
+pub fn exit(code: i32) noreturn {
+    c.exit(code);
+}
+
+pub fn kill(pid: i32, sig: i32) usize {
+    return errnoWrap(c.kill(pid, sig));
+}
+
+pub fn unlink(path: [*]const u8) usize {
+    return errnoWrap(c.unlink(path));
+}
+
+pub fn waitpid(pid: i32, status: *i32, options: u32) usize {
+    comptime assert(i32.bit_count == c_int.bit_count);
+    return errnoWrap(c.waitpid(pid, @ptrCast(*c_int, status), @bitCast(c_int, options)));
+}
+
+pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize {
+    return errnoWrap(c.nanosleep(req, rem));
+}
+
+pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
+    return errnoWrap(c.clock_gettime(clk_id, tp));
+}
+
+pub fn clock_getres(clk_id: i32, tp: *timespec) usize {
+    return errnoWrap(c.clock_getres(clk_id, tp));
+}
+
+pub fn setuid(uid: u32) usize {
+    return errnoWrap(c.setuid(uid));
+}
+
+pub fn setgid(gid: u32) usize {
+    return errnoWrap(c.setgid(gid));
+}
+
+pub fn setreuid(ruid: u32, euid: u32) usize {
+    return errnoWrap(c.setreuid(ruid, euid));
+}
+
+pub fn setregid(rgid: u32, egid: u32) usize {
+    return errnoWrap(c.setregid(rgid, egid));
+}
+
+const NSIG = 32;
+
+pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize));
+pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);
+pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);
+
+/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
+pub const Sigaction = extern struct {
+    /// signal handler
+    __sigaction_u: extern union {
+        __sa_handler: extern fn (i32) void,
+        __sa_sigaction: extern fn (i32, *__siginfo, usize) void,
+    },
+
+    /// see signal options
+    sa_flags: u32,
+
+    /// signal mask to apply
+    sa_mask: sigset_t,
+};
+
+pub const _SIG_WORDS = 4;
+pub const _SIG_MAXSIG = 128;
+
+pub inline fn _SIG_IDX(sig: usize) usize {
+    return sig - 1;
+}
+pub inline fn _SIG_WORD(sig: usize) usize {
+    return_SIG_IDX(sig) >> 5;
+}
+pub inline fn _SIG_BIT(sig: usize) usize {
+    return 1 << (_SIG_IDX(sig) & 31);
+}
+pub inline fn _SIG_VALID(sig: usize) usize {
+    return sig <= _SIG_MAXSIG and sig > 0;
+}
+
+pub const sigset_t = extern struct {
+    __bits: [_SIG_WORDS]u32,
+};
+
+pub fn raise(sig: i32) usize {
+    return errnoWrap(c.raise(sig));
+}
+
+pub const Stat = c.Stat;
+pub const dirent = c.dirent;
+pub const timespec = c.timespec;
+
+pub fn fstat(fd: i32, buf: *c.Stat) usize {
+    return errnoWrap(c.fstat(fd, buf));
+}
+pub const iovec = extern struct {
+    iov_base: [*]u8,
+    iov_len: usize,
+};
+
+pub const iovec_const = extern struct {
+    iov_base: [*]const u8,
+    iov_len: usize,
+};
+
+// TODO avoid libc dependency
+pub fn kqueue() usize {
+    return errnoWrap(c.kqueue());
+}
+
+// TODO avoid libc dependency
+pub fn kevent(kq: i32, changelist: []const Kevent, eventlist: []Kevent, timeout: ?*const timespec) usize {
+    return errnoWrap(c.kevent(
+        kq,
+        changelist.ptr,
+        @intCast(c_int, changelist.len),
+        eventlist.ptr,
+        @intCast(c_int, eventlist.len),
+        timeout,
+    ));
+}
+
+// TODO avoid libc dependency
+pub fn sysctl(name: [*]c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) usize {
+    return errnoWrap(c.sysctl(name, namelen, oldp, oldlenp, newp, newlen));
+}
+
+// TODO avoid libc dependency
+pub fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) usize {
+    return errnoWrap(c.sysctlbyname(name, oldp, oldlenp, newp, newlen));
+}
+
+// TODO avoid libc dependency
+pub fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) usize {
+    return errnoWrap(c.sysctlnametomib(name, wibp, sizep));
+}
+
+// TODO avoid libc dependency
+
+/// Takes the return value from a syscall and formats it back in the way
+/// that the kernel represents it to libc. Errno was a mistake, let's make
+/// it go away forever.
+fn errnoWrap(value: isize) usize {
+    return @bitCast(usize, if (value == -1) -isize(c._errno().*) else value);
+}

Index: pkgsrc/lang/zig/patches/patch-CMakeLists.txt
diff -u /dev/null pkgsrc/lang/zig/patches/patch-CMakeLists.txt:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/patches/patch-CMakeLists.txt        Sun Feb 17 12:33:40 2019
@@ -0,0 +1,21 @@
+$NetBSD: patch-CMakeLists.txt,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- CMakeLists.txt.orig        2019-02-17 10:28:53.000000000 +0000
++++ CMakeLists.txt
+@@ -448,6 +448,7 @@ set(ZIG_STD_FILES
+     "c/freebsd.zig"
+     "c/index.zig"
+     "c/linux.zig"
++    "c/netbsd.zig"
+     "c/windows.zig"
+     "coff.zig"
+     "crypto/blake2.zig"
+@@ -588,6 +589,8 @@ set(ZIG_STD_FILES
+     "os/linux/index.zig"
+     "os/linux/vdso.zig"
+     "os/linux/x86_64.zig"
++    "os/netbsd/errno.zig"
++    "os/netbsd/index.zig"
+     "os/path.zig"
+     "os/time.zig"
+     "os/uefi.zig"
Index: pkgsrc/lang/zig/patches/patch-src-self-hosted_libc__installation.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src-self-hosted_libc__installation.zig:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/patches/patch-src-self-hosted_libc__installation.zig        Sun Feb 17 12:33:40 2019
@@ -0,0 +1,13 @@
+$NetBSD: patch-src-self-hosted_libc__installation.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src-self-hosted/libc_installation.zig.orig 2019-02-17 10:28:53.000000000 +0000
++++ src-self-hosted/libc_installation.zig
+@@ -172,7 +172,7 @@ pub const LibCInstallation = struct {
+                 try group.call(findNativeStaticLibDir, self, loop);
+                 try group.call(findNativeDynamicLinker, self, loop);
+             },
+-            builtin.Os.macosx, builtin.Os.freebsd => {
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                 self.include_dir = try std.mem.dupe(loop.allocator, u8, "/usr/include");
+             },
+             else => @compileError("unimplemented: find libc for this OS"),
Index: pkgsrc/lang/zig/patches/patch-src_analyze.cpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_analyze.cpp:1.1
--- /dev/null   Sun Feb 17 12:33:40 2019
+++ pkgsrc/lang/zig/patches/patch-src_analyze.cpp       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,43 @@
+$NetBSD: patch-src_analyze.cpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/analyze.cpp.orig       2019-02-17 10:28:53.000000000 +0000
++++ src/analyze.cpp
+@@ -4732,7 +4732,8 @@ void find_libc_include_path(CodeGen *g) 
+             }
+         } else if (g->zig_target.os == OsLinux ||
+             g->zig_target.os == OsMacOSX ||
+-            g->zig_target.os == OsFreeBSD)
++            g->zig_target.os == OsFreeBSD ||
++          g->zig_target.os == OsNetBSD)
+         {
+             g->libc_include_dir = get_posix_libc_include_path();
+         } else {
+@@ -4781,7 +4782,7 @@ void find_libc_lib_path(CodeGen *g) {
+ 
+         } else if (g->zig_target.os == OsLinux) {
+             g->libc_lib_dir = get_linux_libc_lib_path("crt1.o");
+-        } else if (g->zig_target.os == OsFreeBSD) {
++        } else if ((g->zig_target.os == OsFreeBSD) || (g->zig_target.os == OsNetBSD)) {
+             g->libc_lib_dir = buf_create_from_str("/usr/lib");
+         } else {
+             zig_panic("Unable to determine libc lib path.");
+@@ -4795,7 +4796,7 @@ void find_libc_lib_path(CodeGen *g) {
+             return;
+         } else if (g->zig_target.os == OsLinux) {
+             g->libc_static_lib_dir = get_linux_libc_lib_path("crtbegin.o");
+-        } else if (g->zig_target.os == OsFreeBSD) {
++        } else if ((g->zig_target.os == OsFreeBSD) || (g->zig_target.os == OsNetBSD)) {
+             g->libc_static_lib_dir = buf_create_from_str("/usr/lib");
+         } else {
+             zig_panic("Unable to determine libc static lib path.");
+@@ -6710,7 +6711,9 @@ LinkLib *add_link_lib(CodeGen *g, Buf *n
+     if (is_libc && g->libc_link_lib != nullptr)
+         return g->libc_link_lib;
+ 
+-    if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX && g->zig_target.os != OsIOS && g->zig_target.os != OsFreeBSD) {
++    if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX &&
++        g->zig_target.os != OsIOS && g->zig_target.os != OsFreeBSD &&
++      g->zig_target.os != OsNetBSD) {
+         fprintf(stderr, "TODO linking against libc is currently incompatible with `--cache on`.\n"
+         "Zig is not yet capable of determining whether the libc installation has changed on subsequent builds.\n");
+         exit(1);
Index: pkgsrc/lang/zig/patches/patch-src_codegen.cpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_codegen.cpp:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-src_codegen.cpp       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_codegen.cpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/codegen.cpp.orig       2019-02-17 10:28:53.000000000 +0000
++++ src/codegen.cpp
+@@ -184,7 +184,8 @@ CodeGen *codegen_create(Buf *root_src_pa
+     // On Darwin/MacOS/iOS, we always link libSystem which contains libc.
+     if (g->zig_target.os == OsMacOSX ||
+         g->zig_target.os == OsIOS ||
+-      g->zig_target.os == OsFreeBSD)
++      g->zig_target.os == OsFreeBSD ||
++      g->zig_target.os == OsNetBSD)
+     {
+         g->libc_link_lib = create_link_lib(buf_create_from_str("c"));
+         g->link_libs_list.append(g->libc_link_lib);
Index: pkgsrc/lang/zig/patches/patch-src_link.cpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_link.cpp:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-src_link.cpp  Sun Feb 17 12:33:40 2019
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_link.cpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/link.cpp.orig  2019-02-17 10:28:53.000000000 +0000
++++ src/link.cpp
+@@ -198,6 +198,9 @@ static Buf *get_dynamic_linker_path(Code
+     if (g->zig_target.os == OsFreeBSD) {
+         return buf_create_from_str("/libexec/ld-elf.so.1");
+     }
++    if (g->zig_target.os == OsNetBSD) {
++        return buf_create_from_str("/libexec/ld.elf_so");
++    }
+     if (g->is_native_target && g->zig_target.arch.arch == ZigLLVM_x86_64) {
+         static const char *ld_names[] = {
+             "ld-linux-x86-64.so.2",
+@@ -263,10 +266,13 @@ static void construct_linker_job_elf(Lin
+     if (lj->link_in_crt) {
+         const char *crt1o;
+         const char *crtbegino;
+-        if (g->is_static) {
++        if (g->zig_target.os == OsNetBSD) {
++          crt1o = "crt0.o";
++          crtbegino = "crtbegin.o";
++      } else if (g->is_static) {
+             crt1o = "crt1.o";
+             crtbegino = "crtbeginT.o";
+-        } else {
++      } else {
+             crt1o = "Scrt1.o";
+             crtbegino = "crtbegin.o";
+         }
Index: pkgsrc/lang/zig/patches/patch-src_os.cpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_os.cpp:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-src_os.cpp    Sun Feb 17 12:33:40 2019
@@ -0,0 +1,61 @@
+$NetBSD: patch-src_os.cpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/os.cpp.orig    2019-02-17 10:28:53.000000000 +0000
++++ src/os.cpp
+@@ -50,11 +50,11 @@ typedef SSIZE_T ssize_t;
+ 
+ #endif
+ 
+-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD)
++#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+ #include <link.h>
+ #endif
+ 
+-#if defined(ZIG_OS_FREEBSD)
++#if defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+ #include <sys/sysctl.h>
+ #endif
+ 
+@@ -78,7 +78,7 @@ static clock_serv_t cclock;
+ #if defined(__APPLE__) && !defined(environ)
+ #include <crt_externs.h>
+ #define environ (*_NSGetEnviron())
+-#elif defined(ZIG_OS_FREEBSD)
++#elif defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+ extern char **environ;
+ #endif
+ 
+@@ -1458,6 +1458,15 @@ Error os_self_exe_path(Buf *out_path) {
+     }
+     buf_resize(out_path, cb - 1);
+     return ErrorNone;
++#elif defined(ZIG_OS_NETBSD)
++    buf_resize(out_path, PATH_MAX);
++    int mib[4] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME };
++    size_t cb = PATH_MAX;
++    if (sysctl(mib, 4, buf_ptr(out_path), &cb, nullptr, 0) != 0) {
++        return ErrorUnexpected;
++    }
++    buf_resize(out_path, cb - 1);
++    return ErrorNone;
+ #endif
+     return ErrorFileNotFound;
+ }
+@@ -1776,7 +1785,7 @@ Error os_get_app_data_dir(Buf *out_path,
+ }
+ 
+ 
+-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD)
++#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+ static int self_exe_shared_libs_callback(struct dl_phdr_info *info, size_t size, void *data) {
+     ZigList<Buf *> *libs = reinterpret_cast< ZigList<Buf *> *>(data);
+     if (info->dlpi_name[0] == '/') {
+@@ -1787,7 +1796,7 @@ static int self_exe_shared_libs_callback
+ #endif
+ 
+ Error os_self_exe_shared_libs(ZigList<Buf *> &paths) {
+-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD)
++#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+     paths.resize(0);
+     dl_iterate_phdr(self_exe_shared_libs_callback, &paths);
+     return ErrorNone;
Index: pkgsrc/lang/zig/patches/patch-src_os.hpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_os.hpp:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-src_os.hpp    Sun Feb 17 12:33:40 2019
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_os.hpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/os.hpp.orig    2019-02-17 10:28:53.000000000 +0000
++++ src/os.hpp
+@@ -25,6 +25,8 @@
+ #define ZIG_OS_LINUX
+ #elif defined(__FreeBSD__)
+ #define ZIG_OS_FREEBSD
++#elif defined(__NetBSD__)
++#define ZIG_OS_NETBSD
+ #else
+ #define ZIG_OS_UNKNOWN
+ #endif
Index: pkgsrc/lang/zig/patches/patch-src_target.cpp
diff -u /dev/null pkgsrc/lang/zig/patches/patch-src_target.cpp:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-src_target.cpp        Sun Feb 17 12:33:40 2019
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_target.cpp,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- src/target.cpp.orig        2019-02-17 10:28:53.000000000 +0000
++++ src/target.cpp
+@@ -743,6 +743,7 @@ uint32_t target_c_type_size_in_bits(cons
+         case OsMacOSX:
+         case OsZen:
+         case OsFreeBSD:
++      case OsNetBSD:
+         case OsOpenBSD:
+             switch (id) {
+                 case CIntTypeShort:
+@@ -783,7 +784,6 @@ uint32_t target_c_type_size_in_bits(cons
+         case OsIOS:
+         case OsKFreeBSD:
+         case OsLv2:
+-        case OsNetBSD:
+         case OsSolaris:
+         case OsHaiku:
+         case OsMinix:
Index: pkgsrc/lang/zig/patches/patch-std_c_index.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_c_index.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_c_index.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,12 @@
+$NetBSD: patch-std_c_index.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/c/index.zig.orig       2019-02-17 10:28:53.000000000 +0000
++++ std/c/index.zig
+@@ -6,6 +6,7 @@ pub use switch (builtin.os) {
+     Os.windows => @import("windows.zig"),
+     Os.macosx, Os.ios => @import("darwin.zig"),
+     Os.freebsd => @import("freebsd.zig"),
++    Os.netbsd => @import("netbsd.zig"),
+     else => empty_import,
+ };
+ const empty_import = @import("../empty.zig");
Index: pkgsrc/lang/zig/patches/patch-std_debug_index.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_debug_index.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_debug_index.zig   Sun Feb 17 12:33:40 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-std_debug_index.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/debug/index.zig.orig   2019-02-17 10:28:53.000000000 +0000
++++ std/debug/index.zig
+@@ -240,7 +240,7 @@ pub fn writeCurrentStackTraceWindows(
+ pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {
+     switch (builtin.os) {
+         builtin.Os.macosx => return printSourceAtAddressMacOs(debug_info, out_stream, address, tty_color),
+-        builtin.Os.linux, builtin.Os.freebsd => return printSourceAtAddressLinux(debug_info, out_stream, address, tty_color),
++        builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => return printSourceAtAddressLinux(debug_info, out_stream, address, tty_color),
+         builtin.Os.windows => return printSourceAtAddressWindows(debug_info, out_stream, address, tty_color),
+         else => return error.UnsupportedOperatingSystem,
+     }
+@@ -717,7 +717,7 @@ pub const OpenSelfDebugInfoError = error
+ 
+ pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {
+     switch (builtin.os) {
+-        builtin.Os.linux, builtin.Os.freebsd => return openSelfDebugInfoLinux(allocator),
++        builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => return openSelfDebugInfoLinux(allocator),
+         builtin.Os.macosx, builtin.Os.ios => return openSelfDebugInfoMacOs(allocator),
+         builtin.Os.windows => return openSelfDebugInfoWindows(allocator),
+         else => return error.UnsupportedOperatingSystem,
+@@ -1141,7 +1141,7 @@ pub const DebugInfo = switch (builtin.os
+         sect_contribs: []pdb.SectionContribEntry,
+         modules: []Module,
+     },
+-    builtin.Os.linux, builtin.Os.freebsd => DwarfInfo,
++    builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => DwarfInfo,
+     else => @compileError("Unsupported OS"),
+ };
+ 
Index: pkgsrc/lang/zig/patches/patch-std_event_fs.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_event_fs.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_event_fs.zig      Sun Feb 17 12:33:40 2019
@@ -0,0 +1,147 @@
+$NetBSD: patch-std_event_fs.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/event/fs.zig.orig      2019-02-17 10:28:53.000000000 +0000
++++ std/event/fs.zig
+@@ -85,6 +85,7 @@ pub async fn pwritev(loop: *Loop, fd: os
+         builtin.Os.macosx,
+         builtin.Os.linux,
+         builtin.Os.freebsd,
++        builtin.Os.netbsd,
+         => {
+             const iovecs = try loop.allocator.alloc(os.posix.iovec_const, data.len);
+             defer loop.allocator.free(iovecs);
+@@ -222,6 +223,7 @@ pub async fn preadv(loop: *Loop, fd: os.
+         builtin.Os.macosx,
+         builtin.Os.linux,
+         builtin.Os.freebsd,
++        builtin.Os.netbsd,
+         => {
+             const iovecs = try loop.allocator.alloc(os.posix.iovec, data.len);
+             defer loop.allocator.free(iovecs);
+@@ -402,7 +404,11 @@ pub async fn openPosix(
+ 
+ pub async fn openRead(loop: *Loop, path: []const u8) os.File.OpenError!os.FileHandle {
+     switch (builtin.os) {
+-        builtin.Os.macosx, builtin.Os.linux, builtin.Os.freebsd => {
++        builtin.Os.macosx,
++        builtin.Os.linux,
++        builtin.Os.freebsd,
++        builtin.Os.netbsd
++        => {
+             const flags = posix.O_LARGEFILE | posix.O_RDONLY | posix.O_CLOEXEC;
+             return await (async openPosix(loop, path, flags, os.File.default_mode) catch unreachable);
+         },
+@@ -431,6 +437,7 @@ pub async fn openWriteMode(loop: *Loop, 
+         builtin.Os.macosx,
+         builtin.Os.linux,
+         builtin.Os.freebsd,
++        builtin.Os.netbsd,
+         => {
+             const flags = posix.O_LARGEFILE | posix.O_WRONLY | posix.O_CREAT | posix.O_CLOEXEC | posix.O_TRUNC;
+             return await (async openPosix(loop, path, flags, os.File.default_mode) catch unreachable);
+@@ -453,7 +460,7 @@ pub async fn openReadWrite(
+     mode: os.File.Mode,
+ ) os.File.OpenError!os.FileHandle {
+     switch (builtin.os) {
+-        builtin.Os.macosx, builtin.Os.linux, builtin.Os.freebsd => {
++        builtin.Os.macosx, builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => {
+             const flags = posix.O_LARGEFILE | posix.O_RDWR | posix.O_CREAT | posix.O_CLOEXEC;
+             return await (async openPosix(loop, path, flags, mode) catch unreachable);
+         },
+@@ -481,7 +488,7 @@ pub const CloseOperation = struct {
+     os_data: OsData,
+ 
+     const OsData = switch (builtin.os) {
+-        builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd => OsDataPosix,
++        builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => OsDataPosix,
+ 
+         builtin.Os.windows => struct {
+             handle: ?os.FileHandle,
+@@ -500,7 +507,7 @@ pub const CloseOperation = struct {
+         self.* = CloseOperation{
+             .loop = loop,
+             .os_data = switch (builtin.os) {
+-                builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd => initOsDataPosix(self),
++                builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => initOsDataPosix(self),
+                 builtin.Os.windows => OsData{ .handle = null },
+                 else => @compileError("Unsupported OS"),
+             },
+@@ -530,6 +537,7 @@ pub const CloseOperation = struct {
+             builtin.Os.linux,
+             builtin.Os.macosx,
+             builtin.Os.freebsd,
++            builtin.Os.netbsd,
+             => {
+                 if (self.os_data.have_fd) {
+                     self.loop.posixFsRequest(&self.os_data.close_req_node);
+@@ -552,6 +560,7 @@ pub const CloseOperation = struct {
+             builtin.Os.linux,
+             builtin.Os.macosx,
+             builtin.Os.freebsd,
++            builtin.Os.netbsd,
+             => {
+                 self.os_data.close_req_node.data.msg.Close.fd = handle;
+                 self.os_data.have_fd = true;
+@@ -569,6 +578,7 @@ pub const CloseOperation = struct {
+             builtin.Os.linux,
+             builtin.Os.macosx,
+             builtin.Os.freebsd,
++            builtin.Os.netbsd,
+             => {
+                 self.os_data.have_fd = false;
+             },
+@@ -584,6 +594,7 @@ pub const CloseOperation = struct {
+             builtin.Os.linux,
+             builtin.Os.macosx,
+             builtin.Os.freebsd,
++            builtin.Os.netbsd,
+             => {
+                 assert(self.os_data.have_fd);
+                 return self.os_data.close_req_node.data.msg.Close.fd;
+@@ -608,6 +619,7 @@ pub async fn writeFileMode(loop: *Loop, 
+         builtin.Os.linux,
+         builtin.Os.macosx,
+         builtin.Os.freebsd,
++        builtin.Os.netbsd,
+         => return await (async writeFileModeThread(loop, path, contents, mode) catch unreachable),
+         builtin.Os.windows => return await (async writeFileWindows(loop, path, contents) catch unreachable),
+         else => @compileError("Unsupported OS"),
+@@ -713,7 +725,7 @@ pub fn Watch(comptime V: type) type {
+         os_data: OsData,
+ 
+         const OsData = switch (builtin.os) {
+-            builtin.Os.macosx, builtin.Os.freebsd => struct {
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => struct {
+                 file_table: FileTable,
+                 table_lock: event.Lock,
+ 
+@@ -802,7 +814,7 @@ pub fn Watch(comptime V: type) type {
+                     return self;
+                 },
+ 
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     const self = try loop.allocator.create(Self);
+                     errdefer loop.allocator.destroy(self);
+ 
+@@ -822,7 +834,7 @@ pub fn Watch(comptime V: type) type {
+         /// All addFile calls and removeFile calls must have completed.
+         pub fn destroy(self: *Self) void {
+             switch (builtin.os) {
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     // TODO we need to cancel the coroutines before destroying the lock
+                     self.os_data.table_lock.deinit();
+                     var it = self.os_data.file_table.iterator();
+@@ -864,7 +876,10 @@ pub fn Watch(comptime V: type) type {
+ 
+         pub async fn addFile(self: *Self, file_path: []const u8, value: V) !?V {
+             switch (builtin.os) {
+-                builtin.Os.macosx, builtin.Os.freebsd => return await (async addFileKEvent(self, file_path, value) catch unreachable),
++                builtin.Os.macosx,
++                builtin.Os.freebsd,
++                builtin.Os.netbsd
++                => return await (async addFileKEvent(self, file_path, value) catch unreachable),
+                 builtin.Os.linux => return await (async addFileLinux(self, file_path, value) catch unreachable),
+                 builtin.Os.windows => return await (async addFileWindows(self, file_path, value) catch unreachable),
+                 else => @compileError("Unsupported OS"),
Index: pkgsrc/lang/zig/patches/patch-std_event_loop.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_event_loop.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_event_loop.zig    Sun Feb 17 12:33:40 2019
@@ -0,0 +1,102 @@
+$NetBSD: patch-std_event_loop.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/event/loop.zig.orig    2019-02-17 10:28:53.000000000 +0000
++++ std/event/loop.zig
+@@ -50,7 +50,7 @@ pub const Loop = struct {
+         };
+ 
+         pub const EventFd = switch (builtin.os) {
+-            builtin.Os.macosx, builtin.Os.freebsd => KEventFd,
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => KEventFd,
+             builtin.Os.linux => struct {
+                 base: ResumeNode,
+                 epoll_op: u32,
+@@ -69,7 +69,7 @@ pub const Loop = struct {
+         };
+ 
+         pub const Basic = switch (builtin.os) {
+-            builtin.Os.macosx, builtin.Os.freebsd => KEventBasic,
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => KEventBasic,
+             builtin.Os.linux => struct {
+                 base: ResumeNode,
+             },
+@@ -221,7 +221,7 @@ pub const Loop = struct {
+                     self.extra_threads[extra_thread_index] = try os.spawnThread(self, workerRun);
+                 }
+             },
+-            builtin.Os.macosx, builtin.Os.freebsd => {
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                 self.os_data.kqfd = try os.bsdKQueue();
+                 errdefer os.close(self.os_data.kqfd);
+ 
+@@ -386,7 +386,7 @@ pub const Loop = struct {
+                 os.close(self.os_data.epollfd);
+                 self.allocator.free(self.eventfd_resume_nodes);
+             },
+-            builtin.Os.macosx, builtin.Os.freebsd => {
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                 os.close(self.os_data.kqfd);
+                 os.close(self.os_data.fs_kqfd);
+             },
+@@ -501,7 +501,7 @@ pub const Loop = struct {
+             const eventfd_node = &resume_stack_node.data;
+             eventfd_node.base.handle = next_tick_node.data;
+             switch (builtin.os) {
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     const kevent_array = (*[1]posix.Kevent)(&eventfd_node.kevent);
+                     const empty_kevs = ([*]posix.Kevent)(undefined)[0..0];
+                     _ = os.bsdKEvent(self.os_data.kqfd, kevent_array, empty_kevs, null) catch {
+@@ -564,6 +564,7 @@ pub const Loop = struct {
+             builtin.Os.linux,
+             builtin.Os.macosx,
+             builtin.Os.freebsd,
++            builtin.Os.netbsd,
+             => self.os_data.fs_thread.wait(),
+             else => {},
+         }
+@@ -628,7 +629,7 @@ pub const Loop = struct {
+                     os.posixWrite(self.os_data.final_eventfd, wakeup_bytes) catch unreachable;
+                     return;
+                 },
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     self.posixFsRequest(&self.os_data.fs_end_request);
+                     const final_kevent = (*[1]posix.Kevent)(&self.os_data.final_kevent);
+                     const empty_kevs = ([*]posix.Kevent)(undefined)[0..0];
+@@ -686,7 +687,7 @@ pub const Loop = struct {
+                         }
+                     }
+                 },
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     var eventlist: [1]posix.Kevent = undefined;
+                     const empty_kevs = ([*]posix.Kevent)(undefined)[0..0];
+                     const count = os.bsdKEvent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable;
+@@ -749,7 +750,7 @@ pub const Loop = struct {
+         self.beginOneEvent(); // finished in posixFsRun after processing the msg
+         self.os_data.fs_queue.put(request_node);
+         switch (builtin.os) {
+-            builtin.Os.macosx, builtin.Os.freebsd => {
++            builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                 const fs_kevs = (*[1]posix.Kevent)(&self.os_data.fs_kevent_wake);
+                 const empty_kevs = ([*]posix.Kevent)(undefined)[0..0];
+                 _ = os.bsdKEvent(self.os_data.fs_kqfd, fs_kevs, empty_kevs, null) catch unreachable;
+@@ -819,7 +820,7 @@ pub const Loop = struct {
+                         else => unreachable,
+                     }
+                 },
+-                builtin.Os.macosx, builtin.Os.freebsd => {
++                builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+                     const fs_kevs = (*[1]posix.Kevent)(&self.os_data.fs_kevent_wait);
+                     var out_kevs: [1]posix.Kevent = undefined;
+                     _ = os.bsdKEvent(self.os_data.fs_kqfd, fs_kevs, out_kevs[0..], null) catch unreachable;
+@@ -831,7 +832,7 @@ pub const Loop = struct {
+ 
+     const OsData = switch (builtin.os) {
+         builtin.Os.linux => LinuxOsData,
+-        builtin.Os.macosx, builtin.Os.freebsd => KEventData,
++        builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => KEventData,
+         builtin.Os.windows => struct {
+             io_port: windows.HANDLE,
+             extra_thread_count: usize,
Index: pkgsrc/lang/zig/patches/patch-std_heap.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_heap.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_heap.zig  Sun Feb 17 12:33:40 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-std_heap.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/heap.zig.orig  2019-02-17 10:28:53.000000000 +0000
++++ std/heap.zig
+@@ -71,7 +71,7 @@ pub const DirectAllocator = struct {
+         const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
+ 
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 const p = os.posix;
+                 const alloc_size = if (alignment <= os.page_size) n else n + alignment;
+                 const addr = p.mmap(null, alloc_size, p.PROT_READ | p.PROT_WRITE, p.MAP_PRIVATE | p.MAP_ANONYMOUS, -1, 0);
+@@ -120,7 +120,7 @@ pub const DirectAllocator = struct {
+         const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
+ 
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 if (new_size <= old_mem.len) {
+                     const base_addr = @ptrToInt(old_mem.ptr);
+                     const old_addr_end = base_addr + old_mem.len;
+@@ -164,7 +164,7 @@ pub const DirectAllocator = struct {
+         const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
+ 
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 _ = os.posix.munmap(@ptrToInt(bytes.ptr), bytes.len);
+             },
+             Os.windows => {
Index: pkgsrc/lang/zig/patches/patch-std_os_file.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_file.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_file.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-std_os_file.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/file.zig.orig       2019-02-17 10:28:53.000000000 +0000
++++ std/os/file.zig
+@@ -237,7 +237,7 @@ pub const File = struct {
+ 
+     pub fn seekForward(self: File, amount: isize) SeekError!void {
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 const result = posix.lseek(self.handle, amount, posix.SEEK_CUR);
+                 const err = posix.getErrno(result);
+                 if (err > 0) {
+@@ -268,7 +268,7 @@ pub const File = struct {
+ 
+     pub fn seekTo(self: File, pos: usize) SeekError!void {
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 const ipos = try math.cast(isize, pos);
+                 const result = posix.lseek(self.handle, ipos, posix.SEEK_SET);
+                 const err = posix.getErrno(result);
+@@ -309,7 +309,7 @@ pub const File = struct {
+ 
+     pub fn getPos(self: File) GetSeekPosError!usize {
+         switch (builtin.os) {
+-            Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++            Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+                 const result = posix.lseek(self.handle, 0, posix.SEEK_CUR);
+                 const err = posix.getErrno(result);
+                 if (err > 0) {
Index: pkgsrc/lang/zig/patches/patch-std_os_get__app__data__dir.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_get__app__data__dir.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_get__app__data__dir.zig        Sun Feb 17 12:33:40 2019
@@ -0,0 +1,13 @@
+$NetBSD: patch-std_os_get__app__data__dir.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/get_app_data_dir.zig.orig   2019-02-17 10:28:53.000000000 +0000
++++ std/os/get_app_data_dir.zig
+@@ -43,7 +43,7 @@ pub fn getAppDataDir(allocator: *mem.All
+             };
+             return os.path.join(allocator, [][]const u8{ home_dir, "Library", "Application Support", appname });
+         },
+-        builtin.Os.linux, builtin.Os.freebsd => {
++        builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => {
+             const home_dir = os.getEnvPosix("HOME") orelse {
+                 // TODO look in /etc/passwd
+                 return error.AppDataDirUnavailable;
Index: pkgsrc/lang/zig/patches/patch-std_os_get__user__id.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_get__user__id.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_get__user__id.zig      Sun Feb 17 12:33:40 2019
@@ -0,0 +1,13 @@
+$NetBSD: patch-std_os_get__user__id.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/get_user_id.zig.orig        2019-02-17 10:28:53.000000000 +0000
++++ std/os/get_user_id.zig
+@@ -11,7 +11,7 @@ pub const UserInfo = struct {
+ /// POSIX function which gets a uid from username.
+ pub fn getUserInfo(name: []const u8) !UserInfo {
+     return switch (builtin.os) {
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => posixGetUserInfo(name),
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => posixGetUserInfo(name),
+         else => @compileError("Unsupported OS"),
+     };
+ }
Index: pkgsrc/lang/zig/patches/patch-std_os_index.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_index.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_index.zig      Sun Feb 17 12:33:40 2019
@@ -0,0 +1,192 @@
+$NetBSD: patch-std_os_index.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/index.zig.orig      2019-02-17 10:28:53.000000000 +0000
++++ std/os/index.zig
+@@ -3,7 +3,7 @@ const builtin = @import("builtin");
+ const Os = builtin.Os;
+ const is_windows = builtin.os == Os.windows;
+ const is_posix = switch (builtin.os) {
+-    builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd => true,
++    builtin.Os.linux, builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => true,
+     else => false,
+ };
+ const os = @This();
+@@ -30,6 +30,7 @@ pub const windows = @import("windows/ind
+ pub const darwin = @import("darwin.zig");
+ pub const linux = @import("linux/index.zig");
+ pub const freebsd = @import("freebsd/index.zig");
++pub const netbsd = @import("netbsd/index.zig");
+ pub const zen = @import("zen.zig");
+ pub const uefi = @import("uefi.zig");
+ 
+@@ -37,6 +38,7 @@ pub const posix = switch (builtin.os) {
+     Os.linux => linux,
+     Os.macosx, Os.ios => darwin,
+     Os.freebsd => freebsd,
++    Os.netbsd => netbsd,
+     Os.zen => zen,
+     else => @compileError("Unsupported OS"),
+ };
+@@ -50,7 +52,7 @@ pub const time = @import("time.zig");
+ 
+ pub const page_size = 4 * 1024;
+ pub const MAX_PATH_BYTES = switch (builtin.os) {
+-    Os.linux, Os.macosx, Os.ios, Os.freebsd => posix.PATH_MAX,
++    Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => posix.PATH_MAX,
+     // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
+     // If it would require 4 UTF-8 bytes, then there would be a surrogate
+     // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
+@@ -125,7 +127,7 @@ pub fn getRandomBytes(buf: []u8) !void {
+                 else => return unexpectedErrorPosix(errno),
+             }
+         },
+-        Os.macosx, Os.ios, Os.freebsd => return getRandomBytesDevURandom(buf),
++        Os.macosx, Os.ios, Os.freebsd, Os.netbsd => return getRandomBytesDevURandom(buf),
+         Os.windows => {
+             // Call RtlGenRandom() instead of CryptGetRandom() on Windows
+             // https://github.com/rust-lang-nursery/rand/issues/111
+@@ -185,7 +187,7 @@ pub fn abort() noreturn {
+         c.abort();
+     }
+     switch (builtin.os) {
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             _ = posix.raise(posix.SIGABRT);
+             _ = posix.raise(posix.SIGKILL);
+             while (true) {}
+@@ -211,7 +213,7 @@ pub fn exit(status: u8) noreturn {
+         c.exit(status);
+     }
+     switch (builtin.os) {
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             posix.exit(status);
+         },
+         Os.windows => {
+@@ -327,7 +329,7 @@ pub fn posix_preadv(fd: i32, iov: [*]con
+                 }
+             }
+         },
+-        builtin.Os.linux, builtin.Os.freebsd => while (true) {
++        builtin.Os.linux, builtin.Os.freebsd, Os.netbsd => while (true) {
+             const rc = posix.preadv(fd, iov, count, offset);
+             const err = posix.getErrno(rc);
+             switch (err) {
+@@ -434,7 +436,7 @@ pub fn posix_pwritev(fd: i32, iov: [*]co
+                 }
+             }
+         },
+-        builtin.Os.linux, builtin.Os.freebsd => while (true) {
++        builtin.Os.linux, builtin.Os.freebsd, builtin.Os.netbsd => while (true) {
+             const rc = posix.pwritev(fd, iov, count, offset);
+             const err = posix.getErrno(rc);
+             switch (err) {
+@@ -699,7 +701,7 @@ pub fn getBaseAddress() usize {
+             const phdr = linuxGetAuxVal(std.elf.AT_PHDR);
+             return phdr - @sizeOf(std.elf.Ehdr);
+         },
+-        builtin.Os.macosx, builtin.Os.freebsd => return @ptrToInt(&std.c._mh_execute_header),
++        builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => return @ptrToInt(&std.c._mh_execute_header),
+         builtin.Os.windows => return @ptrToInt(windows.GetModuleHandleW(null)),
+         else => @compileError("Unsupported OS"),
+     }
+@@ -1339,7 +1341,7 @@ pub fn deleteDirC(dir_path: [*]const u8)
+             const dir_path_w = try windows_util.cStrToPrefixedFileW(dir_path);
+             return deleteDirW(&dir_path_w);
+         },
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             const err = posix.getErrno(posix.rmdir(dir_path));
+             switch (err) {
+                 0 => return,
+@@ -1382,7 +1384,7 @@ pub fn deleteDir(dir_path: []const u8) D
+             const dir_path_w = try windows_util.sliceToPrefixedFileW(dir_path);
+             return deleteDirW(&dir_path_w);
+         },
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             const dir_path_c = try toPosixPath(dir_path);
+             return deleteDirC(&dir_path_c);
+         },
+@@ -1501,7 +1503,7 @@ pub const Dir = struct {
+     allocator: *Allocator,
+ 
+     pub const Handle = switch (builtin.os) {
+-        Os.macosx, Os.ios, Os.freebsd => struct {
++        Os.macosx, Os.ios, Os.freebsd, Os.netbsd => struct {
+             fd: i32,
+             seek: i64,
+             buf: []u8,
+@@ -1578,7 +1580,7 @@ pub const Dir = struct {
+                         .name_data = undefined,
+                     };
+                 },
+-                Os.macosx, Os.ios, Os.freebsd => Handle{
++                Os.macosx, Os.ios, Os.freebsd, Os.netbsd => Handle{
+                     .fd = try posixOpen(
+                         dir_path,
+                         posix.O_RDONLY | posix.O_NONBLOCK | posix.O_DIRECTORY | posix.O_CLOEXEC,
+@@ -1609,7 +1611,7 @@ pub const Dir = struct {
+             Os.windows => {
+                 _ = windows.FindClose(self.handle.handle);
+             },
+-            Os.macosx, Os.ios, Os.linux, Os.freebsd => {
++            Os.macosx, Os.ios, Os.linux, Os.freebsd, Os.netbsd => {
+                 self.allocator.free(self.handle.buf);
+                 os.close(self.handle.fd);
+             },
+@@ -1625,6 +1627,7 @@ pub const Dir = struct {
+             Os.macosx, Os.ios => return self.nextDarwin(),
+             Os.windows => return self.nextWindows(),
+             Os.freebsd => return self.nextFreebsd(),
++            Os.netbsd => return self.nextFreebsd(),
+             else => @compileError("unimplemented"),
+         }
+     }
+@@ -2256,7 +2259,7 @@ pub fn unexpectedErrorWindows(err: windo
+ pub fn openSelfExe() !os.File {
+     switch (builtin.os) {
+         Os.linux => return os.File.openReadC(c"/proc/self/exe"),
+-        Os.macosx, Os.ios, Os.freebsd => {
++        Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             var buf: [MAX_PATH_BYTES]u8 = undefined;
+             const self_exe_path = try selfExePath(&buf);
+             buf[self_exe_path.len] = 0;
+@@ -2317,6 +2320,19 @@ pub fn selfExePath(out_buffer: *[MAX_PAT
+                 else => unexpectedErrorPosix(err),
+             };
+         },
++        Os.netbsd => {
++            var mib = [4]c_int{ posix.CTL_KERN, posix.KERN_PROC_ARGS, -1, posix.KERN_PROC_PATHNAME };
++            var out_len: usize = out_buffer.len;
++            const err = posix.getErrno(posix.sysctl(&mib, 4, out_buffer, &out_len, null, 0));
++
++            if (err == 0) return mem.toSlice(u8, out_buffer);
++
++            return switch (err) {
++                posix.EFAULT => error.BadAdress,
++                posix.EPERM => error.PermissionDenied,
++                else => unexpectedErrorPosix(err),
++            };
++        },
+         Os.windows => {
+             var utf16le_buf: [windows_util.PATH_MAX_WIDE]u16 = undefined;
+             const utf16le_slice = try selfExePathW(&utf16le_buf);
+@@ -2355,7 +2371,7 @@ pub fn selfExeDirPath(out_buffer: *[MAX_
+             // will not return null.
+             return path.dirname(full_exe_path).?;
+         },
+-        Os.windows, Os.macosx, Os.ios, Os.freebsd => {
++        Os.windows, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             const self_exe_path = try selfExePath(out_buffer);
+             // Assume that the OS APIs return absolute paths, and therefore dirname
+             // will not return null.
+@@ -3227,7 +3243,7 @@ pub const CpuCountError = error{
+ 
+ pub fn cpuCount(fallback_allocator: *mem.Allocator) CpuCountError!usize {
+     switch (builtin.os) {
+-        builtin.Os.macosx, builtin.Os.freebsd => {
++        builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => {
+             var count: c_int = undefined;
+             var count_len: usize = @sizeOf(c_int);
+             const rc = posix.sysctlbyname(switch (builtin.os) {
Index: pkgsrc/lang/zig/patches/patch-std_os_path.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_path.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_path.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,22 @@
+$NetBSD: patch-std_os_path.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/path.zig.orig       2019-02-17 10:28:53.000000000 +0000
++++ std/os/path.zig
+@@ -1226,7 +1226,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_B
+             const pathname_w = try windows_util.cStrToPrefixedFileW(pathname);
+             return realW(out_buffer, pathname_w);
+         },
+-        Os.freebsd, Os.macosx, Os.ios => {
++        Os.freebsd, Os.netbsd, Os.macosx, Os.ios => {
+             // TODO instead of calling the libc function here, port the implementation to Zig
+             const err = posix.getErrno(posix.realpath(pathname, out_buffer));
+             switch (err) {
+@@ -1267,7 +1267,7 @@ pub fn real(out_buffer: *[os.MAX_PATH_BY
+             const pathname_w = try windows_util.sliceToPrefixedFileW(pathname);
+             return realW(out_buffer, &pathname_w);
+         },
+-        Os.macosx, Os.ios, Os.linux, Os.freebsd => {
++        Os.macosx, Os.ios, Os.linux, Os.freebsd, Os.netbsd => {
+             const pathname_c = try os.toPosixPath(pathname);
+             return realC(out_buffer, &pathname_c);
+         },
Index: pkgsrc/lang/zig/patches/patch-std_os_time.zig
diff -u /dev/null pkgsrc/lang/zig/patches/patch-std_os_time.zig:1.1
--- /dev/null   Sun Feb 17 12:33:41 2019
+++ pkgsrc/lang/zig/patches/patch-std_os_time.zig       Sun Feb 17 12:33:40 2019
@@ -0,0 +1,49 @@
+$NetBSD: patch-std_os_time.zig,v 1.1 2019/02/17 12:33:40 maya Exp $
+
+--- std/os/time.zig.orig       2019-02-17 10:28:53.000000000 +0000
++++ std/os/time.zig
+@@ -14,7 +14,7 @@ pub const epoch = @import("epoch.zig");
+ /// Sleep for the specified duration
+ pub fn sleep(nanoseconds: u64) void {
+     switch (builtin.os) {
+-        Os.linux, Os.macosx, Os.ios, Os.freebsd => {
++        Os.linux, Os.macosx, Os.ios, Os.freebsd, Os.netbsd => {
+             const s = nanoseconds / ns_per_s;
+             const ns = nanoseconds % ns_per_s;
+             posixSleep(@intCast(u63, s), @intCast(u63, ns));
+@@ -62,7 +62,7 @@ pub fn timestamp() u64 {
+ /// Get the posix timestamp, UTC, in milliseconds
+ pub const milliTimestamp = switch (builtin.os) {
+     Os.windows => milliTimestampWindows,
+-    Os.linux, Os.freebsd => milliTimestampPosix,
++    Os.linux, Os.freebsd, Os.netbsd => milliTimestampPosix,
+     Os.macosx, Os.ios => milliTimestampDarwin,
+     else => @compileError("Unsupported OS"),
+ };
+@@ -178,7 +178,7 @@ pub const Timer = struct {
+                 debug.assert(err != windows.FALSE);
+                 self.start_time = @intCast(u64, start_time);
+             },
+-            Os.linux, Os.freebsd => {
++            Os.linux, Os.freebsd, Os.netbsd => {
+                 //On Linux, seccomp can do arbitrary things to our ability to call
+                 //  syscalls, including return any errno value it wants and
+                 //  inconsistently throwing errors. Since we can't account for
+@@ -214,7 +214,7 @@ pub const Timer = struct {
+         var clock = clockNative() - self.start_time;
+         return switch (builtin.os) {
+             Os.windows => @divFloor(clock * ns_per_s, self.frequency),
+-            Os.linux, Os.freebsd => clock,
++            Os.linux, Os.freebsd, Os.netbsd => clock,
+             Os.macosx, Os.ios => @divFloor(clock * self.frequency.numer, self.frequency.denom),
+             else => @compileError("Unsupported OS"),
+         };
+@@ -235,7 +235,7 @@ pub const Timer = struct {
+ 
+     const clockNative = switch (builtin.os) {
+         Os.windows => clockWindows,
+-        Os.linux, Os.freebsd => clockLinux,
++        Os.linux, Os.freebsd, Os.netbsd => clockLinux,
+         Os.macosx, Os.ios => clockDarwin,
+         else => @compileError("Unsupported OS"),
+     };



Home | Main Index | Thread Index | Old Index