Skip to content

Instantly share code, notes, and snippets.

@tetsu-koba
Created July 21, 2011 01:38
Show Gist options
  • Save tetsu-koba/1096329 to your computer and use it in GitHub Desktop.
Save tetsu-koba/1096329 to your computer and use it in GitHub Desktop.
Android patch for ruby-1.9.2-p290.
diff -u -r ruby-1.9.2-p290/configure ruby-1.9.2-p290.android/configure
--- ruby-1.9.2-p290/configure 2011-07-15 22:00:12.000000000 +0900
+++ ruby-1.9.2-p290.android/configure 2011-07-20 17:50:46.864371770 +0900
@@ -13855,7 +13855,9 @@
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- as_fn_error $? "cannot check setpgrp when cross compiling" "$LINENO" 5
+ #as_fn_error $? "cannot check setpgrp when cross compiling" "$LINENO" 5
+ # hack for Android
+ ac_cv_func_setpgrp_void=yes
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15373,7 +15375,10 @@
LDFLAGS="$LDFLAGS -Zomf"
;; #(
*) :
- : ${LDSHARED='ld'} ;;
+# : ${LDSHARED='ld'} ;;
+# hack for Android
+ : ${LDSHARED='$(CC) -shared'} ;;
+
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rb_cv_dlopen" >&5
$as_echo "$rb_cv_dlopen" >&6; }
diff -u -r ruby-1.9.2-p290/dir.c ruby-1.9.2-p290.android/dir.c
--- ruby-1.9.2-p290/dir.c 2010-11-24 18:37:36.000000000 +0900
+++ ruby-1.9.2-p290.android/dir.c 2011-07-19 14:21:26.544317863 +0900
@@ -702,8 +702,13 @@
static VALUE
dir_set_pos(VALUE dir, VALUE pos)
{
+/* hack for Android*/
+#ifdef HAVE_SEEKDIR
dir_seek(dir, pos);
return pos;
+#else
+ rb_notimplement();
+#endif
}
/*
diff -u -r ruby-1.9.2-p290/eval_intern.h ruby-1.9.2-p290.android/eval_intern.h
--- ruby-1.9.2-p290/eval_intern.h 2010-12-20 22:22:26.000000000 +0900
+++ ruby-1.9.2-p290.android/eval_intern.h 2011-07-19 15:46:05.684317508 +0900
@@ -214,8 +214,12 @@
void rb_trap_restore_mask(void);
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
+#ifdef __ANDROID__
+#define CharNext(p) ((p) + 1)
+#else
#define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
#endif
+#endif
#if defined DOSISH || defined __CYGWIN__
static inline void
diff -u -r ruby-1.9.2-p290/ext/nkf/nkf-utf8/nkf.h ruby-1.9.2-p290.android/ext/nkf/nkf-utf8/nkf.h
--- ruby-1.9.2-p290/ext/nkf/nkf-utf8/nkf.h 2010-04-22 17:04:13.000000000 +0900
+++ ruby-1.9.2-p290.android/ext/nkf/nkf-utf8/nkf.h 2011-07-19 14:29:36.054310422 +0900
@@ -164,6 +164,10 @@
# ifndef HAVE_LOCALE_H
# define HAVE_LOCALE_H
# endif
+#elif defined(__ANDROID__)
+# ifndef HAVE_LOCALE_H
+# define HAVE_LOCALE_H
+# endif
#else
# ifndef HAVE_LANGINFO_H
# define HAVE_LANGINFO_H
diff -u -r ruby-1.9.2-p290/ext/socket/rubysocket.h ruby-1.9.2-p290.android/ext/socket/rubysocket.h
--- ruby-1.9.2-p290/ext/socket/rubysocket.h 2010-11-15 20:43:58.000000000 +0900
+++ ruby-1.9.2-p290.android/ext/socket/rubysocket.h 2011-07-20 20:33:00.903593231 +0900
@@ -162,6 +162,10 @@
#define close closesocket
#endif
+#if defined(__ANDROID__)
+#undef IPV6_PKTINFO
+#endif
+
#define INET_CLIENT 0
#define INET_SERVER 1
#define INET_SOCKS 2
diff -u -r ruby-1.9.2-p290/include/ruby/defines.h ruby-1.9.2-p290.android/include/ruby/defines.h
--- ruby-1.9.2-p290/include/ruby/defines.h 2009-12-30 19:44:02.000000000 +0900
+++ ruby-1.9.2-p290.android/include/ruby/defines.h 2011-07-19 14:09:40.934317381 +0900
@@ -209,6 +209,8 @@
#include <net/socket.h> /* intern.h needs fd_set definition */
#elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H)
# include <sys/select.h>
+#elif defined (__ANDROID__)
+# include <sys/select.h>
#endif
#ifdef __SYMBIAN32__
diff -u -r ruby-1.9.2-p290/thread_pthread.h ruby-1.9.2-p290.android/thread_pthread.h
--- ruby-1.9.2-p290/thread_pthread.h 2010-02-04 16:17:03.000000000 +0900
+++ ruby-1.9.2-p290.android/thread_pthread.h 2011-07-19 15:19:38.364734619 +0900
@@ -11,6 +11,9 @@
#ifndef RUBY_THREAD_PTHREAD_H
#define RUBY_THREAD_PTHREAD_H
+#if defined (__ANDROID__)
+#include <asm/page.h>
+#endif
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment