aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2015-08-22 16:17:17 -0500
committerDavid Barksdale <amatus@amatus.name>2015-08-22 16:18:54 -0500
commita016971fee095e1b2d447d95d348a8060217b697 (patch)
treee33d8740db94aac9a240d48d492d228e5869e7a8
parentb21d14a6f0083599a6c3b44a005aa94b8afc5963 (diff)
Update emscripten to 1.34.4
-rw-r--r--.gitignore2
-rwxr-xr-xbuild-gnunet.sh2
-rw-r--r--gnunet-build/.builder/config3
-rw-r--r--gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules7
-rw-r--r--gnunet-build/packages/build-utils/emscripten-fastcomp/files/emscripten-fastcomp-1.18.0-ar.patch19
-rw-r--r--gnunet-build/packages/build-utils/emscripten/Buildrules5
-rw-r--r--gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-cplusplus-null.patch128
-rw-r--r--gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-fix-idbfs-for-webworkers.patch19
-rw-r--r--gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-getFuncWrapper.patch24
-rw-r--r--gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-import-symbols.patch13
-rw-r--r--gnunet-build/packages/gnunet/gnunet/Buildrules159
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/client-pre.js55
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/client.js35
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/datastore-pre.js2
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/imports14
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/peerstore-pre.js2
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/pre.js98
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/server.js60
-rw-r--r--gnunet-build/packages/libs/libgcrypt/Buildrules10
-rw-r--r--gnunet-build/packages/libs/libgcrypt/files/libgcrypt-1.6.0-align.patch111
-rw-r--r--gnunet-build/packages/libs/libidn/Buildrules1
-rw-r--r--src/cljs/gnunet_web/service.cljs52
22 files changed, 393 insertions, 428 deletions
diff --git a/.gitignore b/.gitignore
index 6ee6e6c..f53356f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,4 @@ gnunet-build/tmp/
/assets/js/gnunet-daemon-*.js
/assets/js/gnunet-service-*.js
/assets/js/libgnunet_plugin_*.js
-/src/js/client-lib.inc.js
+/src/js/client-lib.js
diff --git a/build-gnunet.sh b/build-gnunet.sh
index 7f93286..a14e717 100755
--- a/build-gnunet.sh
+++ b/build-gnunet.sh
@@ -3,7 +3,7 @@
mkdir -p assets/js
cd gnunet-build
export PATH="$PATH":"$(pwd)/scripts"
-build
+build -d
cp sysroot/var/lib/gnunet/hostlist ../assets/
cp sysroot/var/lib/gnunet/js/* ../assets/js/
mv ../assets/js/client-lib.js ../src/js/
diff --git a/gnunet-build/.builder/config b/gnunet-build/.builder/config
index ebb8742..1d8911b 100644
--- a/gnunet-build/.builder/config
+++ b/gnunet-build/.builder/config
@@ -9,7 +9,4 @@ export PATH
EM_CONFIG="${SYSROOT}/${TOOLDIR}/etc/emscripten"
export EM_CONFIG
-# Turns out the now default fastcomp does not support dlopen
-export EMCC_FAST_COMPILER=0
-
# vim: filetype=sh
diff --git a/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules b/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules
index b9f5541..0861c0c 100644
--- a/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules
+++ b/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules
@@ -1,12 +1,11 @@
-VERSION="1.18.0"
+VERSION="1.34.4"
DESCRIPTION="LLVM with the emscripten fastcomp javascript backend."
-SOURCE_URI="git://github.com/amatus/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
-PATCHES="ar"
+SOURCE_URI="git://github.com/kripken/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
CONFIG_OPTS="--enable-optimized --disable-assertions --enable-targets=host,js"
pkg_prep()
{
- git clone git://github.com/amatus/emscripten-fastcomp-clang \
+ git clone git://github.com/kripken/emscripten-fastcomp-clang \
"${S}/tools/clang"
git --git-dir="${S}/tools/clang/.git" checkout "${VERSION}"
}
diff --git a/gnunet-build/packages/build-utils/emscripten-fastcomp/files/emscripten-fastcomp-1.18.0-ar.patch b/gnunet-build/packages/build-utils/emscripten-fastcomp/files/emscripten-fastcomp-1.18.0-ar.patch
deleted file mode 100644
index b92d504..0000000
--- a/gnunet-build/packages/build-utils/emscripten-fastcomp/files/emscripten-fastcomp-1.18.0-ar.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- llvm-3.2.src.orig/tools/llvm-ar/llvm-ar.cpp 2012-10-26 05:49:15.000000000 -0500
-+++ llvm-3.2.src/tools/llvm-ar/llvm-ar.cpp 2013-07-13 21:17:35.047302973 -0500
-@@ -461,11 +461,12 @@
- (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) {
-
- // Make sure the intervening directories are created
-- if (I->hasPath()) {
-- sys::Path dirs(I->getPath());
-- dirs.eraseComponent();
-- if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg))
-+ sys::Path dirs(I->getPath());
-+ dirs.eraseComponent();
-+ if (dirs.isValid()) {
-+ if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg)) {
- return true;
-+ }
- }
-
- // Open up a file stream for writing
diff --git a/gnunet-build/packages/build-utils/emscripten/Buildrules b/gnunet-build/packages/build-utils/emscripten/Buildrules
index 911c74d..11761ec 100644
--- a/gnunet-build/packages/build-utils/emscripten/Buildrules
+++ b/gnunet-build/packages/build-utils/emscripten/Buildrules
@@ -1,7 +1,6 @@
-VERSION="1.18.0"
+VERSION="1.34.4"
DESCRIPTION="Emscripten is an LLVM-to-JavaScript compiler."
-SOURCE_URI="git://github.com/amatus/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
-PATCHES="import-symbols fix-idbfs-for-webworkers getFuncWrapper cplusplus-null"
+SOURCE_URI="git://github.com/kripken/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
RDEPENDS="build-utils/emscripten-fastcomp build-utils/node"
pkg_compile() {
diff --git a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-cplusplus-null.patch b/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-cplusplus-null.patch
deleted file mode 100644
index 4bdf28f..0000000
--- a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-cplusplus-null.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-Index: b/system/include/libc/locale.h
-===================================================================
---- a/system/include/libc/locale.h
-+++ b/system/include/libc/locale.h
-@@ -7,7 +7,11 @@ extern "C" {
-
- #include <features.h>
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define LC_CTYPE 0
- #define LC_NUMERIC 1
-Index: b/system/include/libc/stddef.h
-===================================================================
---- a/system/include/libc/stddef.h
-+++ b/system/include/libc/stddef.h
-@@ -1,7 +1,11 @@
- #ifndef _STDDEF_H
- #define _STDDEF_H
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define __NEED_ptrdiff_t
- #define __NEED_size_t
-Index: b/system/include/libc/stdio.h
-===================================================================
---- a/system/include/libc/stdio.h
-+++ b/system/include/libc/stdio.h
-@@ -21,7 +21,11 @@ extern "C" {
-
- #include <bits/alltypes.h>
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #undef EOF
- #define EOF (-1)
-Index: b/system/include/libc/stdlib.h
-===================================================================
---- a/system/include/libc/stdlib.h
-+++ b/system/include/libc/stdlib.h
-@@ -7,7 +7,11 @@ extern "C" {
-
- #include <features.h>
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define __NEED_size_t
- #define __NEED_wchar_t
-Index: b/system/include/libc/string.h
-===================================================================
---- a/system/include/libc/string.h
-+++ b/system/include/libc/string.h
-@@ -7,7 +7,11 @@ extern "C" {
-
- #include <features.h>
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define __NEED_size_t
- #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
-Index: b/system/include/libc/time.h
-===================================================================
---- a/system/include/libc/time.h
-+++ b/system/include/libc/time.h
-@@ -7,7 +7,11 @@ extern "C" {
-
- #include <features.h>
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define __NEED_size_t
- #define __NEED_time_t
-Index: b/system/include/libc/unistd.h
-===================================================================
---- a/system/include/libc/unistd.h
-+++ b/system/include/libc/unistd.h
-@@ -15,7 +15,11 @@ extern "C" {
- #define SEEK_CUR 1
- #define SEEK_END 2
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #define __NEED_size_t
- #define __NEED_ssize_t
-Index: b/system/include/libc/wchar.h
-===================================================================
---- a/system/include/libc/wchar.h
-+++ b/system/include/libc/wchar.h
-@@ -33,7 +33,11 @@ extern "C" {
- #define WCHAR_MIN (-1-0x7fffffff+L'\0')
- #endif
-
-+#ifdef __cplusplus
- #define NULL 0L
-+#else
-+#define NULL ((void*)0)
-+#endif
-
- #undef WEOF
- #define WEOF 0xffffffffU
diff --git a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-fix-idbfs-for-webworkers.patch b/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-fix-idbfs-for-webworkers.patch
deleted file mode 100644
index 479c7eb..0000000
--- a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-fix-idbfs-for-webworkers.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-commit e1ba13fb602b82c80ead2cc0bafc9341993b3f53
-Author: David Barksdale <amatus@amatus.name>
-Date: Thu Jul 3 18:09:52 2014 -0500
-
- Fix IDBFS for webworkers
-
-diff --git a/src/library_idbfs.js b/src/library_idbfs.js
-index 8082c19..d9718e8 100644
---- a/src/library_idbfs.js
-+++ b/src/library_idbfs.js
-@@ -3,7 +3,7 @@ mergeInto(LibraryManager.library, {
- $IDBFS: {
- dbs: {},
- indexedDB: function() {
-- return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
-+ return indexedDB || window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
- },
- DB_VERSION: 21,
- DB_STORE_NAME: 'FILE_DATA',
diff --git a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-getFuncWrapper.patch b/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-getFuncWrapper.patch
deleted file mode 100644
index 8cdcb24..0000000
--- a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-getFuncWrapper.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Index: b/src/runtime.js
-===================================================================
---- a/src/runtime.js
-+++ b/src/runtime.js
-@@ -439,12 +439,16 @@ var Runtime = {
-
- getFuncWrapper: function(func, sig) {
- assert(sig);
-- if (!Runtime.funcWrappers[func]) {
-- Runtime.funcWrappers[func] = function dynCall_wrapper() {
-+ if (!Runtime.funcWrappers[sig]) {
-+ Runtime.funcWrappers[sig] = {};
-+ }
-+ var sigCache = Runtime.funcWrappers[sig];
-+ if (!sigCache[func]) {
-+ sigCache[func] = function dynCall_wrapper() {
- return Runtime.dynCall(sig, func, arguments);
- };
- }
-- return Runtime.funcWrappers[func];
-+ return sigCache[func];
- },
-
- // Returns a processor of UTF.
diff --git a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-import-symbols.patch b/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-import-symbols.patch
deleted file mode 100644
index 7182e99..0000000
--- a/gnunet-build/packages/build-utils/emscripten/files/emscripten-1.18.0-import-symbols.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: b/emscripten.py
-===================================================================
---- a/emscripten.py 2014-05-21 20:06:16.410485120 -0500
-+++ b/emscripten.py 2014-05-21 22:24:01.090538929 -0500
-@@ -530,6 +530,8 @@
- # If no named globals, only need externals
- global_vars = map(lambda g: g['name'], filter(lambda g: settings['NAMED_GLOBALS'] or g.get('external') or g.get('unIndexable'), forwarded_json['Variables']['globals'].values()))
- global_funcs = ['_' + key for key, value in forwarded_json['Functions']['libraryFunctions'].iteritems() if value != 2]
-+ with open(os.path.join(get_configuration().TEMP_DIR, 'imports'), 'w') as imports_file:
-+ imports_file.write('\n'.join(global_funcs) + '\n');
- def math_fix(g):
- return g if not g.startswith('Math_') else g.split('_')[1]
- asm_global_funcs = ''.join([' var ' + g.replace('.', '_') + '=global.' + g + ';\n' for g in maths]) + \
diff --git a/gnunet-build/packages/gnunet/gnunet/Buildrules b/gnunet-build/packages/gnunet/gnunet/Buildrules
index a4d10dd..039f94e 100644
--- a/gnunet-build/packages/gnunet/gnunet/Buildrules
+++ b/gnunet-build/packages/gnunet/gnunet/Buildrules
@@ -32,47 +32,42 @@ pkg_compile() {
--enable-logging=verbose \
ac_cv_lib_idn_stringprep_check_version=yes \
ac_cv_func_srandom=no \
+ ac_cv_func_getifaddrs=no \
CPPFLAGS="-I${SYSROOT}/usr/include" \
LDFLAGS="-L${SYSROOT}/usr/lib"
emmake make LDFLAGS="${LDFLAGS} -Wc,--ignore-dynamic-linking"
mkdir -p "${D}/var/lib/gnunet/js"
+ OPT_LEVEL=""
#
# libgnunetblock plugins
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='["_libgnunet_plugin_block_dht_init"]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/dht/libgnunet_plugin_block_dht.js" \
"${S}/src/dht/plugin_block_dht.lo"
- mv "${TEMP_DIR}/imports" libgnunet_plugin_block_dht.imports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='["_libgnunet_plugin_block_fs_init"]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/fs/libgnunet_plugin_block_fs.js" \
"${S}/src/fs/plugin_block_fs.lo"
- mv "${TEMP_DIR}/imports" libgnunet_plugin_block_fs.imports
- cat libgnunet_plugin_block_dht.imports \
- libgnunet_plugin_block_fs.imports \
- > libgnunet_plugin_block.imports
cp "${S}/src/dht/libgnunet_plugin_block_dht.js" \
"${S}/src/fs/libgnunet_plugin_block_fs.js" \
"${D}/var/lib/gnunet/js/"
#
# Peerinfo
#
- ( echo '['
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > peerinfo.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s EXPORTED_FUNCTIONS=@peerinfo.exports \
+ ${OPT_LEVEL} \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/peerinfo/gnunet-service-peerinfo.js" \
"${S}/src/peerinfo/gnunet-service-peerinfo.o" \
@@ -88,21 +83,21 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/peerinfo/.libs/gnunet-service-peerinfo.js" \
+ "${S}/src/peerinfo/.libs/gnunet-service-peerinfo.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# libdatacache plugin
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='[
"_libgnunet_plugin_datacache_heap_init"
]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/datacache/libgnunet_plugin_datacache_heap.js" \
"${S}/src/datacache/plugin_datacache_heap.lo"
- mv "${TEMP_DIR}/imports" libgnunet_plugin_datacache_heap.imports
cp "${S}/src/datacache/libgnunet_plugin_datacache_heap.js" \
"${D}/var/lib/gnunet/js/"
#
@@ -110,23 +105,20 @@ pkg_compile() {
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='[
"_libgnunet_plugin_datastore_emscripten_init",
]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/datastore/libgnunet_plugin_datastore_emscripten.js" \
"${S}/src/datastore/plugin_datastore_emscripten.lo"
- ( echo '['
- sed -e 's/.*/"&",/' < "${TEMP_DIR}/imports"
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > datastore.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@datastore.exports \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
-s TOTAL_MEMORY=$((80 * 1024 * 1024)) \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/datastore/gnunet-service-datastore.js" \
@@ -143,6 +135,7 @@ pkg_compile() {
--pre-js "${F}/pre.js" \
--pre-js "${F}/datastore-pre.js"
cp "${S}/src/datastore/.libs/gnunet-service-datastore.js" \
+ "${S}/src/datastore/.libs/gnunet-service-datastore.js.mem" \
"${S}/src/datastore/libgnunet_plugin_datastore_emscripten.js" \
"${D}/var/lib/gnunet/js/"
#
@@ -150,23 +143,20 @@ pkg_compile() {
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='[
"_libgnunet_plugin_ats_proportional_init"
]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/ats/libgnunet_plugin_ats_proportional.js" \
"${S}/src/ats/plugin_ats_proportional.lo"
- ( echo '['
- sed -e 's/.*/"&",/' < "${TEMP_DIR}/imports"
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > ats.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@ats.exports \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/ats/gnunet-service-ats.js" \
"${S}/src/ats/gnunet-service-ats"*.o \
@@ -184,6 +174,7 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/ats/.libs/gnunet-service-ats.js" \
+ "${S}/src/ats/.libs/gnunet-service-ats.js.mem" \
"${S}/src/ats/libgnunet_plugin_ats_proportional.js" \
"${D}/var/lib/gnunet/js/"
#
@@ -191,8 +182,8 @@ pkg_compile() {
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='[
"_libgnunet_plugin_transport_http_client_init",
]' \
@@ -200,15 +191,12 @@ pkg_compile() {
-o "${S}/src/transport/libgnunet_plugin_transport_http_client.js" \
"${S}/src/transport/libgnunet_plugin_transport_http_client_la-plugin_transport_http_client_emscripten.lo" \
"${S}/src/transport/libgnunet_plugin_transport_http_client_la-plugin_transport_http_common.lo"
- ( echo '['
- sed -e 's/.*/"&",/' < "${TEMP_DIR}/imports"
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > transport.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@transport.exports \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/transport/gnunet-service-transport.js" \
"${S}/src/transport/gnunet_service_transport-gnunet-service-transport"*.o \
@@ -228,18 +216,17 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/transport/.libs/gnunet-service-transport.js" \
+ "${S}/src/transport/.libs/gnunet-service-transport.js.mem" \
"${S}/src/transport/libgnunet_plugin_transport_http_client.js" \
"${D}/var/lib/gnunet/js/"
#
# Core
#
- ( echo '['
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > core.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s EXPORTED_FUNCTIONS=@core.exports \
+ ${OPT_LEVEL} \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/core/gnunet-service-core.js" \
"${S}/src/core/gnunet-service-core"*.o \
@@ -257,17 +244,16 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/core/.libs/gnunet-service-core.js" \
+ "${S}/src/core/.libs/gnunet-service-core.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Network Size Estimation
#
- ( echo '['
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > nse.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s EXPORTED_FUNCTIONS=@nse.exports \
+ ${OPT_LEVEL} \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/nse/gnunet-service-nse.js" \
"${S}/src/nse/gnunet-service-nse.o" \
@@ -285,21 +271,18 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/nse/.libs/gnunet-service-nse.js" \
+ "${S}/src/nse/.libs/gnunet-service-nse.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Distributed Hash Table
#
- ( echo '['
- sed -e 's/.*/"&",/' < libgnunet_plugin_block.imports
- sed -e 's/.*/"&",/' < libgnunet_plugin_datacache_heap.imports
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > dht.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
-s TOTAL_MEMORY=$((32 * 1024 * 1024)) \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@dht.exports \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/dht/gnunet-service-dht.js" \
"${S}/src/dht/gnunet-service-dht"*.o \
@@ -324,17 +307,16 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/dht/.libs/gnunet-service-dht.js" \
+ "${S}/src/dht/.libs/gnunet-service-dht.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Topology
#
- ( echo '['
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > topology.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s EXPORTED_FUNCTIONS=@topology.exports \
+ ${OPT_LEVEL} \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/topology/gnunet-daemon-topology.js" \
"${S}/src/topology/gnunet-daemon-topology.o" \
@@ -354,19 +336,17 @@ pkg_compile() {
--js-library "${F}/server.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/topology/.libs/gnunet-daemon-topology.js" \
+ "${S}/src/topology/.libs/gnunet-daemon-topology.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Cadet
#
- ( echo '['
- sed -e 's/.*/"&",/' < libgnunet_plugin_block.imports
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > cadet.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@cadet.exports \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/cadet/gnunet-service-cadet.js" \
"${S}/src/cadet/gnunet_service_cadet"*.o \
@@ -389,29 +369,27 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/cadet/.libs/gnunet-service-cadet.js" \
+ "${S}/src/cadet/.libs/gnunet-service-cadet.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Peerstore
#
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s SIDE_MODULE=1 \
+ ${OPT_LEVEL} \
+ -s SIDE_MODULE=1 \
-s EXPORTED_FUNCTIONS='[
"_libgnunet_plugin_peerstore_emscripten_init",
]' \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/peerstore/libgnunet_plugin_peerstore_emscripten.js" \
"${S}/src/peerstore/plugin_peerstore_emscripten.lo"
- ( echo '['
- sed -e 's/.*/"&",/' < "${TEMP_DIR}/imports"
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > peerstore.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@peerstore.exports \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/peerstore/gnunet-service-peerstore.js" \
"${S}/src/peerstore/gnunet_service_peerstore"*.o \
@@ -426,21 +404,19 @@ pkg_compile() {
--pre-js "${F}/pre.js" \
--pre-js "${F}/peerstore-pre.js"
cp "${S}/src/peerstore/.libs/gnunet-service-peerstore.js" \
+ "${S}/src/peerstore/.libs/gnunet-service-peerstore.js.mem" \
"${S}/src/peerstore/libgnunet_plugin_peerstore_emscripten.js" \
"${D}/var/lib/gnunet/js/"
#
# File Sharing
#
- ( echo '['
- sed -e 's/.*/"&",/' < libgnunet_plugin_block.imports
- sed -e 's/.*/"&",/' < "${F}/imports"
- echo '"_main"]' ) > fs.exports
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
+ ${OPT_LEVEL} \
+ -s MAIN_MODULE=1 \
+ -s EXPORTED_FUNCTIONS=@"${F}/imports" \
+ --memory-init-file 1 \
-s TOTAL_MEMORY=$((32 * 1024 * 1024)) \
- -s DLOPEN_SUPPORT=1 -s MAIN_MODULE=1 \
- -s EXPORTED_FUNCTIONS=@fs.exports \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
-o "${S}/src/fs/gnunet-service-fs.js" \
"${S}/src/fs/gnunet-service-fs"*.o \
@@ -465,6 +441,7 @@ pkg_compile() {
--js-library "${F}/service.js" \
--pre-js "${F}/pre.js"
cp "${S}/src/fs/.libs/gnunet-service-fs.js" \
+ "${S}/src/fs/.libs/gnunet-service-fs.js.mem" \
"${D}/var/lib/gnunet/js/"
#
# Client Library
@@ -476,7 +453,7 @@ pkg_compile() {
"${F}/client-lib.c"
./libtool --tag=CC --mode=link \
emcc -fno-strict-aliasing -Wall \
- -O2 \
+ ${OPT_LEVEL} \
-s EXPORTED_FUNCTIONS=@${F}/client-lib.exports \
-s RESERVED_FUNCTION_POINTERS=100 \
"-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \
diff --git a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js
index 87f6b2b..2906cc8 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js
@@ -1,5 +1,5 @@
// client-pre.js - linked into gnunet-web client library
-// Copyright (C) 2013,2014 David Barksdale <amatus@amatus.name>
+// Copyright (C) 2015 David Barksdale <amatus@amatus.name>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -14,27 +14,40 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-gnunet_prerun = function() {
- // Create /dev/random but it doesn't need to do anything
- var id = FS.makedev(1, 8);
- FS.registerDevice(id, {});
- FS.mkdev('/dev/random', id);
-
- // Create /dev/urandom
- var id = FS.makedev(1, 9);
- FS.registerDevice(id, {
- read: function(stream, buffer, offset, length, pos) {
- var random_bytes = new Uint8Array(length);
- window.crypto.getRandomValues(random_bytes);
- for (var i = 0; i < length; i++) {
- buffer[offset+i] = random_bytes[i];
+// emscripten removed this insanely useful function, wtf?
+function ccallFunc(func, returnType, argTypes, args) {
+ var toC = {'string' : function(str) {
+ var ret = 0;
+ if (str !== null && str !== undefined && str !== 0) { // null string
+ // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
+ ret = Runtime.stackAlloc((str.length << 2) + 1);
+ writeStringToMemory(str, ret);
+ }
+ return ret;
+ }, 'array' : function(arr) {
+ var ret = Runtime.stackAlloc(arr.length);
+ writeArrayToMemory(arr, ret);
+ return ret;
+ }};
+ var cArgs = [];
+ var stack = 0;
+ if (args) {
+ for (var i = 0; i < args.length; i++) {
+ var converter = toC[argTypes[i]];
+ if (converter) {
+ if (stack === 0) stack = Runtime.stackSave();
+ cArgs[i] = converter(args[i]);
+ } else {
+ cArgs[i] = args[i];
}
- return i;
- },
- });
- FS.mkdev('/dev/urandom', id);
+ }
+ }
+ var ret = func.apply(null, cArgs);
+ if (returnType === 'string') ret = Pointer_stringify(ret);
+ if (stack !== 0) {
+ Runtime.stackRestore(stack);
+ }
+ return ret;
}
-if (typeof(Module) === "undefined") Module = { preRun: [] };
-Module.preRun.push(gnunet_prerun);
// vim: set expandtab ts=2 sw=2:
diff --git a/gnunet-build/packages/gnunet/gnunet/files/client.js b/gnunet-build/packages/gnunet/gnunet/files/client.js
index 495a0a4..3d5fd51 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/client.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/client.js
@@ -36,24 +36,30 @@ mergeInto(LibraryManager.library, {
handler: null,
th: null};
client.port.onmessage = function(ev) {
- if (client.handler) {
- var handler = client.handler;
- client.handler = null;
- handler(ev);
- } else
- client.queue.push(ev);
+ try {
+ if (client.handler) {
+ var handler = client.handler;
+ client.handler = null;
+ handler(ev);
+ } else
+ client.queue.push(ev);
+ } catch (e) {
+ console.error("Rekt'd", e);
+ }
};
CLIENT_PORTS[port] = client;
- if (typeof client_connect == "function")
+ console.debug('connecting to service', service_name);
+ if (typeof client_connect == 'function') {
client_connect(service_name, channel.port2);
- else
+ } else {
try {
- gnunet_web.service.client_connect(service_name, "client.js",
+ gnunet_web.service.client_connect(service_name, 'client.js',
channel.port2);
} catch(e) {
- console.error("Failed to connect to", service_name, e);
+ console.error('Failed to connect to', service_name, e);
return 0;
}
+ }
return port;
},
GNUNET_CLIENT_disconnect__deps: ['$CLIENT_PORTS'],
@@ -107,8 +113,13 @@ mergeInto(LibraryManager.library, {
+ client.name);
var view = {{{ makeHEAPView('U8', 'buffer', 'buffer+ret') }}};
// See http://code.google.com/p/chromium/issues/detail?id=169705
- if (ret > 0)
- client.port.postMessage(new Uint8Array(view));
+ if (ret > 0) {
+ try {
+ client.port.postMessage(new Uint8Array(view));
+ } catch (e) {
+ console.error('Failed to send');
+ }
+ }
Runtime.stackRestore(stack);
}, 0);
return port;
diff --git a/gnunet-build/packages/gnunet/gnunet/files/datastore-pre.js b/gnunet-build/packages/gnunet/gnunet/files/datastore-pre.js
index cbee896..d4a584b 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/datastore-pre.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/datastore-pre.js
@@ -18,6 +18,6 @@ datastore_prerun = function() {
store.createIndex('by_expiry', 'expiry');
};
};
-Module.preRun.push(datastore_prerun);
+Module['preInit'].push(datastore_prerun);
// vim: set expandtab ts=2 sw=2
diff --git a/gnunet-build/packages/gnunet/gnunet/files/imports b/gnunet-build/packages/gnunet/gnunet/files/imports
index 579cbf3..1d47eca 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/imports
+++ b/gnunet-build/packages/gnunet/gnunet/files/imports
@@ -1,6 +1,8 @@
-_GNUNET_CONFIGURATION_get_value_float
-_GNUNET_SCHEDULER_run_task
-_GNUNET_STRINGS_fancy_size_to_bytes
-_GNUNET_STRINGS_fancy_time_to_relative
-_GNUNET_log_setup
-_GNUNET_xstrdup_
+[
+"_GNUNET_CONFIGURATION_get_value_float",
+"_GNUNET_SCHEDULER_run_task",
+"_GNUNET_STRINGS_fancy_size_to_bytes",
+"_GNUNET_STRINGS_fancy_time_to_relative",
+"_GNUNET_log_setup",
+"_GNUNET_xstrdup_",
+"_main"]
diff --git a/gnunet-build/packages/gnunet/gnunet/files/peerstore-pre.js b/gnunet-build/packages/gnunet/gnunet/files/peerstore-pre.js
index b46f7f4..2dd5580 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/peerstore-pre.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/peerstore-pre.js
@@ -18,4 +18,4 @@ peerstore_prerun = function() {
store.createIndex('by_expiry', 'expiry');
};
};
-Module.preRun.push(peerstore_prerun);
+Module['preInit'].push(peerstore_prerun);
diff --git a/gnunet-build/packages/gnunet/gnunet/files/pre.js b/gnunet-build/packages/gnunet/gnunet/files/pre.js
index 829f22e..b10d085 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/pre.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/pre.js
@@ -1,5 +1,5 @@
// pre.js - linked into each gnunet-web service
-// Copyright (C) 2013,2014 David Barksdale <amatus@amatus.name>
+// Copyright (C) 2013-2015 David Barksdale <amatus@amatus.name>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -16,18 +16,11 @@
var xhrs = []; // plugin_transport_http_client
-var WorkerMessageQueue = [];
-function flush_worker_message_queue(f) {
- WorkerMessageQueue.forEach(f);
- WorkerMessageQueue = [];
-}
var dev_urandom_bytes = 0;
var random_bytes = [];
var random_offset = 0;
gnunet_prerun = function() {
ENV.GNUNET_PREFIX = "/.";
- //Module['print'] = function(x) { WorkerMessageQueue.push(x); };
- //Module['printErr'] = function(x) { Module.print(x); };
[
'ats_proportional',
'block_dht',
@@ -41,12 +34,8 @@ gnunet_prerun = function() {
'libgnunet_plugin_' + plugin + '.js', true, false);
});
- // Create /dev/random but it doesn't need to do anything
- var id = FS.makedev(1, 8);
- FS.registerDevice(id, {});
- FS.mkdev('/dev/random', id);
-
- // Create /dev/urandom
+ // Create /dev/urandom that provides strong random bytes from the parent
+ // window since workers don't have crypto
var id = FS.makedev(1, 9);
FS.registerDevice(id, {
read: function(stream, buffer, offset, length, pos) {
@@ -60,6 +49,7 @@ gnunet_prerun = function() {
return i;
},
});
+ FS.unlink('/dev/urandom');
FS.mkdev('/dev/urandom', id);
// Mount IDBFS for services that use it
@@ -85,8 +75,8 @@ gnunet_prerun = function() {
}
addRunDependency('window-init');
}
-if (typeof(Module) === "undefined") Module = { preRun: [] };
-Module.preRun.push(gnunet_prerun);
+if (typeof(Module) === "undefined") Module = { 'preInit': [] };
+Module['preInit'].push(gnunet_prerun);
// a map of window index to port
var windows = {};
@@ -108,21 +98,17 @@ function do_to_window(fn) {
}
function get_message(ev) {
- if ('init' == ev.data.type) {
- var stdout = new MessageChannel();
- var stderr = new MessageChannel();
- //Module['print'] = function(x) { stdout.port1.postMessage(x); };
- //Module['printErr'] = function(x) { stderr.port1.postMessage(x); };
- //flush_worker_message_queue(Module.print);
- ev.target.postMessage(
- {type: 'init', stdout: stdout.port2, stderr: stderr.port2},
- [stdout.port2, stderr.port2]);
- FS.writeFile('/private_key', ev.data['private-key'], {encoding: 'binary'});
- random_bytes = ev.data['random-bytes'];
- random_offset = 0;
- removeRunDependency('window-init');
- } else if ('connect' == ev.data.type) {
- SERVER.connect(ev.data.port, ev.data['client-name']);
+ try {
+ if ('init' == ev.data.type) {
+ FS.writeFile('/private_key', ev.data['private-key'], {encoding: 'binary'});
+ random_bytes = ev.data['random-bytes'];
+ random_offset = 0;
+ removeRunDependency('window-init');
+ } else if ('connect' == ev.data.type) {
+ SERVER.connect(ev.data.port, ev.data['client-name']);
+ }
+ } catch (e) {
+ console.error('Rekt', e);
}
}
@@ -131,11 +117,15 @@ function client_connect(service_name, message_port) {
console.debug('I want to connect to', service_name);
do_to_window(function(w) {
console.debug('I am now connecting to', service_name);
- w.postMessage({
- type: 'client_connect',
- service_name: service_name,
- client_name: location.pathname,
- message_port: message_port}, [message_port]);
+ try {
+ w.postMessage({
+ type: 'client_connect',
+ service_name: service_name,
+ client_name: location.pathname,
+ message_port: message_port}, [message_port]);
+ } catch (e) {
+ console.error('Failed to connect to', service_name);
+ }
});
}
@@ -143,4 +133,40 @@ function breakpoint() {
var x = 1; // Something to break on
}
+// emscripten removed this insanely useful function, wtf?
+function ccallFunc(func, returnType, argTypes, args) {
+ var toC = {'string' : function(str) {
+ var ret = 0;
+ if (str !== null && str !== undefined && str !== 0) { // null string
+ // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
+ ret = Runtime.stackAlloc((str.length << 2) + 1);
+ writeStringToMemory(str, ret);
+ }
+ return ret;
+ }, 'array' : function(arr) {
+ var ret = Runtime.stackAlloc(arr.length);
+ writeArrayToMemory(arr, ret);
+ return ret;
+ }};
+ var cArgs = [];
+ var stack = 0;
+ if (args) {
+ for (var i = 0; i < args.length; i++) {
+ var converter = toC[argTypes[i]];
+ if (converter) {
+ if (stack === 0) stack = Runtime.stackSave();
+ cArgs[i] = converter(args[i]);
+ } else {
+ cArgs[i] = args[i];
+ }
+ }
+ }
+ var ret = func.apply(null, cArgs);
+ if (returnType === 'string') ret = Pointer_stringify(ret);
+ if (stack !== 0) {
+ Runtime.stackRestore(stack);
+ }
+ return ret;
+}
+
// vim: set expandtab ts=2 sw=2:
diff --git a/gnunet-build/packages/gnunet/gnunet/files/server.js b/gnunet-build/packages/gnunet/gnunet/files/server.js
index 3fb04ed..d8beef3 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/server.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/server.js
@@ -20,6 +20,7 @@ mergeInto(LibraryManager.library, {
handlers_initialized: false,
connect_notify_list: [],
disconnect_notify_list: [],
+ connect_notify_queue: [],
clients: {},
next_client: 1,
connect: function(port, client_name) {
@@ -34,6 +35,11 @@ mergeInto(LibraryManager.library, {
user_context: 0,
user_context_size: 0,
};
+ if (!SERVER.handlers_initialized) {
+ console.debug('And I\'m queueing it for later');
+ SERVER.connect_notify_queue.push(port._name);
+ return;
+ }
SERVER.connect_notify_list.map(function(notify) {
ccallFunc(Runtime.getFuncWrapper(notify.callback, 'vii'), 'void',
['number', 'number'],
@@ -42,26 +48,30 @@ mergeInto(LibraryManager.library, {
},
message_queue: [],
client_get_message: function(ev) {
- var size = ev.data[0] << 8 | ev.data[1];
- var type = ev.data[2] << 8 | ev.data[3];
- console.debug('Got message of type ' + type + ' size ' + size + ' from '
- + SERVER.clients[ev.target._name].name);
- if (!SERVER.handlers_initialized) {
- console.debug('And I\'m queueing it for later');
- SERVER.message_queue.push(ev);
- return;
- }
- var handler = SERVER.handlers[type];
- if (typeof handler === 'undefined') {
- console.debug("But I don't know what to do with it");
- } else {
- if (handler.expected_size == 0 || handler.expected_size == size) {
- ccallFunc(Runtime.getFuncWrapper(handler.callback, 'viii'), 'void',
- ['number', 'number', 'array'],
- [handler.callback_cls, ev.target._name, ev.data]);
+ try {
+ var size = ev.data[0] << 8 | ev.data[1];
+ var type = ev.data[2] << 8 | ev.data[3];
+ console.debug('Got message of type ' + type + ' size ' + size + ' from '
+ + SERVER.clients[ev.target._name].name);
+ if (!SERVER.handlers_initialized) {
+ console.debug('And I\'m queueing it for later');
+ SERVER.message_queue.push(ev);
+ return;
+ }
+ var handler = SERVER.handlers[type];
+ if (typeof handler === 'undefined') {
+ console.debug("But I don't know what to do with it");
} else {
- console.debug("But I was expecting size " + handler.expected_size);
+ if (handler.expected_size == 0 || handler.expected_size == size) {
+ ccallFunc(Runtime.getFuncWrapper(handler.callback, 'viii'), 'void',
+ ['number', 'number', 'array'],
+ [handler.callback_cls, ev.target._name, ev.data]);
+ } else {
+ console.debug("But I was expecting size " + handler.expected_size);
+ }
}
+ } catch (e) {
+ console.error("ReKt", e);
}
}
},
@@ -82,9 +92,19 @@ mergeInto(LibraryManager.library, {
};
}
setTimeout(function() {
- var queue = SERVER.message_queue;
- SERVER.message_queue = [];
SERVER.handlers_initialized = true;
+ var queue = SERVER.connect_notify_queue;
+ SERVER.connect_notify_queue = [];
+ console.debug('Processing ' + queue.length + ' queued connections');
+ queue.forEach(function(client) {
+ SERVER.connect_notify_list.map(function(notify) {
+ ccallFunc(Runtime.getFuncWrapper(notify.callback, 'vii'), 'void',
+ ['number', 'number'],
+ [notify.callback_cls, client]);
+ });
+ });
+ queue = SERVER.message_queue;
+ SERVER.message_queue = [];
console.debug('Processing ' + queue.length + ' queued messages');
queue.forEach(SERVER.client_get_message);
}, 0);
diff --git a/gnunet-build/packages/libs/libgcrypt/Buildrules b/gnunet-build/packages/libs/libgcrypt/Buildrules
index e0dfc7f..991ecac 100644
--- a/gnunet-build/packages/libs/libgcrypt/Buildrules
+++ b/gnunet-build/packages/libs/libgcrypt/Buildrules
@@ -1,6 +1,7 @@
VERSION="1.6.0"
DESCRIPTION="This is a general purpose cryptographic library based on the code from GnuPG."
SOURCE_URI="ftp://ftp.gnupg.org/gcrypt/${NAME}/${NAME}-${VERSION}.tar.bz2"
+PATCHES="align"
BDEPENDS="${BDEPENDS} libs/libgpg-error"
pkg_compile() {
@@ -13,6 +14,9 @@ pkg_compile() {
--disable-asm \
--disable-avx-support \
--disable-avx2-support \
+ --disable-neon-support \
+ --disable-drng-support \
+ --disable-padlock-support \
--disable-amd64-as-feature-detection \
--with-gpg-error-prefix="${SYSROOT}/usr" \
ac_cv_sizeof_unsigned_short=2 \
@@ -24,13 +28,17 @@ pkg_compile() {
gnupg_cv_mlock_is_in_sys_mman=no \
gcry_cv_have_asm=no \
gcry_cv_have___asm__=no \
+ gcry_cv_gcc_arm_platform_as_ok=no \
+ gcry_cv_gcc_inline_asm_bmi2=no \
+ gcry_cv_gcc_inline_asm_ssse3=no \
+ gcry_cv_gcc_inline_asm_pclmul=no \
CPPFLAGS="-I${SYSROOT}/usr/include" \
LDFLAGS="-L${SYSROOT}/usr/lib"
emmake make SUBDIRS="compat mpi cipher random src" \
LDFLAGS="${LDFLAGS} -Wc,--ignore-dynamic-linking"
#emmake make SUBDIRS="tests"
#touch tests/*.o
- #EMMAKEN_JUST_CONFIGURE=true EMCONFIGURE_JS=true emmake make check \
+ #EMMAKEN_JUST_CONFIGURE=1 EMCONFIGURE_JS=1 emmake make check \
# SUBDIRS="tests" \
# LDFLAGS="-L${SYSROOT}/usr/lib -Wc,-s,TOTAL_MEMORY=33554432"
emmake make SUBDIRS="compat mpi cipher random src" \
diff --git a/gnunet-build/packages/libs/libgcrypt/files/libgcrypt-1.6.0-align.patch b/gnunet-build/packages/libs/libgcrypt/files/libgcrypt-1.6.0-align.patch
new file mode 100644
index 0000000..ceeeb86
--- /dev/null
+++ b/gnunet-build/packages/libs/libgcrypt/files/libgcrypt-1.6.0-align.patch
@@ -0,0 +1,111 @@
+diff -ruN source/cipher/rijndael-tables.h source.new/cipher/rijndael-tables.h
+--- source/cipher/rijndael-tables.h 2013-03-15 14:25:38.000000000 -0500
++++ source.new/cipher/rijndael-tables.h 2015-08-22 14:51:17.970177977 -0500
+@@ -58,7 +58,7 @@
+ };
+
+
+-static const unsigned char T1[256][4] =
++static const unsigned char T1[256][4] __attribute__((aligned(4))) =
+ {
+ { 0xc6,0x63,0x63,0xa5 }, { 0xf8,0x7c,0x7c,0x84 },
+ { 0xee,0x77,0x77,0x99 }, { 0xf6,0x7b,0x7b,0x8d },
+@@ -190,7 +190,7 @@
+ { 0x6d,0xbb,0xbb,0xd6 }, { 0x2c,0x16,0x16,0x3a }
+ };
+
+-static const unsigned char T2[256][4] =
++static const unsigned char T2[256][4] __attribute__((aligned(4))) =
+ {
+ { 0xa5,0xc6,0x63,0x63 }, { 0x84,0xf8,0x7c,0x7c },
+ { 0x99,0xee,0x77,0x77 }, { 0x8d,0xf6,0x7b,0x7b },
+@@ -322,7 +322,7 @@
+ { 0xd6,0x6d,0xbb,0xbb }, { 0x3a,0x2c,0x16,0x16 }
+ };
+
+-static const unsigned char T3[256][4] =
++static const unsigned char T3[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x63,0xa5,0xc6,0x63 }, { 0x7c,0x84,0xf8,0x7c },
+ { 0x77,0x99,0xee,0x77 }, { 0x7b,0x8d,0xf6,0x7b },
+@@ -454,7 +454,7 @@
+ { 0xbb,0xd6,0x6d,0xbb }, { 0x16,0x3a,0x2c,0x16 }
+ };
+
+-static const unsigned char T4[256][4] =
++static const unsigned char T4[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x63,0x63,0xa5,0xc6 }, { 0x7c,0x7c,0x84,0xf8 },
+ { 0x77,0x77,0x99,0xee }, { 0x7b,0x7b,0x8d,0xf6 },
+@@ -586,7 +586,7 @@
+ { 0xbb,0xbb,0xd6,0x6d }, { 0x16,0x16,0x3a,0x2c }
+ };
+
+-static const unsigned char T5[256][4] =
++static const unsigned char T5[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x51,0xf4,0xa7,0x50 }, { 0x7e,0x41,0x65,0x53 },
+ { 0x1a,0x17,0xa4,0xc3 }, { 0x3a,0x27,0x5e,0x96 },
+@@ -718,7 +718,7 @@
+ { 0x48,0x6c,0x5c,0x74 }, { 0xd0,0xb8,0x57,0x42 }
+ };
+
+-static const unsigned char T6[256][4] =
++static const unsigned char T6[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x50,0x51,0xf4,0xa7 }, { 0x53,0x7e,0x41,0x65 },
+ { 0xc3,0x1a,0x17,0xa4 }, { 0x96,0x3a,0x27,0x5e },
+@@ -850,7 +850,7 @@
+ { 0x74,0x48,0x6c,0x5c }, { 0x42,0xd0,0xb8,0x57 }
+ };
+
+-static const unsigned char T7[256][4] =
++static const unsigned char T7[256][4] __attribute__((aligned(4))) =
+ {
+ { 0xa7,0x50,0x51,0xf4 }, { 0x65,0x53,0x7e,0x41 },
+ { 0xa4,0xc3,0x1a,0x17 }, { 0x5e,0x96,0x3a,0x27 },
+@@ -982,7 +982,7 @@
+ { 0x5c,0x74,0x48,0x6c }, { 0x57,0x42,0xd0,0xb8 }
+ };
+
+-static const unsigned char T8[256][4] =
++static const unsigned char T8[256][4] __attribute__((aligned(4))) =
+ {
+ { 0xf4,0xa7,0x50,0x51 }, { 0x41,0x65,0x53,0x7e },
+ { 0x17,0xa4,0xc3,0x1a }, { 0x27,0x5e,0x96,0x3a },
+@@ -1150,7 +1150,7 @@
+ 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+ };
+
+-static const unsigned char U1[256][4] =
++static const unsigned char U1[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x00,0x00,0x00,0x00 }, { 0x0e,0x09,0x0d,0x0b },
+ { 0x1c,0x12,0x1a,0x16 }, { 0x12,0x1b,0x17,0x1d },
+@@ -1282,7 +1282,7 @@
+ { 0x83,0x4f,0x9a,0xa8 }, { 0x8d,0x46,0x97,0xa3 }
+ };
+
+-static const unsigned char U2[256][4] =
++static const unsigned char U2[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x00,0x00,0x00,0x00 }, { 0x0b,0x0e,0x09,0x0d },
+ { 0x16,0x1c,0x12,0x1a }, { 0x1d,0x12,0x1b,0x17 },
+@@ -1414,7 +1414,7 @@
+ { 0xa8,0x83,0x4f,0x9a }, { 0xa3,0x8d,0x46,0x97 }
+ };
+
+-static const unsigned char U3[256][4] =
++static const unsigned char U3[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x00,0x00,0x00,0x00 }, { 0x0d,0x0b,0x0e,0x09 },
+ { 0x1a,0x16,0x1c,0x12 }, { 0x17,0x1d,0x12,0x1b },
+@@ -1546,7 +1546,7 @@
+ { 0x9a,0xa8,0x83,0x4f }, { 0x97,0xa3,0x8d,0x46 }
+ };
+
+-static const unsigned char U4[256][4] =
++static const unsigned char U4[256][4] __attribute__((aligned(4))) =
+ {
+ { 0x00,0x00,0x00,0x00 }, { 0x09,0x0d,0x0b,0x0e },
+ { 0x12,0x1a,0x16,0x1c }, { 0x1b,0x17,0x1d,0x12 },
diff --git a/gnunet-build/packages/libs/libidn/Buildrules b/gnunet-build/packages/libs/libidn/Buildrules
index ef88753..50d9e47 100644
--- a/gnunet-build/packages/libs/libidn/Buildrules
+++ b/gnunet-build/packages/libs/libidn/Buildrules
@@ -2,5 +2,6 @@ VERSION="1.28"
DESCRIPTION="GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA specifications."
SOURCE_URI="http://ftpmirror.gnu.org/${NAME}/${NAME}-${VERSION}.tar.gz"
PATCHES="gnulib"
+CONFIG_OPTS="NM=llvm-nm gl_cv_ld_output_def=no"
# vim: syntax=sh
diff --git a/src/cljs/gnunet_web/service.cljs b/src/cljs/gnunet_web/service.cljs
index ca91b33..c6be3a5 100644
--- a/src/cljs/gnunet_web/service.cljs
+++ b/src/cljs/gnunet_web/service.cljs
@@ -50,32 +50,36 @@
(.-lineno event)
(.-message event))))
(set! (.-onmessage port)
- (fn [event]
- (let [data (.-data event)]
- (condp = (.-type data)
- "init" (do
- (set! (.-onmessage (aget data "stdout"))
- (fn [event]
- (.debug js/console
- worker-name
- (.-data event))))
- (set! (.-onmessage (aget data "stderr"))
- (fn [event]
- (.debug js/console
- worker-name
- (.-data event)))))
- "client_connect" (client-connect (aget data "service_name")
- (aget data "client_name")
- (aget data "message_port"))
- (.warn js/console worker-name data)))))
+ (try
+ (fn [event]
+ (let [data (.-data event)]
+ (condp = (.-type data)
+ "init" (do
+ (set! (.-onmessage (aget data "stdout"))
+ (fn [event]
+ (.debug js/console
+ worker-name
+ (.-data event))))
+ (set! (.-onmessage (aget data "stderr"))
+ (fn [event]
+ (.debug js/console
+ worker-name
+ (.-data event)))))
+ "client_connect" (client-connect (aget data "service_name")
+ (aget data "client_name")
+ (aget data "message_port"))
+ (.warn js/console worker-name data))))
+ (catch :default e
+ (js/console.error "REKT" e))))
(.start port)
- (.postMessage port (clj->js {:type "init"
- :private-key private-key
- :random-bytes random-bytes}))
+ (.postMessage port (js-obj "type" "init"
+ "private-key" (to-array private-key)
+ "random-bytes" random-bytes))
worker))
(defn ^:export client-connect
[service-name client-name message-port]
+ (js/console.debug "client" client-name "wants to connect to" service-name)
(let [service (get @services service-name)]
(if (nil? service)
(let [worker (start-worker service-name
@@ -83,7 +87,7 @@
port (.-port worker)]
(add-service service-name port)
(recur service-name client-name message-port))
- (.postMessage service (clj->js {:type "connect"
- :client-name client-name
- :port message-port})
+ (.postMessage service (js-obj "type" "connect"
+ "client-name" client-name
+ "port" message-port)
(array message-port)))))