diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 02:11:53 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 02:11:53 +0000 |
commit | 69ac654c90178dce12c3365afbc03447a0fccf78 (patch) | |
tree | 390fb7f7cd6f0888e0c321b8049f0471dd2ca205 /nacl | |
parent | f21431e574b1b27e47d19ff40ce2997783d310e3 (diff) |
Merges a patch form naclports.
* configure.in (RUBY_NACL and others): Supports PNaCl.
* dln.c: replace the old hacky dynamic loading over HTTP with nacl_io.
* file.c: tenatively use access(2) instead of eaccess.
(rb_file_load_ok): weaken with attribute but not by postprocess.
* io.c (socket.h): now NaCl has socket.h
(flock): disable here instead of nacl/ioctl.h
* nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
respect path to them if they are absolute.
This helps naclports to build ruby in their source tree.
(PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
(ruby.o, file.o): move the hack to attributes in ruby.c and file.c
* nacl/ioctl.h: removed. move the hack to io.c.
* nacl/nacl-config.rb: support arm, pnacl and others.
* nacl/pepper_main.c: support build in a naclports tree.
* ruby.c (rb_load_file): weaken with attribute but not by postprocess.
The patch is by [email protected] and the Native Client Authors.
It is available at:
* https://chromium.googlesource.com/external/naclports.git/+/873ca4910a5f9d4206306aacb4ed79c587c6a5f3/ports/ruby/nacl.patch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'nacl')
-rw-r--r-- | nacl/GNUmakefile.in | 41 | ||||
-rw-r--r-- | nacl/README.nacl | 4 | ||||
-rw-r--r-- | nacl/ioctl.h | 7 | ||||
-rwxr-xr-x | nacl/nacl-config.rb | 14 | ||||
-rw-r--r-- | nacl/pepper_main.c | 6 |
5 files changed, 36 insertions, 36 deletions
diff --git a/nacl/GNUmakefile.in b/nacl/GNUmakefile.in index c1aaa36c7c..0ad8a29ee5 100644 --- a/nacl/GNUmakefile.in +++ b/nacl/GNUmakefile.in @@ -7,45 +7,54 @@ include Makefile NACL_SDK_ROOT=@NACL_SDK_ROOT@ NACL_TOOLCHAIN=@NACL_TOOLCHAIN@ NACL_TOOLCHAIN_DIR=$(NACL_SDK_ROOT)/toolchain/$(NACL_TOOLCHAIN) + +# Don't override CC/LD/etc if they are already set to absolute +# paths (this is the case when building in the naclports tree). +ifeq ($(dir $(CC)),./) CC:=$(NACL_TOOLCHAIN_DIR)/bin/$(CC) +endif +ifeq ($(dir $(LD)),./) LD:=$(NACL_TOOLCHAIN_DIR)/bin/$(LD) +endif +ifeq ($(dir $(NM)),./) NM:=$(NACL_TOOLCHAIN_DIR)/bin/$(NM) +endif +ifeq ($(dir $(AR)),./) AR:=$(NACL_TOOLCHAIN_DIR)/bin/$(AR) +endif +ifeq ($(dir $(AS)),./) AS:=$(NACL_TOOLCHAIN_DIR)/bin/$(AS) +endif +ifeq ($(dir $(RANLIB)),./) RANLIB:=$(NACL_TOOLCHAIN_DIR)/bin/$(RANLIB) +endif +ifeq ($(dir $(OBJDUMP)),./) OBJDUMP:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJDUMP) +endif +ifeq ($(dir $(OBJCOPY)),./) OBJCOPY:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJCOPY) +endif PYTHON=@PYTHON@ PPROGRAM=pepper-$(PROGRAM) PEPPER_LIBS=-lppapi -PROGRAM_NMF=$(PROGRAM:.nexe=.nmf) -PPROGRAM_NMF=$(PPROGRAM:.nexe=.nmf) +PROGRAM_NMF=$(PROGRAM:$(EXEEXT)=.nmf) +PPROGRAM_NMF=$(PPROGRAM:$(EXEEXT)=.nmf) GNUmakefile: $(srcdir)/nacl/GNUmakefile.in $(PPROGRAM): $(PROGRAM) pepper_main.$(OBJEXT) $(Q)$(MAKE) $(MFLAGS) PROGRAM=$(PPROGRAM) MAINOBJ="pepper_main.$(OBJEXT)" LIBS="$(LIBS) $(PEPPER_LIBS)" program -$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=.nexe) nacl/create_nmf.rb +$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=$(EXEEXT)) nacl/create_nmf.rb .PHONY: pprogram package show_naclflags -.SUFFIXES: .nexe .nmf -.nexe.nmf: +.SUFFIXES: $(EXEEXT) .nmf +$(EXEEXT).nmf: $(ECHO) generating manifest $@ - $(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=.nexe) $@ + $(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=$(EXEEXT)) $@ pepper_main.$(OBJEXT): $(srcdir)/nacl/pepper_main.c @$(ECHO) compiling nacl/pepper_main.c $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $(srcdir)/nacl/pepper_main.c -ruby.$(OBJEXT): - @$(ECHO) compiling $< - $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)[email protected] -c $< - $(Q) $(OBJCOPY) --weaken-symbol=rb_load_file [email protected] $@ - @-$(RM) [email protected] -file.$(OBJEXT): - @$(ECHO) compiling $< - $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)[email protected] -c $< - $(Q) $(OBJCOPY) --weaken-symbol=rb_file_load_ok [email protected] $@ - @-$(RM) [email protected] .rbconfig.time: @$(MAKE) .rbconfig.raw.time RBCONFIG=.rbconfig.raw.time diff --git a/nacl/README.nacl b/nacl/README.nacl index 471c3b5e5f..ef2c3d1fa4 100644 --- a/nacl/README.nacl +++ b/nacl/README.nacl @@ -6,14 +6,14 @@ You need to install the following things before building NaCl port of Ruby. * Ruby 1.9.3 or later * Python 2.6 or later -* NativeClient SDK pepper 22 or later +* NativeClient SDK pepper 37 or later * GNU make == Steps (1) Extract all files from the tarball: $ tar xzf ruby-X.Y.Z.tar.gz (2) Set NACL_SDK_ROOT environment variable to the path to the Native Client SDK you installed: - $ export NACL_SDK_ROOT=/home/yugui/src/nacl_sdk/pepper_16 + $ export NACL_SDK_ROOT=/home/yugui/src/nacl_sdk/pepper_37 (3) Configure $ ./configure --prefix=/tmp/nacl-ruby --host=x86_64-nacl --with-baseruby=/path/to/ruby-1.9.3 (4) Make diff --git a/nacl/ioctl.h b/nacl/ioctl.h deleted file mode 100644 index 0a18eeb3f5..0000000000 --- a/nacl/ioctl.h +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2012 Google Inc. All Rights Reserved. -// Author: [email protected] (Yugui Sonoda) -#ifndef RUBY_NACL_IOCTL_H -#define RUBY_NACL_IOCTL_H -int ioctl(int fd, int request, ...); -struct flock{}; -#endif diff --git a/nacl/nacl-config.rb b/nacl/nacl-config.rb index 2da05c0847..732de1dee3 100755 --- a/nacl/nacl-config.rb +++ b/nacl/nacl-config.rb @@ -27,14 +27,12 @@ module NaClConfig INSTALL_PROGRAM = config['INSTALL_PROGRAM'] INSTALL_LIBRARY = config['INSTALL_DATA'] - SEL_LDR = [ - File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "sel_ldr_#{cpu_nick}"), - File.join(SDK_ROOT, 'tools', "sel_ldr_#{cpu_nick}") - ].find{|path| File.executable?(path)} or raise "No sel_ldr found" - IRT_CORE = [ - File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "irt_core_#{cpu_nick}.nexe"), - File.join(SDK_ROOT, 'tools', "irt_core_#{cpu_nick}.nexe") - ].find{|path| File.exist?(path)} or raise "No irt_core found" + if cpu_nick == 'x86_64' or cpu_nick == 'x86_32' + SEL_LDR = File.join(SDK_ROOT, 'tools', "sel_ldr_#{cpu_nick}") + IRT_CORE = File.join(SDK_ROOT, 'tools', "irt_core_#{cpu_nick}.nexe") + raise "No sel_ldr found" if not File.executable?(SEL_LDR) + raise "No irt_core found" if not File.exists?(IRT_CORE) + end RUNNABLE_LD = File.join(HOST_LIB, 'runnable-ld.so') module_function diff --git a/nacl/pepper_main.c b/nacl/pepper_main.c index 1ccafd9332..e8d01ad078 100644 --- a/nacl/pepper_main.c +++ b/nacl/pepper_main.c @@ -210,7 +210,7 @@ pruby_async_return_value(void* data, VALUE value) static struct PP_Var pruby_cstr_to_var(const char* str) { -#ifdef PPB_VAR_INTERFACE_1_0 +#ifndef PPB_VAR_INTERFACE_1_1 if (var_interface != NULL) return var_interface->VarFromUtf8(module_id, str, strlen(str)); return PP_MakeUndefined(); @@ -252,7 +252,7 @@ pruby_str_to_var(volatile VALUE str) fprintf(stderr, "[BUG] Unexpected object type: %x\n", TYPE(str)); exit(EXIT_FAILURE); } -#ifdef PPB_VAR_INTERFACE_1_0 +#ifndef PPB_VAR_INTERFACE_1_1 if (var_interface != NULL) { return var_interface->VarFromUtf8(module_id, RSTRING_PTR(str), RSTRING_LEN(str)); } @@ -517,7 +517,7 @@ static void Instance_DidDestroy(PP_Instance instance) { * the top left of the plugin's coordinate system (not the page). If the * plugin is invisible, @a clip will be (0, 0, 0, 0). */ -#ifdef PPP_INSTANCE_INTERFACE_1_0 +#ifndef PPP_INSTANCE_INTERFACE_1_1 static void Instance_DidChangeView(PP_Instance instance, const struct PP_Rect* position, |