diff --git a/.gitmodules b/.gitmodules index 83769058b1..dd558f464c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,27 +1,27 @@ -[submodule "subprojects/softfloat3"] - path = subprojects/softfloat3 - url = https://github.com/urbit/berkeley-softfloat-3.git -[submodule "subprojects/ed25519"] - path = subprojects/ed25519 - url = https://github.com/urbit/ed25519.git -[submodule "subprojects/libscrypt"] - path = subprojects/libscrypt - url = https://github.com/urbit/libscrypt.git -[submodule "subprojects/murmur3"] - path = subprojects/murmur3 - url = https://github.com/urbit/murmur3.git -[submodule "subprojects/libuv"] - path = subprojects/libuv - url = https://github.com/urbit/libuv.git -[submodule "subprojects/h2o"] - path = subprojects/libh2o - url = https://github.com/urbit/h2o.git [submodule "subprojects/argon2"] path = subprojects/argon2 url = https://github.com/urbit/argon2.git -[submodule "subprojects/secp256k1"] - path = subprojects/secp256k1 - url = https://github.com/urbit/secp256k1.git +[submodule "subprojects/ed25519"] + path = subprojects/ed25519 + url = https://github.com/urbit/ed25519.git +[submodule "subprojects/h2o"] + path = subprojects/libh2o + url = https://github.com/urbit/h2o.git +[submodule "subprojects/libuv"] + path = subprojects/libuv + url = https://github.com/urbit/libuv.git +[submodule "subprojects/libscrypt"] + path = subprojects/libscrypt + url = https://github.com/urbit/libscrypt.git [submodule "subprojects/libsni"] path = subprojects/libsni url = https://github.com/urbit/sniproxy +[submodule "subprojects/murmur3"] + path = subprojects/murmur3 + url = https://github.com/urbit/murmur3.git +[submodule "subprojects/secp256k1"] + path = subprojects/secp256k1 + url = https://github.com/urbit/secp256k1.git +[submodule "subprojects/softfloat3"] + path = subprojects/softfloat3 + url = https://github.com/urbit/berkeley-softfloat-3.git diff --git a/.travis.yml b/.travis.yml index a957eb3154..3c645ce07c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,12 +37,7 @@ addons: - openssl - libssl-dev - libncurses5-dev - - automake - - autoconf - - make - - libtool - - g++ - - re2c + - gcc - libcurl4-gnutls-dev - unzip - gdb diff --git a/include/c/defs.h b/include/c/defs.h index 74dfeeb339..4f4ba37b7d 100644 --- a/include/c/defs.h +++ b/include/c/defs.h @@ -91,27 +91,23 @@ cnt_w = (cnt_w + 1) % (n); \ } while (0) -/* c3_malloc(): asserting malloc - */ -#define c3_malloc(s) ({ \ - void* rut = malloc(s); \ - if ( 0 == rut ) { \ - c3_assert(!"memory lost"); \ - } \ - rut;}) - -/* c3_calloc(): asserting calloc - */ -#define c3_calloc(s) ({ \ - void* rut = c3_malloc(s); \ - memset(rut, 0, s); \ - rut;}) - -/* c3_realloc(): asserting realloc - */ -#define c3_realloc(a, b) ({ \ - void* rut = realloc(a, b); \ - if ( 0 == rut ) { \ - c3_assert(!"memory lost"); \ - } \ - rut;}) + /* Asserting allocators. + */ +# define c3_malloc(s) ({ \ + void* rut = malloc(s); \ + if ( 0 == rut ) { \ + c3_assert(!"memory lost"); \ + } \ + rut;}) +# define c3_calloc(s) ({ \ + void* rut = calloc(1,s); \ + if ( 0 == rut ) { \ + c3_assert(!"memory lost"); \ + } \ + rut;}) +# define c3_realloc(a, b) ({ \ + void* rut = realloc(a, b); \ + if ( 0 == rut ) { \ + c3_assert(!"memory lost"); \ + } \ + rut;}) diff --git a/meson.build b/meson.build index e1da8d14e1..523ac3b258 100644 --- a/meson.build +++ b/meson.build @@ -242,22 +242,17 @@ conf_data.set('U3_MEMORY_DEBUG', get_option('gc')) conf_data.set('U3_CPU_DEBUG', get_option('prof')) conf_data.set('U3_EVENT_TIME_DEBUG', get_option('event-time')) -osdet = build_machine.system() +osdet = host_machine.system() +cc = meson.get_compiler('c') os_c_flags = ['-funsigned-char','-ffast-math'] -os_deps = [] +os_deps = [dependency('threads')] os_link_flags = [] if osdet == 'linux' conf_data.set('U3_OS_linux', true) - if(legacy_meson) - pthread_dep = find_library('pthread') - else - pthread_dep = meson.get_compiler('c').find_library('pthread') - endif - ncurses_dep = dependency('ncurses') - os_deps = os_deps + [pthread_dep, ncurses_dep] + os_deps = os_deps + [ncurses_dep] elif osdet == 'darwin' conf_data.set('U3_OS_osx', true) @@ -267,7 +262,7 @@ elif osdet == 'darwin' if(legacy_meson) ncurses_dep = find_library('ncurses') else - ncurses_dep = meson.get_compiler('c').find_library('ncurses') + ncurses_dep = cc.find_library('ncurses') endif os_deps = os_deps + [ncurses_dep] @@ -275,10 +270,9 @@ elif osdet == 'darwin' elif osdet == 'bsd' or osdet == 'freebsd' conf_data.set('U3_OS_bsd', true) - pthread_dep = meson.get_compiler('c').find_library('pthread') - kvm_dep = meson.get_compiler('c').find_library('kvm') + kvm_dep = cc.find_library('kvm') ncurses_dep = dependency('ncurses') - os_deps = os_deps + [kvm_dep, pthread_dep, ncurses_dep] + os_deps = os_deps + [kvm_dep, ncurses_dep] elif osdet == 'openbsd' conf_data.set('U3_OS_bsd', true) @@ -290,7 +284,7 @@ else error('Unsupported OS detected:' + osdet) endif -endian = build_machine.endian() +endian = host_machine.endian() if endian == 'little' conf_data.set('U3_OS_ENDIAN_little', true) @@ -305,9 +299,10 @@ configure_file(input : 'include/config.h.in', # We expect these libs to supplied with the distribution curl_dep = dependency('libcurl', version: '>=7.19.0') -if osdet == 'darwin' and not get_option('nix') - libcrypto = meson.get_compiler('c').find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ]) - libssl = meson.get_compiler('c').find_library('ssl', dirs: [ '/usr/local/opt/openssl/lib/' ]) +if (osdet == 'darwin' and not get_option('nix') and + run_command('test', '-d', '/usr/local/opt/openssl/lib').returncode() == 0) + libcrypto = cc.find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ]) + libssl = cc.find_library('ssl', dirs: [ '/usr/local/opt/openssl/lib/' ]) openssl_dep = declare_dependency(dependencies: [libcrypto, libssl], include_directories: include_directories('/usr/local/opt/openssl/include')) else openssl_dep = dependency('openssl', version: '>=1.0.0') @@ -317,36 +312,36 @@ if(legacy_meson) gmp_dep = find_library('gmp') sigsegv_dep = find_library('sigsegv') elif osdet != 'openbsd' - gmp_dep = meson.get_compiler('c').find_library('gmp') - sigsegv_dep = meson.get_compiler('c').find_library('sigsegv') + # XX on OS X with MacPorts, set LIBRARY_PATH=/opt/local/lib to get meson to + # find these. + gmp_dep = cc.find_library('gmp') + sigsegv_dep = cc.find_library('sigsegv') endif # For these libs we provide fallback bundle -urbitscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep']) - -ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep']) -murmur3_dep = dependency('murmur3', version: '>=0.1.0', fallback: ['murmur3', 'murmur3_dep']) -softfloat3_dep = dependency('softfloat3', version: '>=3.0.0', fallback: ['softfloat3', 'softfloat3_dep']) -libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep']) -libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep']) argon2_dep = dependency('argon2', version: '>=1', fallback: ['argon2', 'argon2_dep']) -secp256k1_dep = dependency('libsecp256k1', version: '>=0.1.0', fallback: ['secp256k1', 'secp256k1_dep']) - +ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep']) +libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep']) +libscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep']) libsni_dep = dependency('libsni', version: '>=0.5.0', fallback: ['libsni', 'libsni_dep']) +libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep']) +murmur3_dep = dependency('murmur3', version: '>=0.1.0', fallback: ['murmur3', 'murmur3_dep']) +secp256k1_dep = dependency('libsecp256k1', version: '>=0.1.0', fallback: ['secp256k1', 'secp256k1_dep']) +softfloat3_dep = dependency('softfloat3', version: '>=3.0.0', fallback: ['softfloat3', 'softfloat3_dep']) -deps = [openssl_dep, +deps = [argon2_dep, curl_dep, - libuv_dep, - libh2o_dep, - secp256k1_dep, - gmp_dep, - sigsegv_dep, - urbitscrypt_dep, ed25519_dep, + gmp_dep, + libh2o_dep, + libscrypt_dep, + libsni_dep, + libuv_dep, murmur3_dep, - argon2_dep, - softfloat3_dep, - libsni_dep] + openssl_dep, + secp256k1_dep, + sigsegv_dep, + softfloat3_dep] executable('urbit', sources : sources, diff --git a/subprojects/libh2o b/subprojects/libh2o index 3b1f53c86b..0ed9ac7075 160000 --- a/subprojects/libh2o +++ b/subprojects/libh2o @@ -1 +1 @@ -Subproject commit 3b1f53c86b71f6fdc099b3b378de6f379b4b8412 +Subproject commit 0ed9ac70757a16ec45f91b8a347850d9699c3fb1 diff --git a/subprojects/libuv b/subprojects/libuv index 0c3a346a60..6429495dc9 160000 --- a/subprojects/libuv +++ b/subprojects/libuv @@ -1 +1 @@ -Subproject commit 0c3a346a60f0b3bb42445b2c63198a6e0f94c89b +Subproject commit 6429495dc9a80aaf1c243038b381451f12bc7dcf diff --git a/subprojects/secp256k1 b/subprojects/secp256k1 index 87f73ffad3..b4e8798651 160000 --- a/subprojects/secp256k1 +++ b/subprojects/secp256k1 @@ -1 +1 @@ -Subproject commit 87f73ffad3d3047baf1ed134fb7827a9dca163ee +Subproject commit b4e87986511e01ea6477838dc686cc7c08c3c8c9 diff --git a/vere/raft.c b/vere/raft.c index 8c12b1ac64..6bf9d34d4b 100644 --- a/vere/raft.c +++ b/vere/raft.c @@ -75,7 +75,7 @@ _raft_rnam_free(u3_rnam* nam_u) static u3_rnam* _raft_readname(const c3_c* str_c, c3_w siz_w) { - u3_rnam* nam_u = calloc(1, sizeof(*nam_u)); + u3_rnam* nam_u = c3_calloc(sizeof(*nam_u)); c3_c* col_c; c3_w nam_w; @@ -520,8 +520,8 @@ _raft_rmsg_read(const u3_rbuf* buf_u, u3_rmsg* msg_u) memcpy(&msg_u->rest.apen.ent_d, buf_u->buf_y + red_i, sizeof(c3_d)); red_i += sizeof(c3_d); - msg_u->rest.apen.ent_u = calloc( - 1, msg_u->rest.apen.ent_d * sizeof(u3_rent)); + msg_u->rest.apen.ent_u = c3_calloc( + msg_u->rest.apen.ent_d * sizeof(u3_rent)); { c3_d i_d; u3_rent* ent_u = msg_u->rest.apen.ent_u; @@ -1152,7 +1152,7 @@ _raft_write_rest(u3_rcon* ron_u, c3_d lai_d, c3_w lat_w, u3_rmsg* msg_u) msg_u->rest.lai_d = lai_d; msg_u->rest.lat_w = lat_w; msg_u->rest.nam_w = 1 + strlen(raf_u->str_c) / 4; - msg_u->rest.nam_c = calloc(1, 4 * msg_u->rest.nam_w); + msg_u->rest.nam_c = c3_calloc(4 * msg_u->rest.nam_w); strncpy(msg_u->rest.nam_c, raf_u->str_c, 4 * msg_u->rest.nam_w + 1); msg_u->len_d += 4 + msg_u->rest.nam_w; } diff --git a/vere/sist.c b/vere/sist.c index 6a9c57cebe..a0a4665955 100644 --- a/vere/sist.c +++ b/vere/sist.c @@ -272,7 +272,7 @@ _sist_cask(c3_c* dir_c, u3_noun nun) { c3_c paw_c[60]; u3_noun key; - u3_utty* uty_u = calloc(1, sizeof(u3_utty)); + u3_utty* uty_u = c3_calloc(sizeof(u3_utty)); uty_u->fid_i = 0; uH; diff --git a/vere/term.c b/vere/term.c index 54cb0a222b..1550797e4b 100644 --- a/vere/term.c +++ b/vere/term.c @@ -95,7 +95,7 @@ _term_close_cb(uv_handle_t* han_t) void u3_term_io_init() { - u3_utty* uty_u = calloc(1, sizeof(u3_utty)); + u3_utty* uty_u = c3_calloc(sizeof(u3_utty)); if ( c3y == u3_Host.ops_u.dem ) { uty_u->fid_i = 1;