Skip to content

Instantly share code, notes, and snippets.

@sergeykish
Created April 10, 2011 16:38
Show Gist options
  • Save sergeykish/912507 to your computer and use it in GitHub Desktop.
Save sergeykish/912507 to your computer and use it in GitHub Desktop.
Plan 9 ruby-1.8.6
APE=/sys/src/ape
<$APE/config
TARG=ruby
OFILES=\
array.$O\
bignum.$O\
class.$O\
compar.$O\
dir.$O\
dln.$O\
enum.$O\
error.$O\
eval.$O\
file.$O\
gc.$O\
hash.$O\
inits.$O\
io.$O\
marshal.$O\
math.$O\
numeric.$O\
object.$O\
pack.$O\
parse.$O\
process.$O\
prec.$O\
random.$O\
range.$O\
re.$O\
regex.$O\
ruby.$O\
signal.$O\
sprintf.$O\
st.$O\
string.$O\
struct.$O\
time.$O\
util.$O\
variable.$O\
version.$O\
OMISSING=\
fileblocks.$O\
crypt.$O\
flock.$O\
isnan.$O\
finite.$O\
isinf.$O\
acosh.$O\
alloca.$O\
UPDATE=\
mkfile\
$HFILES\
${OFILES:%.$O=%.c}\
BIN=$APEBIN
CFLAGS=-B -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -D_C99_SNPRINTF_EXTENSION -I. -c
all:V: ruby
%.$O: missing/%.c
$CC $CFLAGS missing/$stem.c
%.$O: %.c
$CC $CFLAGS $stem.c
libruby.a: dmyext.$O $OFILES
ar rcu $target $prereq
ruby: main.$O libruby.a $OMISSING
$LD -o $target $prereq
clean:V:
rm -f *.$O ruby libruby.a
diff -r ruby-1.8.6-p230-origin/math.c ruby-1.8.6-p230/math.c
37c37
< #elif define(ERANGE)
---
> #elif defined(ERANGE)
diff -u ruby-1.8.6-p230-origin/file.c ruby-1.8.6-p230/file.c
--- ruby-1.8.6-p230-origin/file.c 2011-04-01 18:46:25.332501814 +0300
+++ ruby-1.8.6-p230/file.c 2011-04-01 17:49:32.779474377 +0300
@@ -1913,7 +1913,7 @@
o = NIL_P(owner) ? -1 : NUM2INT(owner);
g = NIL_P(group) ? -1 : NUM2INT(group);
GetOpenFile(obj, fptr);
-#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__)
+#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__) || defined(PLAN9)
if (!fptr->path) return Qnil;
if (chown(fptr->path, o, g) == -1)
rb_sys_fail(fptr->path);
diff -u ruby-1.8.6-p230-origin/io.c ruby-1.8.6-p230/io.c
--- ruby-1.8.6-p230-origin/io.c 2011-04-01 18:46:23.692542010 +0300
+++ ruby-1.8.6-p230/io.c 2011-04-01 17:50:59.144024310 +0300
@@ -4467,7 +4467,9 @@
chmod(fn, st.st_mode);
#endif
if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
+#ifndef PLAN9
fchown(fileno(fw), st.st_uid, st.st_gid);
+#endif
}
#endif
rb_stdout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile);
@@ -4861,7 +4863,7 @@
#ifdef HAVE_FCNTL
TRAP_BEG;
-# if defined(__CYGWIN__)
+# if defined(__CYGWIN__) || defined PLAN9
retval = io_p?ioctl(fd, cmd, (void*)narg):fcntl(fd, cmd, narg);
# else
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment