Merge branch 'release-candidate' into passcode-eof

* release-candidate:
  Abbreviate cc
  Sort deps
  Fix build on OSX with MacPorts
  meson cleanup
  Try removing a bunch of dependencies
  Clean up allocator defs
This commit is contained in:
Joe Bryan 2019-01-09 00:09:48 -05:00
commit 638242c8d4
9 changed files with 83 additions and 97 deletions

42
.gitmodules vendored
View File

@ -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"] [submodule "subprojects/argon2"]
path = subprojects/argon2 path = subprojects/argon2
url = https://github.com/urbit/argon2.git url = https://github.com/urbit/argon2.git
[submodule "subprojects/secp256k1"] [submodule "subprojects/ed25519"]
path = subprojects/secp256k1 path = subprojects/ed25519
url = https://github.com/urbit/secp256k1.git 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"] [submodule "subprojects/libsni"]
path = subprojects/libsni path = subprojects/libsni
url = https://github.com/urbit/sniproxy 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

View File

@ -37,12 +37,7 @@ addons:
- openssl - openssl
- libssl-dev - libssl-dev
- libncurses5-dev - libncurses5-dev
- automake - gcc
- autoconf
- make
- libtool
- g++
- re2c
- libcurl4-gnutls-dev - libcurl4-gnutls-dev
- unzip - unzip
- gdb - gdb

View File

@ -91,27 +91,23 @@
cnt_w = (cnt_w + 1) % (n); \ cnt_w = (cnt_w + 1) % (n); \
} while (0) } while (0)
/* c3_malloc(): asserting malloc /* Asserting allocators.
*/ */
#define c3_malloc(s) ({ \ # define c3_malloc(s) ({ \
void* rut = malloc(s); \ void* rut = malloc(s); \
if ( 0 == rut ) { \ if ( 0 == rut ) { \
c3_assert(!"memory lost"); \ c3_assert(!"memory lost"); \
} \ } \
rut;}) rut;})
# define c3_calloc(s) ({ \
/* c3_calloc(): asserting calloc void* rut = calloc(1,s); \
*/ if ( 0 == rut ) { \
#define c3_calloc(s) ({ \ c3_assert(!"memory lost"); \
void* rut = c3_malloc(s); \ } \
memset(rut, 0, s); \ rut;})
rut;}) # define c3_realloc(a, b) ({ \
void* rut = realloc(a, b); \
/* c3_realloc(): asserting realloc if ( 0 == rut ) { \
*/ c3_assert(!"memory lost"); \
#define c3_realloc(a, b) ({ \ } \
void* rut = realloc(a, b); \ rut;})
if ( 0 == rut ) { \
c3_assert(!"memory lost"); \
} \
rut;})

View File

@ -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_CPU_DEBUG', get_option('prof'))
conf_data.set('U3_EVENT_TIME_DEBUG', get_option('event-time')) 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_c_flags = ['-funsigned-char','-ffast-math']
os_deps = [] os_deps = [dependency('threads')]
os_link_flags = [] os_link_flags = []
if osdet == 'linux' if osdet == 'linux'
conf_data.set('U3_OS_linux', true) 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') ncurses_dep = dependency('ncurses')
os_deps = os_deps + [pthread_dep, ncurses_dep] os_deps = os_deps + [ncurses_dep]
elif osdet == 'darwin' elif osdet == 'darwin'
conf_data.set('U3_OS_osx', true) conf_data.set('U3_OS_osx', true)
@ -267,7 +262,7 @@ elif osdet == 'darwin'
if(legacy_meson) if(legacy_meson)
ncurses_dep = find_library('ncurses') ncurses_dep = find_library('ncurses')
else else
ncurses_dep = meson.get_compiler('c').find_library('ncurses') ncurses_dep = cc.find_library('ncurses')
endif endif
os_deps = os_deps + [ncurses_dep] os_deps = os_deps + [ncurses_dep]
@ -275,10 +270,9 @@ elif osdet == 'darwin'
elif osdet == 'bsd' or osdet == 'freebsd' elif osdet == 'bsd' or osdet == 'freebsd'
conf_data.set('U3_OS_bsd', true) conf_data.set('U3_OS_bsd', true)
pthread_dep = meson.get_compiler('c').find_library('pthread') kvm_dep = cc.find_library('kvm')
kvm_dep = meson.get_compiler('c').find_library('kvm')
ncurses_dep = dependency('ncurses') 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' elif osdet == 'openbsd'
conf_data.set('U3_OS_bsd', true) conf_data.set('U3_OS_bsd', true)
@ -290,7 +284,7 @@ else
error('Unsupported OS detected:' + osdet) error('Unsupported OS detected:' + osdet)
endif endif
endian = build_machine.endian() endian = host_machine.endian()
if endian == 'little' if endian == 'little'
conf_data.set('U3_OS_ENDIAN_little', true) 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 # We expect these libs to supplied with the distribution
curl_dep = dependency('libcurl', version: '>=7.19.0') curl_dep = dependency('libcurl', version: '>=7.19.0')
if osdet == 'darwin' and not get_option('nix') if (osdet == 'darwin' and not get_option('nix') and
libcrypto = meson.get_compiler('c').find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ]) run_command('test', '-d', '/usr/local/opt/openssl/lib').returncode() == 0)
libssl = meson.get_compiler('c').find_library('ssl', dirs: [ '/usr/local/opt/openssl/lib/' ]) 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')) openssl_dep = declare_dependency(dependencies: [libcrypto, libssl], include_directories: include_directories('/usr/local/opt/openssl/include'))
else else
openssl_dep = dependency('openssl', version: '>=1.0.0') openssl_dep = dependency('openssl', version: '>=1.0.0')
@ -317,36 +312,36 @@ if(legacy_meson)
gmp_dep = find_library('gmp') gmp_dep = find_library('gmp')
sigsegv_dep = find_library('sigsegv') sigsegv_dep = find_library('sigsegv')
elif osdet != 'openbsd' elif osdet != 'openbsd'
gmp_dep = meson.get_compiler('c').find_library('gmp') # XX on OS X with MacPorts, set LIBRARY_PATH=/opt/local/lib to get meson to
sigsegv_dep = meson.get_compiler('c').find_library('sigsegv') # find these.
gmp_dep = cc.find_library('gmp')
sigsegv_dep = cc.find_library('sigsegv')
endif endif
# For these libs we provide fallback bundle # 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']) 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']) 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, curl_dep,
libuv_dep,
libh2o_dep,
secp256k1_dep,
gmp_dep,
sigsegv_dep,
urbitscrypt_dep,
ed25519_dep, ed25519_dep,
gmp_dep,
libh2o_dep,
libscrypt_dep,
libsni_dep,
libuv_dep,
murmur3_dep, murmur3_dep,
argon2_dep, openssl_dep,
softfloat3_dep, secp256k1_dep,
libsni_dep] sigsegv_dep,
softfloat3_dep]
executable('urbit', executable('urbit',
sources : sources, sources : sources,

@ -1 +1 @@
Subproject commit 3b1f53c86b71f6fdc099b3b378de6f379b4b8412 Subproject commit 0ed9ac70757a16ec45f91b8a347850d9699c3fb1

@ -1 +1 @@
Subproject commit 0c3a346a60f0b3bb42445b2c63198a6e0f94c89b Subproject commit 6429495dc9a80aaf1c243038b381451f12bc7dcf

@ -1 +1 @@
Subproject commit 87f73ffad3d3047baf1ed134fb7827a9dca163ee Subproject commit b4e87986511e01ea6477838dc686cc7c08c3c8c9

View File

@ -75,7 +75,7 @@ _raft_rnam_free(u3_rnam* nam_u)
static u3_rnam* static u3_rnam*
_raft_readname(const c3_c* str_c, c3_w siz_w) _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_c* col_c;
c3_w nam_w; 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)); memcpy(&msg_u->rest.apen.ent_d, buf_u->buf_y + red_i, sizeof(c3_d));
red_i += sizeof(c3_d); red_i += sizeof(c3_d);
msg_u->rest.apen.ent_u = calloc( msg_u->rest.apen.ent_u = c3_calloc(
1, msg_u->rest.apen.ent_d * sizeof(u3_rent)); msg_u->rest.apen.ent_d * sizeof(u3_rent));
{ {
c3_d i_d; c3_d i_d;
u3_rent* ent_u = msg_u->rest.apen.ent_u; 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.lai_d = lai_d;
msg_u->rest.lat_w = lat_w; msg_u->rest.lat_w = lat_w;
msg_u->rest.nam_w = 1 + strlen(raf_u->str_c) / 4; 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); 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; msg_u->len_d += 4 + msg_u->rest.nam_w;
} }

View File

@ -95,7 +95,7 @@ _term_close_cb(uv_handle_t* han_t)
void void
u3_term_io_init() 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 ) { if ( c3y == u3_Host.ops_u.dem ) {
uty_u->fid_i = 1; uty_u->fid_i = 1;