Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Allow to build both 32 and 64-bit nexes, and serve them together. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | ferrieux-nacl |
Files: | files | file ages | folders |
SHA1: |
d0dd0f5238528af2af7cec1c260c62c5 |
User & Date: | ferrieux 2011-04-12 21:52:10 |
Context
2011-04-14
| ||
21:10 | Balls demo -- better status display during Nacl load. Added setup and troubleshooting instructions. check-in: 6bc9b780a1 user: ferrieux tags: ferrieux-nacl | |
2011-04-12
| ||
21:52 | Allow to build both 32 and 64-bit nexes, and serve them together. check-in: d0dd0f5238 user: ferrieux tags: ferrieux-nacl | |
2011-04-11
| ||
21:40 | Fix wobbling by int($x+0.5) check-in: 164a94c046 user: ferrieux tags: ferrieux-nacl | |
Changes
Changes to nacl/Makefile.patch.
︙ | ︙ | |||
38 39 40 41 42 43 44 | -COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o +#COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o +IGNORE_COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o AC_FLAGS = -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\" -DPACKAGE_STRING=\"tcl\ 8.6\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DNO_DLFCN_H=1 -DHAVE_SYS_PARAM_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DSTATIC_BUILD=1 -DHAVE_ZLIB=1 -DMODULE_SCOPE=extern -DTCL_SHLIB_EXT=\".so\" -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_TYPE=long\ long -DUSEGETWD=1 -DHAVE_MKSTEMP=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DNO_GETWD=1 -DNO_WAIT3=1 -DNO_UNAME=1 -DNO_REALPATH=1 -DNEED_FAKE_RFC2553=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_BLKCNT_T=1 -DNO_FSTATFS=1 -Dstrtod=fixstrtod -Dsocklen_t=int -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DNO_UNION_WAIT=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_MKSTEMPS=1 -DTCL_UNLOAD_DLLS=1 AR = nacl-ar | < < < < < < < < < | | | | < < < < | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | -COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o +#COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o +IGNORE_COMPAT_OBJS = waitpid.o fake-rfc2553.o memcmp.o strstr.o strtoul.o strtod.o fixstrtod.o AC_FLAGS = -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\" -DPACKAGE_STRING=\"tcl\ 8.6\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -DNO_DLFCN_H=1 -DHAVE_SYS_PARAM_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DSTATIC_BUILD=1 -DHAVE_ZLIB=1 -DMODULE_SCOPE=extern -DTCL_SHLIB_EXT=\".so\" -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_TYPE=long\ long -DUSEGETWD=1 -DHAVE_MKSTEMP=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DNO_GETWD=1 -DNO_WAIT3=1 -DNO_UNAME=1 -DNO_REALPATH=1 -DNEED_FAKE_RFC2553=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_BLKCNT_T=1 -DNO_FSTATFS=1 -Dstrtod=fixstrtod -Dsocklen_t=int -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DNO_UNION_WAIT=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_MKSTEMPS=1 -DTCL_UNLOAD_DLLS=1 AR = nacl-ar @@ -335,12 +346,13 @@ STUB_LIB_OBJS = tclStubLib.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} -UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ +UNIX_OBJS = naclMissing.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ tclUnixFile.o tclUnixPipe.o tclUnixSock.o \ tclUnixTime.o tclUnixInit.o tclUnixThrd.o \ tclUnixCompat.o NOTIFY_OBJS = tclUnixNotfy.o +IGN = MAC_OSX_OBJS = tclMacOSXBundle.o tclMacOSXFCmd.o tclMacOSXNotify.o @@ -600,7 +612,7 @@ all: binaries libraries doc packages -binaries: ${LIB_FILE} $(STUB_LIB_FILE) ${TCL_EXE} +binaries: ${LIB_FILE} $(STUB_LIB_FILE) tcl$(arch).nexe libraries: @@ -634,14 +646,30 @@ # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above ${NATIVE_TCLSH}: -Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in - $(SHELL) config.status +init.tcl.c: ../library/init.tcl init.natcl + cat $^ | tools/tocstr > $@ + +tclUnixPort.h: ../unix/tclUnixPort.h tclUnixPort.h.patch + cat ../unix/tclUnixPort.h > tclUnixPort.h + patch -p0 < tclUnixPort.h.patch + +naclMain.o: naclMain.c init.tcl.c + $(CC) -c $(CC_SWITCHES) naclMain.c + +tcl$(arch).nexe: naclMain.o libtcl8.6.a + $(CCPLUS) $^ $(LDFLAGS) -o $@ + +$(TCL_OBJS) $(STUB_LIB_OBJS) $(TCLSH_OBJS) $(TCLTEST_OBJS): tclUnixPort.h + +#Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in +# $(SHELL) config.status #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in # $(SHELL) config.status clean: clean-packages rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ - errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl + errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl \ + init.tcl.c tclUnixPort.h cd dltest ; $(MAKE) clean distclean: distclean-packages clean @@ -794,7 +826,6 @@ echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ $(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE)) ; \ fi |
︙ | ︙ |
Changes to nacl/README.
1 2 3 4 5 6 7 8 9 10 11 12 | NaTcl : Tcl in Nacl Overview -------- NaCl == Native Client is Google's neat sandboxing technology, allowing to run untrusted code compiled natively, in the context of a browser. See http://code.google.com/p/nativeclient/. The idea is that with Tcl running in this context, and a supporting | | < < | < > > | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | NaTcl : Tcl in Nacl Overview -------- NaCl == Native Client is Google's neat sandboxing technology, allowing to run untrusted code compiled natively, in the context of a browser. See http://code.google.com/p/nativeclient/. The idea is that with Tcl running in this context, and a supporting browser (currently, Chrome only; in the future, other browsers too), one could develop client-side code mainly in Tcl, with a very thin layer of JS in the page; so, basically, Tcl to control the HTML5 DOM ! Building Tcl for Nacl --------------------- - install the NaCl SDK (for me native_client_sdk_0_1_721_0) - set your PATH so that nacl-gcc et al become reachable - cd (Tcl-source-tree)/nacl - run './configure' (which calls ../unix/configure with proper flags, and patches the generated Makefile) - run 'make'. This creates tcl.nmf and tcl32.nexe or tcl64.nexe, depending on the kind of x86 you're currently on. - (optional) to also build the other kind, do 'make distclean', then './configure -m32 (or -m64)', then 'make'. The provided manifest file (tcl.nmf) points to both, to be compatible with both builds of Chrome. - launch the NaCl-provided python-based webserver, and make it see your nacl dir somewhere in its document tree. e.g. cd $NACL/examples; ln -s /..../tcl/nacl nacl; python httpd.py 5103 - (once) open about:flags in Chrome and enable Native Client - start '(cd tools;./chromedebug)', and point Chrome to the index.html in nacl. e.g. chromedebug http://localhost:5103/nacl. - alternatively, use './chrd' to load the 'balls' demo. - (every time) make sure no non-chromedebug chrome process is running, otherwise it will be used instead, and NaCl will fail to load. Also, when you update or tweak anything, it is a good idea to flush your browser's cache ! - note: 'chromedebug' just sets an env var for debug output (on stderr), and stars chrome with '--no-sandbox', which is currently needed for NaCl to be really enabled on Linux. Overview of the porting method ------------------------------ Nacl comes with a very incomplete libc and set of headers. The strategy, then, is to simply "plug" missing syscalls or library functions with either explicitly failing stubs (returning -1 or NULL, |
︙ | ︙ | |||
91 92 93 94 95 96 97 | NaTcl. See [domset] and [after] (in init.natcl, which is compiled into the binray .nexe) as two very simple examples. In an universe without syscalls, loading other scripts is problematic. To circumvent this (and bootstrap the loading of the main script), [source $url] is reimplemented over a JS XmlHttpRequest. And to preserve the blocking semantics of traditional [source] while XHR | | | | | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | NaTcl. See [domset] and [after] (in init.natcl, which is compiled into the binray .nexe) as two very simple examples. In an universe without syscalls, loading other scripts is problematic. To circumvent this (and bootstrap the loading of the main script), [source $url] is reimplemented over a JS XmlHttpRequest. And to preserve the blocking semantics of traditional [source] while XHR is purely async, this implementation is coroutine-based and calls [yield] after starting the request. When the download completes, JS calls back into Tcl to resume the coro, and continue the sequential execution of the Tcl script where it left. This allows for arbitrary series and nesting of [source]. For this reason, the main script is bootstrapped by evaluating: coroutine main_coro source $url This means that all the init code in the script will run in the coro context (for [source]'s benefit, but that could be extended to other |
︙ | ︙ |
Changes to nacl/balls.natcl.
︙ | ︙ | |||
222 223 224 225 226 227 228 | canv_bind <Motion> motioncb canv_bind <Enter> entercb canv_bind <Leave> leavecb every $frameInterval updateStage every 1000 computeFps | < < < < < < < < < < < | 222 223 224 225 226 227 228 | canv_bind <Motion> motioncb canv_bind <Enter> entercb canv_bind <Leave> leavecb every $frameInterval updateStage every 1000 computeFps |
Changes to nacl/configure.
|
| | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #! /bin/sh tmp=/tmp/nacl-configure.$$ findarch() { echo -n "Finding default arch ..." >&2 echo "int foo(x) {return x*x;}" > $tmp.c nacl-gcc -c $tmp.c -o $tmp.o kind=`file $tmp.o` /bin/rm $tmp.[co] case "$kind" in *32-bit*) arch=32;; *64-bit*) arch=64;; *) echo "### Cannot compute default arch. Please specify -m32 or -m64.">&2;exit 1;; esac echo " -m$arch" >&2 } case "$1" in -m32) arch=32;; -m64) arch=64;; "") findarch;; *) echo "Usage: ./configure [-m32|-m64]">&2;exit 1;; esac export arch set -ex CC="nacl-gcc -m$arch" CPP="nacl-cpp -m$arch" CFLAGS="-Wno-long-long -pthread -DNACL" ../unix/configure --host nacl --disable-threads --disable-shared rm -f a.out core.* || true cat Makefile > $tmp.mk sed -e '/^CC[ ]*=/ a\ CCPLUS = nacl-g++ -m'$arch'\ arch='$arch' ' < $tmp.mk > Makefile patch -p0 < Makefile.patch set +x echo " Makefile generated and patched for NaCl. Ready for 'make' :) ">&2 exit 0 |
Added nacl/tcl.nmf.
> > > > > > | 1 2 3 4 5 6 | { "nexes": { "x86-32": "tcl32.nexe", "x86-64": "tcl64.nexe", } } |
Deleted nacl/tools/nexe2nmf.
|
| < < < < < < < < < < < < < < |