├── LICENSE ├── Makefile ├── README.md ├── distinfo └── patches ├── patch-dart_runtime_bin_dbg_connection_h ├── patch-dart_runtime_bin_dbg_connection_linux_cc ├── patch-dart_runtime_bin_dbg_connection_macos_cc ├── patch-dart_runtime_bin_directory_android_cc ├── patch-dart_runtime_bin_directory_linux_cc ├── patch-dart_runtime_bin_eventhandler_h ├── patch-dart_runtime_bin_eventhandler_linux_cc ├── patch-dart_runtime_bin_eventhandler_macos_cc ├── patch-dart_runtime_bin_file_android_cc ├── patch-dart_runtime_bin_file_linux_cc ├── patch-dart_runtime_bin_file_system_watcher_linux_cc ├── patch-dart_runtime_bin_platform_linux_cc ├── patch-dart_runtime_bin_process_android_cc ├── patch-dart_runtime_bin_process_linux_cc ├── patch-dart_runtime_bin_socket_linux_cc ├── patch-dart_runtime_bin_socket_macos_cc ├── patch-dart_runtime_bin_thread_android_cc ├── patch-dart_runtime_bin_thread_h ├── patch-dart_runtime_bin_thread_linux_cc ├── patch-dart_runtime_bin_utils_android_cc ├── patch-dart_runtime_bin_utils_linux_cc ├── patch-dart_runtime_platform_globals_h ├── patch-dart_runtime_vm_os_linux_cc ├── patch-dart_runtime_vm_os_thread_android_cc ├── patch-dart_runtime_vm_os_thread_h ├── patch-dart_runtime_vm_os_thread_linux_cc ├── patch-dart_runtime_vm_signal_handler_h ├── patch-dart_runtime_vm_signal_handler_linux_cc ├── patch-dart_runtime_vm_thread_interrupter_linux_cc ├── patch-dart_third_party_nss_nspr_pr_include_md__openbsd_cfg ├── patch-dart_third_party_nss_nspr_pr_include_md__openbsd_h ├── patch-dart_third_party_nss_nspr_pr_include_md_prosdep_h ├── patch-dart_third_party_nss_nspr_pr_include_prcpucfg_h ├── patch-dart_third_party_nss_nspr_pr_include_private_primpl_h ├── patch-dart_tools_build_py └── patch-dart_tools_gyp_configurations_gypi /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Adam Wolk 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # $OpenBSD: Makefile,v 1.209 2015/04/04 09:21:04 ajacoutot Exp $ 2 | 3 | ONLY_FOR_ARCHS= i386 amd64 4 | DPB_PROPERTIES= parallel 5 | 6 | COMMENT= Dart programming language 7 | 8 | V= 1.10.0 9 | DISTNAME= dart-${V} 10 | 11 | CATEGORIES= lang 12 | 13 | HOMEPAGE= https://www.dartlang.org/ 14 | 15 | MAINTAINER= Adam Wolk 16 | 17 | # BSD-like 18 | PERMIT_PACKAGE_CDROM= patents # TODO: check this 19 | PERMIT_PACKAGE_FTP = Yes # TODO: check this 20 | PERMIT_DISTFILES_FTP = Yes # TODO: check this 21 | MASTER_SITES= http://gsdview.appspot.com/dart-archive/channels/stable/raw/45396/src/ 22 | 23 | MAKE_ENV+= V=1 24 | 25 | MODULES= gcc4 lang/python 26 | MODGCC4_ARCHS= * 27 | MODGCC4_LANGS= c c++ 28 | MODGCC4_VERSION= 4.9 29 | 30 | MODPY_RUNDEP= No 31 | 32 | WANTLIB += X11 Xext Xfixes Xrender Xss c cairo cups dbus-1 event 33 | WANTLIB += execinfo expat fontconfig freetype gconf-2 gdk-x11-2.0 34 | WANTLIB += gdk_pixbuf-2.0 glib-2.0 gobject-2.0 gtk-x11-2.0 35 | WANTLIB += m pango-1.0 pangocairo-1.0 36 | WANTLIB += png pthread speex 37 | WANTLIB += xml2 xslt 38 | WANTLIB += usb-1.0 sndio 39 | WANTLIB += Xcomposite 40 | WANTLIB += stdc++ 41 | WANTLIB += Xi Xtst 42 | WANTLIB += Xdamage 43 | WANTLIB += Xcursor Xrandr gio-2.0 44 | WANTLIB += jpeg nspr4 nss3 nssutil3 plc4 smime3 45 | 46 | RUN_DEPENDS= devel/xdg-utils \ 47 | devel/desktop-file-utils \ 48 | graphics/libexif \ 49 | x11/gnome/libgnome-keyring \ 50 | x11/gtk+3,-guic 51 | BUILD_DEPENDS= archivers/bzip2 \ 52 | devel/gperf \ 53 | devel/gmake \ 54 | devel/bison \ 55 | devel/flex \ 56 | devel/yasm \ 57 | shells/bash \ 58 | sysutils/flock \ 59 | sysutils/pciutils \ 60 | x11/gnome/libgnome-keyring 61 | 62 | LIB_DEPENDS= devel/libexecinfo \ 63 | devel/libusb1 \ 64 | security/nss \ 65 | devel/gconf2 \ 66 | textproc/libxslt \ 67 | x11/gtk+2 \ 68 | audio/speex \ 69 | print/cups,-libs 70 | 71 | do-configure: 72 | @cd ${WRKSRC} && env -i ${CONFIGURE_ENV} /usr/local/bin/python2.7 ./dart/tools/compiler_scripts/generate_my_projects.py && \ 73 | env -i ${CONFIGURE_ENV} /usr/local/bin/python2.7 ./dart/editor/build/generate_sources.py && \ 74 | env -i ${CONFIGURE_ENV} /usr/local/bin/python2.7 ./dart/tools/gyp_dart.py 75 | 76 | do-build: 77 | @cd ${WRKSRC}/dart && env -i ${MAKE_ENV} /usr/local/bin/python2.7 ./tools/build.py -m release --arch=x64 runtime 78 | 79 | .include 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openbsd-dart 2 | Work in progress port for dartlang.org for OpenBSD - DO NOT USE IN PRODUCTION 3 | 4 | The port started from /usr/ports/www/chromium and currently contains a ton of 5 | stuff that's not really needed. The way the port is perfomed is hacky to say the 6 | least - I want to get a runtime binary running after which I will be attemping 7 | adding proper support for OpenBSD as a new target OS. For now - everything is fair 8 | game - including tricking the build to use android/mac/linux files when it looks 9 | like allowing me to move forward. 10 | 11 | By now you shold know not to use this package in production or for any important work. 12 | This repository is published in case anyone wants to chip in to get this done faster 13 | and for me personally to have a backup/record of the work. 14 | 15 | This port will be mostly worked on during weekends so don't expect it being finalised 16 | during a couple of days. 17 | 18 | Goals 19 | ===== 20 | 21 | Have a fully functional & working build of dart runtime & sdk for OpenBSD. 22 | 23 | Status 24 | ====== 25 | 26 | Ongoing work to make at least the runtime buildable - in a really hacky way for now. 27 | Currently fighting with the nss/nspr build. You can see a full build output in this gist: 28 | 29 | - https://gist.github.com/mulander/4929a40b2c8e9bab4440 30 | 31 | I restarted it several times, as subsequent builds tend to pick up other files untill the 32 | whole process settles on a single error. 33 | 34 | UPDATE: 2015-05-10 posted to the [dart issue tracker #10260](https://code.google.com/p/dart/issues/detail?can=2&start=0&num=100&q=BSD&colspec=ID%20Type%20Status%20Priority%20Area%20Milestone%20Owner%20Summary%20Modified&groupby=&sort=&id=10260) 35 | 36 | The build got pretty far, as in most of dart runtime builds without issues with small modifications to use kqueue/pthreads in some places - so far I 'patched' 36 files where most of them is 'use the mac one instead of linux' or 'use the android one instead of linux' with really rare cases when I actually had to edit the code. I obviously took the recommended "[ 'OS=="openbsd"', { 'dart_target_os': 'Linux', } ]," from comment #5. 37 | 38 | Unfortunately I'm also having huge issues with building NSPR similarly to what was reported in comment #7 over an year ago. I'm afraid that without guidance/help I won't be able to move far with the port. 39 | 40 | Regardless, it would be nice if the project had a porting guide for new platforms. I did not find any documentation that would tell me how the project build system works & how it should be configured. I don't know why the third party libs are bundled with the distribution & how to untangle them to use the system wide installed & already ported libraries. I assume the project has reasons for that but this leads to duplicate effort in software porting on the platform side. 41 | 42 | The current state is of course uploaded to the github account linked in comment #10. 43 | 44 | UPDATE: 2015-08-23 45 | 46 | The dart issue tracker is obviously gone. The case was migrated as https://github.com/dart-lang/sdk/issues/10260. I'm roughly waiting for the upstream to migrate to BoringSSL as anything else feels like a waste of time. This is reported as https://github.com/dart-lang/sdk/issues/23560 which is currently marked as blocked by https://github.com/dart-lang/sdk/issues/23561. The repo state was tested against Dart v1.10.0, I tried locally against v1.11.3 but most patches no longer apply and there is no point in trying until upstream migrates to BoringSSL. 47 | 48 | UPDATE: 2015-09-02 49 | 50 | Dart 1.12 has been released and the blocker for BoringSSL work has been closed (https://github.com/dart-lang/sdk/issues/23561). The main task is still ongoing in https://github.com/dart-lang/sdk/issues/23560. This left me with 2 options. 51 | 52 | - wait for a release so I can reuse their tarball mechanism 53 | - fork the repo and try to add *proper* OpenBSD support 54 | 55 | I decided to do it the proper way. It will probably impact hugely the amount of time required to finish the port but should have a higher quality port in the end with a higher chance of upstreaming the changes. 56 | 57 | All work is done in https://github.com/mulander/sdk OpenBSD-support branch. Any work done on the port is possible thanks to [Koparo](https://koparo.com) supporting the project. 58 | 59 | UPDATE: 2015-09-04 60 | 61 | Started to move forward with the port. 62 | - Current effort can be tracked in [this](https://github.com/mulander/sdk/commits/OpenBSD-support) repository 63 | - [Reported](https://github.com/dart-lang/sdk/issues/10260) the efforts upstream 64 | - [Reported](https://github.com/dart-lang/sdk/issues/24287) outdated gclient setup 65 | - [Reported](https://github.com/dart-lang/sdk/issues/24289) the build system ignoring environment variables 66 | 67 | The effort will be ongoing. This repository will get semi frequent status updates. Follow the [main fork](https://github.com/mulander/sdk) for up to the minute changes. 68 | 69 | 70 | Contributing 71 | ============ 72 | 73 | Start by forking the repository & checking it out to `/usr/ports/mystuff/lang/dart`. 74 | You should now be able to go through: 75 | 76 | - `make fetch` 77 | - `make checksum` 78 | - `make configure` 79 | - `make build` 80 | 81 | Pick a build error you want to tackle. Go to the port directory (`cd ``make show=WRKSRC`). 82 | Make an .orig file (`cp target.c{,.orig}`) and apply your changes to target.c. When done 83 | `cd - && make update-patches`. 84 | 85 | Rinse & repeat - comitting after each fixed issue. Send a pull request when you're happy :) 86 | 87 | Please use github issues to discuss/suggest changes to the port itself. 88 | 89 | TODO 90 | ==== 91 | 92 | - Fetch sources - done 93 | - Generate makefiles - done 94 | - Use gcc4 - done 95 | - Build runtime - WIP 96 | - Build sdk 97 | - ~~Build editor~~ - no point since the dart team bailed on it 98 | - Clean up the port (remove hacky build stuff / patches - write proper ones) 99 | - Upstream proper patches 100 | -------------------------------------------------------------------------------- /distinfo: -------------------------------------------------------------------------------- 1 | SHA256 (dart-1.10.0.tar.gz) = 1OFECR4pV33oWK3U/VP+/zsz4CuTCqKSx3Fy4tQ3YT4= 2 | SIZE (dart-1.10.0.tar.gz) = 460046109 3 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_dbg_connection_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/dbg_connection.h.orig Sat Apr 25 17:24:55 2015 3 | +++ dart/runtime/bin/dbg_connection.h Sat Apr 25 17:25:41 2015 4 | @@ -16,9 +16,9 @@ 5 | // Declare the OS-specific types ahead of defining the generic class. 6 | #if defined(TARGET_OS_ANDROID) 7 | #include "bin/dbg_connection_android.h" 8 | -#elif defined(TARGET_OS_LINUX) 9 | +#elif defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | #include "bin/dbg_connection_linux.h" 11 | -#elif defined(TARGET_OS_MACOS) 12 | +#elif defined(TARGET_OS_MACOS) || defined(__OpenBSD__) 13 | #include "bin/dbg_connection_macos.h" 14 | #elif defined(TARGET_OS_WINDOWS) 15 | #include "bin/dbg_connection_win.h" 16 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_dbg_connection_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/dbg_connection_linux.cc.orig Sat Apr 25 17:25:03 2015 3 | +++ dart/runtime/bin/dbg_connection_linux.cc Sat Apr 25 17:25:52 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include // NOLINT 12 | #include // NOLINT 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_dbg_connection_macos_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/dbg_connection_macos.cc.orig Sat Apr 25 17:25:11 2015 3 | +++ dart/runtime/bin/dbg_connection_macos.cc Sat Apr 25 17:26:00 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_MACOS) 9 | +#if defined(TARGET_OS_MACOS) || defined(__OpenBSD__) 10 | 11 | #include // NOLINT 12 | #include // NOLINT 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_directory_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/directory_android.cc.orig Sat Apr 25 17:39:33 2015 3 | +++ dart/runtime/bin/directory_android.cc Sat Apr 25 17:40:36 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | 11 | #include "bin/directory.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_directory_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/directory_linux.cc.orig Sat Apr 25 17:39:18 2015 3 | +++ dart/runtime/bin/directory_linux.cc Sat Apr 25 17:40:28 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/directory.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_eventhandler_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/eventhandler.h.orig Sat Apr 18 20:44:46 2015 3 | +++ dart/runtime/bin/eventhandler.h Sat Apr 18 20:45:54 2015 4 | @@ -595,9 +595,9 @@ class DescriptorInfoMultipleMixin : public DI { 5 | // The event handler delegation class is OS specific. 6 | #if defined(TARGET_OS_ANDROID) 7 | #include "bin/eventhandler_android.h" 8 | -#elif defined(TARGET_OS_LINUX) 9 | +#elif defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | #include "bin/eventhandler_linux.h" 11 | -#elif defined(TARGET_OS_MACOS) 12 | +#elif defined(TARGET_OS_MACOS) || defined(__OpenBSD__) 13 | #include "bin/eventhandler_macos.h" 14 | #elif defined(TARGET_OS_WINDOWS) 15 | #include "bin/eventhandler_win.h" 16 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_eventhandler_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/eventhandler_linux.cc.orig Sat Apr 25 17:08:01 2015 3 | +++ dart/runtime/bin/eventhandler_linux.cc Sat Apr 25 17:09:12 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/eventhandler.h" 12 | #include "bin/eventhandler_linux.h" 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_eventhandler_macos_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/eventhandler_macos.cc.orig Sat Apr 25 17:08:21 2015 3 | +++ dart/runtime/bin/eventhandler_macos.cc Sat Apr 25 17:09:26 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_MACOS) 9 | +#if defined(TARGET_OS_MACOS) || defined(__OpenBSD__) 10 | 11 | #include "bin/eventhandler.h" 12 | #include "bin/eventhandler_macos.h" 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_file_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/file_android.cc.orig Sat Apr 25 19:16:38 2015 3 | +++ dart/runtime/bin/file_android.cc Sat Apr 25 19:22:46 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | 11 | #include "bin/file.h" 12 | 13 | @@ -11,7 +11,6 @@ 14 | #include // NOLINT 15 | #include // NOLINT 16 | #include // NOLINT 17 | -#include // NOLINT 18 | #include // NOLINT 19 | #include // NOLINT 20 | 21 | @@ -89,13 +88,13 @@ int64_t File::Write(const void* buffer, int64_t num_by 22 | 23 | int64_t File::Position() { 24 | ASSERT(handle_->fd() >= 0); 25 | - return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); 26 | + return NO_RETRY_EXPECTED(lseek(handle_->fd(), 0, SEEK_CUR)); 27 | } 28 | 29 | 30 | bool File::SetPosition(int64_t position) { 31 | ASSERT(handle_->fd() >= 0); 32 | - return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; 33 | + return NO_RETRY_EXPECTED(lseek(handle_->fd(), position, SEEK_SET)) >= 0; 34 | } 35 | 36 | 37 | @@ -169,7 +168,7 @@ File* File::Open(const char* name, FileOpenMode mode) 38 | return NULL; 39 | } 40 | if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) { 41 | - int64_t position = lseek64(fd, 0, SEEK_END); 42 | + int64_t position = lseek(fd, 0, SEEK_END); 43 | if (position < 0) { 44 | return NULL; 45 | } 46 | @@ -275,28 +274,20 @@ bool File::Copy(const char* old_path, const char* new_ 47 | VOID_TEMP_FAILURE_RETRY(close(old_fd)); 48 | return false; 49 | } 50 | - off_t offset = 0; 51 | + 52 | int result = 1; 53 | - while (result > 0) { 54 | - // Loop to ensure we copy everything, and not only up to 2GB. 55 | - result = NO_RETRY_EXPECTED( 56 | - sendfile(new_fd, old_fd, &offset, kMaxUint32)); 57 | - } 58 | - // From sendfile man pages: 59 | - // Applications may wish to fall back to read(2)/write(2) in the case 60 | - // where sendfile() fails with EINVAL or ENOSYS. 61 | - if (result < 0 && (errno == EINVAL || errno == ENOSYS)) { 62 | - const intptr_t kBufferSize = 8 * KB; 63 | - uint8_t buffer[kBufferSize]; 64 | - while ((result = TEMP_FAILURE_RETRY( 65 | - read(old_fd, buffer, kBufferSize))) > 0) { 66 | - int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result)); 67 | - if (wrote != result) { 68 | - result = -1; 69 | - break; 70 | - } 71 | + // OpenBSD has no sendfile so use read(2)/write(2) to copy the file 72 | + const intptr_t kBufferSize = 8 * KB; 73 | + uint8_t buffer[kBufferSize]; 74 | + while ((result = TEMP_FAILURE_RETRY( 75 | + read(old_fd, buffer, kBufferSize))) > 0) { 76 | + int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result)); 77 | + if (wrote != result) { 78 | + result = -1; 79 | + break; 80 | } 81 | } 82 | + 83 | int e = errno; 84 | VOID_TEMP_FAILURE_RETRY(close(old_fd)); 85 | VOID_TEMP_FAILURE_RETRY(close(new_fd)); 86 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_file_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/file_linux.cc.orig Sat Apr 25 19:16:31 2015 3 | +++ dart/runtime/bin/file_linux.cc Sat Apr 25 19:16:49 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/file.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_file_system_watcher_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/file_system_watcher_linux.cc.orig Sat Apr 25 20:06:32 2015 3 | +++ dart/runtime/bin/file_system_watcher_linux.cc Sat Apr 25 20:06:39 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/file_system_watcher.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_platform_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/platform_linux.cc.orig Sat Apr 25 21:42:40 2015 3 | +++ dart/runtime/bin/platform_linux.cc Sat Apr 25 21:42:52 2015 4 | @@ -13,6 +13,7 @@ 5 | 6 | #include "bin/fdutils.h" 7 | 8 | +extern char **environ; 9 | 10 | namespace dart { 11 | namespace bin { 12 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_process_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/process_android.cc.orig Sat Apr 25 21:48:41 2015 3 | +++ dart/runtime/bin/process_android.cc Sat Apr 25 21:49:13 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) && defined(__OpenBSD__) 10 | 11 | #include "bin/process.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_process_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/process_linux.cc.orig Sat Apr 25 21:48:47 2015 3 | +++ dart/runtime/bin/process_linux.cc Sat Apr 25 21:49:07 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/process.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_socket_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/socket_linux.cc.orig Sat Apr 25 22:01:41 2015 3 | +++ dart/runtime/bin/socket_linux.cc Sat Apr 25 22:02:02 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include // NOLINT 12 | #include // NOLINT 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_socket_macos_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/socket_macos.cc.orig Sat Apr 25 22:40:01 2015 3 | +++ dart/runtime/bin/socket_macos.cc Sat Apr 25 23:02:39 2015 4 | @@ -3,8 +3,9 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_MACOS) 9 | +#if defined(TARGET_OS_MACOS) || defined(__OpenBSD__) 10 | 11 | +#include // NOLINT 12 | #include // NOLINT 13 | #include // NOLINT 14 | #include // NOLINT 15 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_thread_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/thread_android.cc.orig Sat Apr 25 20:40:00 2015 3 | +++ dart/runtime/bin/thread_android.cc Sat Apr 25 20:39:30 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | 11 | #include "bin/thread.h" 12 | 13 | @@ -146,7 +146,7 @@ intptr_t Thread::GetMaxStackSize() { 14 | 15 | 16 | ThreadId Thread::GetCurrentThreadId() { 17 | - return gettid(); 18 | + return pthread_self(); 19 | } 20 | 21 | 22 | @@ -157,12 +157,12 @@ bool Thread::Join(ThreadId id) { 23 | 24 | intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { 25 | ASSERT(sizeof(id) == sizeof(intptr_t)); 26 | - return static_cast(id); 27 | + return reinterpret_cast(id); 28 | } 29 | 30 | 31 | bool Thread::Compare(ThreadId a, ThreadId b) { 32 | - return a == b; 33 | + return pthread_equal(a, b) != 0; 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_thread_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/thread.h.orig Sat Apr 25 20:35:39 2015 3 | +++ dart/runtime/bin/thread.h Sat Apr 25 20:35:53 2015 4 | @@ -8,7 +8,7 @@ 5 | #include "platform/globals.h" 6 | 7 | // Declare the OS-specific types ahead of defining the generic classes. 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | #include "bin/thread_android.h" 11 | #elif defined(TARGET_OS_LINUX) 12 | #include "bin/thread_linux.h" 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_thread_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/thread_linux.cc.orig Sat Apr 25 20:38:26 2015 3 | +++ dart/runtime/bin/thread_linux.cc Sat Apr 25 20:38:34 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "bin/thread.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_utils_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/utils_android.cc.orig Sat Apr 25 20:45:00 2015 3 | +++ dart/runtime/bin/utils_android.cc Sat Apr 25 20:45:34 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | 11 | #include // NOLINT 12 | #include // NOLINT 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_bin_utils_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/bin/utils_linux.cc.orig Sat Apr 25 20:45:06 2015 3 | +++ dart/runtime/bin/utils_linux.cc Sat Apr 25 20:45:24 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include // NOLINT 12 | #include // NOLINT 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_platform_globals_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/platform/globals.h.orig Sat Apr 18 20:08:45 2015 3 | +++ dart/runtime/platform/globals.h Sat Apr 18 20:08:56 2015 4 | @@ -86,7 +86,7 @@ 5 | // - with gcc, run: "echo | gcc -E -dM -" 6 | #if defined(__ANDROID__) 7 | #define TARGET_OS_ANDROID 1 8 | -#elif defined(__linux__) || defined(__FreeBSD__) 9 | +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) 10 | #define TARGET_OS_LINUX 1 11 | #elif defined(__APPLE__) 12 | #define TARGET_OS_MACOS 1 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_os_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/os_linux.cc.orig Sun Apr 19 00:39:25 2015 3 | +++ dart/runtime/vm/os_linux.cc Sun Apr 19 23:14:31 2015 4 | @@ -9,7 +9,7 @@ 5 | 6 | #include // NOLINT 7 | #include // NOLINT 8 | -#include // NOLINT 9 | +#include // NOLINT 10 | #include // NOLINT 11 | #include // NOLINT 12 | #include // NOLINT 13 | @@ -272,7 +272,7 @@ class JitdumpCodeObserver : public CodeObserver { 14 | pid_t gettid() { 15 | // libc doesn't wrap the Linux-specific gettid system call. 16 | // Note that this thread id is not the same as the posix thread id. 17 | - return syscall(SYS_gettid); 18 | + return getthrid(); 19 | } 20 | 21 | uint64_t GetKernelTimeNanos() { 22 | @@ -411,8 +411,8 @@ void* OS::AlignedAllocate(intptr_t size, intptr_t alig 23 | const int kMinimumAlignment = 16; 24 | ASSERT(Utils::IsPowerOfTwo(alignment)); 25 | ASSERT(alignment >= kMinimumAlignment); 26 | - void* p = memalign(alignment, size); 27 | - if (p == NULL) { 28 | + void* p = NULL; 29 | + if(posix_memalign(&p, alignment, size)) { 30 | UNREACHABLE(); 31 | } 32 | return p; 33 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_os_thread_android_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/os_thread_android.cc.orig Fri Apr 24 10:30:10 2015 3 | +++ dart/runtime/vm/os_thread_android.cc Sun May 10 14:08:55 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" // NOLINT 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | 11 | #include "vm/os_thread.h" 12 | 13 | @@ -146,7 +146,7 @@ intptr_t OSThread::GetMaxStackSize() { 14 | 15 | 16 | ThreadId OSThread::GetCurrentThreadId() { 17 | - return gettid(); 18 | + return pthread_self(); 19 | } 20 | 21 | 22 | @@ -157,12 +157,12 @@ bool OSThread::Join(ThreadId id) { 23 | 24 | intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { 25 | ASSERT(sizeof(id) == sizeof(intptr_t)); 26 | - return static_cast(id); 27 | + return reinterpret_cast(id); 28 | } 29 | 30 | 31 | bool OSThread::Compare(ThreadId a, ThreadId b) { 32 | - return a == b; 33 | + return pthread_equal(a, b) != 0; 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_os_thread_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/os_thread.h.orig Sun Apr 19 22:06:20 2015 3 | +++ dart/runtime/vm/os_thread.h Sun Apr 19 22:06:52 2015 4 | @@ -9,7 +9,7 @@ 5 | #include "vm/allocation.h" 6 | 7 | // Declare the OS-specific types ahead of defining the generic classes. 8 | -#if defined(TARGET_OS_ANDROID) 9 | +#if defined(TARGET_OS_ANDROID) || defined(__OpenBSD__) 10 | #include "vm/os_thread_android.h" 11 | #elif defined(TARGET_OS_LINUX) 12 | #include "vm/os_thread_linux.h" 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_os_thread_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/os_thread_linux.cc.orig Sun Apr 19 23:55:01 2015 3 | +++ dart/runtime/vm/os_thread_linux.cc Mon Apr 20 00:48:07 2015 4 | @@ -3,7 +3,7 @@ 5 | // BSD-style license that can be found in the LICENSE file. 6 | 7 | #include "platform/globals.h" // NOLINT 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | 11 | #include "vm/os_thread.h" 12 | 13 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_signal_handler_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/signal_handler.h.orig Sat Apr 18 21:51:34 2015 3 | +++ dart/runtime/vm/signal_handler.h Sun Apr 19 00:27:33 2015 4 | @@ -8,9 +8,12 @@ 5 | #include "vm/allocation.h" 6 | #include "vm/globals.h" 7 | 8 | -#if defined(TARGET_OS_LINUX) 9 | +#if defined(TARGET_OS_LINUX) && !defined(__OpenBSD__) 10 | #include // NOLINT 11 | #include // NOLINT 12 | +#elif defined(__OpenBSD__) 13 | +#include // NOLINT 14 | +typedef struct sigcontext mcontext_t; 15 | #elif defined(TARGET_OS_ANDROID) 16 | #include // NOLINT 17 | #if !defined(__BIONIC_HAVE_UCONTEXT_T) 18 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_signal_handler_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/signal_handler_linux.cc.orig Mon Apr 20 01:02:38 2015 3 | +++ dart/runtime/vm/signal_handler_linux.cc Sat Apr 25 16:32:08 2015 4 | @@ -12,7 +12,11 @@ namespace dart { 5 | uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { 6 | uintptr_t pc = 0; 7 | 8 | -#if defined(TARGET_ARCH_IA32) 9 | +#if defined(__OpenBSD__) && defined(TARGET_ARCH_IA32) 10 | + pc = static_cast(mcontext.sc_eip); 11 | +#elif defined(__OpenBSD__) && defined(TARGET_ARCH_X64) 12 | + pc = static_cast(mcontext.sc_rip); 13 | +#elif defined(TARGET_ARCH_IA32) 14 | pc = static_cast(mcontext.gregs[REG_EIP]); 15 | #elif defined(TARGET_ARCH_X64) 16 | pc = static_cast(mcontext.gregs[REG_RIP]); 17 | @@ -38,7 +42,11 @@ uintptr_t SignalHandler::GetProgramCounter(const mcont 18 | uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { 19 | uintptr_t fp = 0; 20 | 21 | -#if defined(TARGET_ARCH_IA32) 22 | +#if defined(__OpenBSD__) && defined(TARGET_ARCH_IA32) 23 | + fp = static_cast(mcontext.sc_ebp); 24 | +#elif defined(__OpenBSD__) && defined(TARGET_ARCH_X64) 25 | + fp = static_cast(mcontext.sc_rbp); 26 | +#elif defined(TARGET_ARCH_IA32) 27 | fp = static_cast(mcontext.gregs[REG_EBP]); 28 | #elif defined(TARGET_ARCH_X64) 29 | fp = static_cast(mcontext.gregs[REG_RBP]); 30 | @@ -65,7 +73,11 @@ uintptr_t SignalHandler::GetFramePointer(const mcontex 31 | uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { 32 | uintptr_t sp = 0; 33 | 34 | -#if defined(TARGET_ARCH_IA32) 35 | +#if defined(__OpenBSD__) && defined(TARGET_ARCH_IA32) 36 | + sp = static_cast(mcontext.sc_esp); 37 | +#elif defined(__OpenBSD__) && defined(TARGET_ARCH_X64) 38 | + sp = static_cast(mcontext.sc_rsp); 39 | +#elif defined(TARGET_ARCH_IA32) 40 | sp = static_cast(mcontext.gregs[REG_ESP]); 41 | #elif defined(TARGET_ARCH_X64) 42 | sp = static_cast(mcontext.gregs[REG_RSP]); 43 | -------------------------------------------------------------------------------- /patches/patch-dart_runtime_vm_thread_interrupter_linux_cc: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/runtime/vm/thread_interrupter_linux.cc.orig Sat Apr 25 16:39:04 2015 3 | +++ dart/runtime/vm/thread_interrupter_linux.cc Sat Apr 25 16:47:32 2015 4 | @@ -29,8 +29,12 @@ class ThreadInterrupterLinux : public AllStatic { 5 | } 6 | ASSERT(OSThread::Compare(state->id, OSThread::GetCurrentThreadId())); 7 | // Extract thread state. 8 | +#if defined(__OpenBSD__) 9 | + mcontext_t mcontext = reinterpret_cast(context_); 10 | +#else 11 | ucontext_t* context = reinterpret_cast(context_); 12 | mcontext_t mcontext = context->uc_mcontext; 13 | +#endif 14 | InterruptedThreadState its; 15 | its.tid = state->id; 16 | its.pc = SignalHandler::GetProgramCounter(mcontext); 17 | -------------------------------------------------------------------------------- /patches/patch-dart_third_party_nss_nspr_pr_include_md__openbsd_cfg: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/third_party/nss/nspr/pr/include/md/_openbsd.cfg.orig Sun May 10 15:39:32 2015 3 | +++ dart/third_party/nss/nspr/pr/include/md/_openbsd.cfg Sun May 10 16:21:52 2015 4 | @@ -0,0 +1,388 @@ 5 | +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 6 | +/* 7 | + * The contents of this file are subject to the Mozilla Public 8 | + * License Version 1.1 (the "License"); you may not use this file 9 | + * except in compliance with the License. You may obtain a copy of 10 | + * the License at http://www.mozilla.org/MPL/ 11 | + * 12 | + * Software distributed under the License is distributed on an "AS 13 | + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 14 | + * implied. See the License for the specific language governing 15 | + * rights and limitations under the License. 16 | + * 17 | + * The Original Code is the Netscape Portable Runtime (NSPR). 18 | + * 19 | + * The Initial Developer of the Original Code is Netscape 20 | + * Communications Corporation. Portions created by Netscape are 21 | + * Copyright (C) 1998-2000 Netscape Communications Corporation. All 22 | + * Rights Reserved. 23 | + * 24 | + * Contributor(s): 25 | + * 26 | + * Alternatively, the contents of this file may be used under the 27 | + * terms of the GNU General Public License Version 2 or later (the 28 | + * "GPL"), in which case the provisions of the GPL are applicable 29 | + * instead of those above. If you wish to allow use of your 30 | + * version of this file only under the terms of the GPL and not to 31 | + * allow others to use your version of this file under the MPL, 32 | + * indicate your decision by deleting the provisions above and 33 | + * replace them with the notice and other provisions required by 34 | + * the GPL. If you do not delete the provisions above, a recipient 35 | + * may use your version of this file under either the MPL or the 36 | + * GPL. 37 | + */ 38 | + 39 | +#ifndef nspr_cpucfg___ 40 | +#define nspr_cpucfg___ 41 | + 42 | +#ifndef XP_UNIX 43 | +#define XP_UNIX 44 | +#endif 45 | + 46 | +#if defined(__OpenBSD__) 47 | +#define _PR_PTHREADS 48 | +#endif 49 | + 50 | +#ifndef OPENBSD 51 | +#define OPENBSD 52 | +#endif 53 | + 54 | +#define PR_AF_INET6 24 /* same as AF_INET6 */ 55 | + 56 | +#if defined(__i386__) 57 | + 58 | +#define IS_LITTLE_ENDIAN 1 59 | +#undef IS_BIG_ENDIAN 60 | +#define HAVE_LONG_LONG 61 | +#undef HAVE_ALIGNED_DOUBLES 62 | +#undef HAVE_ALIGNED_LONGLONGS 63 | + 64 | +#define PR_BYTES_PER_BYTE 1 65 | +#define PR_BYTES_PER_SHORT 2 66 | +#define PR_BYTES_PER_INT 4 67 | +#define PR_BYTES_PER_INT64 8 68 | +#define PR_BYTES_PER_LONG 4 69 | +#define PR_BYTES_PER_FLOAT 4 70 | +#define PR_BYTES_PER_DOUBLE 8 71 | +#define PR_BYTES_PER_WORD 4 72 | +#define PR_BYTES_PER_DWORD 8 73 | +#define PR_BYTES_PER_WORD_LOG2 2 74 | +#define PR_BYTES_PER_DWORD_LOG2 3 75 | + 76 | +#define PR_BITS_PER_BYTE 8 77 | +#define PR_BITS_PER_SHORT 16 78 | +#define PR_BITS_PER_INT 32 79 | +#define PR_BITS_PER_INT64 64 80 | +#define PR_BITS_PER_LONG 32 81 | +#define PR_BITS_PER_FLOAT 32 82 | +#define PR_BITS_PER_DOUBLE 64 83 | +#define PR_BITS_PER_WORD 32 84 | + 85 | +#define PR_BITS_PER_BYTE_LOG2 3 86 | +#define PR_BITS_PER_SHORT_LOG2 4 87 | +#define PR_BITS_PER_INT_LOG2 5 88 | +#define PR_BITS_PER_INT64_LOG2 6 89 | +#define PR_BITS_PER_LONG_LOG2 5 90 | +#define PR_BITS_PER_FLOAT_LOG2 5 91 | +#define PR_BITS_PER_DOUBLE_LOG2 6 92 | +#define PR_BITS_PER_WORD_LOG2 5 93 | + 94 | +#define PR_ALIGN_OF_SHORT 2 95 | +#define PR_ALIGN_OF_INT 4 96 | +#define PR_ALIGN_OF_LONG 4 97 | +#define PR_ALIGN_OF_INT64 4 98 | +#define PR_ALIGN_OF_FLOAT 4 99 | +#define PR_ALIGN_OF_DOUBLE 4 100 | +#define PR_ALIGN_OF_POINTER 4 101 | + 102 | +#elif defined(__amd64__) 103 | + 104 | +#define IS_LITTLE_ENDIAN 1 105 | +#undef IS_BIG_ENDIAN 106 | +#define IS_64 107 | + 108 | +#define PR_BYTES_PER_BYTE 1 109 | +#define PR_BYTES_PER_SHORT 2 110 | +#define PR_BYTES_PER_INT 4 111 | +#define PR_BYTES_PER_INT64 8 112 | +#define PR_BYTES_PER_LONG 8 113 | +#define PR_BYTES_PER_FLOAT 4 114 | +#define PR_BYTES_PER_DOUBLE 8 115 | +#define PR_BYTES_PER_WORD 8 116 | +#define PR_BYTES_PER_DWORD 8 117 | + 118 | +#define PR_BITS_PER_BYTE 8 119 | +#define PR_BITS_PER_SHORT 16 120 | +#define PR_BITS_PER_INT 32 121 | +#define PR_BITS_PER_INT64 64 122 | +#define PR_BITS_PER_LONG 64 123 | +#define PR_BITS_PER_FLOAT 32 124 | +#define PR_BITS_PER_DOUBLE 64 125 | +#define PR_BITS_PER_WORD 64 126 | + 127 | +#define PR_BITS_PER_BYTE_LOG2 3 128 | +#define PR_BITS_PER_SHORT_LOG2 4 129 | +#define PR_BITS_PER_INT_LOG2 5 130 | +#define PR_BITS_PER_INT64_LOG2 6 131 | +#define PR_BITS_PER_LONG_LOG2 6 132 | +#define PR_BITS_PER_FLOAT_LOG2 5 133 | +#define PR_BITS_PER_DOUBLE_LOG2 6 134 | +#define PR_BITS_PER_WORD_LOG2 6 135 | + 136 | +#define PR_ALIGN_OF_SHORT 2 137 | +#define PR_ALIGN_OF_INT 4 138 | +#define PR_ALIGN_OF_LONG 8 139 | +#define PR_ALIGN_OF_INT64 8 140 | +#define PR_ALIGN_OF_FLOAT 4 141 | +#define PR_ALIGN_OF_DOUBLE 8 142 | +#define PR_ALIGN_OF_POINTER 8 143 | +#define PR_ALIGN_OF_WORD 8 144 | + 145 | +#define PR_BYTES_PER_WORD_LOG2 3 146 | +#define PR_BYTES_PER_DWORD_LOG2 3 147 | + 148 | +#define HAVE_LONG_LONG 149 | +#define HAVE_ALIGNED_DOUBLES 150 | +#define HAVE_ALIGNED_LONGLONGS 151 | + 152 | +#elif defined(__sparc_v9__) 153 | + 154 | +#undef IS_LITTLE_ENDIAN 155 | +#define IS_BIG_ENDIAN 1 156 | +#define HAVE_LONG_LONG 157 | +#define HAVE_ALIGNED_DOUBLES 158 | +#define HAVE_ALIGNED_LONGLONGS 159 | +#define IS_64 160 | + 161 | +#define PR_BYTES_PER_BYTE 1 162 | +#define PR_BYTES_PER_SHORT 2 163 | +#define PR_BYTES_PER_INT 4 164 | +#define PR_BYTES_PER_INT64 8 165 | +#define PR_BYTES_PER_LONG 8 166 | +#define PR_BYTES_PER_FLOAT 4 167 | +#define PR_BYTES_PER_DOUBLE 8 168 | +#define PR_BYTES_PER_WORD 8 169 | +#define PR_BYTES_PER_DWORD 8 170 | + 171 | +#define PR_BITS_PER_BYTE 8 172 | +#define PR_BITS_PER_SHORT 16 173 | +#define PR_BITS_PER_INT 32 174 | +#define PR_BITS_PER_INT64 64 175 | +#define PR_BITS_PER_LONG 64 176 | +#define PR_BITS_PER_FLOAT 32 177 | +#define PR_BITS_PER_DOUBLE 64 178 | +#define PR_BITS_PER_WORD 64 179 | + 180 | +#define PR_BITS_PER_BYTE_LOG2 3 181 | +#define PR_BITS_PER_SHORT_LOG2 4 182 | +#define PR_BITS_PER_INT_LOG2 5 183 | +#define PR_BITS_PER_INT64_LOG2 6 184 | +#define PR_BITS_PER_LONG_LOG2 6 185 | +#define PR_BITS_PER_FLOAT_LOG2 5 186 | +#define PR_BITS_PER_DOUBLE_LOG2 6 187 | +#define PR_BITS_PER_WORD_LOG2 6 188 | + 189 | +#define PR_ALIGN_OF_SHORT 2 190 | +#define PR_ALIGN_OF_INT 4 191 | +#define PR_ALIGN_OF_LONG 8 192 | +#define PR_ALIGN_OF_INT64 8 193 | +#define PR_ALIGN_OF_FLOAT 4 194 | +#define PR_ALIGN_OF_DOUBLE 8 195 | +#define PR_ALIGN_OF_POINTER 8 196 | + 197 | +#define PR_BYTES_PER_WORD_LOG2 3 198 | +#define PR_BYTES_PER_DWORD_LOG2 3 199 | + 200 | +#elif defined(__sparc__) 201 | + 202 | +#undef IS_LITTLE_ENDIAN 203 | +#define IS_BIG_ENDIAN 1 204 | +#define HAVE_LONG_LONG 205 | +#define HAVE_ALIGNED_DOUBLES 206 | +#define HAVE_ALIGNED_LONGLONGS 207 | + 208 | +#define PR_BYTES_PER_BYTE 1 209 | +#define PR_BYTES_PER_SHORT 2 210 | +#define PR_BYTES_PER_INT 4 211 | +#define PR_BYTES_PER_INT64 8 212 | +#define PR_BYTES_PER_LONG 4 213 | +#define PR_BYTES_PER_FLOAT 4 214 | +#define PR_BYTES_PER_DOUBLE 8 215 | +#define PR_BYTES_PER_WORD 4 216 | +#define PR_BYTES_PER_DWORD 8 217 | +#define PR_BYTES_PER_WORD_LOG2 2 218 | +#define PR_BYTES_PER_DWORD_LOG2 3 219 | + 220 | +#define PR_BITS_PER_BYTE 8 221 | +#define PR_BITS_PER_SHORT 16 222 | +#define PR_BITS_PER_INT 32 223 | +#define PR_BITS_PER_INT64 64 224 | +#define PR_BITS_PER_LONG 32 225 | +#define PR_BITS_PER_FLOAT 32 226 | +#define PR_BITS_PER_DOUBLE 64 227 | +#define PR_BITS_PER_WORD 32 228 | + 229 | +#define PR_BITS_PER_BYTE_LOG2 3 230 | +#define PR_BITS_PER_SHORT_LOG2 4 231 | +#define PR_BITS_PER_INT_LOG2 5 232 | +#define PR_BITS_PER_INT64_LOG2 6 233 | +#define PR_BITS_PER_LONG_LOG2 5 234 | +#define PR_BITS_PER_FLOAT_LOG2 5 235 | +#define PR_BITS_PER_DOUBLE_LOG2 6 236 | +#define PR_BITS_PER_WORD_LOG2 5 237 | + 238 | +#define PR_ALIGN_OF_SHORT 2 239 | +#define PR_ALIGN_OF_INT 4 240 | +#define PR_ALIGN_OF_LONG 4 241 | +#define PR_ALIGN_OF_INT64 8 242 | +#define PR_ALIGN_OF_FLOAT 4 243 | +#define PR_ALIGN_OF_DOUBLE 8 244 | +#define PR_ALIGN_OF_POINTER 4 245 | + 246 | +#elif defined(__alpha__) 247 | +#define IS_LITTLE_ENDIAN 1 248 | +#undef IS_BIG_ENDIAN 249 | +#define HAVE_LONG_LONG 250 | +#define HAVE_ALIGNED_DOUBLES 251 | +#define HAVE_ALIGNED_LONGLONGS 252 | +#define IS_64 253 | + 254 | +#define PR_BYTES_PER_BYTE 1 255 | +#define PR_BYTES_PER_SHORT 2 256 | +#define PR_BYTES_PER_INT 4 257 | +#define PR_BYTES_PER_INT64 8 258 | +#define PR_BYTES_PER_LONG 8 259 | +#define PR_BYTES_PER_FLOAT 4 260 | +#define PR_BYTES_PER_DOUBLE 8 261 | +#define PR_BYTES_PER_WORD 8 262 | +#define PR_BYTES_PER_DWORD 8 263 | + 264 | +#define PR_BITS_PER_BYTE 8 265 | +#define PR_BITS_PER_SHORT 16 266 | +#define PR_BITS_PER_INT 32 267 | +#define PR_BITS_PER_INT64 64 268 | +#define PR_BITS_PER_LONG 64 269 | +#define PR_BITS_PER_FLOAT 32 270 | +#define PR_BITS_PER_DOUBLE 64 271 | +#define PR_BITS_PER_WORD 64 272 | + 273 | +#define PR_BITS_PER_BYTE_LOG2 3 274 | +#define PR_BITS_PER_SHORT_LOG2 4 275 | +#define PR_BITS_PER_INT_LOG2 5 276 | +#define PR_BITS_PER_INT64_LOG2 6 277 | +#define PR_BITS_PER_LONG_LOG2 6 278 | +#define PR_BITS_PER_FLOAT_LOG2 5 279 | +#define PR_BITS_PER_DOUBLE_LOG2 6 280 | +#define PR_BITS_PER_WORD_LOG2 6 281 | + 282 | +#define PR_ALIGN_OF_SHORT 2 283 | +#define PR_ALIGN_OF_INT 4 284 | +#define PR_ALIGN_OF_LONG 8 285 | +#define PR_ALIGN_OF_INT64 8 286 | +#define PR_ALIGN_OF_FLOAT 4 287 | +#define PR_ALIGN_OF_DOUBLE 8 288 | +#define PR_ALIGN_OF_POINTER 8 289 | + 290 | +#define PR_BYTES_PER_WORD_LOG2 3 291 | +#define PR_BYTES_PER_DWORD_LOG2 3 292 | + 293 | +#elif defined(__powerpc__) || defined(__m68k__) 294 | + 295 | +#undef IS_LITTLE_ENDIAN 296 | +#define IS_BIG_ENDIAN 1 297 | +#define HAVE_LONG_LONG 298 | +#undef HAVE_ALIGNED_DOUBLES 299 | +#undef HAVE_ALIGNED_LONGLONGS 300 | + 301 | +#define PR_BYTES_PER_BYTE 1 302 | +#define PR_BYTES_PER_SHORT 2 303 | +#define PR_BYTES_PER_INT 4 304 | +#define PR_BYTES_PER_INT64 8 305 | +#define PR_BYTES_PER_LONG 4 306 | +#define PR_BYTES_PER_FLOAT 4 307 | +#define PR_BYTES_PER_DOUBLE 8 308 | +#define PR_BYTES_PER_WORD 4 309 | +#define PR_BYTES_PER_DWORD 8 310 | + 311 | +#define PR_BITS_PER_BYTE 8 312 | +#define PR_BITS_PER_SHORT 16 313 | +#define PR_BITS_PER_INT 32 314 | +#define PR_BITS_PER_INT64 64 315 | +#define PR_BITS_PER_LONG 32 316 | +#define PR_BITS_PER_FLOAT 32 317 | +#define PR_BITS_PER_DOUBLE 64 318 | +#define PR_BITS_PER_WORD 32 319 | + 320 | +#define PR_BITS_PER_BYTE_LOG2 3 321 | +#define PR_BITS_PER_SHORT_LOG2 4 322 | +#define PR_BITS_PER_INT_LOG2 5 323 | +#define PR_BITS_PER_INT64_LOG2 6 324 | +#define PR_BITS_PER_LONG_LOG2 5 325 | +#define PR_BITS_PER_FLOAT_LOG2 5 326 | +#define PR_BITS_PER_DOUBLE_LOG2 6 327 | +#define PR_BITS_PER_WORD_LOG2 5 328 | + 329 | +#define PR_ALIGN_OF_SHORT 2 330 | +#define PR_ALIGN_OF_INT 4 331 | +#define PR_ALIGN_OF_LONG 4 332 | +#define PR_ALIGN_OF_INT64 4 333 | +#define PR_ALIGN_OF_FLOAT 4 334 | +#define PR_ALIGN_OF_DOUBLE 4 335 | +#define PR_ALIGN_OF_POINTER 4 336 | + 337 | +#define PR_BYTES_PER_WORD_LOG2 2 338 | +#define PR_BYTES_PER_DWORD_LOG2 3 339 | + 340 | +#else 341 | + 342 | +#error Must define constants for type sizes here. 343 | + 344 | +#endif 345 | + 346 | + 347 | +#ifndef NO_NSPR_10_SUPPORT 348 | + 349 | +#define BYTES_PER_BYTE PR_BYTES_PER_BYTE 350 | +#define BYTES_PER_SHORT PR_BYTES_PER_SHORT 351 | +#define BYTES_PER_INT PR_BYTES_PER_INT 352 | +#define BYTES_PER_INT64 PR_BYTES_PER_INT64 353 | +#define BYTES_PER_LONG PR_BYTES_PER_LONG 354 | +#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT 355 | +#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE 356 | +#define BYTES_PER_WORD PR_BYTES_PER_WORD 357 | +#define BYTES_PER_DWORD PR_BYTES_PER_DWORD 358 | + 359 | +#define BITS_PER_BYTE PR_BITS_PER_BYTE 360 | +#define BITS_PER_SHORT PR_BITS_PER_SHORT 361 | +#define BITS_PER_INT PR_BITS_PER_INT 362 | +#define BITS_PER_INT64 PR_BITS_PER_INT64 363 | +#define BITS_PER_LONG PR_BITS_PER_LONG 364 | +#define BITS_PER_FLOAT PR_BITS_PER_FLOAT 365 | +#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE 366 | +#define BITS_PER_WORD PR_BITS_PER_WORD 367 | + 368 | +#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2 369 | +#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2 370 | +#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2 371 | +#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2 372 | +#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2 373 | +#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2 374 | +#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2 375 | +#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2 376 | + 377 | +#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT 378 | +#define ALIGN_OF_INT PR_ALIGN_OF_INT 379 | +#define ALIGN_OF_LONG PR_ALIGN_OF_LONG 380 | +#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64 381 | +#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT 382 | +#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE 383 | +#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER 384 | +#define ALIGN_OF_WORD PR_ALIGN_OF_WORD 385 | + 386 | +#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2 387 | +#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 388 | +#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 389 | + 390 | +#endif /* NO_NSPR_10_SUPPORT */ 391 | + 392 | +#endif /* nspr_cpucfg___ */ 393 | -------------------------------------------------------------------------------- /patches/patch-dart_third_party_nss_nspr_pr_include_md__openbsd_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/third_party/nss/nspr/pr/include/md/_openbsd.h.orig Sun Apr 26 21:01:03 2015 3 | +++ dart/third_party/nss/nspr/pr/include/md/_openbsd.h Sun Apr 26 21:00:56 2015 4 | @@ -0,0 +1,235 @@ 5 | +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 6 | +/* 7 | + * The contents of this file are subject to the Mozilla Public 8 | + * License Version 1.1 (the "License"); you may not use this file 9 | + * except in compliance with the License. You may obtain a copy of 10 | + * the License at http://www.mozilla.org/MPL/ 11 | + * 12 | + * Software distributed under the License is distributed on an "AS 13 | + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 14 | + * implied. See the License for the specific language governing 15 | + * rights and limitations under the License. 16 | + * 17 | + * The Original Code is the Netscape Portable Runtime (NSPR). 18 | + * 19 | + * The Initial Developer of the Original Code is Netscape 20 | + * Communications Corporation. Portions created by Netscape are 21 | + * Copyright (C) 1998-2000 Netscape Communications Corporation. All 22 | + * Rights Reserved. 23 | + * 24 | + * Contributor(s): 25 | + * 26 | + * Alternatively, the contents of this file may be used under the 27 | + * terms of the GNU General Public License Version 2 or later (the 28 | + * "GPL"), in which case the provisions of the GPL are applicable 29 | + * instead of those above. If you wish to allow use of your 30 | + * version of this file only under the terms of the GPL and not to 31 | + * allow others to use your version of this file under the MPL, 32 | + * indicate your decision by deleting the provisions above and 33 | + * replace them with the notice and other provisions required by 34 | + * the GPL. If you do not delete the provisions above, a recipient 35 | + * may use your version of this file under either the MPL or the 36 | + * GPL. 37 | + */ 38 | + 39 | +#ifndef nspr_openbsd_defs_h___ 40 | +#define nspr_openbsd_defs_h___ 41 | + 42 | +#include 43 | + 44 | +#define PR_LINKER_ARCH "openbsd" 45 | +#define _PR_SI_SYSNAME "OPENBSD" 46 | +#if defined(__i386__) 47 | +#define _PR_SI_ARCHITECTURE "x86" 48 | +#elif defined(__alpha__) 49 | +#define _PR_SI_ARCHITECTURE "alpha" 50 | +#elif defined(__amd64__) 51 | +#define _PR_SI_ARCHITECTURE "amd64" 52 | +#elif defined(__m68k__) 53 | +#define _PR_SI_ARCHITECTURE "m68k" 54 | +#elif defined(__powerpc__) 55 | +#define _PR_SI_ARCHITECTURE "powerpc" 56 | +#elif defined(__sparc__) 57 | +#define _PR_SI_ARCHITECTURE "sparc" 58 | +#endif 59 | + 60 | +#define PR_DLL_SUFFIX ".so.1.0" 61 | + 62 | +#define _PR_VMBASE 0x30000000 63 | +#define _PR_STACK_VMBASE 0x50000000 64 | +#define _MD_DEFAULT_STACK_SIZE 65536L 65 | +#define _MD_MMAP_FLAGS MAP_PRIVATE 66 | + 67 | +#undef HAVE_STACK_GROWING_UP 68 | +#define HAVE_DLL 69 | +#define USE_DLFCN 70 | +#define _PR_HAVE_SOCKADDR_LEN 71 | +#define _PR_NO_LARGE_FILES 72 | +#define _PR_STAT_HAS_ST_ATIMESPEC 73 | +#define _PR_POLL_AVAILABLE 74 | +#define _PR_USE_POLL 75 | +#define _PR_HAVE_SYSV_SEMAPHORES 76 | +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY 77 | + 78 | +#define _PR_INET6 79 | +#define _PR_HAVE_INET_NTOP 80 | +#define _PR_HAVE_GETHOSTBYNAME2 81 | +#define _PR_HAVE_GETADDRINFO 82 | +#define _PR_INET6_PROBE 83 | + 84 | +#define USE_SETJMP 85 | + 86 | +#ifndef _PR_PTHREADS 87 | +#include 88 | + 89 | +#define PR_CONTEXT_TYPE sigjmp_buf 90 | + 91 | +#define CONTEXT(_th) ((_th)->md.context) 92 | + 93 | +#if defined(__i386__) || defined(__sparc__) || defined(__m68k__) 94 | +#define JB_SP_INDEX 2 95 | +#elif defined(__powerpc__) 96 | +#define JB_SP_INDEX 1 97 | +#elif defined(__alpha__) 98 | +#define JB_SP_INDEX 34 99 | +#elif defined(__amd64__) 100 | +#define JB_SP_INDEX 6 101 | +#else 102 | +#error "Need to define SP index in jmp_buf here" 103 | +#endif 104 | +#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX] 105 | + 106 | +#define PR_NUM_GCREGS _JBLEN 107 | + 108 | +/* 109 | +** Initialize a thread context to run "_main()" when started 110 | +*/ 111 | +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ 112 | +{ \ 113 | + *status = PR_TRUE; \ 114 | + if (sigsetjmp(CONTEXT(_thread), 1)) { \ 115 | + _main(); \ 116 | + } \ 117 | + _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \ 118 | +} 119 | + 120 | +#define _MD_SWITCH_CONTEXT(_thread) \ 121 | + if (!sigsetjmp(CONTEXT(_thread), 1)) { \ 122 | + (_thread)->md.errcode = errno; \ 123 | + _PR_Schedule(); \ 124 | + } 125 | + 126 | +/* 127 | +** Restore a thread context, saved by _MD_SWITCH_CONTEXT 128 | +*/ 129 | +#define _MD_RESTORE_CONTEXT(_thread) \ 130 | +{ \ 131 | + errno = (_thread)->md.errcode; \ 132 | + _MD_SET_CURRENT_THREAD(_thread); \ 133 | + siglongjmp(CONTEXT(_thread), 1); \ 134 | +} 135 | + 136 | +/* Machine-dependent (MD) data structures */ 137 | + 138 | +struct _MDThread { 139 | + PR_CONTEXT_TYPE context; 140 | + int id; 141 | + int errcode; 142 | +}; 143 | + 144 | +struct _MDThreadStack { 145 | + PRInt8 notused; 146 | +}; 147 | + 148 | +struct _MDLock { 149 | + PRInt8 notused; 150 | +}; 151 | + 152 | +struct _MDSemaphore { 153 | + PRInt8 notused; 154 | +}; 155 | + 156 | +struct _MDCVar { 157 | + PRInt8 notused; 158 | +}; 159 | + 160 | +struct _MDSegment { 161 | + PRInt8 notused; 162 | +}; 163 | + 164 | +/* 165 | + * md-specific cpu structure field 166 | + */ 167 | +#define _PR_MD_MAX_OSFD FD_SETSIZE 168 | + 169 | +struct _MDCPU_Unix { 170 | + PRCList ioQ; 171 | + PRUint32 ioq_timeout; 172 | + PRInt32 ioq_max_osfd; 173 | + PRInt32 ioq_osfd_cnt; 174 | +#ifndef _PR_USE_POLL 175 | + fd_set fd_read_set, fd_write_set, fd_exception_set; 176 | + PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD], 177 | + fd_exception_cnt[_PR_MD_MAX_OSFD]; 178 | +#else 179 | + struct pollfd *ioq_pollfds; 180 | + int ioq_pollfds_size; 181 | +#endif /* _PR_USE_POLL */ 182 | +}; 183 | + 184 | +#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ) 185 | +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu)) 186 | +#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set) 187 | +#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt) 188 | +#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set) 189 | +#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt) 190 | +#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set) 191 | +#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt) 192 | +#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout) 193 | +#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd) 194 | +#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt) 195 | +#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds) 196 | +#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size) 197 | + 198 | +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32 199 | + 200 | +struct _MDCPU { 201 | + struct _MDCPU_Unix md_unix; 202 | +}; 203 | + 204 | +#define _MD_INIT_LOCKS() 205 | +#define _MD_NEW_LOCK(lock) PR_SUCCESS 206 | +#define _MD_FREE_LOCK(lock) 207 | +#define _MD_LOCK(lock) 208 | +#define _MD_UNLOCK(lock) 209 | +#define _MD_INIT_IO() 210 | +#define _MD_IOQ_LOCK() 211 | +#define _MD_IOQ_UNLOCK() 212 | + 213 | +#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu) 214 | +#define _MD_INIT_THREAD _MD_InitializeThread 215 | +#define _MD_EXIT_THREAD(thread) 216 | +#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread 217 | +#define _MD_RESUME_THREAD(thread) _MD_resume_thread 218 | +#define _MD_CLEAN_THREAD(_thread) 219 | + 220 | +#endif /* ! _PR_PTHREADS */ 221 | + 222 | +#define _MD_EARLY_INIT _MD_EarlyInit 223 | +#define _MD_FINAL_INIT _PR_UnixInit 224 | +#define _MD_GET_INTERVAL _PR_UNIX_GetInterval 225 | +#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond 226 | + 227 | +/* 228 | + * We wrapped the select() call. _MD_SELECT refers to the built-in, 229 | + * unwrapped version. 230 | + */ 231 | +#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv) 232 | +#include 233 | +#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout) 234 | + 235 | +#if OpenBSD1_3 == 1L 236 | +typedef unsigned int nfds_t; 237 | +#endif 238 | + 239 | +#endif /* nspr_openbsd_defs_h___ */ 240 | -------------------------------------------------------------------------------- /patches/patch-dart_third_party_nss_nspr_pr_include_md_prosdep_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/third_party/nss/nspr/pr/include/md/prosdep.h.orig Sat Apr 25 23:40:15 2015 3 | +++ dart/third_party/nss/nspr/pr/include/md/prosdep.h Sun Apr 26 21:02:12 2015 4 | @@ -40,7 +40,7 @@ PR_BEGIN_EXTERN_C 5 | #elif defined(NETBSD) 6 | #include "md/_netbsd.h" 7 | 8 | -#elif defined(OPENBSD) 9 | +#elif defined(__OpenBSD__) 10 | #include "md/_openbsd.h" 11 | 12 | #elif defined(BSDI) 13 | -------------------------------------------------------------------------------- /patches/patch-dart_third_party_nss_nspr_pr_include_prcpucfg_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/third_party/nss/nspr/pr/include/prcpucfg.h.orig Sat Apr 25 21:23:50 2015 3 | +++ dart/third_party/nss/nspr/pr/include/prcpucfg.h Sun Apr 26 21:03:30 2015 4 | @@ -9,6 +9,8 @@ 5 | #include "md/_darwin.cfg" 6 | #elif defined(__linux__) 7 | #include "md/_linux.cfg" 8 | +#elif defined(__OpenBSD__) 9 | +#include "md/_openbsd.cfg" 10 | #else 11 | #error Add a case for your platform 12 | #endif 13 | -------------------------------------------------------------------------------- /patches/patch-dart_third_party_nss_nspr_pr_include_private_primpl_h: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/third_party/nss/nspr/pr/include/private/primpl.h.orig Fri Apr 24 10:32:25 2015 3 | +++ dart/third_party/nss/nspr/pr/include/private/primpl.h Sun May 10 20:02:02 2015 4 | @@ -14,10 +14,22 @@ 5 | * To be safe, we include pthread.h first. 6 | */ 7 | 8 | -#if defined(_PR_PTHREADS) 9 | #include 10 | -#endif 11 | 12 | +/* PRThread.flags */ 13 | +#define _PR_SYSTEM 0x01 14 | +#define _PR_INTERRUPT 0x02 15 | +#define _PR_ATTACHED 0x04 /* created via PR_AttachThread */ 16 | +#define _PR_PRIMORDIAL 0x08 /* the thread that called PR_Init */ 17 | +#define _PR_ON_SLEEPQ 0x10 /* thread is on the sleepQ */ 18 | +#define _PR_ON_PAUSEQ 0x20 /* thread is on the pauseQ */ 19 | +#define _PR_SUSPENDING 0x40 /* thread wants to suspend */ 20 | +#define _PR_GLOBAL_SCOPE 0x80 /* thread is global scope */ 21 | +#define _PR_IDLE_THREAD 0x200 /* this is an idle thread */ 22 | +#define _PR_GCABLE_THREAD 0x400 /* this is a collectable thread */ 23 | +#define _PR_BOUND_THREAD 0x800 /* a bound thread */ 24 | +#define _PR_INTERRUPT_BLOCKED 0x1000 /* interrupts blocked */ 25 | + 26 | #if defined(_PR_BTHREADS) 27 | #include 28 | #endif 29 | @@ -1583,6 +1595,7 @@ struct PRThread { 30 | pthread_t id; /* pthread identifier for the thread */ 31 | PRBool idSet; /* whether 'id' has been set. Protected by 32 | * pt_book.ml. */ 33 | + PRUint32 flags; 34 | #ifdef _PR_NICE_PRIORITY_SCHEDULING 35 | pid_t tid; /* Linux-specific kernel thread ID */ 36 | #endif 37 | -------------------------------------------------------------------------------- /patches/patch-dart_tools_build_py: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/tools/build.py.orig Fri Apr 24 10:29:57 2015 3 | +++ dart/tools/build.py Sun May 10 14:08:55 2015 4 | @@ -112,7 +112,7 @@ def ProcessOptions(options, args): 5 | return False 6 | options.os = [ProcessOsOption(os_name) for os_name in options.os] 7 | for os_name in options.os: 8 | - if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: 9 | + if not os_name in ['android', 'freebsd', 'linux', 'macos', 'openbsd', 'win32']: 10 | print "Unknown os %s" % os_name 11 | return False 12 | if os_name != HOST_OS: 13 | @@ -436,7 +436,7 @@ def BuildOneConfig(options, target, target_os, mode, a 14 | ] 15 | else: 16 | make = 'make' 17 | - if HOST_OS == 'freebsd': 18 | + if HOST_OS in ('freebsd', 'openbsd'): 19 | make = 'gmake' 20 | # work around lack of flock 21 | os.environ['LINK'] = '$(CXX)' 22 | -------------------------------------------------------------------------------- /patches/patch-dart_tools_gyp_configurations_gypi: -------------------------------------------------------------------------------- 1 | $OpenBSD$ 2 | --- dart/tools/gyp/configurations.gypi.orig Fri Apr 24 10:29:57 2015 3 | +++ dart/tools/gyp/configurations.gypi Sun May 10 14:08:55 2015 4 | @@ -25,6 +25,7 @@ 5 | ['"<(target_arch)"=="simmips"', { 'dart_target_arch': 'SIMMIPS', }], 6 | [ 'OS=="linux"', { 'dart_target_os': 'Linux', } ], 7 | [ 'OS=="mac"', { 'dart_target_os': 'Macos', } ], 8 | + [ 'OS=="openbsd"', { 'dart_target_os': 'Linux', } ], 9 | [ 'OS=="win"', { 'dart_target_os': 'Win', } ], 10 | # The OS is set to "android" only when we are building Dartium+Clank. We 11 | # use 'chrome_target_os' so that Release and Debug configurations inherit 12 | --------------------------------------------------------------------------------