Skip to content

Instantly share code, notes, and snippets.

@FROGGS

FROGGS/qnx.patch Secret

Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/88b75ce683284babe32d to your computer and use it in GitHub Desktop.
Save FROGGS/88b75ce683284babe32d to your computer and use it in GitHub Desktop.
#!/bin/bash
export QNX_HOST=/home/froggs/bbndk/host_10_2_0_15/linux/x86
export QNX_TARGET=/home/froggs/bbndk/target_10_2_0_1155/qnx6
export PATH="/home/froggs/bbndk/host_10_2_0_15/linux/x86/usr/bin:$PATH"
perl Configure.pl --build=i686-pc-linux --host=arm-unknown-nto-qnx8.0.0eabi
make
#
diff --git a/Configure.pl b/Configure.pl
index 1a15b17..f3b30e2 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -564,7 +564,7 @@ sub setup_cross {
my $crossconf = "--build=$build --host=$host";
for (\$build, \$host) {
- if ($$_ =~ /-(\w+)$/) {
+ if ($$_ =~ /[^-]+-[^-]+-(.+)$/) {
$$_ = $1;
if (!exists $::SYSTEMS{$1}) {
softfail("unknown OS '$1'");
diff --git a/build/setup.pm b/build/setup.pm
index c67ccc9..49b819c 100755
--- a/build/setup.pm
+++ b/build/setup.pm
@@ -476,6 +476,16 @@ our %OS_DARWIN = (
},
);
+our %OS_QNX = (
+ %OS_POSIX,
+
+ syslibs => [ @{$OS_POSIX{syslibs}}, qw( rt dl ) ],
+
+ -thirdparty => {
+ uv => { %TP_UVDUMMY, objects => '$(UV_LINUX)' },
+ },
+);
+
our %SYSTEMS = (
posix => [ qw( posix posix cc ), { %OS_POSIX } ],
linux => [ qw( posix gnu gcc ), { %OS_LINUX } ],
@@ -487,6 +497,7 @@ our %SYSTEMS = (
win32 => [ qw( win32 msvc cl ), { %OS_WIN32 } ],
cygwin => [ qw( posix gnu gcc ), { %OS_WIN32 } ],
mingw32 => [ qw( win32 gnu gcc ), { %OS_MINGW32 } ],
+ 'nto-qnx8.0.0eabi' => [ qw( posix posix qcc ), { %OS_QNX } ],
);
42;
diff --git a/src/io/io.c b/src/io/io.c
index efe5f12..e9a6ae9 100644
--- a/src/io/io.c
+++ b/src/io/io.c
@@ -61,7 +61,7 @@ MVMint64 MVM_io_tell(MVMThreadContext *tc, MVMObject *oshandle) {
MVMOSHandle *handle = verify_is_handle(tc, oshandle, "tell");
if (handle->body.ops->seekable) {
uv_mutex_t *mutex = acquire_mutex(tc, handle);
- MVMint64 result = handle->body.ops->seekable->tell(tc, handle);
+ MVMint64 result = handle->body.ops->seekable->_tell(tc, handle);
release_mutex(tc, mutex);
return result;
}
@@ -250,7 +250,7 @@ MVMint64 MVM_io_eof(MVMThreadContext *tc, MVMObject *oshandle) {
MVMOSHandle *handle = verify_is_handle(tc, oshandle, "eof");
if (handle->body.ops->sync_readable) {
uv_mutex_t *mutex = acquire_mutex(tc, handle);
- MVMint64 result = handle->body.ops->sync_readable->eof(tc, handle);
+ MVMint64 result = handle->body.ops->sync_readable->_eof(tc, handle);
release_mutex(tc, mutex);
return result;
}
diff --git a/src/io/io.h b/src/io/io.h
index 891d7bb..56d7a44 100644
--- a/src/io/io.h
+++ b/src/io/io.h
@@ -37,7 +37,7 @@ struct MVMIOSyncReadable {
MVMString * (*slurp) (MVMThreadContext *tc, MVMOSHandle *h);
MVMString * (*read_chars) (MVMThreadContext *tc, MVMOSHandle *h, MVMint64 chars);
MVMint64 (*read_bytes) (MVMThreadContext *tc, MVMOSHandle *h, char **buf, MVMint64 bytes);
- MVMint64 (*eof) (MVMThreadContext *tc, MVMOSHandle *h);
+ MVMint64 (*_eof) (MVMThreadContext *tc, MVMOSHandle *h);
};
/* I/O operations on handles that can do synchronous writing. */
@@ -67,7 +67,7 @@ struct MVMIOAsyncWritable {
/* I/O operations on handles that can seek/tell. */
struct MVMIOSeekable {
void (*seek) (MVMThreadContext *tc, MVMOSHandle *h, MVMint64 offset, MVMint64 whence);
- MVMint64 (*tell) (MVMThreadContext *tc, MVMOSHandle *h);
+ MVMint64 (*_tell) (MVMThreadContext *tc, MVMOSHandle *h);
};
/* I/O operations on handles that do socket-y things (connect, bind, accept). */
diff --git a/src/io/syncfile.c b/src/io/syncfile.c
index 55e9bf1..5245148 100644
--- a/src/io/syncfile.c
+++ b/src/io/syncfile.c
@@ -82,7 +82,7 @@ static void seek(MVMThreadContext *tc, MVMOSHandle *h, MVMint64 offset, MVMint64
}
/* Get curernt position in the file. */
-static MVMint64 tell(MVMThreadContext *tc, MVMOSHandle *h) {
+static MVMint64 _tell(MVMThreadContext *tc, MVMOSHandle *h) {
MVMIOFileData *data = (MVMIOFileData *)h->body.data;
return data->ds ? MVM_string_decodestream_tell_bytes(tc, data->ds) : 0;
}
@@ -196,7 +196,7 @@ static MVMint64 read_bytes(MVMThreadContext *tc, MVMOSHandle *h, char **buf, MVM
}
/* Checks if the end of file has been reached. */
-static MVMint64 eof(MVMThreadContext *tc, MVMOSHandle *h) {
+static MVMint64 _eof(MVMThreadContext *tc, MVMOSHandle *h) {
MVMIOFileData *data = (MVMIOFileData *)h->body.data;
MVMint64 r;
MVMint64 seek_pos;
@@ -382,9 +382,9 @@ static void gc_free(MVMThreadContext *tc, MVMObject *h, void *d) {
/* IO ops table, populated with functions. */
static const MVMIOClosable closable = { closefh };
static const MVMIOEncodable encodable = { set_encoding };
-static const MVMIOSyncReadable sync_readable = { set_separator, read_line, slurp, read_chars, read_bytes, eof };
+static const MVMIOSyncReadable sync_readable = { set_separator, read_line, slurp, read_chars, read_bytes, _eof };
static const MVMIOSyncWritable sync_writable = { write_str, write_bytes, flush, truncatefh };
-static const MVMIOSeekable seekable = { seek, tell };
+static const MVMIOSeekable seekable = { seek, _tell };
static const MVMIOLockable lockable = { lock, unlock };
static const MVMIOOps op_table = {
&closable,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment