camlspotter avatar camlspotter committed fbe8692

added the patch

Comments (0)

Files changed (1)

ocaml-android-3.12.1-ndk_r7.patch

+diff -urN ocaml-3.12.1/Makefile ocaml-target/Makefile
+--- ocaml-3.12.1/Makefile	2010-06-16 10:32:26.000000000 +0900
++++ ocaml-target/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -395,7 +395,11 @@
+ 	    -e 's|%%MKDLL%%|$(MKDLL)|' \
+ 	    -e 's|%%MKEXE%%|$(MKEXE)|' \
+ 	    -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \
+-	    utils/config.mlp > utils/config.ml
++	    -e 's|%%MKDLL_EXTRA%%|$(MKDLL_EXTRA)|' \
++	    -e 's|%%MKEXE_EXTRA%%|$(MKEXE_EXTRA)|' \
++	    -e 's|%%MKMAINDLL_EXTRA%%|$(MKMAINDLL_EXTRA)|' \
++        -e 's|%%AR%%|$(AR)|' \
++        utils/config.mlp > utils/config.ml
+ 	@chmod -w utils/config.ml
+ 
+ partialclean::
+@@ -439,7 +443,7 @@
+ 	cd asmrun; $(MAKE) meta.o dynlink.o
+ 	$(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \
+ 	  $(COMPOBJS:.cmo=.cmx) \
+-	  asmrun/meta.o asmrun/dynlink.o -cclib "$(BYTECCLIBS)"
++	  asmrun/meta.o asmrun/dynlink.o
+ 	@sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \
+ 	  driver/ocamlcomp.sh.in > ocamlcomp.sh
+ 	@chmod +x ocamlcomp.sh
+diff -urN ocaml-3.12.1/asmrun/Makefile ocaml-target/asmrun/Makefile
+--- ocaml-3.12.1/asmrun/Makefile	2010-04-21 00:47:15.000000000 +0900
++++ ocaml-target/asmrun/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -38,12 +38,12 @@
+ 
+ libasmrun.a: $(OBJS)
+ 	rm -f libasmrun.a
+-	ar rc libasmrun.a $(OBJS)
++	$(AR) rc libasmrun.a $(OBJS)
+ 	$(RANLIB) libasmrun.a
+ 
+ libasmrund.a: $(DOBJS)
+ 	rm -f libasmrund.a
+-	ar rc libasmrund.a $(DOBJS)
++	$(AR) rc libasmrund.a $(DOBJS)
+ 	$(RANLIB) libasmrund.a
+ 
+ all-noprof:
+@@ -52,7 +52,7 @@
+ 
+ libasmrunp.a: $(POBJS)
+ 	rm -f libasmrunp.a
+-	ar rc libasmrunp.a $(POBJS)
++	$(AR) rc libasmrunp.a $(POBJS)
+ 	$(RANLIB) libasmrunp.a
+ 
+ install: install-default install-$(PROFILING)
+diff -urN ocaml-3.12.1/asmrun/signals_osdep.h ocaml-target/asmrun/signals_osdep.h
+--- ocaml-3.12.1/asmrun/signals_osdep.h	2009-05-20 20:52:42.000000000 +0900
++++ ocaml-target/asmrun/signals_osdep.h	2012-02-03 01:49:29.000000000 +0900
+@@ -78,7 +78,7 @@
+ 
+ /****************** ARM, Linux */
+ 
+-#elif defined(TARGET_arm) && defined (SYS_linux)
++#elif defined(TARGET_arm) && defined (SYS_linux) && !defined (ANDROID)
+ 
+   #include <sys/ucontext.h>
+ 
+diff -urN ocaml-3.12.1/byterun/Makefile ocaml-target/byterun/Makefile
+--- ocaml-3.12.1/byterun/Makefile	2010-07-28 22:19:44.000000000 +0900
++++ ocaml-target/byterun/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -36,11 +36,11 @@
+ 		  prims.o libcamlrund.a $(BYTECCLIBS)
+ 
+ libcamlrun.a: $(OBJS)
+-	ar rc libcamlrun.a $(OBJS)
++	$(AR) rc libcamlrun.a $(OBJS)
+ 	$(RANLIB) libcamlrun.a
+ 
+ libcamlrund.a: $(DOBJS)
+-	ar rc libcamlrund.a $(DOBJS)
++	$(AR) rc libcamlrund.a $(DOBJS)
+ 	$(RANLIB) libcamlrund.a
+ 
+ libcamlrun_shared.so: $(PICOBJS)
+diff -urN ocaml-3.12.1/byterun/sys.c ocaml-target/byterun/sys.c
+--- ocaml-3.12.1/byterun/sys.c	2011-05-13 00:12:14.000000000 +0900
++++ ocaml-target/byterun/sys.c	2012-02-03 01:49:29.000000000 +0900
+@@ -51,7 +51,7 @@
+ #include "stacks.h"
+ #include "sys.h"
+ 
+-#ifndef _WIN32
++#if !defined(_WIN32) && !defined(ANDROID)
+ extern int errno;
+ #endif
+ 
+diff -urN ocaml-3.12.1/config/Makefile ocaml-target/config/Makefile
+--- ocaml-3.12.1/config/Makefile	1970-01-01 09:00:00.000000000 +0900
++++ ocaml-target/config/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -0,0 +1,116 @@
++### designated for Android NDK r6
++
++### 1. EDIT BELOW ------------------------------------
++PREFIX=/Users/keigoi/usr/ocaml-android
++
++## the directory where gcc stays
++ARM_EABI_GCC=/Users/keigoi/Documents/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86
++## the directory where libgcc.a stays
++ARM_EABI_GCCLIB=$(ARM_EABI_GCC)/lib/gcc/arm-linux-androideabi/4.4.3
++## the directory where /usr/lib/libc.so stays
++ANDROID_PLATFORM=/Users/keigoi/Documents/android-ndk-r7/platforms/android-3/arch-arm
++
++#ml let mklib out files opts = Printf.sprintf "/Users/keigoi/Documents/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ar rc %s %s %s; /Users/keigoi/Documents/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib %s" out opts files out;;
++### 1. EDIT ABOVE ------------------------------------
++
++
++### ANDROID_GCC=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -nostdlib -isystem$(ANDROID_PLATFORM)/usr/include
++ANDROID_GCC=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc
++ANDROID_COMP_OPTS=-isystem$(ANDROID_PLATFORM)/usr/include -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -O0 -g -c -MMD -MP -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -DANDROID -D__BEOS__ -D__ARM_EABI__
++ANDROID_LINK_OPTS=-nostdlib -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc
++
++ANDROID_LIBS=-l:$(ARM_EABI_GCCLIB)/libgcc.a -L$(ANDROID_PLATFORM)/usr/lib -lc -lm -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-rpath-link=$(ANDROID_PLATFORM)/usr/lib
++
++AR=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-ar 
++BYTECC=$(ANDROID_GCC)
++BYTECCCOMPOPTS=$(ANDROID_COMP_OPTS)
++BYTECCLINKOPTS=$(ANDROID_LINK_OPTS)
++BYTECCLIBS=$(ANDROID_LIBS)
++BYTECCRPATH=
++
++NATIVECC=$(ANDROID_GCC)
++NATIVECCCOMPOPTS=$(ANDROID_COMP_OPTS)
++NATIVECCPROFOPTS=$(ANDROID_COMP_OPTS)
++NATIVECCLINKOPTS=$(ANDROID_LINK_OPTS)
++NATIVECCRPATH=
++NATIVECCLIBS=$(ANDROID_LIBS)
++
++PARTIALLD=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-ld -r
++PACKLD=$(PARTIALLD) -dynamic-linker /system/bin/linker -z nocopyreloc -o\ 
++
++MKEXE=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -nostdlib $(ANDROID_LINK_OPTS) $(ANDROID_PLATFORM)/usr/lib/crtbegin_dynamic.o
++MKEXE_EXTRA=$(ANDROID_PLATFORM)/usr/lib/crtend_android.o
++### MKDLL=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -shared -flat_namespace -nostdlib -Wl,-soname,$(TARGET) -Wl,-shared,-Bsymbolic $(OBJ) -Wl,--whole-archive -Wl,--no-whole-archive $(ANDROID_LIBS)
++MKDLL=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -shared -nostdlib -Wl,-shared,-Bsymbolic
++MKDLL_EXTRA=
++MKMAINDLL=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -shared -nostdlib -Wl,-shared,-Bsymbolic
++MKMAINDLL_EXTRA=
++
++RANLIB=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-ranlib
++RANLIBCMD=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-ranlib
++
++### How to build a static library
++MKLIB=$(AR) $(1) $(2); $(ARM_EABI_GCC)/bin/arm-linux-androideabi-ranlib $(1)
++
++ASPPPROFFLAGS=-DPROFILING
++ASPP=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-gcc -c
++ASM=$(ARM_EABI_GCC)/bin/arm-linux-androideabi-as
++
++### NATDYNLINK=true
++NATDYNLINK=false
++
++
++
++
++BINDIR=$(PREFIX)/bin
++LIBDIR=$(PREFIX)/lib/ocaml
++STUBLIBDIR=$(LIBDIR)/stublibs
++MANDIR=$(PREFIX)/man
++MANEXT=1
++SHARPBANGSCRIPTS=true
++BNG_ARCH=generic
++BNG_ASM_LEVEL=0
++### PTHREAD_LINK=-cclib -lpthread
++PTHREAD_LINK=
++X11_INCLUDES=-I/usr/X11R6/include
++X11_LINK=-L/usr/X11R6/lib -lX11
++DBM_INCLUDES=
++DBM_LINK=
++TK_DEFS=
++TK_LINK=
++LIBBFD_LINK=
++EXE=
++### SUPPORTS_SHARED_LIBRARIES=true
++SUPPORTS_SHARED_LIBRARIES=false
++SHAREDCCCOMPOPTS=
++MKSHAREDLIBRPATH=
++NATDYNLINKOPTS=
++SYSLIB=-l$(1)
++#ml let syslib x = "-l"^x;;
++
++ARCH=arm
++MODEL=default
++SYSTEM=linux
++
++PROFILING=prof
++DYNLINKOPTS=
++### OTHERLIBRARIES=unix str num dynlink bigarray systhreads threads graph dbm labltk
++OTHERLIBRARIES=unix str num bigarray dynlink
++DEBUGGER=ocamldebugger
++CC_PROFILE=-pg
++### SYSTHREAD_SUPPORT=true
++SYSTHREAD_SUPPORT=false
++
++DLLCCCOMPOPTS=
++IFLEXDIR=
++O=o
++A=a
++SO=so
++EXT_OBJ=.o
++EXT_ASM=.s
++EXT_LIB=.a
++EXT_DLL=.so
++EXTRALIBS=
++CCOMPTYPE=cc
++TOOLCHAIN=cc
++CMXS=cmxs
+diff -urN ocaml-3.12.1/config/m.h ocaml-target/config/m.h
+--- ocaml-3.12.1/config/m.h	1970-01-01 09:00:00.000000000 +0900
++++ ocaml-target/config/m.h	2012-02-03 01:50:00.000000000 +0900
+@@ -0,0 +1,15 @@
++#ifndef __PIC__
++#  define ARCH_CODE32
++#endif
++#undef ARCH_SIXTYFOUR
++#define SIZEOF_INT 4
++#define SIZEOF_LONG 4
++#define SIZEOF_PTR 4
++#define SIZEOF_SHORT 2
++#define ARCH_INT64_TYPE long long
++#define ARCH_UINT64_TYPE unsigned long long 
++#define ARCH_INT64_PRINTF_FORMAT "ll"
++#undef ARCH_BIG_ENDIAN
++#undef ARCH_ALIGN_DOUBLE
++#undef ARCH_ALIGN_INT64
++#undef NONSTANDARD_DIV_MOD
+diff -urN ocaml-3.12.1/config/s.h ocaml-target/config/s.h
+--- ocaml-3.12.1/config/s.h	1970-01-01 09:00:00.000000000 +0900
++++ ocaml-target/config/s.h	2012-02-03 01:49:29.000000000 +0900
+@@ -0,0 +1,46 @@
++#define OCAML_OS_TYPE "Unix"
++#define OCAML_STDLIB_DIR "/usr/local/androidocamlhead/lib/ocaml"
++/*#define POSIX_SIGNALS
++#define HAS_GETRUSAGE
++#define HAS_TIMES
++#define HAS_TERMCAP*/
++#define HAS_SOCKETS
++#define HAS_SOCKLEN_T
++#define HAS_INET_ATON
++#define HAS_IPV6
++#define HAS_UNISTD
++#define HAS_OFF_T
++#define HAS_DIRENT
++#define HAS_REWINDDIR
++#define HAS_LOCKF
++#define HAS_MKFIFO
++#define HAS_GETCWD
++#define HAS_GETWD
++#define HAS_GETPRIORITY
++#define HAS_UTIME
++#define HAS_UTIMES
++#define HAS_DUP2
++#define HAS_FCHMOD
++#define HAS_TRUNCATE
++#define HAS_SYS_SELECT_H
++#define HAS_SELECT
++#define HAS_SYMLINK
++#define HAS_WAITPID
++#define HAS_WAIT4
++#define HAS_GETGROUPS
++#define HAS_SETGROUPS
++#define HAS_INITGROUPS
++#define HAS_TERMIOS
++#define HAS_ASYNC_IO
++#define HAS_SETITIMER
++#define HAS_GETHOSTNAME
++#define HAS_UNAME
++#define HAS_GETTIMEOFDAY
++#define HAS_MKTIME
++#define HAS_SETSID
++#define HAS_PUTENV
++#define HAS_LOCALE
++/*#define SUPPORT_DYNAMIC_LINKING*/
++#define HAS_MMAP
++/*#define HAS_STACK_OVERFLOW_DETECTION
++#define HAS_SIGWAIT*/
+diff -urN ocaml-3.12.1/ocamldoc/Makefile ocaml-target/ocamldoc/Makefile
+--- ocaml-3.12.1/ocamldoc/Makefile	2011-05-02 22:14:14.000000000 +0900
++++ ocaml-target/ocamldoc/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -188,7 +188,7 @@
+ 	../otherlibs/bigarray/bigarray.mli \
+ 	../otherlibs/num/num.mli
+ 
+-all: exe lib manpages
++all: exe lib
+ 
+ exe: $(OCAMLDOC)
+ lib: $(OCAMLDOC_LIBCMA) $(OCAMLDOC_LIBCMI) $(ODOC_TEST)
+diff -urN ocaml-3.12.1/otherlibs/unix/termios.c ocaml-target/otherlibs/unix/termios.c
+--- ocaml-3.12.1/otherlibs/unix/termios.c	2010-01-22 21:48:24.000000000 +0900
++++ ocaml-target/otherlibs/unix/termios.c	2012-02-03 01:49:29.000000000 +0900
+@@ -265,12 +265,21 @@
+   return Val_unit;
+ }
+ 
++#if defined(ANDROID)
++
++CAMLprim value unix_tcdrain(value fd)
++{ invalid_argument("tcdrain not implemented"); }
++
++#else
++
+ CAMLprim value unix_tcdrain(value fd)
+ {
+   if (tcdrain(Int_val(fd)) == -1) uerror("tcdrain", Nothing);
+   return Val_unit;
+ }
+ 
++#endif
++
+ static int queue_flag_table[] = {
+   TCIFLUSH, TCOFLUSH, TCIOFLUSH
+ };
+diff -urN ocaml-3.12.1/utils/ccomp.ml ocaml-target/utils/ccomp.ml
+--- ocaml-3.12.1/utils/ccomp.ml	2010-04-28 21:09:32.000000000 +0900
++++ ocaml-target/utils/ccomp.ml	2012-02-03 01:49:29.000000000 +0900
+@@ -74,7 +74,7 @@
+                              quoted_archive (quote_files file_list))
+   | _ ->
+       let r1 =
+-        command(Printf.sprintf "ar rc %s %s"
++        command(Config.ar ^ Printf.sprintf " rc %s %s"
+                 quoted_archive (quote_files file_list)) in
+       if r1 <> 0 || String.length Config.ranlib = 0
+       then r1
+@@ -108,7 +108,7 @@
+         files
+         extra
+     else
+-      Printf.sprintf "%s -o %s %s %s %s %s %s %s"
++      Printf.sprintf "%s -o %s %s %s %s %s %s %s %s"
+         (match !Clflags.c_compiler, mode with
+         | Some cc, _ -> cc
+         | None, Exe -> Config.mkexe
+@@ -123,5 +123,10 @@
+         (String.concat " " (List.rev !Clflags.ccopts))
+         files
+         extra
++        (match mode with
++        | Exe -> Config.exe_extra
++        | Dll -> Config.dll_extra
++        | MainDll -> Config.maindll_extra
++        | Partial -> assert false)
+   in
+   command cmd = 0
+diff -urN ocaml-3.12.1/utils/config.mli ocaml-target/utils/config.mli
+--- ocaml-3.12.1/utils/config.mli	2010-05-19 20:29:38.000000000 +0900
++++ ocaml-target/utils/config.mli	2012-02-03 01:49:29.000000000 +0900
+@@ -115,3 +115,8 @@
+         (* Whether the system thread library is implemented *)
+ 
+ val print_config : out_channel -> unit;;
++
++val ar : string
++val exe_extra : string
++val dll_extra : string
++val maindll_extra : string
+diff -urN ocaml-3.12.1/utils/config.mlp ocaml-target/utils/config.mlp
+--- ocaml-3.12.1/utils/config.mlp	2010-05-19 20:29:38.000000000 +0900
++++ ocaml-target/utils/config.mlp	2012-02-03 01:49:29.000000000 +0900
+@@ -119,3 +119,8 @@
+   p_bool "systhread_supported" systhread_supported;
+   flush oc;
+ ;;
++
++let ar = "%%AR%%"
++let exe_extra = "%%MKEXE_EXTRA%%"
++let dll_extra = "%%MKDLL_EXTRA%%"
++let maindll_extra = "%%MKMAINDLL_EXTRA%%"
+diff -urN ocaml-3.12.1/yacc/Makefile ocaml-target/yacc/Makefile
+--- ocaml-3.12.1/yacc/Makefile	2010-05-21 20:28:21.000000000 +0900
++++ ocaml-target/yacc/Makefile	2012-02-03 01:49:29.000000000 +0900
+@@ -25,7 +25,7 @@
+ all: ocamlyacc$(EXE)
+ 
+ ocamlyacc$(EXE): $(OBJS)
+-	$(CC) $(CFLAGS) $(CCLINKFLAGS) -o ocamlyacc $(OBJS)
++	$(MKEXE) $(BYTECCLINKOPTS) -o ocamlyacc $(OBJS) $(BYTECCLIBS)
+ 
+ version.h : ../VERSION
+ 	echo "#define OCAML_VERSION \"`sed -e 1q ../VERSION`\"" >version.h
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.