diff --git a/.gitignore b/.gitignore index 8700400106..380990d3a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,7 @@ -# subrepositories, downloaded pills -/arvo/ -*.pill -# autoconf -/.MAKEFILE-VERSION -/make.conf -/.make.conf -# intermediate -*.swo -*.swp -*.o -/outside/**/*.a -/outside/re2/obj -# build -/bin/ -/vere.pkg -.tags -.etags -GPATH -GTAGS -GRTAGS -# scratch -/zod/ -# dependencies -node_modules/ -.sass-cache -# OS -.DS_Store -# ?? -/inst -cscope.* -build/ -TAGS -/fakezod +/out +/result +/result-* +/work /zod +/fakezod* +tags diff --git a/.gitmodules b/.gitmodules index 7cc8ed5b8b..e6a1da4004 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,30 +1,12 @@ -[submodule "subprojects/argon2"] - path = subprojects/argon2 - url = https://github.com/urbit/argon2.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/libent"] - path = subprojects/libent - url = https://github.com/urbit/libent.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 +[submodule "nix/nixcrpkgs"] + path = nix/nixcrpkgs + url = https://github.com/urbit/nixcrpkgs +[submodule "pkg/urb"] + path = pkg/urb + url = https://github.com/urbit/urb.git +[submodule "pkg/ent"] + path = pkg/ent + url = https://github.com/urbit/libent +[submodule "pkg/arvo"] + path = pkg/arvo + url = https://github.com/urbit/arvo.git diff --git a/.travis.yml b/.travis.yml index f606a2957f..f04e45d331 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,62 +1,16 @@ -dist: xenial -language: node_js -node_js: -- 4 - -# Uncomment me if this gets annoying -# -# notifications: -# email: false - -before_install: - # try to get pill early, so configuration errors will be quickly caught - - cd .travis - - bash check-trailing-whitespace.sh - - bash get-brass-pill.sh - - cd .. - - wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip - - unzip ninja-linux.zip - - sudo mv ninja /usr/bin/ +language: nix +nix: 2.1.3 install: - # pwd: ~/urbit - - pip3 install --user -I meson + # nix-env -iA cachix -f https://cachix.org/api/v1/install + +before_install: + - git lfs pull script: - - meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true - - cd ./build - - ninja - - ninja test - - sudo ninja install - - cd ../.travis - - npm install - - ulimit -c unlimited -S - - npm run -s test; bash print-core-backtrace.sh $? - -addons: - apt: - packages: - - python3 - - python3-pip - - python3-setuptools - - python3-wheel - - libgmp3-dev - - libsigsegv-dev - - openssl - - libssl-dev - - libncurses5-dev - - gcc - - libcurl4-gnutls-dev - - unzip - - gdb -# before_deploy: "make deb" # TODO -# deploy: -# skip_cleanup: true -# provider: releases -# prerelease: true # turn this off for official releases -# api_key: -# secure: XX -# file: ./build/urbit # TODO upload package from before_deploy -# on: -# repo: urbit/urbit -# tags: true + # cachix authtoken "$CACHIX_AUTH_TOKEN" >/dev/null + # cachix use urbit + - make + - make test + - sh/update-brass-pill # To verify that this works. + # ./sh/cachix diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..2c047ed297 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +PKGS = minima extrema rusthello prog + +################################################################################ + +.PHONY: build all install release test clean + +build: + nix-build --no-out-link + +all: build release test + +install: + nix-env -f . -iA urbit -iA urbit-debug -iA urb + +release: + sh/release urbit linux32 + sh/release urbit linux64 + sh/release urbit darwin + +test: + sh/test + +clean: + rm -rf ./out ./work + rm -f result result-* diff --git a/default.nix b/default.nix index b21daad11a..a21725f733 100644 --- a/default.nix +++ b/default.nix @@ -1,37 +1,8 @@ let - pkgs = - builtins.fetchGit { - name = "nixpkgs-2018-11-13"; - url = https://github.com/nixos/nixpkgs/; - rev = "695a3d4254545968fc3015142c5299c0da5ca0a9"; - }; + pkgs = import ./nix/pkgs {}; + deps = import ./nix/deps {}; in - with (import pkgs {}); - -let - - osxdeps = lib.optionals stdenv.isDarwin ( - with darwin.apple_sdk.frameworks; - [ Cocoa CoreServices ]); - - deps = [ cmark curl gcc gmp libsigsegv meson ncurses ninja pkgconfig zlib - re2c openssl ]; - - isGitDir = (path: type: type != "directory" || baseNameOf path != ".git"); - -in - - stdenv.mkDerivation { - name = "urbit"; - - src = builtins.filterSource isGitDir ./.; - - buildInputs = osxdeps ++ deps; - - mesonFlags = "-Dnix=true"; - - NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreServices"; - } + deps // pkgs diff --git a/jets/f/slot.c b/jets/f/slot.c deleted file mode 100644 index 212934c934..0000000000 --- a/jets/f/slot.c +++ /dev/null @@ -1,55 +0,0 @@ -/* j/6/slot.c -** -*/ -#include "all.h" - - -/* functions -*/ - u3_noun - u3qf_slot(u3_atom axe, - u3_noun vax) - { - u3_noun fag = u3r_at(axe, u3t(vax)); - - fprintf(stderr, "slot axe %d\r\n", axe); - - if ( u3_none == fag ) { - return u3m_bail(c3__exit); - } - else { - u3_noun typ = u3qfu_peek( - } - c3_w i_w, met_w = c3_min(u3r_met(3, axe), u3r_met(3, vax)); - - if ( c3n == _slot_fiz(axe, vax) ) { - return c3n; - } - for ( i_w = 0; i_w < met_w; i_w++ ) { - c3_y axe_y = u3r_byte(i_w, axe); - c3_y vax_y = u3r_byte(i_w, vax); - - if ( (axe_y >= 'A') && (axe_y <= 'Z') ) axe_y = 0; - if ( (vax_y >= 'A') && (vax_y <= 'Z') ) vax_y = 0; - - if ( axe_y && vax_y && (axe_y != vax_y) ) { - return c3n; - } - } - return c3y; - } - - u3_noun - u3we_slot(u3_noun cor) - { - u3_noun axe, vax; - - if ( (c3n == u3r_mean(cor, u3x_sam_2, &axe, u3x_sam_3, &vax, 0)) || - (c3n == u3ud(axe)) || - (c3n == u3du(vax)) ) - { - return u3m_bail(c3__fail); - } else { - return u3qf_slot(axe, vax); - } - } diff --git a/jets/f/type.c b/jets/f/type.c deleted file mode 100644 index d1876ba0aa..0000000000 --- a/jets/f/type.c +++ /dev/null @@ -1,45 +0,0 @@ -/* j/6/type.c -** -*/ - -/* new template for type switching -*/ -{ - u3_noun p_sut, q_sut, r_sut; - - if ( c3n == u3du(sut) ) switch ( sut ) { - default: return u3m_bail(c3__fail); - - case c3__noun: - { - } - case c3__void: - { - } - } - else switch ( u3h(sut) ) { - default: return u3m_bail(c3__fail); - - case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - case c3__fork: p_sut = u3t(sut); - { - } - case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut); - { - } - } -} diff --git a/meson.build b/meson.build deleted file mode 100644 index 5cec95b129..0000000000 --- a/meson.build +++ /dev/null @@ -1,424 +0,0 @@ -project('urbit', 'c', meson_version: '>=0.29.0') - -legacy_meson = false - -detect_meson_version = run_command('meson', '--version') -meson_ver = detect_meson_version.stdout() - -if(meson_ver == '0.29.0\n') - legacy_meson = true -elif(not meson.version().version_compare('>=0.40.0')) - error('Meson 0.29.0 is last legacy version supported. Otherwise please upgrade to 0.40.0 or higher.') -endif - -jets_a_src = [ -'jets/a/add.c', -'jets/a/dec.c', -'jets/a/div.c', -'jets/a/gte.c', -'jets/a/gth.c', -'jets/a/lte.c', -'jets/a/lth.c', -'jets/a/mod.c', -'jets/a/mul.c', -'jets/a/sub.c',] - -jets_b_src = [ -'jets/b/bind.c', -'jets/b/clap.c', -'jets/b/drop.c', -'jets/b/flop.c', -'jets/b/lent.c', -'jets/b/levy.c', -'jets/b/lien.c', -'jets/b/murn.c', -'jets/b/need.c', -'jets/b/reap.c', -'jets/b/reel.c', -'jets/b/roll.c', -'jets/b/skid.c', -'jets/b/skim.c', -'jets/b/skip.c', -'jets/b/scag.c', -'jets/b/slag.c', -'jets/b/snag.c', -'jets/b/sort.c', -'jets/b/turn.c', - 'jets/b/weld.c' ] - -jets_c_src = [ -'jets/c/bex.c', -'jets/c/xeb.c', -'jets/c/can.c', -'jets/c/cap.c', -'jets/c/cat.c', -'jets/c/con.c', -'jets/c/cut.c', -'jets/c/dor.c', -'jets/c/dvr.c', -'jets/c/dis.c', -'jets/c/end.c', -'jets/c/gor.c', -'jets/c/lsh.c', -'jets/c/mas.c', -'jets/c/met.c', -'jets/c/mix.c', -'jets/c/mor.c', -'jets/c/mug.c', -'jets/c/muk.c', -'jets/c/peg.c', -'jets/c/po.c', -'jets/c/pow.c', -'jets/c/rap.c', -'jets/c/rep.c', -'jets/c/rev.c', -'jets/c/rip.c', -'jets/c/ripn.c', -'jets/c/rsh.c', -'jets/c/swp.c', -'jets/c/sqt.c' -] - -jets_d_src = [ -'jets/d/in_has.c', -'jets/d/in_int.c', -'jets/d/in_gas.c', -'jets/d/in_mer.c', -'jets/d/in_put.c', -'jets/d/in_tap.c', -'jets/d/in_uni.c', -'jets/d/in_wyt.c', -'jets/d/in_bif.c', -'jets/d/in_dif.c', -'jets/d/in_del.c', -'jets/d/by_del.c', -'jets/d/by_gas.c', -'jets/d/by_get.c', -'jets/d/by_has.c', -'jets/d/by_int.c', -'jets/d/by_jab.c', -'jets/d/by_put.c', -'jets/d/by_uni.c', -'jets/d/by_bif.c', -'jets/d/by_dif.c' -] - -jets_e_src = [ -'jets/e/aes_ecb.c', -'jets/e/aes_cbc.c', -'jets/e/aesc.c', -'jets/e/argon2.c', -'jets/e/blake.c', -'jets/e/cue.c', -'jets/e/fl.c', -'jets/e/hmac.c', -'jets/e/jam.c', -'jets/e/mat.c', -'jets/e/mink.c', -'jets/e/mule.c', -'jets/e/parse.c', -'jets/e/rd.c', -'jets/e/rq.c', -'jets/e/rs.c', -'jets/e/rh.c', -'jets/e/rub.c', -'jets/e/scr.c', -'jets/e/secp.c', -'jets/e/shax.c', -'jets/e/sha1.c', -'jets/e/lore.c', -'jets/e/loss.c', -'jets/e/lune.c', -'jets/e/trip.c', -'jets/e/ripe.c' -] - -jets_e_ed_src = [ -'jets/e/ed_puck.c', -'jets/e/ed_sign.c', -'jets/e/ed_veri.c', -'jets/e/ed_shar.c' -] - -jets_f_src = [ -'jets/f/ap.c', -'jets/f/cell.c', -'jets/f/comb.c', -'jets/f/cons.c', -'jets/f/core.c', -'jets/f/face.c', -'jets/f/fitz.c', -'jets/f/flan.c', -'jets/f/flip.c', -'jets/f/flor.c', -'jets/f/fork.c', -'jets/f/hint.c', -'jets/f/hike.c', -'jets/f/look.c', -'jets/f/loot.c' -] - -jets_f_ut_src = [ -'jets/f/ut.c', -'jets/f/ut_buss.c', -'jets/f/ut_crop.c', -'jets/f/ut_find.c', -'jets/f/ut_fire.c', -'jets/f/ut_fish.c', -'jets/f/ut_fuse.c', -'jets/f/ut_gain.c', -'jets/f/ut_lose.c', -'jets/f/ut_mint.c', -'jets/f/ut_mull.c', -'jets/f/ut_nest.c', -'jets/f/ut_peek.c', -'jets/f/ut_peel.c', -'jets/f/ut_play.c', -'jets/f/ut_repo.c', -'jets/f/ut_rest.c', -'jets/f/ut_tack.c', -'jets/f/ut_toss.c', -'jets/f/ut_wrap.c' -] - -jets_src = [ -'jets/tree.c' -] - -jets_all_src = [ - jets_a_src, jets_b_src, - jets_c_src, jets_d_src, - jets_e_src, jets_e_ed_src, - jets_f_src, jets_f_ut_src, - jets_src -] - -noun_src = [ - 'noun/allocate.c', - 'noun/events.c', - 'noun/hashtable.c', - 'noun/imprison.c', - 'noun/jets.c', - 'noun/manage.c', - 'noun/nock.c', - 'noun/retrieve.c', - 'noun/trace.c', - 'noun/vortex.c', - 'noun/xtract.c', - 'noun/zave.c' -] - -vere_lib_src = [ - 'vere/ames.c', - 'vere/behn.c', - 'vere/cttp.c', - 'vere/dawn.c', - 'vere/foil.c', - #'vere/fuse.c', - 'vere/http.c', - 'vere/ivory.c', - 'vere/king.c', - 'vere/newt.c', - 'vere/pier.c', - 'vere/reck.c', - 'vere/save.c', - 'vere/term.c', - 'vere/time.c', - 'vere/unix.c', - 'vere/walk.c' -] - -incdir = include_directories('include/') - -conf_data = configuration_data() -conf_data.set('URBIT_VERSION', '"0.7.2"') -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')) -conf_data.set('U3_MEMORY_LOG', get_option('memory-log')) - -osdet = host_machine.system() -cc = meson.get_compiler('c') -os_c_flags = ['-funsigned-char','-ffast-math'] -os_deps = [dependency('threads')] -os_link_flags = [] - -if osdet == 'linux' - conf_data.set('U3_OS_linux', true) - - ncurses_dep = dependency('ncurses') - os_deps = os_deps + [ncurses_dep] - -elif osdet == 'darwin' - conf_data.set('U3_OS_osx', true) - - # os_c_flags = os_c_flags + ['-bind_at_load'] - # os_link_flags = ['-framework CoreServices', '-framework CoreFoundation'] - if(legacy_meson) - ncurses_dep = find_library('ncurses') - else - ncurses_dep = cc.find_library('ncurses') - endif - - os_deps = os_deps + [ncurses_dep] - -elif osdet == 'bsd' or osdet == 'freebsd' - conf_data.set('U3_OS_bsd', true) - - kvm_dep = cc.find_library('kvm') - ncurses_dep = dependency('ncurses') - os_deps = os_deps + [kvm_dep, ncurses_dep] - -elif osdet == 'openbsd' - conf_data.set('U3_OS_bsd', true) - os_link_flags = ['-L/usr/local/lib', '-lgmp', '-lsigsegv', '-lcurses'] - gmp_dep = [] - sigsegv_dep = [] - -else - error('Unsupported OS detected:' + osdet) -endif - -endian = host_machine.endian() - -if endian == 'little' - conf_data.set('U3_OS_ENDIAN_little', true) -else - error('Little endian encoding required') -endif - -configure_file(input : 'include/config.h.in', - output : 'config.h', - configuration : conf_data) - -# 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') 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') -endif - -if(legacy_meson) - gmp_dep = find_library('gmp') - sigsegv_dep = find_library('sigsegv') -elif osdet != 'openbsd' - # 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 -# -argon2_dep = dependency('argon2', version: '>=1', fallback: ['argon2', 'argon2_dep']) -ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep']) -libscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_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']) - -# XX temporary, should only be needed in vere -# -libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep']) -libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep']) - - -noun_deps = [argon2_dep, - ed25519_dep, - gmp_dep, - libscrypt_dep, - murmur3_dep, - openssl_dep, - secp256k1_dep, - sigsegv_dep, - softfloat3_dep, - libh2o_dep, - libuv_dep] - -libnoun = static_library('noun', - sources: [noun_src, jets_all_src], - include_directories: incdir, - c_args : os_c_flags, - link_args: os_link_flags, - dependencies: noun_deps + os_deps, - install: false -) - -# For these two libs we provide fallback bundle - -libent_dep = dependency( - 'libent', - version: '>=0.2.1', - fallback: ['libent', 'libent_dep'], -) - -libsni_dep = dependency( - 'libsni', - version: '>=0.5.0', - fallback: ['libsni', 'libsni_dep'], -) - -vere_deps = [ - curl_dep, - libent_dep, - libh2o_dep, - libsni_dep, - libuv_dep, - openssl_dep, -] - -executable('urbit', -sources : vere_lib_src + [ 'vere/main.c' ], -include_directories : incdir, -c_args : os_c_flags, -link_args: os_link_flags, -dependencies: vere_deps + os_deps, -link_with: libnoun, -install: true) - -executable('urbit-worker', -sources : vere_lib_src + [ 'vere/serf.c' ], -include_directories : incdir, -c_args : os_c_flags, -link_args: os_link_flags, -dependencies: vere_deps + os_deps, -link_with: libnoun, -install: true) - -test_hashtable = executable('test-hashtable', -sources : vere_lib_src + ['tests/hashtable_tests.c'], -include_directories : incdir, -c_args : os_c_flags, -link_args: os_link_flags, -dependencies: vere_deps + os_deps, -link_with: libnoun, -install: false) - -test('test-hashtable', test_hashtable) - -test_mem = executable('test-mem', -sources : vere_lib_src + ['tests/test.c'], -include_directories : incdir, -c_args : os_c_flags, -link_args: os_link_flags, -dependencies: vere_deps + os_deps, -link_with: libnoun, -install: false) - -test('test-mem', test_mem, should_fail: true) - -test_hash = executable('test-hash', -sources : vere_lib_src + ['tests/hash_tests.c'], -include_directories : incdir, -c_args : os_c_flags, -link_args: os_link_flags, -dependencies: vere_deps + os_deps, -link_with: libnoun, -install: false) - -test('test-hash', test_hash) diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100644 index 0d0166a5a0..0000000000 --- a/meson_options.txt +++ /dev/null @@ -1,10 +0,0 @@ -option('gc', type : 'boolean', value : false, - description : 'Add debugging information to heap. Run with -g. Breaks image.') -option('prof', type : 'boolean', value : false, - description : 'Activate profiling. Run with -P.') -option('event-time', type : 'boolean', value : false, - description : 'Print timing information per event.') -option('memory-log', type : 'boolean', value : false, - description : 'Write memory usage to a logfile.') -option('nix', type: 'boolean', value: false, - description: 'Build using nix.') diff --git a/nix/crossdeps.nix b/nix/crossdeps.nix new file mode 100644 index 0000000000..af2b8b9c5c --- /dev/null +++ b/nix/crossdeps.nix @@ -0,0 +1,13 @@ +crossenv: + +rec { + argon2 = import ./deps/argon2/cross.nix { inherit crossenv; }; + murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; }; + uv = import ./deps/uv/cross.nix { inherit crossenv; }; + ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; }; + sni = import ./deps/sni/cross.nix { inherit crossenv; }; + scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; }; + softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; }; + secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; }; + h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; }; +} diff --git a/nix/dep-repos.nix b/nix/dep-repos.nix new file mode 100644 index 0000000000..bd3463a894 --- /dev/null +++ b/nix/dep-repos.nix @@ -0,0 +1,19 @@ +# This is a hack to give us access to the fetching of dependency repos +# as nix builds. We use this to cache those Cachix for faster rebuilds +# in CI. + +with (import ./deps {}); + +{ + argon2-src = argon2.src; + ed25519-src = ed25519.src; + ent-src = ent.src; + h2o-src = h2o.src; + murmur3-src = murmur3.src; + nodehello-src = nodehello.src; + scrypt-src = scrypt.src; + secp256k1-src = secp256k1.src; + sni-src = sni.src; + softfloat3-src = softfloat3.src; + uv-src = uv.src; +} diff --git a/nix/deps-env.nix b/nix/deps-env.nix new file mode 100644 index 0000000000..2810652db9 --- /dev/null +++ b/nix/deps-env.nix @@ -0,0 +1,31 @@ +let + + pkgs = import ./nixpkgs.nix; + tlon = import ./pkgs { pkgs=pkgs; }; + deps = import ./deps { pkgs=pkgs; }; + + tools = + with pkgs; + [ cargo rustc meson ninja pkgconfig libtool gdb ]; + + libs = + with pkgs; + [ openssl zlib curl gmp scrypt libsigsegv ncurses openssl zlib ]; + + osx = + with pkgs; + lib.optionals stdenv.isDarwin ( + with darwin.apple_sdk.frameworks; + [ Cocoa CoreServices ]); + + vendor = + with deps; + [ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ]; + +in + +pkgs.stdenv.mkDerivation rec { + name = "urbit-deps-env"; + env = pkgs.buildEnv { name = name; paths = buildInputs; }; + buildInputs = tools ++ libs ++ osx ++ vendor; +} diff --git a/nix/deps/argon2/builder.sh b/nix/deps/argon2/builder.sh new file mode 100644 index 0000000000..9430b939f9 --- /dev/null +++ b/nix/deps/argon2/builder.sh @@ -0,0 +1,14 @@ +source $stdenv/setup + +cp -r $src ./src +chmod -R a+w ./src +cd ./src + +sed -i 's|ar rcs|${AR} rcs|' Makefile + +make libargon2.a -j4 + +mkdir -p $out/{lib,include} +cp libargon2.a $out/lib +cp include/argon2.h $out/include +cp ./src/blake2/*.h $out/include diff --git a/nix/deps/argon2/cross.nix b/nix/deps/argon2/cross.nix new file mode 100644 index 0000000000..f7776d03ee --- /dev/null +++ b/nix/deps/argon2/cross.nix @@ -0,0 +1,17 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "argon2-4da94"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + NO_THREADS = true; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "argon2"; + rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c"; + sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc"; + }; +} diff --git a/nix/deps/argon2/default.nix b/nix/deps/argon2/default.nix new file mode 100644 index 0000000000..e101ca6968 --- /dev/null +++ b/nix/deps/argon2/default.nix @@ -0,0 +1,13 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "argon2-4da94"; + builder = ./builder.sh; + NO_THREADS = true; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "argon2"; + rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c"; + sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc"; + }; +} diff --git a/nix/deps/default.nix b/nix/deps/default.nix new file mode 100644 index 0000000000..40e15b46b7 --- /dev/null +++ b/nix/deps/default.nix @@ -0,0 +1,13 @@ +{ pkgs ? import ../nixpkgs.nix }: + +rec { + argon2 = import ./argon2 { inherit pkgs; }; + murmur3 = import ./murmur3 { inherit pkgs; }; + uv = import ./uv { inherit pkgs; }; + ed25519 = import ./ed25519 { inherit pkgs; }; + sni = import ./sni { inherit pkgs; }; + scrypt = import ./scrypt { inherit pkgs; }; + softfloat3 = import ./softfloat3 { inherit pkgs; }; + secp256k1 = import ./secp256k1 { inherit pkgs; }; + h2o = import ./h2o { inherit pkgs uv; }; +} diff --git a/nix/deps/ed25519/builder.sh b/nix/deps/ed25519/builder.sh new file mode 100644 index 0000000000..e37423356f --- /dev/null +++ b/nix/deps/ed25519/builder.sh @@ -0,0 +1,29 @@ +source $stdenv/setup + +sources=" \ + $src/src/add_scalar.c \ + $src/src/seed.c \ + $src/src/verify.c \ + $src/src/add_scalar.c \ + $src/src/sha512.c \ + $src/src/ge.c \ + $src/src/fe.c \ + $src/src/keypair.c \ + $src/src/sign.c \ + $src/src/sc.c \ + $src/src/key_exchange.c \ +" + +CFLAGS="-O3 -Wall -I$src/src" + +for fn in $sources +do echo $CC $CFLAGS -c $fn -o $(basename $fn).o + $CC -O3 -Wall -I$src/src -c $fn -o $(basename $fn).o +done + +mkdir -p $out/{lib,include} + +$AR rcs $out/lib/libed25519.a *.o +echo $AR rcs $out/lib/libed25519.a *.o + +cp $src/src/*.h $out/include diff --git a/nix/deps/ed25519/cross.nix b/nix/deps/ed25519/cross.nix new file mode 100644 index 0000000000..76ae2a5d52 --- /dev/null +++ b/nix/deps/ed25519/cross.nix @@ -0,0 +1,16 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "ed25519-76385"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "ed25519"; + rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c"; + sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp"; + }; +} diff --git a/nix/deps/ed25519/default.nix b/nix/deps/ed25519/default.nix new file mode 100644 index 0000000000..4d4ee42c83 --- /dev/null +++ b/nix/deps/ed25519/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "ed25519-76385"; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "ed25519"; + rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c"; + sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp"; + }; +} diff --git a/nix/deps/h2o/builder.sh b/nix/deps/h2o/builder.sh new file mode 100644 index 0000000000..4c5c71723b --- /dev/null +++ b/nix/deps/h2o/builder.sh @@ -0,0 +1,109 @@ +source $stdenv/setup + +sources=" \ + deps/cloexec/cloexec.c \ + deps/libgkc/gkc.c \ + deps/libyrmcds/close.c \ + deps/libyrmcds/connect.c \ + deps/libyrmcds/recv.c \ + deps/libyrmcds/send.c \ + deps/libyrmcds/send_text.c \ + deps/libyrmcds/socket.c \ + deps/libyrmcds/strerror.c \ + deps/libyrmcds/text_mode.c \ + deps/picohttpparser/picohttpparser.c \ + lib/common/cache.c \ + lib/common/file.c \ + lib/common/filecache.c \ + lib/common/hostinfo.c \ + lib/common/http1client.c \ + lib/common/memcached.c \ + lib/common/memory.c \ + lib/common/multithread.c \ + lib/common/serverutil.c \ + lib/common/socket.c \ + lib/common/socketpool.c \ + lib/common/string.c \ + lib/common/time.c \ + lib/common/timeout.c \ + lib/common/url.c \ + lib/core/config.c \ + lib/core/configurator.c \ + lib/core/context.c \ + lib/core/headers.c \ + lib/core/logconf.c \ + lib/core/proxy.c \ + lib/core/request.c \ + lib/core/token.c \ + lib/core/util.c \ + lib/handler/access_log.c \ + lib/handler/chunked.c \ + lib/handler/compress.c \ + lib/handler/compress/gzip.c \ + lib/handler/errordoc.c \ + lib/handler/expires.c \ + lib/handler/fastcgi.c \ + lib/handler/file.c \ + lib/handler/headers.c \ + lib/handler/mimemap.c \ + lib/handler/proxy.c \ + lib/handler/redirect.c \ + lib/handler/reproxy.c \ + lib/handler/throttle_resp.c \ + lib/handler/status.c \ + lib/handler/headers_util.c \ + lib/handler/status/events.c \ + lib/handler/status/requests.c \ + lib/handler/http2_debug_state.c \ + lib/handler/status/durations.c \ + lib/handler/configurator/access_log.c \ + lib/handler/configurator/compress.c \ + lib/handler/configurator/errordoc.c \ + lib/handler/configurator/expires.c \ + lib/handler/configurator/fastcgi.c \ + lib/handler/configurator/file.c \ + lib/handler/configurator/headers.c \ + lib/handler/configurator/proxy.c \ + lib/handler/configurator/redirect.c \ + lib/handler/configurator/reproxy.c \ + lib/handler/configurator/throttle_resp.c \ + lib/handler/configurator/status.c \ + lib/handler/configurator/http2_debug_state.c \ + lib/handler/configurator/headers_util.c \ + lib/http1.c \ + lib/tunnel.c \ + lib/http2/cache_digests.c \ + lib/http2/casper.c \ + lib/http2/connection.c \ + lib/http2/frame.c \ + lib/http2/hpack.c \ + lib/http2/scheduler.c \ + lib/http2/stream.c \ + lib/http2/http2_debug_state.c \ +" + +CFLAGS=" \ + -O3 \ + -Wall -Wno-unused-value -Wno-unused-function \ + -I$src/include \ + -I$src/deps/cloexec \ + -I$src/deps/brotli/enc \ + -I$src/deps/golombset \ + -I$src/deps/libgkc \ + -I$src/deps/libyrmcds \ + -I$src/deps/klib \ + -I$src/deps/neverbleed \ + -I$src/deps/picohttpparser \ + -I$src/deps/picotest \ + -I$src/deps/yaml/include \ + -I$src/deps/yoml +" + +for s in $sources +do cc $CFLAGS -c $src/$s -o $(sed 's|/|_|g; s/.c$/.o/' <<< $s) +done + +mkdir -p $out/{lib,include} +ar rcs $out/lib/libh2o.a *.o +cp -r $src/include/* $out/include +cp $src/deps/picohttpparser/picohttpparser.h $out/include diff --git a/nix/deps/h2o/cross.nix b/nix/deps/h2o/cross.nix new file mode 100644 index 0000000000..49b6ce3dee --- /dev/null +++ b/nix/deps/h2o/cross.nix @@ -0,0 +1,17 @@ +{ crossenv, uv }: + +crossenv.make_derivation rec { + inherit (crossenv) openssl zlib; + inherit uv; + + name = "h2o-0ed9a"; + cross_inputs = [ uv crossenv.openssl crossenv.zlib ]; + builder = ./cross.sh; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "h2o"; + rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1"; + sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm"; + }; +} diff --git a/nix/deps/h2o/cross.sh b/nix/deps/h2o/cross.sh new file mode 100644 index 0000000000..e91314996b --- /dev/null +++ b/nix/deps/h2o/cross.sh @@ -0,0 +1,26 @@ +source $stdenv/setup + +cp -r $src src +chmod -R u+w src +cd src + +cmake-cross . \ + -DZLIB_LIBRARY=$zlib/lib/libz.a \ + -DZLIB_INCLUDE_DIR=$zlib/include \ + -DCMAKE_INSTALL_PREFIX=$out \ + -DBUILD_SHARED_LIBS=off \ + -DWITH_MRUBY=off \ + -DWITH_BUNDLED_SSL=off \ + -DWITH_PICOTLS=on + +make libh2o + +mkdir -p $out/{lib,lib/pkgconfig,include} + +cp ./libh2o.a $out/lib + +cp ./libh2o.pc $out/lib/pkgconfig + +cp -r include/* $out/include + +cp deps/picohttpparser/picohttpparser.h $out/include diff --git a/nix/deps/h2o/default.nix b/nix/deps/h2o/default.nix new file mode 100644 index 0000000000..101edbeb78 --- /dev/null +++ b/nix/deps/h2o/default.nix @@ -0,0 +1,13 @@ +{ pkgs, uv }: + +pkgs.stdenv.mkDerivation rec { + name = "h2o-0ed9a"; + buildInputs = [ uv pkgs.openssl pkgs.zlib ]; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "h2o"; + rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1"; + sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm"; + }; +} diff --git a/nix/deps/murmur3/builder.sh b/nix/deps/murmur3/builder.sh new file mode 100644 index 0000000000..9afd6918a0 --- /dev/null +++ b/nix/deps/murmur3/builder.sh @@ -0,0 +1,11 @@ +source $stdenv/setup + +echo $CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c +$CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c + +mkdir -p $out/{lib,include} + +echo $AR rcs $out/lib/libmurmur3.a murmur3.o +$AR rcs $out/lib/libmurmur3.a murmur3.o + +cp $src/murmur3.h $out/include diff --git a/nix/deps/murmur3/cross.nix b/nix/deps/murmur3/cross.nix new file mode 100644 index 0000000000..024f58656d --- /dev/null +++ b/nix/deps/murmur3/cross.nix @@ -0,0 +1,16 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "murmur3-71a75"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "murmur3"; + rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca"; + sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg"; + }; +} diff --git a/nix/deps/murmur3/default.nix b/nix/deps/murmur3/default.nix new file mode 100644 index 0000000000..01c0ae9cf2 --- /dev/null +++ b/nix/deps/murmur3/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "murmur3-71a75"; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "murmur3"; + rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca"; + sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg"; + }; +} diff --git a/nix/deps/scrypt/builder.sh b/nix/deps/scrypt/builder.sh new file mode 100644 index 0000000000..94e03d0314 --- /dev/null +++ b/nix/deps/scrypt/builder.sh @@ -0,0 +1,27 @@ +source $stdenv/setup + +sources=" \ + crypto_scrypt-check \ + crypto_scrypt-hash \ + crypto_scrypt-hexconvert \ + crypto_scrypt-nosse \ + crypto-mcf \ + crypto-scrypt-saltgen \ + slowequals \ + sha256 \ + b64 \ +" + +CFLAGS="-I$src -Wall -ffast-math -O3 -D_FORTIFY_SOURCE=2 -fstack-protector" + +for s in $sources +do echo $CC $CFLAGS -c $src/$s.c -o $s.o + $CC $CFLAGS -c $src/$s.c -o $s.o +done + +echo $AR rcs libscrypt.a *.o +$AR rcs libscrypt.a *.o + +mkdir -p $out/{lib,include} +cp libscrypt.a $out/lib +cp $src/*.h $out/include diff --git a/nix/deps/scrypt/cross.nix b/nix/deps/scrypt/cross.nix new file mode 100644 index 0000000000..9a74e5b65e --- /dev/null +++ b/nix/deps/scrypt/cross.nix @@ -0,0 +1,16 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "scrypt-02969"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "libscrypt"; + rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2"; + sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n"; + }; +} diff --git a/nix/deps/scrypt/default.nix b/nix/deps/scrypt/default.nix new file mode 100644 index 0000000000..a0740f9e1e --- /dev/null +++ b/nix/deps/scrypt/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "scrypt-02969"; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "libscrypt"; + rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2"; + sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n"; + }; +} diff --git a/nix/deps/secp256k1/builder.sh b/nix/deps/secp256k1/builder.sh new file mode 100644 index 0000000000..703164c6c1 --- /dev/null +++ b/nix/deps/secp256k1/builder.sh @@ -0,0 +1,11 @@ +source $stdenv/setup + +cp -r $src ./src +chmod -R u+w ./src +cd src + +libtoolize +./autogen.sh +./configure --prefix=$out --host=$host $configureFlags +make +make install diff --git a/nix/deps/secp256k1/cross.nix b/nix/deps/secp256k1/cross.nix new file mode 100644 index 0000000000..67ac2379de --- /dev/null +++ b/nix/deps/secp256k1/cross.nix @@ -0,0 +1,25 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "secp256k1-b4e87"; + builder = ./builder.sh; + + CFLAGS = "-fPIC"; + + configureFlags = [ + "--disable-shared" + "--enable-module-recovery" + ]; + + cross_inputs = [ crossenv.libgmp ]; + native_inputs = + with crossenv.nixpkgs; + [ autoconf automake libtool m4 ]; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "bitcoin-core"; + repo = "secp256k1"; + rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49"; + sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c"; + }; +} diff --git a/nix/deps/secp256k1/default.nix b/nix/deps/secp256k1/default.nix new file mode 100644 index 0000000000..438b2dc25d --- /dev/null +++ b/nix/deps/secp256k1/default.nix @@ -0,0 +1,25 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "secp256k1-b4e87"; + builder = ./builder.sh; + + CFLAGS = "-fPIC"; + + configureFlags = [ + "--disable-shared" + "--enable-module-recovery" + ]; + + buildInputs = [ pkgs.gmp ]; + nativeBuildInputs = + with pkgs; + [ autoconf automake libtool m4 ]; + + src = pkgs.fetchFromGitHub { + owner = "bitcoin-core"; + repo = "secp256k1"; + rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49"; + sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c"; + }; +} diff --git a/nix/deps/sni/builder.sh b/nix/deps/sni/builder.sh new file mode 100644 index 0000000000..c726b58c5d --- /dev/null +++ b/nix/deps/sni/builder.sh @@ -0,0 +1,13 @@ +source $stdenv/setup + +CFLAGS="-O3 -Wall -ffast-math -Wno-unused-const-variable" + +echo $CC $CFLAGS -c $src/src/tls.c -o tls.o +$CC $CFLAGS -c $src/src/tls.c -o tls.o + +echo $AR rcs libsni.a tls.o +$AR rcs libsni.a tls.o + +mkdir -p $out/{lib,include} +cp libsni.a $out/lib/ +cp $src/src/tls.h $out/include/ diff --git a/nix/deps/sni/cross.nix b/nix/deps/sni/cross.nix new file mode 100644 index 0000000000..69d11152e5 --- /dev/null +++ b/nix/deps/sni/cross.nix @@ -0,0 +1,18 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "sni"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "sniproxy"; + rev = "173beb88ee62bddd13874ca04ab338cdec704928"; + sha256 = "1ib6p7vhpvbg6d5a2aimppsb09kjg4px4vlw5h3ys9zf9c1if5z4"; + }; +} + + diff --git a/nix/deps/sni/default.nix b/nix/deps/sni/default.nix new file mode 100644 index 0000000000..506a5df63c --- /dev/null +++ b/nix/deps/sni/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "sni"; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "sniproxy"; + rev = "173beb88ee62bddd13874ca04ab338cdec704928"; + sha256 = "1ib6p7vhpvbg6d5a2aimppsb09kjg4px4vlw5h3ys9zf9c1if5z4"; + }; +} diff --git a/nix/deps/softfloat3/builder.sh b/nix/deps/softfloat3/builder.sh new file mode 100644 index 0000000000..6a8efbaf85 --- /dev/null +++ b/nix/deps/softfloat3/builder.sh @@ -0,0 +1,15 @@ +source $stdenv/setup + +cp -r $src $TMP/$name +chmod -R u+w $TMP/$name +cd $TMP/$name + +cd ./build/Linux-386-SSE2-GCC +sed -i 's|gcc|$(CC)|' Makefile +sed -i 's/ar crs/$(AR) crs/' Makefile + +make -j4 + +mkdir -p $out/{lib,include} +cp $src/source/include/*.h $out/include +cp softfloat.a $out/lib/libsoftfloat3.a diff --git a/nix/deps/softfloat3/cross.nix b/nix/deps/softfloat3/cross.nix new file mode 100644 index 0000000000..9d76c7e699 --- /dev/null +++ b/nix/deps/softfloat3/cross.nix @@ -0,0 +1,16 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "softfloat3-ec4c7"; + builder = ./builder.sh; + + CC = "${crossenv.host}-gcc"; + AR = "${crossenv.host}-ar"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "berkeley-softfloat-3"; + rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986"; + sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339"; + }; +} diff --git a/nix/deps/softfloat3/default.nix b/nix/deps/softfloat3/default.nix new file mode 100644 index 0000000000..c101b28c24 --- /dev/null +++ b/nix/deps/softfloat3/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "softfloat3-ec4c7"; + builder = ./builder.sh; + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "berkeley-softfloat-3"; + rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986"; + sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339"; + }; +} diff --git a/nix/deps/uv/builder.sh b/nix/deps/uv/builder.sh new file mode 100644 index 0000000000..2d6f324391 --- /dev/null +++ b/nix/deps/uv/builder.sh @@ -0,0 +1,9 @@ +source $stdenv/setup + +cp -r $src ./src +chmod -R a+w ./src +cd ./src + +LIBTOOLIZE=libtoolize ./autogen.sh +./configure --prefix=$out --host=$host $configureFlags +make install diff --git a/nix/deps/uv/cross.nix b/nix/deps/uv/cross.nix new file mode 100644 index 0000000000..4e81e4bd7b --- /dev/null +++ b/nix/deps/uv/cross.nix @@ -0,0 +1,17 @@ +{ crossenv }: + +crossenv.make_derivation rec { + name = "uv-64294"; + native_inputs = with crossenv.nixpkgs; [ autoconf automake libtool m4 ]; + builder = ./builder.sh; + + configureFlags = [ "--disable-shared" ]; + CFLAGS = "-fPIC"; + + src = crossenv.nixpkgs.fetchFromGitHub { + owner = "urbit"; + repo = "libuv"; + rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf"; + sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15"; + }; +} diff --git a/nix/deps/uv/default.nix b/nix/deps/uv/default.nix new file mode 100644 index 0000000000..ecf8383d26 --- /dev/null +++ b/nix/deps/uv/default.nix @@ -0,0 +1,27 @@ +{ pkgs }: + +let + + osx = + with pkgs; + lib.optionals stdenv.isDarwin ( + with darwin.apple_sdk.frameworks; + [ Cocoa CoreServices ]); + +in + +pkgs.stdenv.mkDerivation rec { + name = "uv-64294"; + buildInputs = osx ++ (with pkgs; [ autoconf automake libtool m4 ]); + builder = ./builder.sh; + + CFLAGS = "-fPIC"; + configureFlags = [ "--disable-shared" ]; + + src = pkgs.fetchFromGitHub { + owner = "urbit"; + repo = "libuv"; + rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf"; + sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15"; + }; +} diff --git a/nix/nixcrpkgs b/nix/nixcrpkgs new file mode 160000 index 0000000000..59c86f2709 --- /dev/null +++ b/nix/nixcrpkgs @@ -0,0 +1 @@ +Subproject commit 59c86f2709001a62e1d82e3c41fd01c4f236bdd7 diff --git a/nix/nixcrpkgs.nix b/nix/nixcrpkgs.nix new file mode 100644 index 0000000000..c47d62abe8 --- /dev/null +++ b/nix/nixcrpkgs.nix @@ -0,0 +1,7 @@ +let + + nixpkgs = import ./nixpkgs.nix; + +in + +import ./nixcrpkgs/top.nix { inherit nixpkgs; } diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix new file mode 100644 index 0000000000..fd2d2cd4a4 --- /dev/null +++ b/nix/nixpkgs.nix @@ -0,0 +1,13 @@ +let + + rev = "61c3169a0e17d789c566d5b241bfe309ce4a6275"; + hash = "0qbycg7wkb71v20rchlkafrjfpbk2fnlvvbh3ai9pyfisci5wxvq"; + pkgs = builtins.fetchTarball { + name = "nixpkgs-2019-01-15"; + url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz"; + sha256 = hash; + }; + +in + +import pkgs {} diff --git a/nix/ops/brass/builder.sh b/nix/ops/brass/builder.sh new file mode 100755 index 0000000000..8c8677a5f9 --- /dev/null +++ b/nix/ops/brass/builder.sh @@ -0,0 +1,27 @@ +source $stdenv/setup + +set -ex + +cp -r $FAKEZOD ./zod +chmod -R u+rw ./zod + +urbit -d ./zod + +cleanup () { + if [ -e ./zod/.vere.lock ] + then kill $(< ./zod/.vere.lock) || true; + fi +} + +trap cleanup EXIT + +urb ./zod -p hood -d '+hood/autoload |' +urb ./zod -p hood -d "+hood/mount %" + +rm -r ./zod/home +cp -r $ARVO ./zod/home + +urb ./zod -p hood -d "+hood/commit %home" +urb ./zod -P brass.pill -d '+brass' + +mv brass.pill $out diff --git a/nix/ops/brass/default.nix b/nix/ops/brass/default.nix new file mode 100644 index 0000000000..45253b9b6a --- /dev/null +++ b/nix/ops/brass/default.nix @@ -0,0 +1,10 @@ +{ pkgs, tlon, deps, urbit, fakezod, arvo }: + +pkgs.stdenv.mkDerivation rec { + name = "brass"; + builder = ./builder.sh; + buildInputs = [ urbit tlon.urb pkgs.coreutils ]; + + FAKEZOD = fakezod; + ARVO = arvo; +} diff --git a/nix/ops/default.nix b/nix/ops/default.nix new file mode 100644 index 0000000000..b4c66d25bc --- /dev/null +++ b/nix/ops/default.nix @@ -0,0 +1,46 @@ +{ pkgs ? import ../nixpkgs.nix }: + +let + + deps = import ../deps { inherit pkgs; }; + tlon = import ../pkgs { inherit pkgs; }; + arvo = tlon.arvo; + urbit = tlon.urbit; + +in + +rec { + + bootzod = import ./fakeship { + inherit pkgs tlon deps urbit; + brass = ../../bin/brass.pill; + ship = "zod"; + }; + + bootbus = import ./fakeship { + inherit pkgs tlon deps urbit; + brass = ../../bin/brass.pill; + ship = "bus"; + }; + + test = import ./test { + inherit pkgs tlon deps urbit arvo; + ship = bootzod; + }; + + solid = import ./solid { + inherit arvo pkgs tlon deps urbit; + fakezod = bootzod; + }; + + brass = import ./brass { + inherit arvo pkgs tlon deps urbit; + fakezod = bootzod; + }; + + fakezod = import ./fakeship { + inherit pkgs tlon deps urbit brass; + ship = "zod"; + }; + +} diff --git a/nix/ops/fakeship/builder.sh b/nix/ops/fakeship/builder.sh new file mode 100755 index 0000000000..8a00b164ac --- /dev/null +++ b/nix/ops/fakeship/builder.sh @@ -0,0 +1,19 @@ +source $stdenv/setup + +set -ex + +urbit -d -F $SHIP -B "$PILL" $out + +check () { + [ 3 -eq "$(urb $out -d 3)" ] +} + +if check +then + echo "Boot success." >&2 + urb $out -p hood -d '+hood/exit' || true +else + echo "Boot failure." >&2 + kill $(< $out/.vere.lock) || true + exit 1 +fi diff --git a/nix/ops/fakeship/default.nix b/nix/ops/fakeship/default.nix new file mode 100644 index 0000000000..133a1ba3b1 --- /dev/null +++ b/nix/ops/fakeship/default.nix @@ -0,0 +1,9 @@ +{ pkgs, tlon, deps, urbit, brass, ship ? "zod" }: + +pkgs.stdenv.mkDerivation rec { + name = "fake" + ship; + builder = ./builder.sh; + buildInputs = [ urbit tlon.urb ]; + PILL = brass; + SHIP = ship; +} diff --git a/nix/ops/solid/builder.sh b/nix/ops/solid/builder.sh new file mode 100755 index 0000000000..0c94c14a55 --- /dev/null +++ b/nix/ops/solid/builder.sh @@ -0,0 +1,31 @@ +source $stdenv/setup + +set -ex + +cp -r $FAKEZOD ./zod +chmod -R u+rw ./zod + +urbit -d ./zod + +cleanup () { + if [ -e ./zod/.vere.lock ] + then kill $(< ./zod/.vere.lock) || true; + fi +} + +trap cleanup EXIT + +urb ./zod -p hood -d '+hood/autoload |' +urb ./zod -p hood -d "+hood/mount %" + +rm -r ./zod/home +cp -r $ARVO ./zod/home + +# cp -r $ARVO/sys ./zod/home/ +# cp $ARVO/gen/solid.hoon ./zod/home/gen/ +# cp $ARVO/lib/pill.hoon ./zod/home/lib/ + +urb ./zod -p hood -d "+hood/commit %home" +urb ./zod -P urbit.pill -d '+solid, =dub &' + +mv urbit.pill $out diff --git a/nix/ops/solid/default.nix b/nix/ops/solid/default.nix new file mode 100644 index 0000000000..9834568910 --- /dev/null +++ b/nix/ops/solid/default.nix @@ -0,0 +1,10 @@ +{ pkgs, tlon, deps, urbit, fakezod, arvo }: + +pkgs.stdenv.mkDerivation rec { + name = "solid"; + builder = ./builder.sh; + buildInputs = [ urbit tlon.urb pkgs.coreutils ]; + + FAKEZOD = fakezod; + ARVO = arvo; +} diff --git a/nix/ops/test/builder.sh b/nix/ops/test/builder.sh new file mode 100644 index 0000000000..8ca7c7ebe0 --- /dev/null +++ b/nix/ops/test/builder.sh @@ -0,0 +1,65 @@ +source $stdenv/setup + +set -ex + +cp -r $SHIP ./ship +chmod -R u+rw ./ship + +urbit -d ./ship 2> urbit-output + +tail -f urbit-output >&2 & +tailproc=$! + +shutdown () { + if [ -e ./ship/.vere.lock ] + then kill $(< ./ship/.vere.lock) || true; + fi + + kill "$tailproc" || true; +} + +trap shutdown EXIT + +urb ./ship -p hood -d '+hood/autoload |' +urb ./ship -p hood -d '+hood/mount %' + +rm -r ./ship/home +cp -r $ARVO ./ship/home + +urb ./ship -p hood -d '+hood/commit %home' + +# Start the test app +urb ./ship -p hood -d '+hood/start %test' + +# Run the %cores tests +urb ./ship -d '~& ~ ~& %start-test-cores ~' +urb ./ship -p test -d ':- %cores /' +urb ./ship -d '~& %finish-test-cores ~' + +# Run the %renders tests +urb ./ship -d '~& ~ ~& %start-test-renders ~' +urb ./ship -p test -d ':- %renders /' +urb ./ship -d '~& %finish-test-renders ~' + +# Run the test generator +urb ./ship -d '+test' | tee test-generator-output + +shutdown + +# Collect output + +cp urbit-output test-cores-output +cp urbit-output test-renders-output +rm urbit-output + +sed -i '0,/start-test-renders/d' test-renders-output +sed -i '/finish-test-renders/,$d' test-renders-output + +sed -i '0,/start-test-cores/d' test-cores-output +sed -i '/finish-test-cores/,$d' test-cores-output + +mkdir $out + +cp test-renders-output $out/renders +cp test-cores-output $out/cores +cp test-generator-output $out/generator diff --git a/nix/ops/test/default.nix b/nix/ops/test/default.nix new file mode 100644 index 0000000000..3a18414952 --- /dev/null +++ b/nix/ops/test/default.nix @@ -0,0 +1,10 @@ +{ pkgs, tlon, deps, urbit, ship, arvo }: + +pkgs.stdenv.mkDerivation rec { + name = "test"; + builder = ./builder.sh; + buildInputs = [ urbit tlon.urb pkgs.coreutils ]; + + SHIP = ship; + ARVO = arvo; +} diff --git a/nix/pkgs/arvo/builder.sh b/nix/pkgs/arvo/builder.sh new file mode 100644 index 0000000000..31933a29ed --- /dev/null +++ b/nix/pkgs/arvo/builder.sh @@ -0,0 +1,3 @@ +source $stdenv/setup + +cp -r $src $out diff --git a/nix/pkgs/arvo/default.nix b/nix/pkgs/arvo/default.nix new file mode 100644 index 0000000000..f5c192ff41 --- /dev/null +++ b/nix/pkgs/arvo/default.nix @@ -0,0 +1,7 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation { + name = "arvo"; + builder = ./builder.sh; + src = pkgs.buildRustCrateHelpers.exclude [ ".git" ] ../../../pkg/arvo; +} diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix new file mode 100644 index 0000000000..ee384fcc9e --- /dev/null +++ b/nix/pkgs/default.nix @@ -0,0 +1,29 @@ +{ pkgs ? import ../nixpkgs.nix }: + +let + + deps = import ../deps { inherit pkgs; }; + +in + +rec { + arvo = import ./arvo { inherit pkgs; }; + ent = import ./ent { inherit pkgs; }; + urb = import ../../pkg/urb { inherit pkgs; }; + + urbit = import ./urbit { + inherit pkgs ent; + inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3; + inherit (deps) secp256k1 h2o; + name = "urbit"; + debug = false; + }; + + urbit-debug = import ./urbit { + inherit pkgs ent; + inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3; + inherit (deps) secp256k1 h2o; + name = "urbit-debug"; + debug = true; + }; +} diff --git a/nix/pkgs/ent/builder.sh b/nix/pkgs/ent/builder.sh new file mode 100644 index 0000000000..f1c558dd08 --- /dev/null +++ b/nix/pkgs/ent/builder.sh @@ -0,0 +1,8 @@ +source $stdenv/setup + +cp -r $src ./src +chmod -R u+w ./src +cd ./src + +./configure +PREFIX=$out make install diff --git a/nix/pkgs/ent/cross.nix b/nix/pkgs/ent/cross.nix new file mode 100644 index 0000000000..e84d7a01ed --- /dev/null +++ b/nix/pkgs/ent/cross.nix @@ -0,0 +1,10 @@ +{ env_name, env, deps }: + +env.make_derivation rec { + name = "ent-7506f"; + builder = ./builder.sh; + src = ../../../pkg/ent; + + CC = "${env.host}-gcc"; + AR = "${env.host}-ar"; +} diff --git a/nix/pkgs/ent/default.nix b/nix/pkgs/ent/default.nix new file mode 100644 index 0000000000..ce7c2088cc --- /dev/null +++ b/nix/pkgs/ent/default.nix @@ -0,0 +1,7 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation rec { + name = "ent-7506f"; + builder = ./builder.sh; + src = ../../../pkg/ent; +} diff --git a/nix/pkgs/urbit/builder.sh b/nix/pkgs/urbit/builder.sh new file mode 100644 index 0000000000..0f2d99d628 --- /dev/null +++ b/nix/pkgs/urbit/builder.sh @@ -0,0 +1,13 @@ +source $stdenv/setup + +cp -r $src ./src +chmod -R u+w ./src +cd src + +./configure + +make urbit urbit-worker -j8 + +mkdir -p $out/bin +cp urbit $out/bin/$exename +cp urbit-worker $out/bin/$exename-worker diff --git a/nix/pkgs/urbit/default.nix b/nix/pkgs/urbit/default.nix new file mode 100644 index 0000000000..b536eef94e --- /dev/null +++ b/nix/pkgs/urbit/default.nix @@ -0,0 +1,44 @@ +{ + pkgs, + name ? "urbit", + debug ? false, + argon2, ed25519, ent, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv +}: + +let + + deps = + with pkgs; + [ curl gmp libsigsegv ncurses openssl zlib ]; + + vendor = + [ argon2 softfloat3 ed25519 ent h2o scrypt uv murmur3 secp256k1 sni ]; + + # osx = + # with pkgs; + # lib.optionals stdenv.isDarwin ( + # with darwin.apple_sdk.frameworks; + # [ Cocoa CoreServices ]); + + # NIX_LDFLAGS = + # pkgs.lib.optionalString pkgs.stdenv.isDarwin + # "-framework CoreServices -framework CoreFoundation"; + +in + +pkgs.stdenv.mkDerivation { + name = name; + exename = name; + src = ../../../pkg/urbit; + builder = ./builder.sh; + + nativeBuildInputs = deps ++ vendor; + + # See https://github.com/NixOS/nixpkgs/issues/18995 + hardeningDisable = if debug then [ "all" ] else []; + + CFLAGS = if debug then "-O0 -g" else "-O3"; + MEMORY_DEBUG = debug; + CPU_DEBUG = debug; + EVENT_TIME_DEBUG = false; +} diff --git a/nix/pkgs/urbit/release.nix b/nix/pkgs/urbit/release.nix new file mode 100644 index 0000000000..2d6c93ff06 --- /dev/null +++ b/nix/pkgs/urbit/release.nix @@ -0,0 +1,29 @@ +{ env_name, env, deps }: + +{ ent, name ? "urbit", debug ? false }: + +let + + crossdeps = + with env; + [ curl libgmp libsigsegv ncurses openssl zlib ]; + + vendor = + with deps; + [ argon2 softfloat3 ed25519 h2o scrypt uv murmur3 secp256k1 sni ]; + +in + +env.make_derivation { + CFLAGS = if debug then "-O0 -g" else "-O3"; + LDFLAGS = if debug then "" else "-s"; + MEMORY_DEBUG = debug; + CPU_DEBUG = debug; + EVENT_TIME_DEBUG = false; + + name = "${name}-${env_name}"; + exename = name; + src = ../../../pkg/urbit; + cross_inputs = crossdeps ++ vendor ++ [ ent ]; + builder = ./release.sh; +} diff --git a/nix/pkgs/urbit/release.sh b/nix/pkgs/urbit/release.sh new file mode 100644 index 0000000000..adef458786 --- /dev/null +++ b/nix/pkgs/urbit/release.sh @@ -0,0 +1,21 @@ +source $setup + +cp -r $src ./src +chmod -R u+w ./src +cd src + +for dep in $cross_inputs; do + export CFLAGS="${CFLAGS-} -I$dep/include" + export LDFLAGS="${LDFLAGS-} -L$dep/lib" +done + +CC=$host-gcc \ +PKG_CONFIG=pkg-config-cross \ +HOST=$host \ +./configure + +make urbit urbit-worker -j8 + +mkdir -p $out/bin +cp urbit $out/bin/$exename +cp urbit-worker $out/bin/$exename-worker diff --git a/nix/pkgs/urbit/shell.nix b/nix/pkgs/urbit/shell.nix new file mode 100644 index 0000000000..310b3eba1b --- /dev/null +++ b/nix/pkgs/urbit/shell.nix @@ -0,0 +1,14 @@ +let + + pkgs = import ../../nixpkgs.nix; + deps = import ../../deps { inherit pkgs; }; + tlon = import ../../pkgs { inherit pkgs; }; + +in + +import ./default.nix { + inherit pkgs; + inherit (tlon) ent; + inherit (deps) + argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv; +} diff --git a/nix/release.nix b/nix/release.nix new file mode 100644 index 0000000000..caf86377c4 --- /dev/null +++ b/nix/release.nix @@ -0,0 +1,51 @@ +let + + nixpkgs = import ./nixpkgs.nix; + nixcrpkgs = import ./nixcrpkgs.nix; + crossdeps = import ./crossdeps.nix; + + release = + env_name: env: { + inherit env env_name; + deps = crossdeps env; + }; + + linux32 = release "linux32" nixcrpkgs.linux32; + linux64 = release "linux64" nixcrpkgs.linux64; + darwin = release "darwin" nixcrpkgs.mac; + + ent = env: + import ./pkgs/ent/cross.nix env; + + urbit = env: + import ./pkgs/urbit/release.nix env + { ent = ent env; debug = false; name = "urbit"; }; + + urbit-debug = env: + import ./pkgs/urbit/release.nix env + { ent = ent env; debug = true; name = "urbit-debug"; }; + +in + +{ + linux32-env = linux32.env; + linux32 = linux32.deps // { + ent = ent linux32; + urbit = urbit linux32; + urbit-debug = urbit-debug linux32; + }; + + linux64-env = linux64.env; + linux64 = linux64.deps // { + ent = ent linux64; + urbit = urbit linux64; + urbit-debug = urbit-debug linux64; + }; + + darwin-env = darwin.env; + darwin = darwin.deps // { + ent = ent darwin; + urbit = urbit darwin; + urbit-debug = urbit-debug darwin; + }; +} diff --git a/include/c/defs.h b/pkg/c3/defs.h similarity index 100% rename from include/c/defs.h rename to pkg/c3/defs.h diff --git a/include/c/motes.h b/pkg/c3/motes.h similarity index 100% rename from include/c/motes.h rename to pkg/c3/motes.h diff --git a/include/c/portable.h b/pkg/c3/portable.h similarity index 100% rename from include/c/portable.h rename to pkg/c3/portable.h diff --git a/include/c/types.h b/pkg/c3/types.h similarity index 100% rename from include/c/types.h rename to pkg/c3/types.h diff --git a/pkg/ent b/pkg/ent new file mode 160000 index 0000000000..31ac2913f1 --- /dev/null +++ b/pkg/ent @@ -0,0 +1 @@ +Subproject commit 31ac2913f14c6f7631f5792ad942605fb2d9fb87 diff --git a/include/noun/aliases.h b/pkg/noun/aliases.h similarity index 100% rename from include/noun/aliases.h rename to pkg/noun/aliases.h diff --git a/noun/allocate.c b/pkg/noun/allocate.c similarity index 100% rename from noun/allocate.c rename to pkg/noun/allocate.c diff --git a/include/noun/allocate.h b/pkg/noun/allocate.h similarity index 100% rename from include/noun/allocate.h rename to pkg/noun/allocate.h diff --git a/noun/events.c b/pkg/noun/events.c similarity index 100% rename from noun/events.c rename to pkg/noun/events.c diff --git a/include/noun/events.h b/pkg/noun/events.h similarity index 100% rename from include/noun/events.h rename to pkg/noun/events.h diff --git a/noun/hashtable.c b/pkg/noun/hashtable.c similarity index 100% rename from noun/hashtable.c rename to pkg/noun/hashtable.c diff --git a/include/noun/hashtable.h b/pkg/noun/hashtable.h similarity index 100% rename from include/noun/hashtable.h rename to pkg/noun/hashtable.h diff --git a/tests/hashtable_tests.c b/pkg/noun/hashtable_tests.c similarity index 100% rename from tests/hashtable_tests.c rename to pkg/noun/hashtable_tests.c diff --git a/noun/imprison.c b/pkg/noun/imprison.c similarity index 100% rename from noun/imprison.c rename to pkg/noun/imprison.c diff --git a/include/noun/imprison.h b/pkg/noun/imprison.h similarity index 100% rename from include/noun/imprison.h rename to pkg/noun/imprison.h diff --git a/noun/jets.c b/pkg/noun/jets.c similarity index 100% rename from noun/jets.c rename to pkg/noun/jets.c diff --git a/include/noun/jets.h b/pkg/noun/jets.h similarity index 100% rename from include/noun/jets.h rename to pkg/noun/jets.h diff --git a/jets/a/add.c b/pkg/noun/jets/a/add.c similarity index 100% rename from jets/a/add.c rename to pkg/noun/jets/a/add.c diff --git a/jets/a/dec.c b/pkg/noun/jets/a/dec.c similarity index 100% rename from jets/a/dec.c rename to pkg/noun/jets/a/dec.c diff --git a/jets/a/div.c b/pkg/noun/jets/a/div.c similarity index 100% rename from jets/a/div.c rename to pkg/noun/jets/a/div.c diff --git a/jets/a/gte.c b/pkg/noun/jets/a/gte.c similarity index 100% rename from jets/a/gte.c rename to pkg/noun/jets/a/gte.c diff --git a/jets/a/gth.c b/pkg/noun/jets/a/gth.c similarity index 100% rename from jets/a/gth.c rename to pkg/noun/jets/a/gth.c diff --git a/jets/a/lte.c b/pkg/noun/jets/a/lte.c similarity index 100% rename from jets/a/lte.c rename to pkg/noun/jets/a/lte.c diff --git a/jets/a/lth.c b/pkg/noun/jets/a/lth.c similarity index 100% rename from jets/a/lth.c rename to pkg/noun/jets/a/lth.c diff --git a/jets/a/mod.c b/pkg/noun/jets/a/mod.c similarity index 100% rename from jets/a/mod.c rename to pkg/noun/jets/a/mod.c diff --git a/jets/a/mul.c b/pkg/noun/jets/a/mul.c similarity index 100% rename from jets/a/mul.c rename to pkg/noun/jets/a/mul.c diff --git a/jets/a/sub.c b/pkg/noun/jets/a/sub.c similarity index 100% rename from jets/a/sub.c rename to pkg/noun/jets/a/sub.c diff --git a/jets/b/bind.c b/pkg/noun/jets/b/bind.c similarity index 100% rename from jets/b/bind.c rename to pkg/noun/jets/b/bind.c diff --git a/jets/b/clap.c b/pkg/noun/jets/b/clap.c similarity index 100% rename from jets/b/clap.c rename to pkg/noun/jets/b/clap.c diff --git a/jets/b/drop.c b/pkg/noun/jets/b/drop.c similarity index 100% rename from jets/b/drop.c rename to pkg/noun/jets/b/drop.c diff --git a/jets/b/flop.c b/pkg/noun/jets/b/flop.c similarity index 100% rename from jets/b/flop.c rename to pkg/noun/jets/b/flop.c diff --git a/jets/b/lent.c b/pkg/noun/jets/b/lent.c similarity index 100% rename from jets/b/lent.c rename to pkg/noun/jets/b/lent.c diff --git a/jets/b/levy.c b/pkg/noun/jets/b/levy.c similarity index 100% rename from jets/b/levy.c rename to pkg/noun/jets/b/levy.c diff --git a/jets/b/lien.c b/pkg/noun/jets/b/lien.c similarity index 100% rename from jets/b/lien.c rename to pkg/noun/jets/b/lien.c diff --git a/jets/b/murn.c b/pkg/noun/jets/b/murn.c similarity index 100% rename from jets/b/murn.c rename to pkg/noun/jets/b/murn.c diff --git a/jets/b/need.c b/pkg/noun/jets/b/need.c similarity index 100% rename from jets/b/need.c rename to pkg/noun/jets/b/need.c diff --git a/jets/b/reap.c b/pkg/noun/jets/b/reap.c similarity index 100% rename from jets/b/reap.c rename to pkg/noun/jets/b/reap.c diff --git a/jets/b/reel.c b/pkg/noun/jets/b/reel.c similarity index 100% rename from jets/b/reel.c rename to pkg/noun/jets/b/reel.c diff --git a/jets/b/roll.c b/pkg/noun/jets/b/roll.c similarity index 100% rename from jets/b/roll.c rename to pkg/noun/jets/b/roll.c diff --git a/jets/b/scag.c b/pkg/noun/jets/b/scag.c similarity index 100% rename from jets/b/scag.c rename to pkg/noun/jets/b/scag.c diff --git a/jets/b/skid.c b/pkg/noun/jets/b/skid.c similarity index 100% rename from jets/b/skid.c rename to pkg/noun/jets/b/skid.c diff --git a/jets/b/skim.c b/pkg/noun/jets/b/skim.c similarity index 100% rename from jets/b/skim.c rename to pkg/noun/jets/b/skim.c diff --git a/jets/b/skip.c b/pkg/noun/jets/b/skip.c similarity index 100% rename from jets/b/skip.c rename to pkg/noun/jets/b/skip.c diff --git a/jets/b/slag.c b/pkg/noun/jets/b/slag.c similarity index 100% rename from jets/b/slag.c rename to pkg/noun/jets/b/slag.c diff --git a/jets/b/snag.c b/pkg/noun/jets/b/snag.c similarity index 100% rename from jets/b/snag.c rename to pkg/noun/jets/b/snag.c diff --git a/jets/b/sort.c b/pkg/noun/jets/b/sort.c similarity index 100% rename from jets/b/sort.c rename to pkg/noun/jets/b/sort.c diff --git a/jets/b/turn.c b/pkg/noun/jets/b/turn.c similarity index 100% rename from jets/b/turn.c rename to pkg/noun/jets/b/turn.c diff --git a/jets/b/weld.c b/pkg/noun/jets/b/weld.c similarity index 100% rename from jets/b/weld.c rename to pkg/noun/jets/b/weld.c diff --git a/jets/c/bex.c b/pkg/noun/jets/c/bex.c similarity index 100% rename from jets/c/bex.c rename to pkg/noun/jets/c/bex.c diff --git a/jets/c/can.c b/pkg/noun/jets/c/can.c similarity index 100% rename from jets/c/can.c rename to pkg/noun/jets/c/can.c diff --git a/jets/c/cap.c b/pkg/noun/jets/c/cap.c similarity index 100% rename from jets/c/cap.c rename to pkg/noun/jets/c/cap.c diff --git a/jets/c/cat.c b/pkg/noun/jets/c/cat.c similarity index 100% rename from jets/c/cat.c rename to pkg/noun/jets/c/cat.c diff --git a/jets/c/con.c b/pkg/noun/jets/c/con.c similarity index 100% rename from jets/c/con.c rename to pkg/noun/jets/c/con.c diff --git a/jets/c/cut.c b/pkg/noun/jets/c/cut.c similarity index 100% rename from jets/c/cut.c rename to pkg/noun/jets/c/cut.c diff --git a/jets/c/dis.c b/pkg/noun/jets/c/dis.c similarity index 100% rename from jets/c/dis.c rename to pkg/noun/jets/c/dis.c diff --git a/jets/c/dor.c b/pkg/noun/jets/c/dor.c similarity index 100% rename from jets/c/dor.c rename to pkg/noun/jets/c/dor.c diff --git a/jets/c/dvr.c b/pkg/noun/jets/c/dvr.c similarity index 100% rename from jets/c/dvr.c rename to pkg/noun/jets/c/dvr.c diff --git a/jets/c/end.c b/pkg/noun/jets/c/end.c similarity index 100% rename from jets/c/end.c rename to pkg/noun/jets/c/end.c diff --git a/jets/c/gor.c b/pkg/noun/jets/c/gor.c similarity index 100% rename from jets/c/gor.c rename to pkg/noun/jets/c/gor.c diff --git a/jets/c/lsh.c b/pkg/noun/jets/c/lsh.c similarity index 100% rename from jets/c/lsh.c rename to pkg/noun/jets/c/lsh.c diff --git a/jets/c/mas.c b/pkg/noun/jets/c/mas.c similarity index 100% rename from jets/c/mas.c rename to pkg/noun/jets/c/mas.c diff --git a/jets/c/met.c b/pkg/noun/jets/c/met.c similarity index 100% rename from jets/c/met.c rename to pkg/noun/jets/c/met.c diff --git a/jets/c/mix.c b/pkg/noun/jets/c/mix.c similarity index 100% rename from jets/c/mix.c rename to pkg/noun/jets/c/mix.c diff --git a/jets/c/mor.c b/pkg/noun/jets/c/mor.c similarity index 100% rename from jets/c/mor.c rename to pkg/noun/jets/c/mor.c diff --git a/jets/c/mug.c b/pkg/noun/jets/c/mug.c similarity index 100% rename from jets/c/mug.c rename to pkg/noun/jets/c/mug.c diff --git a/jets/c/muk.c b/pkg/noun/jets/c/muk.c similarity index 100% rename from jets/c/muk.c rename to pkg/noun/jets/c/muk.c diff --git a/jets/c/peg.c b/pkg/noun/jets/c/peg.c similarity index 100% rename from jets/c/peg.c rename to pkg/noun/jets/c/peg.c diff --git a/jets/c/po.c b/pkg/noun/jets/c/po.c similarity index 100% rename from jets/c/po.c rename to pkg/noun/jets/c/po.c diff --git a/jets/c/pow.c b/pkg/noun/jets/c/pow.c similarity index 100% rename from jets/c/pow.c rename to pkg/noun/jets/c/pow.c diff --git a/jets/c/rap.c b/pkg/noun/jets/c/rap.c similarity index 100% rename from jets/c/rap.c rename to pkg/noun/jets/c/rap.c diff --git a/jets/c/rep.c b/pkg/noun/jets/c/rep.c similarity index 100% rename from jets/c/rep.c rename to pkg/noun/jets/c/rep.c diff --git a/jets/c/rev.c b/pkg/noun/jets/c/rev.c similarity index 100% rename from jets/c/rev.c rename to pkg/noun/jets/c/rev.c diff --git a/jets/c/rip.c b/pkg/noun/jets/c/rip.c similarity index 100% rename from jets/c/rip.c rename to pkg/noun/jets/c/rip.c diff --git a/jets/c/ripn.c b/pkg/noun/jets/c/ripn.c similarity index 100% rename from jets/c/ripn.c rename to pkg/noun/jets/c/ripn.c diff --git a/jets/c/rsh.c b/pkg/noun/jets/c/rsh.c similarity index 100% rename from jets/c/rsh.c rename to pkg/noun/jets/c/rsh.c diff --git a/jets/c/sqt.c b/pkg/noun/jets/c/sqt.c similarity index 100% rename from jets/c/sqt.c rename to pkg/noun/jets/c/sqt.c diff --git a/jets/c/swp.c b/pkg/noun/jets/c/swp.c similarity index 100% rename from jets/c/swp.c rename to pkg/noun/jets/c/swp.c diff --git a/jets/c/xeb.c b/pkg/noun/jets/c/xeb.c similarity index 100% rename from jets/c/xeb.c rename to pkg/noun/jets/c/xeb.c diff --git a/jets/d/by_bif.c b/pkg/noun/jets/d/by_bif.c similarity index 100% rename from jets/d/by_bif.c rename to pkg/noun/jets/d/by_bif.c diff --git a/jets/d/by_del.c b/pkg/noun/jets/d/by_del.c similarity index 100% rename from jets/d/by_del.c rename to pkg/noun/jets/d/by_del.c diff --git a/jets/d/by_dif.c b/pkg/noun/jets/d/by_dif.c similarity index 100% rename from jets/d/by_dif.c rename to pkg/noun/jets/d/by_dif.c diff --git a/jets/d/by_gas.c b/pkg/noun/jets/d/by_gas.c similarity index 100% rename from jets/d/by_gas.c rename to pkg/noun/jets/d/by_gas.c diff --git a/jets/d/by_get.c b/pkg/noun/jets/d/by_get.c similarity index 100% rename from jets/d/by_get.c rename to pkg/noun/jets/d/by_get.c diff --git a/jets/d/by_has.c b/pkg/noun/jets/d/by_has.c similarity index 100% rename from jets/d/by_has.c rename to pkg/noun/jets/d/by_has.c diff --git a/jets/d/by_int.c b/pkg/noun/jets/d/by_int.c similarity index 100% rename from jets/d/by_int.c rename to pkg/noun/jets/d/by_int.c diff --git a/jets/d/by_jab.c b/pkg/noun/jets/d/by_jab.c similarity index 100% rename from jets/d/by_jab.c rename to pkg/noun/jets/d/by_jab.c diff --git a/jets/d/by_put.c b/pkg/noun/jets/d/by_put.c similarity index 100% rename from jets/d/by_put.c rename to pkg/noun/jets/d/by_put.c diff --git a/jets/d/by_uni.c b/pkg/noun/jets/d/by_uni.c similarity index 100% rename from jets/d/by_uni.c rename to pkg/noun/jets/d/by_uni.c diff --git a/jets/d/in_bif.c b/pkg/noun/jets/d/in_bif.c similarity index 100% rename from jets/d/in_bif.c rename to pkg/noun/jets/d/in_bif.c diff --git a/jets/d/in_del.c b/pkg/noun/jets/d/in_del.c similarity index 100% rename from jets/d/in_del.c rename to pkg/noun/jets/d/in_del.c diff --git a/jets/d/in_dif.c b/pkg/noun/jets/d/in_dif.c similarity index 100% rename from jets/d/in_dif.c rename to pkg/noun/jets/d/in_dif.c diff --git a/jets/d/in_gas.c b/pkg/noun/jets/d/in_gas.c similarity index 100% rename from jets/d/in_gas.c rename to pkg/noun/jets/d/in_gas.c diff --git a/jets/d/in_has.c b/pkg/noun/jets/d/in_has.c similarity index 100% rename from jets/d/in_has.c rename to pkg/noun/jets/d/in_has.c diff --git a/jets/d/in_int.c b/pkg/noun/jets/d/in_int.c similarity index 100% rename from jets/d/in_int.c rename to pkg/noun/jets/d/in_int.c diff --git a/jets/d/in_mer.c b/pkg/noun/jets/d/in_mer.c similarity index 100% rename from jets/d/in_mer.c rename to pkg/noun/jets/d/in_mer.c diff --git a/jets/d/in_put.c b/pkg/noun/jets/d/in_put.c similarity index 100% rename from jets/d/in_put.c rename to pkg/noun/jets/d/in_put.c diff --git a/jets/d/in_tap.c b/pkg/noun/jets/d/in_tap.c similarity index 100% rename from jets/d/in_tap.c rename to pkg/noun/jets/d/in_tap.c diff --git a/jets/d/in_uni.c b/pkg/noun/jets/d/in_uni.c similarity index 100% rename from jets/d/in_uni.c rename to pkg/noun/jets/d/in_uni.c diff --git a/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c similarity index 100% rename from jets/d/in_wyt.c rename to pkg/noun/jets/d/in_wyt.c diff --git a/jets/e/aes_cbc.c b/pkg/noun/jets/e/aes_cbc.c similarity index 100% rename from jets/e/aes_cbc.c rename to pkg/noun/jets/e/aes_cbc.c diff --git a/jets/e/aes_ecb.c b/pkg/noun/jets/e/aes_ecb.c similarity index 100% rename from jets/e/aes_ecb.c rename to pkg/noun/jets/e/aes_ecb.c diff --git a/jets/e/aesc.c b/pkg/noun/jets/e/aesc.c similarity index 100% rename from jets/e/aesc.c rename to pkg/noun/jets/e/aesc.c diff --git a/jets/e/argon2.c b/pkg/noun/jets/e/argon2.c similarity index 100% rename from jets/e/argon2.c rename to pkg/noun/jets/e/argon2.c diff --git a/jets/e/blake.c b/pkg/noun/jets/e/blake.c similarity index 98% rename from jets/e/blake.c rename to pkg/noun/jets/e/blake.c index 8a703a4cac..329e86d2f6 100644 --- a/jets/e/blake.c +++ b/pkg/noun/jets/e/blake.c @@ -4,7 +4,7 @@ #include "all.h" #include -#include "../src/blake2/blake2.h" +#include /* functions */ diff --git a/jets/e/cue.c b/pkg/noun/jets/e/cue.c similarity index 100% rename from jets/e/cue.c rename to pkg/noun/jets/e/cue.c diff --git a/jets/e/ed_puck.c b/pkg/noun/jets/e/ed_puck.c similarity index 100% rename from jets/e/ed_puck.c rename to pkg/noun/jets/e/ed_puck.c diff --git a/jets/e/ed_shar.c b/pkg/noun/jets/e/ed_shar.c similarity index 100% rename from jets/e/ed_shar.c rename to pkg/noun/jets/e/ed_shar.c diff --git a/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c similarity index 100% rename from jets/e/ed_sign.c rename to pkg/noun/jets/e/ed_sign.c diff --git a/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c similarity index 100% rename from jets/e/ed_veri.c rename to pkg/noun/jets/e/ed_veri.c diff --git a/jets/e/fl.c b/pkg/noun/jets/e/fl.c similarity index 100% rename from jets/e/fl.c rename to pkg/noun/jets/e/fl.c diff --git a/jets/e/hmac.c b/pkg/noun/jets/e/hmac.c similarity index 100% rename from jets/e/hmac.c rename to pkg/noun/jets/e/hmac.c diff --git a/jets/e/jam.c b/pkg/noun/jets/e/jam.c similarity index 100% rename from jets/e/jam.c rename to pkg/noun/jets/e/jam.c diff --git a/jets/e/lore.c b/pkg/noun/jets/e/lore.c similarity index 100% rename from jets/e/lore.c rename to pkg/noun/jets/e/lore.c diff --git a/jets/e/loss.c b/pkg/noun/jets/e/loss.c similarity index 100% rename from jets/e/loss.c rename to pkg/noun/jets/e/loss.c diff --git a/jets/e/lune.c b/pkg/noun/jets/e/lune.c similarity index 100% rename from jets/e/lune.c rename to pkg/noun/jets/e/lune.c diff --git a/jets/e/mat.c b/pkg/noun/jets/e/mat.c similarity index 100% rename from jets/e/mat.c rename to pkg/noun/jets/e/mat.c diff --git a/jets/e/mink.c b/pkg/noun/jets/e/mink.c similarity index 100% rename from jets/e/mink.c rename to pkg/noun/jets/e/mink.c diff --git a/jets/e/mule.c b/pkg/noun/jets/e/mule.c similarity index 100% rename from jets/e/mule.c rename to pkg/noun/jets/e/mule.c diff --git a/jets/e/parse.c b/pkg/noun/jets/e/parse.c similarity index 100% rename from jets/e/parse.c rename to pkg/noun/jets/e/parse.c diff --git a/jets/e/rd.c b/pkg/noun/jets/e/rd.c similarity index 100% rename from jets/e/rd.c rename to pkg/noun/jets/e/rd.c diff --git a/jets/e/rh.c b/pkg/noun/jets/e/rh.c similarity index 100% rename from jets/e/rh.c rename to pkg/noun/jets/e/rh.c diff --git a/jets/e/ripe.c b/pkg/noun/jets/e/ripe.c similarity index 100% rename from jets/e/ripe.c rename to pkg/noun/jets/e/ripe.c diff --git a/jets/e/rq.c b/pkg/noun/jets/e/rq.c similarity index 100% rename from jets/e/rq.c rename to pkg/noun/jets/e/rq.c diff --git a/jets/e/rs.c b/pkg/noun/jets/e/rs.c similarity index 100% rename from jets/e/rs.c rename to pkg/noun/jets/e/rs.c diff --git a/jets/e/rub.c b/pkg/noun/jets/e/rub.c similarity index 100% rename from jets/e/rub.c rename to pkg/noun/jets/e/rub.c diff --git a/jets/e/scr.c b/pkg/noun/jets/e/scr.c similarity index 100% rename from jets/e/scr.c rename to pkg/noun/jets/e/scr.c diff --git a/jets/e/secp.c b/pkg/noun/jets/e/secp.c similarity index 100% rename from jets/e/secp.c rename to pkg/noun/jets/e/secp.c diff --git a/jets/e/sha1.c b/pkg/noun/jets/e/sha1.c similarity index 100% rename from jets/e/sha1.c rename to pkg/noun/jets/e/sha1.c diff --git a/jets/e/shax.c b/pkg/noun/jets/e/shax.c similarity index 100% rename from jets/e/shax.c rename to pkg/noun/jets/e/shax.c diff --git a/jets/e/tape.c b/pkg/noun/jets/e/tape.c similarity index 100% rename from jets/e/tape.c rename to pkg/noun/jets/e/tape.c diff --git a/jets/e/trip.c b/pkg/noun/jets/e/trip.c similarity index 100% rename from jets/e/trip.c rename to pkg/noun/jets/e/trip.c diff --git a/jets/f/ap.c b/pkg/noun/jets/f/ap.c similarity index 100% rename from jets/f/ap.c rename to pkg/noun/jets/f/ap.c diff --git a/jets/f/cell.c b/pkg/noun/jets/f/cell.c similarity index 100% rename from jets/f/cell.c rename to pkg/noun/jets/f/cell.c diff --git a/jets/f/comb.c b/pkg/noun/jets/f/comb.c similarity index 100% rename from jets/f/comb.c rename to pkg/noun/jets/f/comb.c diff --git a/jets/f/cons.c b/pkg/noun/jets/f/cons.c similarity index 100% rename from jets/f/cons.c rename to pkg/noun/jets/f/cons.c diff --git a/jets/f/core.c b/pkg/noun/jets/f/core.c similarity index 100% rename from jets/f/core.c rename to pkg/noun/jets/f/core.c diff --git a/jets/f/face.c b/pkg/noun/jets/f/face.c similarity index 100% rename from jets/f/face.c rename to pkg/noun/jets/f/face.c diff --git a/jets/f/fine.c b/pkg/noun/jets/f/fine.c similarity index 100% rename from jets/f/fine.c rename to pkg/noun/jets/f/fine.c diff --git a/jets/f/fitz.c b/pkg/noun/jets/f/fitz.c similarity index 100% rename from jets/f/fitz.c rename to pkg/noun/jets/f/fitz.c diff --git a/jets/f/flan.c b/pkg/noun/jets/f/flan.c similarity index 100% rename from jets/f/flan.c rename to pkg/noun/jets/f/flan.c diff --git a/jets/f/flip.c b/pkg/noun/jets/f/flip.c similarity index 100% rename from jets/f/flip.c rename to pkg/noun/jets/f/flip.c diff --git a/jets/f/flor.c b/pkg/noun/jets/f/flor.c similarity index 100% rename from jets/f/flor.c rename to pkg/noun/jets/f/flor.c diff --git a/jets/f/fork.c b/pkg/noun/jets/f/fork.c similarity index 100% rename from jets/f/fork.c rename to pkg/noun/jets/f/fork.c diff --git a/jets/f/help.c b/pkg/noun/jets/f/help.c similarity index 100% rename from jets/f/help.c rename to pkg/noun/jets/f/help.c diff --git a/jets/f/hike.c b/pkg/noun/jets/f/hike.c similarity index 100% rename from jets/f/hike.c rename to pkg/noun/jets/f/hike.c diff --git a/jets/f/hint.c b/pkg/noun/jets/f/hint.c similarity index 100% rename from jets/f/hint.c rename to pkg/noun/jets/f/hint.c diff --git a/jets/f/look.c b/pkg/noun/jets/f/look.c similarity index 100% rename from jets/f/look.c rename to pkg/noun/jets/f/look.c diff --git a/jets/f/loot.c b/pkg/noun/jets/f/loot.c similarity index 100% rename from jets/f/loot.c rename to pkg/noun/jets/f/loot.c diff --git a/jets/f/ut.c b/pkg/noun/jets/f/ut.c similarity index 100% rename from jets/f/ut.c rename to pkg/noun/jets/f/ut.c diff --git a/jets/f/ut_buss.c b/pkg/noun/jets/f/ut_buss.c similarity index 100% rename from jets/f/ut_buss.c rename to pkg/noun/jets/f/ut_buss.c diff --git a/jets/f/ut_conk.c b/pkg/noun/jets/f/ut_conk.c similarity index 100% rename from jets/f/ut_conk.c rename to pkg/noun/jets/f/ut_conk.c diff --git a/jets/f/ut_crop.c b/pkg/noun/jets/f/ut_crop.c similarity index 100% rename from jets/f/ut_crop.c rename to pkg/noun/jets/f/ut_crop.c diff --git a/jets/f/ut_find.c b/pkg/noun/jets/f/ut_find.c similarity index 100% rename from jets/f/ut_find.c rename to pkg/noun/jets/f/ut_find.c diff --git a/jets/f/ut_fire.c b/pkg/noun/jets/f/ut_fire.c similarity index 100% rename from jets/f/ut_fire.c rename to pkg/noun/jets/f/ut_fire.c diff --git a/jets/f/ut_fish.c b/pkg/noun/jets/f/ut_fish.c similarity index 100% rename from jets/f/ut_fish.c rename to pkg/noun/jets/f/ut_fish.c diff --git a/jets/f/ut_fuse.c b/pkg/noun/jets/f/ut_fuse.c similarity index 100% rename from jets/f/ut_fuse.c rename to pkg/noun/jets/f/ut_fuse.c diff --git a/jets/f/ut_gain.c b/pkg/noun/jets/f/ut_gain.c similarity index 100% rename from jets/f/ut_gain.c rename to pkg/noun/jets/f/ut_gain.c diff --git a/jets/f/ut_lose.c b/pkg/noun/jets/f/ut_lose.c similarity index 100% rename from jets/f/ut_lose.c rename to pkg/noun/jets/f/ut_lose.c diff --git a/jets/f/ut_mint.c b/pkg/noun/jets/f/ut_mint.c similarity index 100% rename from jets/f/ut_mint.c rename to pkg/noun/jets/f/ut_mint.c diff --git a/jets/f/ut_mull.c b/pkg/noun/jets/f/ut_mull.c similarity index 100% rename from jets/f/ut_mull.c rename to pkg/noun/jets/f/ut_mull.c diff --git a/jets/f/ut_nest.c b/pkg/noun/jets/f/ut_nest.c similarity index 100% rename from jets/f/ut_nest.c rename to pkg/noun/jets/f/ut_nest.c diff --git a/jets/f/ut_peek.c b/pkg/noun/jets/f/ut_peek.c similarity index 100% rename from jets/f/ut_peek.c rename to pkg/noun/jets/f/ut_peek.c diff --git a/jets/f/ut_peel.c b/pkg/noun/jets/f/ut_peel.c similarity index 100% rename from jets/f/ut_peel.c rename to pkg/noun/jets/f/ut_peel.c diff --git a/jets/f/ut_play.c b/pkg/noun/jets/f/ut_play.c similarity index 100% rename from jets/f/ut_play.c rename to pkg/noun/jets/f/ut_play.c diff --git a/jets/f/ut_repo.c b/pkg/noun/jets/f/ut_repo.c similarity index 100% rename from jets/f/ut_repo.c rename to pkg/noun/jets/f/ut_repo.c diff --git a/jets/f/ut_rest.c b/pkg/noun/jets/f/ut_rest.c similarity index 100% rename from jets/f/ut_rest.c rename to pkg/noun/jets/f/ut_rest.c diff --git a/jets/f/ut_tack.c b/pkg/noun/jets/f/ut_tack.c similarity index 100% rename from jets/f/ut_tack.c rename to pkg/noun/jets/f/ut_tack.c diff --git a/jets/f/ut_toss.c b/pkg/noun/jets/f/ut_toss.c similarity index 100% rename from jets/f/ut_toss.c rename to pkg/noun/jets/f/ut_toss.c diff --git a/jets/f/ut_wrap.c b/pkg/noun/jets/f/ut_wrap.c similarity index 100% rename from jets/f/ut_wrap.c rename to pkg/noun/jets/f/ut_wrap.c diff --git a/include/jets/g.h b/pkg/noun/jets/g.h similarity index 100% rename from include/jets/g.h rename to pkg/noun/jets/g.h diff --git a/include/jets/k.h b/pkg/noun/jets/k.h similarity index 100% rename from include/jets/k.h rename to pkg/noun/jets/k.h diff --git a/include/jets/l.h b/pkg/noun/jets/l.h similarity index 100% rename from include/jets/l.h rename to pkg/noun/jets/l.h diff --git a/include/jets/q.h b/pkg/noun/jets/q.h similarity index 100% rename from include/jets/q.h rename to pkg/noun/jets/q.h diff --git a/jets/tree.c b/pkg/noun/jets/tree.c similarity index 100% rename from jets/tree.c rename to pkg/noun/jets/tree.c diff --git a/include/jets/w.h b/pkg/noun/jets/w.h similarity index 100% rename from include/jets/w.h rename to pkg/noun/jets/w.h diff --git a/include/jets/y.h b/pkg/noun/jets/y.h similarity index 100% rename from include/jets/y.h rename to pkg/noun/jets/y.h diff --git a/noun/manage.c b/pkg/noun/manage.c similarity index 100% rename from noun/manage.c rename to pkg/noun/manage.c diff --git a/include/noun/manage.h b/pkg/noun/manage.h similarity index 100% rename from include/noun/manage.h rename to pkg/noun/manage.h diff --git a/noun/nock.c b/pkg/noun/nock.c similarity index 100% rename from noun/nock.c rename to pkg/noun/nock.c diff --git a/include/noun/nock.h b/pkg/noun/nock.h similarity index 100% rename from include/noun/nock.h rename to pkg/noun/nock.h diff --git a/include/noun/options.h b/pkg/noun/options.h similarity index 100% rename from include/noun/options.h rename to pkg/noun/options.h diff --git a/noun/retrieve.c b/pkg/noun/retrieve.c similarity index 100% rename from noun/retrieve.c rename to pkg/noun/retrieve.c diff --git a/include/noun/retrieve.h b/pkg/noun/retrieve.h similarity index 100% rename from include/noun/retrieve.h rename to pkg/noun/retrieve.h diff --git a/noun/trace.c b/pkg/noun/trace.c similarity index 100% rename from noun/trace.c rename to pkg/noun/trace.c diff --git a/include/noun/trace.h b/pkg/noun/trace.h similarity index 100% rename from include/noun/trace.h rename to pkg/noun/trace.h diff --git a/noun/vortex.c b/pkg/noun/vortex.c similarity index 100% rename from noun/vortex.c rename to pkg/noun/vortex.c diff --git a/include/noun/vortex.h b/pkg/noun/vortex.h similarity index 100% rename from include/noun/vortex.h rename to pkg/noun/vortex.h diff --git a/noun/xtract.c b/pkg/noun/xtract.c similarity index 100% rename from noun/xtract.c rename to pkg/noun/xtract.c diff --git a/include/noun/xtract.h b/pkg/noun/xtract.h similarity index 100% rename from include/noun/xtract.h rename to pkg/noun/xtract.h diff --git a/noun/zave.c b/pkg/noun/zave.c similarity index 100% rename from noun/zave.c rename to pkg/noun/zave.c diff --git a/include/noun/zave.h b/pkg/noun/zave.h similarity index 100% rename from include/noun/zave.h rename to pkg/noun/zave.h diff --git a/pkg/urb b/pkg/urb new file mode 160000 index 0000000000..29a2e6a79e --- /dev/null +++ b/pkg/urb @@ -0,0 +1 @@ +Subproject commit 29a2e6a79e59f93e6399225efec6e09bc17f2767 diff --git a/pkg/urbit/.gitignore b/pkg/urbit/.gitignore new file mode 100644 index 0000000000..0e9e181d56 --- /dev/null +++ b/pkg/urbit/.gitignore @@ -0,0 +1,25 @@ +# +# Configuration Result +# +/config.mk +include/config.h +# +# Build Outputs +# +*.o +/urbit +/urbit-worker +/tags +# +# Editor Bullshit +# +.tags +TAGS +cscope.* +.DS_Store +/.etags +GPATH +GRTAGS +GTAGS +*.swo +*.swp diff --git a/pkg/urbit/.travis.yml b/pkg/urbit/.travis.yml new file mode 100644 index 0000000000..f606a2957f --- /dev/null +++ b/pkg/urbit/.travis.yml @@ -0,0 +1,62 @@ +dist: xenial +language: node_js +node_js: +- 4 + +# Uncomment me if this gets annoying +# +# notifications: +# email: false + +before_install: + # try to get pill early, so configuration errors will be quickly caught + - cd .travis + - bash check-trailing-whitespace.sh + - bash get-brass-pill.sh + - cd .. + - wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip + - unzip ninja-linux.zip + - sudo mv ninja /usr/bin/ + +install: + # pwd: ~/urbit + - pip3 install --user -I meson + +script: + - meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true + - cd ./build + - ninja + - ninja test + - sudo ninja install + - cd ../.travis + - npm install + - ulimit -c unlimited -S + - npm run -s test; bash print-core-backtrace.sh $? + +addons: + apt: + packages: + - python3 + - python3-pip + - python3-setuptools + - python3-wheel + - libgmp3-dev + - libsigsegv-dev + - openssl + - libssl-dev + - libncurses5-dev + - gcc + - libcurl4-gnutls-dev + - unzip + - gdb +# before_deploy: "make deb" # TODO +# deploy: +# skip_cleanup: true +# provider: releases +# prerelease: true # turn this off for official releases +# api_key: +# secure: XX +# file: ./build/urbit # TODO upload package from before_deploy +# on: +# repo: urbit/urbit +# tags: true diff --git a/.travis/.gitattributes b/pkg/urbit/.travis/.gitattributes similarity index 100% rename from .travis/.gitattributes rename to pkg/urbit/.travis/.gitattributes diff --git a/.travis/.gitignore b/pkg/urbit/.travis/.gitignore similarity index 100% rename from .travis/.gitignore rename to pkg/urbit/.travis/.gitignore diff --git a/.travis/check-trailing-whitespace.sh b/pkg/urbit/.travis/check-trailing-whitespace.sh similarity index 100% rename from .travis/check-trailing-whitespace.sh rename to pkg/urbit/.travis/check-trailing-whitespace.sh diff --git a/.travis/get-brass-pill.sh b/pkg/urbit/.travis/get-brass-pill.sh similarity index 100% rename from .travis/get-brass-pill.sh rename to pkg/urbit/.travis/get-brass-pill.sh diff --git a/.travis/package-lock.json b/pkg/urbit/.travis/package-lock.json similarity index 100% rename from .travis/package-lock.json rename to pkg/urbit/.travis/package-lock.json diff --git a/.travis/package.json b/pkg/urbit/.travis/package.json similarity index 100% rename from .travis/package.json rename to pkg/urbit/.travis/package.json diff --git a/.travis/pin-brass-pill.txt b/pkg/urbit/.travis/pin-brass-pill.txt similarity index 100% rename from .travis/pin-brass-pill.txt rename to pkg/urbit/.travis/pin-brass-pill.txt diff --git a/.travis/print-core-backtrace.sh b/pkg/urbit/.travis/print-core-backtrace.sh similarity index 100% rename from .travis/print-core-backtrace.sh rename to pkg/urbit/.travis/print-core-backtrace.sh diff --git a/.travis/test.js b/pkg/urbit/.travis/test.js similarity index 100% rename from .travis/test.js rename to pkg/urbit/.travis/test.js diff --git a/CONTRIBUTING.md b/pkg/urbit/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to pkg/urbit/CONTRIBUTING.md diff --git a/LICENSE.txt b/pkg/urbit/LICENSE.txt similarity index 100% rename from LICENSE.txt rename to pkg/urbit/LICENSE.txt diff --git a/pkg/urbit/Makefile b/pkg/urbit/Makefile new file mode 100644 index 0000000000..4b05392ac7 --- /dev/null +++ b/pkg/urbit/Makefile @@ -0,0 +1,48 @@ +include config.mk + +jets = jets/tree.c $(wildcard jets/*/*.c) +noun = $(wildcard noun/*.c) +vere = $(wildcard vere/*.c) +king = $(wildcard king/*.c) +serf = $(wildcard serf/*.c) + +common = $(jets) $(noun) $(vere) +headers = $(shell find include -type f) + +common_objs = $(shell echo $(common) | sed 's/\.c/.o/g') +king_objs = $(shell echo $(king) | sed 's/\.c/.o/g') +serf_objs = $(shell echo $(serf) | sed 's/\.c/.o/g') + +all_objs = $(common_objs) $(king_objs) $(serf_objs) +all_srcs = $(common) $(king) $(serf) + +################################################################################ + +.PHONY: all clean mkproper + +################################################################################ + +all: urbit urbit-worker + +clean: + rm -f $(all_objs) ./urbit ./urbit-worker ./tags + +mrproper: clean + rm -f config.mk include/config.h + +################################################################################ + +urbit: $(common_objs) $(king_objs) + @echo CC -o $@ + @$(CC) $^ $(LDFLAGS) -o $@ + +urbit-worker: $(common_objs) $(serf_objs) + @echo CC -o $@ + @$(CC) $^ $(LDFLAGS) -o $@ + +%.o: %.c $(headers) + @echo CC $< + @$(CC) -I./include $(CFLAGS) -c $< -o $@ + +tags: $(all_srcs) $(headers) + ctags $^ diff --git a/Spec/flw.txt b/pkg/urbit/Spec/flw.txt similarity index 100% rename from Spec/flw.txt rename to pkg/urbit/Spec/flw.txt diff --git a/Spec/http-ports.txt b/pkg/urbit/Spec/http-ports.txt similarity index 100% rename from Spec/http-ports.txt rename to pkg/urbit/Spec/http-ports.txt diff --git a/Spec/nock/4.txt b/pkg/urbit/Spec/nock/4.txt similarity index 100% rename from Spec/nock/4.txt rename to pkg/urbit/Spec/nock/4.txt diff --git a/Spec/nock/5.txt b/pkg/urbit/Spec/nock/5.txt similarity index 100% rename from Spec/nock/5.txt rename to pkg/urbit/Spec/nock/5.txt diff --git a/Spec/u3.md b/pkg/urbit/Spec/u3.md similarity index 100% rename from Spec/u3.md rename to pkg/urbit/Spec/u3.md diff --git a/pkg/urbit/configure b/pkg/urbit/configure new file mode 100755 index 0000000000..1c39ce78ee --- /dev/null +++ b/pkg/urbit/configure @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +set -e + +URBIT_VERSION=0.7.0 + +deps=" \ + curl gmp sigsegv argon2 ed25519 ent h2o scrypt sni uv murmur3 secp256k1 \ + softfloat3 ncurses ssl crypto z \ +" + +echo '#pragma once' >include/config.h + +defmacro () { + echo "#define $1 $2" >>include/config.h +} + +defmacro URBIT_VERSION '"0.7.0"' + +[ -n "$MEMORY_DEBUG" ] && defmacro U3_MEMORY_DEBUG 1 +[ -n "$CPU_DEBUG" ] && defmacro U3_CPU_DEBUG 1 +[ -n "$EVENT_TIME_DEBUG" ] && defmacro U3_EVENT_TIME_DEBUG 1 + +if [ -n "${HOST-}" ] +then os=$(sed 's$^[^-]*-\([^-]*\)-.*$\1$' <<< "$HOST") + cpu=$(sed 's$-.*$$' <<< ${HOST}) +else os=$(uname -s) + cpu=$(uname -p) +fi + +case $(tr A-Z a-z <<< $cpu) in + unknown) + defmacro U3_OS_ENDIAN_little 1 + ;; + i386) + defmacro U3_OS_ENDIAN_little 1 + ;; + i686) + defmacro U3_OS_ENDIAN_little 1 + ;; + x86_64) + defmacro U3_OS_ENDIAN_little 1 + ;; + *) + echo "Unknown or unsupported CPU: '$cpu'" >&2 + exit 1 + ;; +esac + +# TODO Determine if the target cpu is little or big endian. +case $(tr A-Z a-z <<< $os) in + *linux*) + defmacro U3_OS_linux 1 + ;; + *darwin*) + defmacro U3_OS_osx 1 + ;; + *apple*) + defmacro U3_OS_osx 1 + ;; + *freebsd*) + defmacro U3_OS_bsd 1 + osdeps="kvm" + ;; + *openbsd*) + defmacro U3_OS_bsd 1 + ;; + *) + echo "Unknown or unsupported OS: '$os'" >&2 + exit 1 + ;; +esac + +for dep in ${osdeps-} $deps +do LDFLAGS="${LDFLAGS-} -l$dep" + ${PKG_CONFIG-pkg-config} --cflags --libs $dep 2>/dev/null || true +done + +cat >config.mk <&2 +cat config.mk >&2 + +echo == include/config.h == >&2 +cat include/config.h >&2 diff --git a/debian/changelog b/pkg/urbit/debian/changelog similarity index 100% rename from debian/changelog rename to pkg/urbit/debian/changelog diff --git a/debian/compat b/pkg/urbit/debian/compat similarity index 100% rename from debian/compat rename to pkg/urbit/debian/compat diff --git a/debian/control b/pkg/urbit/debian/control similarity index 100% rename from debian/control rename to pkg/urbit/debian/control diff --git a/debian/copyright b/pkg/urbit/debian/copyright similarity index 100% rename from debian/copyright rename to pkg/urbit/debian/copyright diff --git a/debian/debhelper-build-stamp b/pkg/urbit/debian/debhelper-build-stamp similarity index 100% rename from debian/debhelper-build-stamp rename to pkg/urbit/debian/debhelper-build-stamp diff --git a/debian/docs b/pkg/urbit/debian/docs similarity index 100% rename from debian/docs rename to pkg/urbit/debian/docs diff --git a/debian/install b/pkg/urbit/debian/install similarity index 100% rename from debian/install rename to pkg/urbit/debian/install diff --git a/debian/rules b/pkg/urbit/debian/rules similarity index 100% rename from debian/rules rename to pkg/urbit/debian/rules diff --git a/debian/source/format b/pkg/urbit/debian/source/format similarity index 100% rename from debian/source/format rename to pkg/urbit/debian/source/format diff --git a/pkg/urbit/extras/extras_README b/pkg/urbit/extras/extras_README new file mode 100644 index 0000000000..b9b76029dc --- /dev/null +++ b/pkg/urbit/extras/extras_README @@ -0,0 +1,3 @@ +Extras Readme + +This folder is for all the useful, but not strictly essential, stuff for developers. diff --git a/pkg/urbit/extras/hoon-mode.el/hoon-mode.el b/pkg/urbit/extras/hoon-mode.el/hoon-mode.el new file mode 100644 index 0000000000..42c6e4ab09 --- /dev/null +++ b/pkg/urbit/extras/hoon-mode.el/hoon-mode.el @@ -0,0 +1,180 @@ +;;; hoon-mode.el --- Major mode for editing hoon files for urbit + +;; Copyright (C) 2014–2015 Urbit + +;; Author: +;; * Adam Bliss https://github.com/abliss +;; Contributors: +;; * N Gvrnd https://github.com/ngvrnd +;; * TJamesCorcoran https://github.com/TJamesCorcoran +;; * Rastus Vernon https://github.com/rastus-vernon +;; +;; Keywords: extensions, hoon, nock, urbit, neoreaction, Mars + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; This is my first Major Mode, so don't expect much. It's heavily based on +;; SampleMode from the emacs wiki. + + +;;; Code: + +(defvar hoon-mode-hook nil) + +(defvar hoon-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-j" 'newline-and-indent) + map) + "Keymap for `hoon-mode'.") + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.hoon$" . hoon-mode)) +(add-to-list 'auto-mode-alist '("\\.hook$" . hoon-mode)) + +(defvar hoon-mode-syntax-table + (let ((st (make-syntax-table lisp-mode-syntax-table))) + (modify-syntax-entry ?\' "\"" st) + (modify-syntax-entry ?| "." st) + (modify-syntax-entry ?\; "." st) + (modify-syntax-entry ?\" "\"" st) + (modify-syntax-entry ?: ". 12b" st) + (modify-syntax-entry ?\n "> b" st) + st) + "Syntax table for `hoon-mode'.") + +(defvar hoon-font-lock-keywords + '( + ("\\+\\+ \\(\\w+\\)" (1 font-lock-function-name-face)) + ("\\(%\\w+\\)" (1 font-lock-keyword-face)) + ("\\(\\w+\\)=" (1 font-lock-variable-name-face)) + ("[=,]\\(\\w+\\|@\\w*\\)" (1 font-lock-type-face)) + ) + "Keyword highlighting specification for `hoon-mode'.") + +(defvar hoon-imenu-generic-expression ".*") + +(defvar hoon-outline-regexp ":::") + +;;;###autoload +(define-derived-mode hoon-mode fundamental-mode "Hoon" + "A major mode for editing Hoon files." + :syntax-table hoon-mode-syntax-table + (set (make-local-variable 'comment-start) "::") + (set (make-local-variable 'comment-end) "") + (set (make-local-variable 'comment-use-syntax) nil) + (set (make-local-variable 'comment-start-skip) "\\(::+\\)\\s *") + (set (make-local-variable 'font-lock-defaults) '(hoon-font-lock-keywords)) + (set (make-local-variable 'indent-tabs-mode) nil) ;; tabs zutiefst verboten + (set (make-local-variable 'indent-line-function) 'indent-relative) + (set (make-local-variable 'imenu-generic-expression) + hoon-imenu-generic-expression) + (set (make-local-variable 'outline-regexp) hoon-outline-regexp) + ) + +;;; Indentation + +(defun hoon-indent-line () + "Indent current line of Hoon code." + (interactive) + (let ((savep (> (current-column) (current-indentation))) + (indent (condition-case nil (max (hoon-calculate-indentation) 0) + (error 0)))) + (if savep + (save-excursion (indent-line-to indent)) + (indent-line-to indent)))) + +(defun hoon-calculate-indentation () + "Return the column to which the current line should be indented." + 0) ;;TODO + + + +;;---------- +;; hack the mode line +;;---------- + +; In the urbit webserver a directory is basically a resource fork, +; and contains a single file, always named "hymn.hook". Emacs' +; default buffer-naming will, of course, name this hymn.hook. +; +; But if you are visitng two files, 5/hymn.hook and 6/hymn.hook, they +; will both appear the same on the mode line. +; +; This sucks, and we'd rather have them appear as "5/hymn.hook" and "6/hymn.hook". +; +; Trivial, right? No. + +; The mode line is an interesting beast. +; 1) it's defined in two variables: +; * mode-line-format, which includes in turn the variable... +; * mode-line-buffer-identification +; 2) both of these include "magic" string components which +; constitute a micro-DSL (domain specific language), which includes tags like +; '%b', indicating that the buffer-name should be substituted in +; (see emacs variable docs for 'mode-line-format') +; 3) this magic DSL is evaluated by lisp funcs that are written in C +; and thus which can not be monkey-patched +; https://www.gnu.org/software/emacs/manual/html_node/elisp/Primitive-Function-Type.html +; translation: "do not sharpen chainsaw while it is running" +; 4) the commands that are executed when the DSL is interpreted are likewise written in C +; +; The upshot is... +; +; WAIT. A better way exists. Instead of hacking the mode-line format, +; just invoke 'rename-buffer, which also lives down in the C +; underbelly. Everything falls out nicely. + +(defvar hoon-buffer-string "") +(make-variable-buffer-local 'hoon-buffer-string) + +(defun hoon-mode-hack-the-modeline () + ;; (setq mode-line-format + ;; '("%e" + ;; mode-line-front-space + ;; mode-line-mule-info + ;; mode-line-client + ;; mode-line-modified + ;; mode-line-remote + ;; mode-line-frame-identification + ;; hoon-buffer-string + ;; " " + ;; mode-line-position + ;; (vc-mode vc-mode) + ;; " " + ;; mode-line-modes + ;; mode-line-misc-info + ;; mode-line-end-spaces)) + ;; (setq hoon-buffer-string + ;; (concat + ;; (nth 1 (reverse (split-string (file-name-directory (buffer-file-name)) "/"))) + ;; "/" + ;; (file-name-nondirectory (buffer-file-name)))) + + (rename-buffer + (concat + (nth 1 (reverse (split-string (file-name-directory (buffer-file-name)) "/"))) + "/" + (file-name-nondirectory (buffer-file-name)))) +) + +(add-hook 'hoon-mode-hook 'hoon-mode-hack-the-modeline) + + + +(provide 'hoon-mode) +;;; hoon.el ends here diff --git a/pkg/urbit/extras/hoon.vim/ftdetect/hoonfiletype.vim b/pkg/urbit/extras/hoon.vim/ftdetect/hoonfiletype.vim new file mode 100644 index 0000000000..a5e92f1525 --- /dev/null +++ b/pkg/urbit/extras/hoon.vim/ftdetect/hoonfiletype.vim @@ -0,0 +1,2 @@ +au BufNewfile,BufEnter *.hoon setf hoon + diff --git a/pkg/urbit/extras/hoon.vim/ftplugin/hoon.vim b/pkg/urbit/extras/hoon.vim/ftplugin/hoon.vim new file mode 100644 index 0000000000..82b8b9fe63 --- /dev/null +++ b/pkg/urbit/extras/hoon.vim/ftplugin/hoon.vim @@ -0,0 +1,162 @@ +if exists("b:hoon_did_submode_mapping") || !exists("g:hoon_ninja") || g:hoon_ninja == 0 + finish +endif + +let g:submode_timeout = 0 + +call submode#enter_with('hoon_ninja', 'i', '', '//') +call submode#map('hoon_ninja', 'i', '', 'bar', '\|') +call submode#map('hoon_ninja', 'i', '', 'gal', '<') +call submode#map('hoon_ninja', 'i', '', 'per', ')') +call submode#map('hoon_ninja', 'i', '', 'gar', '>') +call submode#map('hoon_ninja', 'i', '', 'sel', '[') +call submode#map('hoon_ninja', 'i', '', 'bas', '\') +call submode#map('hoon_ninja', 'i', '', 'hax', '#') +call submode#map('hoon_ninja', 'i', '', 'sem', ';') +call submode#map('hoon_ninja', 'i', '', 'buc', '$') +call submode#map('hoon_ninja', 'i', '', 'hep', '-') +call submode#map('hoon_ninja', 'i', '', 'ser', ']') +call submode#map('hoon_ninja', 'i', '', 'cab', '_') +call submode#map('hoon_ninja', 'i', '', 'kel', '{') +call submode#map('hoon_ninja', 'i', '', 'sig', '~') +call submode#map('hoon_ninja', 'i', '', 'cen', '%') +call submode#map('hoon_ninja', 'i', '', 'ker', '}') +call submode#map('hoon_ninja', 'i', '', 'soq', "'") +call submode#map('hoon_ninja', 'i', '', 'col', ':') +call submode#map('hoon_ninja', 'i', '', 'ket', '^') +call submode#map('hoon_ninja', 'i', '', 'tar', '*') +call submode#map('hoon_ninja', 'i', '', 'com', ',') +call submode#map('hoon_ninja', 'i', '', 'lus', '+') +call submode#map('hoon_ninja', 'i', '', 'tec', '`') +call submode#map('hoon_ninja', 'i', '', 'doq', '"') +call submode#map('hoon_ninja', 'i', '', 'pam', '&') +call submode#map('hoon_ninja', 'i', '', 'tis', '=') +call submode#map('hoon_ninja', 'i', '', 'dot', '.') +call submode#map('hoon_ninja', 'i', '', 'pat', '@') +call submode#map('hoon_ninja', 'i', '', 'wut', '?') +call submode#map('hoon_ninja', 'i', '', 'fas', '/') +call submode#map('hoon_ninja', 'i', '', 'pel', '(') +call submode#map('hoon_ninja', 'i', '', 'zap', '!') + +call submode#map('hoon_ninja', 'i', '', 'br', '\|') +call submode#map('hoon_ninja', 'i', '', 'gl', '<') +call submode#map('hoon_ninja', 'i', '', 'pr', ')') +call submode#map('hoon_ninja', 'i', '', 'gr', '>') +call submode#map('hoon_ninja', 'i', '', 'sl', '[') +call submode#map('hoon_ninja', 'i', '', 'bs', '\') +call submode#map('hoon_ninja', 'i', '', 'hx', '#') +call submode#map('hoon_ninja', 'i', '', 'sm', ';') +call submode#map('hoon_ninja', 'i', '', 'bc', '$') +call submode#map('hoon_ninja', 'i', '', 'hp', '-') +call submode#map('hoon_ninja', 'i', '', 'sr', ']') +call submode#map('hoon_ninja', 'i', '', 'cb', '_') +call submode#map('hoon_ninja', 'i', '', 'kl', '{') +call submode#map('hoon_ninja', 'i', '', 'sg', '~') +call submode#map('hoon_ninja', 'i', '', 'cn', '%') +call submode#map('hoon_ninja', 'i', '', 'kr', '}') +call submode#map('hoon_ninja', 'i', '', 'sq', "'") +call submode#map('hoon_ninja', 'i', '', 'cl', ':') +call submode#map('hoon_ninja', 'i', '', 'kt', '^') +call submode#map('hoon_ninja', 'i', '', 'tr', '*') +call submode#map('hoon_ninja', 'i', '', 'cm', ',') +call submode#map('hoon_ninja', 'i', '', 'ls', '+') +call submode#map('hoon_ninja', 'i', '', 'tc', '`') +call submode#map('hoon_ninja', 'i', '', 'dq', '"') +call submode#map('hoon_ninja', 'i', '', 'pm', '&') +call submode#map('hoon_ninja', 'i', '', 'ts', '=') +call submode#map('hoon_ninja', 'i', '', 'dt', '.') +call submode#map('hoon_ninja', 'i', '', 'pt', '@') +call submode#map('hoon_ninja', 'i', '', 'wt', '?') +call submode#map('hoon_ninja', 'i', '', 'fs', '/') +call submode#map('hoon_ninja', 'i', '', 'pl', '(') +call submode#map('hoon_ninja', 'i', '', 'zp', '!') + +call submode#enter_with('hoon_ajnin', 'i', '', '??') +call submode#map('hoon_ajnin', 'i', '', '\|', 'bar') +call submode#map('hoon_ajnin', 'i', '', '<', 'gal') +call submode#map('hoon_ajnin', 'i', '', ')', 'per') +call submode#map('hoon_ajnin', 'i', '', '>', 'gar') +call submode#map('hoon_ajnin', 'i', '', '[', 'sel') +call submode#map('hoon_ajnin', 'i', '', '\', 'bas') +call submode#map('hoon_ajnin', 'i', '', '#', 'hax') +call submode#map('hoon_ajnin', 'i', '', ';', 'sem') +call submode#map('hoon_ajnin', 'i', '', '$', 'buc') +call submode#map('hoon_ajnin', 'i', '', '-', 'hep') +call submode#map('hoon_ajnin', 'i', '', ']', 'ser') +call submode#map('hoon_ajnin', 'i', '', '_', 'cab') +call submode#map('hoon_ajnin', 'i', '', '{', 'kel') +call submode#map('hoon_ajnin', 'i', '', '~', 'sig') +call submode#map('hoon_ajnin', 'i', '', '%', 'cen') +call submode#map('hoon_ajnin', 'i', '', '}', 'ker') +call submode#map('hoon_ajnin', 'i', '', '"', 'soq') +call submode#map('hoon_ajnin', 'i', '', ':', 'col') +call submode#map('hoon_ajnin', 'i', '', '^', 'ket') +call submode#map('hoon_ajnin', 'i', '', '*', 'tar') +call submode#map('hoon_ajnin', 'i', '', ',', 'com') +call submode#map('hoon_ajnin', 'i', '', '+', 'lus') +call submode#map('hoon_ajnin', 'i', '', '`', 'tec') +call submode#map('hoon_ajnin', 'i', '', '"', 'doq') +call submode#map('hoon_ajnin', 'i', '', '&', 'pam') +call submode#map('hoon_ajnin', 'i', '', '=', 'tis') +call submode#map('hoon_ajnin', 'i', '', '.', 'dot') +call submode#map('hoon_ajnin', 'i', '', '@', 'pat') +call submode#map('hoon_ajnin', 'i', '', '?', 'wut') +call submode#map('hoon_ajnin', 'i', '', '/', 'fas') +call submode#map('hoon_ajnin', 'i', '', '(', 'pel') +call submode#map('hoon_ajnin', 'i', '', '!', 'zap') +call submode#map('hoon_ajnin', 'i', '', '1', 'zap') +call submode#map('hoon_ajnin', 'i', '', '2', 'pat') +call submode#map('hoon_ajnin', 'i', '', '3', 'hax') +call submode#map('hoon_ajnin', 'i', '', '4', 'buc') +call submode#map('hoon_ajnin', 'i', '', '5', 'cen') +call submode#map('hoon_ajnin', 'i', '', '6', 'ket') +call submode#map('hoon_ajnin', 'i', '', '7', 'pam') +call submode#map('hoon_ajnin', 'i', '', '8', 'lus') +call submode#map('hoon_ajnin', 'i', '', '9', 'pel') +call submode#map('hoon_ajnin', 'i', '', '0', 'per') + +call submode#enter_with('hoon_jnn', 'i', '', '/?') +call submode#map('hoon_jnn', 'i', '', '\|', 'br') +call submode#map('hoon_jnn', 'i', '', '<', 'gl') +call submode#map('hoon_jnn', 'i', '', ')', 'pr') +call submode#map('hoon_jnn', 'i', '', '>', 'gr') +call submode#map('hoon_jnn', 'i', '', '[', 'sl') +call submode#map('hoon_jnn', 'i', '', '\', 'bs') +call submode#map('hoon_jnn', 'i', '', '#', 'hx') +call submode#map('hoon_jnn', 'i', '', ';', 'sm') +call submode#map('hoon_jnn', 'i', '', '$', 'bc') +call submode#map('hoon_jnn', 'i', '', '-', 'hp') +call submode#map('hoon_jnn', 'i', '', ']', 'sr') +call submode#map('hoon_jnn', 'i', '', '_', 'cb') +call submode#map('hoon_jnn', 'i', '', '{', 'kl') +call submode#map('hoon_jnn', 'i', '', '~', 'sg') +call submode#map('hoon_jnn', 'i', '', '%', 'cn') +call submode#map('hoon_jnn', 'i', '', '}', 'kr') +call submode#map('hoon_jnn', 'i', '', '"', 'sq') +call submode#map('hoon_jnn', 'i', '', ':', 'cl') +call submode#map('hoon_jnn', 'i', '', '^', 'kt') +call submode#map('hoon_jnn', 'i', '', '*', 'tr') +call submode#map('hoon_jnn', 'i', '', ',', 'cm') +call submode#map('hoon_jnn', 'i', '', '+', 'ls') +call submode#map('hoon_jnn', 'i', '', '`', 'tc') +call submode#map('hoon_jnn', 'i', '', '"', 'dq') +call submode#map('hoon_jnn', 'i', '', '&', 'pm') +call submode#map('hoon_jnn', 'i', '', '=', 'ts') +call submode#map('hoon_jnn', 'i', '', '.', 'dt') +call submode#map('hoon_jnn', 'i', '', '@', 'pt') +call submode#map('hoon_jnn', 'i', '', '?', 'wt') +call submode#map('hoon_jnn', 'i', '', '/', 'fs') +call submode#map('hoon_jnn', 'i', '', '(', 'pl') +call submode#map('hoon_jnn', 'i', '', '!', 'zp') +call submode#map('hoon_jnn', 'i', '', '1', 'zp') +call submode#map('hoon_jnn', 'i', '', '2', 'pt') +call submode#map('hoon_jnn', 'i', '', '3', 'hx') +call submode#map('hoon_jnn', 'i', '', '4', 'bc') +call submode#map('hoon_jnn', 'i', '', '5', 'cn') +call submode#map('hoon_jnn', 'i', '', '6', 'kt') +call submode#map('hoon_jnn', 'i', '', '7', 'pm') +call submode#map('hoon_jnn', 'i', '', '8', 'ls') +call submode#map('hoon_jnn', 'i', '', '9', 'pl') +call submode#map('hoon_jnn', 'i', '', '0', 'pr') +let b:hoon_did_submode_mapping = 1 + diff --git a/pkg/urbit/extras/hoon.vim/indent/hoon.vim b/pkg/urbit/extras/hoon.vim/indent/hoon.vim new file mode 100644 index 0000000000..b17164036b --- /dev/null +++ b/pkg/urbit/extras/hoon.vim/indent/hoon.vim @@ -0,0 +1,36 @@ +" Public Domain +" Credit Goes to fode +" +" With contributions from Philip C Monk + +if exists("b:did_indent") + finish +endif + +let b:did_indent = 1 + + +setlocal indentexpr=HoonIndent(v:lnum) +setlocal nolisp +setlocal autoindent + +if exists("*HoonIndent") + finish +endif + +function! HoonIndent(lnum) + let prevlnum = prevnonblank(a:lnum-1) + if prevlnum == 0 + return 0 + endif + let prevl = substitute(getline(prevlnum),'::.*$','','') + + let ind = indent(prevlnum) + if prevl =~ '++\s*\w*\s*$' + " luslus operator + let ind += &sw + endif + + return ind +endfunction + diff --git a/pkg/urbit/extras/hoon.vim/syntax/hoon.vim b/pkg/urbit/extras/hoon.vim/syntax/hoon.vim new file mode 100644 index 0000000000..0b1e3ac216 --- /dev/null +++ b/pkg/urbit/extras/hoon.vim/syntax/hoon.vim @@ -0,0 +1,205 @@ +"hoon.vim: Hoon syntax file +" Eric Fode, Philip C Monk + +if exists("b:current_syntax") + finish +endif + +set autoindent +map g/ /++ +nmap gs :let varname = '\<\>'?++ =varname +set tabstop=2 +" nmap gc :let &colorcolumn=join(range(81,999),",") +" nmap gC :let &colorcolumn=join(range(999,999),",") +" nmap ge :vertical resize 85 + +" Because symobls are used much more than numbers, some +" developers swap the number and symbol keys in insert +" mode. This is disabled by default. Uncomment the +" following lines to enable. +" inoremap 1 ! +" inoremap 2 @ +" inoremap 3 # +" inoremap 4 $ +" inoremap 5 % +" inoremap 6 ^ +" inoremap 7 & +" inoremap 8 * +" inoremap 9 ( +" inoremap 0 ) +" inoremap ! 1 +" inoremap @ 2 +" inoremap # 3 +" inoremap $ 4 +" inoremap % 5 +" inoremap ^ 6 +" inoremap & 7 +" inoremap * 8 +" inoremap ( 9 +" inoremap ) 0 + +syn case match + +" Declarations +hi def link hoonDeclaration Define +hi def link hoonSymbol Constant +hi def link hoonAtom Identifier +hi def link hoonRune Operator +hi def link hoonIdentifier Identifier +hi def link hoonBranch Conditional +hi def link hoonType Type +" hi def link hoonName Constant +hi def link hoonNumber Number +hi def link hoonComment Comment +hi def link hoonTodo Todo +hi def link hoonString String + +syn match hoonDeclaration "+[+-]" nextgroup=hoonSymbolDec skipwhite +syn match hoonSymbol /%\%(\%(\%(\w\|-\)\+\)\|[|&$]\|\%(\.n\)\|\%(\.y\)\)/ +syn match hoonAtom /\%(@\w*\)\|\^/ +syn match hoonName "\w*" contained +syn match hoonSymbolDec "\w\w\+" contained contains=hoonName + +" numbers +" Numbers are in decimal, binary, hex, base32, or base64, and they must +" contain dots (optionally followed by whitespace), as in the German manner. + +syn sync linebreaks=1 +syn match hoonNumber "\d\{1,3\}\%(\.\_s\?\d\{3\}\)*" +syn match hoonNumber "0x\x\{1,4\}\%(\.\_s*\x\{4\}\)*" +syn match hoonNumber "0b[01]\{1,4\}\%(\.\_s*[01]\{4\}\)*" +syn match hoonNumber "0v[0-9a-v]\{1,5\}\%(\.\_s*[0-9a-v]\{5\}\)*" +syn match hoonNumber "0w[-~0-9a-zA-Z]\{1,5\}\%(\.\_s*[-~0-9a-zA-Z]\{5\}\)*" + +" comments + +syn region hoonComment start="::" end="$" contains=@spell,hoonTodo +syn keyword hoonTodo contained XX XXX TODO FIXME + +" strings + +syn region hoonString start=+'+ skip=+\\[\\']+ end=+'+ contains=@spell +syn region hoonBlock start=+'''+ end=+'''+ +syn region hoonString start=+"+ skip=+\\[\\"]+ end=+"+ contains=@spell + + +" match digraphs + +syn match hoonRune "||" +syn match hoonRune "|_" +syn match hoonRune "|%" +syn match hoonRune "|:" +syn match hoonRune "|\." +syn match hoonRune "|-" +syn match hoonRune "|\^" +syn match hoonRune "|+" +syn match hoonRune "|\*" +syn match hoonRune "|=" +syn match hoonRune "|?" +syn match hoonRune "|\/" +syn match hoonRune "%_" +syn match hoonRune "%:" +syn match hoonRune "%\." +syn match hoonRune "%\^" +syn match hoonRune "%+" +syn match hoonRune "%-" +syn match hoonRune "%\~" +syn match hoonRune "%\*" +syn match hoonRune "%=" +syn match hoonRune "\$|" +syn match hoonRune "\$_" +syn match hoonRune "\$:" +syn match hoonRune "\$%" +syn match hoonRune "\$," +syn match hoonRune "\$&" +syn match hoonRune "\$?" +syn match hoonRune "\$+" +syn match hoonRune "\$=" +syn match hoonRune ":_" +syn match hoonRune ":\~" +syn match hoonRune ":/" +syn match hoonRune ":\^" +syn match hoonRune ":+" +syn match hoonRune ":-" +syn match hoonRune ":\~" +syn match hoonRune ":\*" +syn match hoonRune "\.+" +syn match hoonRune "\.\*" +syn match hoonRune "\.=" +syn match hoonRune "\.?" +syn match hoonRune "\.\^" +syn match hoonRune "#<" +syn match hoonRune "#>" +syn match hoonRune "\^|" +syn match hoonRune "\^\." +syn match hoonRune "\^-" +syn match hoonRune "\^+" +syn match hoonRune "\^&" +syn match hoonRune "\^\~" +syn match hoonRune "\^=" +syn match hoonRune "\^?" +syn match hoonRune "\~|" +syn match hoonRune "\~\$" +syn match hoonRune "\~%" +syn match hoonRune "\~:" +syn match hoonRune "\~/" +syn match hoonRune "\~<" +syn match hoonRune "\~>" +syn match hoonRune "\~#" +syn match hoonRune "\~\^" +syn match hoonRune "\~+" +syn match hoonRune "\~&" +syn match hoonRune "\~=" +syn match hoonRune "\~?" +syn match hoonRune "\~!" +syn match hoonRune ";_" +syn match hoonRune ";," +syn match hoonRune ";%" +syn match hoonRune ";:" +syn match hoonRune ";\." +syn match hoonRune ";<" +syn match hoonRune ";>" +syn match hoonRune ";-" +syn match hoonRune ";+" +syn match hoonRune ";&" +syn match hoonRune ";\~" +syn match hoonRune ";;" +syn match hoonRune ";\*" +syn match hoonRune ";=" +syn match hoonRune ";?" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=|" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=\." +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=\^" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=:" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=<" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=>" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=-" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=+" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=\*" +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs=\~" +syn match hoonRune "?|" +syn match hoonRune "?:" +syn match hoonRune "?\." +syn match hoonRune "?<" +syn match hoonRune "?>" +syn match hoonRune "?-" +syn match hoonRune "?\^" +syn match hoonRune "?=" +syn match hoonRune "?+" +syn match hoonRune "?&" +syn match hoonRune "?@" +syn match hoonRune "?\~" +syn match hoonRune "?!" +syn match hoonRune "!:" +syn match hoonRune "!," +syn match hoonRune "!;" +syn match hoonRune "!\^" +syn match hoonRune "!>" +syn match hoonRune "!=" + +" Not technically runes, but we highlight them like that. +syn match hoonRune "\%([^a-zA-Z]\|^\)\zs==" +syn match hoonRune "--" + +let b:current_syntax = "hoon" + diff --git a/pkg/urbit/extras/hoonSublime/Comments.tmPreferences b/pkg/urbit/extras/hoonSublime/Comments.tmPreferences new file mode 100644 index 0000000000..236fa89b23 --- /dev/null +++ b/pkg/urbit/extras/hoonSublime/Comments.tmPreferences @@ -0,0 +1,24 @@ + + + + + name + Comments + scope + source.hoon + settings + + shellVariables + + + name + TM_COMMENT_START + value + :: + + + + uuid + 4C2E088A-2EDB-44AB-9C62-CE0112B4C237 + + \ No newline at end of file diff --git a/pkg/urbit/extras/hoonSublime/hoon.YAML-tmLanguage b/pkg/urbit/extras/hoonSublime/hoon.YAML-tmLanguage new file mode 100644 index 0000000000..2cbf3f0728 --- /dev/null +++ b/pkg/urbit/extras/hoonSublime/hoon.YAML-tmLanguage @@ -0,0 +1,51 @@ +# [PackageDev] target_format: plist, ext: tmLanguage +--- +name: hoon +scopeName: source.hoon +fileTypes: [hoon, hook] +uuid: 9a56507d-ae34-4bd0-84fa-079029cb9509 + +patterns: +- comment: comment + name: comment.line.hoon + begin: '::' + end: \n +- comment: doqbloq + name: string.double.hoon + begin: \s*""" + end: \s*""" +- comment: soqbloq + name: string.double.hoon + begin: \s*''' + end: \s*''' +- comment: tape + name: string.double.hoon + begin: \" + patterns: [{match: '\\.|[^"]'}] + end: \" +- comment: cord + name: string.single.hoon + begin: \' + patterns: [{match: "\\\\.|[^']"}] + end: \' +- comment: arm + name: constant.character.hoon + match: "[a-z]([a-z0-9-]*[a-z0-9])?/" +- comment: arm + contentName: entity.name.function.hoon + begin: "\\+[-+] (?=[a-z]([a-z0-9-]*[a-z0-9])?)" + end: "(?![a-z0-9-])" +- comment: cube + name: constant.character.hoon + match: "%[a-z]([a-z0-9-]*[a-z0-9])?" +- comment: odor + name: storage.type.hoon + match: "@[a-z]([a-z0-9-]*[a-z0-9])?" +- comment: rune + name: keyword.control.hoon + match: "[+\\-|$%:.#^~;=?!_,&@\\/<>%*]" +- comment: rune + name: keyword.control.hoon + begin: ';script(type "text/coffeescript")' + end: '==' +... diff --git a/pkg/urbit/extras/hoonSublime/hoon.tmLanguage b/pkg/urbit/extras/hoonSublime/hoon.tmLanguage new file mode 100644 index 0000000000..f9a6a4fb75 --- /dev/null +++ b/pkg/urbit/extras/hoonSublime/hoon.tmLanguage @@ -0,0 +1,136 @@ + + + + + fileTypes + + hoon + hook + + name + hoon + patterns + + + begin + :: + comment + comment + end + \n + name + comment.line.hoon + + + begin + \s*""" + comment + doqbloq + end + \s*""" + name + string.double.hoon + + + begin + \s*''' + comment + soqbloq + end + \s*''' + name + string.double.hoon + + + begin + \" + comment + tape + end + \" + name + string.double.hoon + patterns + + + match + \\.|[^"] + + + + + begin + \' + comment + cord + end + \' + name + string.single.hoon + patterns + + + match + \\.|[^'] + + + + + comment + arm + match + [a-z]([a-z0-9-]*[a-z0-9])?/ + name + constant.character.hoon + + + begin + \+[-+] (?=[a-z]([a-z0-9-]*[a-z0-9])?) + comment + arm + contentName + entity.name.function.hoon + end + (?![a-z0-9-]) + + + comment + cube + match + %[a-z]([a-z0-9-]*[a-z0-9])? + name + constant.character.hoon + + + comment + odor + match + @[a-z]([a-z0-9-]*[a-z0-9])? + name + storage.type.hoon + + + comment + rune + match + [+\-|$%:.#^~;=?!_,&@\/<>%*] + name + keyword.control.hoon + + + begin + ;script(type "text/coffeescript") + comment + rune + end + == + name + keyword.control.hoon + + + scopeName + source.hoon + uuid + 9a56507d-ae34-4bd0-84fa-079029cb9509 + + diff --git a/gdb-test-hash b/pkg/urbit/gdb-test-hash similarity index 100% rename from gdb-test-hash rename to pkg/urbit/gdb-test-hash diff --git a/include/all.h b/pkg/urbit/include/all.h similarity index 100% rename from include/all.h rename to pkg/urbit/include/all.h diff --git a/include/config.h.in b/pkg/urbit/include/config.h.in similarity index 100% rename from include/config.h.in rename to pkg/urbit/include/config.h.in diff --git a/vere/main.c b/pkg/urbit/king/main.c similarity index 99% rename from vere/main.c rename to pkg/urbit/king/main.c index 3b2c76b5e1..27e34a4168 100644 --- a/vere/main.c +++ b/pkg/urbit/king/main.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/scripts/bootstrap b/pkg/urbit/scripts/bootstrap similarity index 100% rename from scripts/bootstrap rename to pkg/urbit/scripts/bootstrap diff --git a/scripts/build b/pkg/urbit/scripts/build similarity index 100% rename from scripts/build rename to pkg/urbit/scripts/build diff --git a/vere/serf.c b/pkg/urbit/serf/main.c similarity index 99% rename from vere/serf.c rename to pkg/urbit/serf/main.c index b454ddee66..5926a94318 100644 --- a/vere/serf.c +++ b/pkg/urbit/serf/main.c @@ -17,9 +17,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include diff --git a/pkg/urbit/shell.nix b/pkg/urbit/shell.nix new file mode 100644 index 0000000000..6974e63c9e --- /dev/null +++ b/pkg/urbit/shell.nix @@ -0,0 +1 @@ +import ../../nix/pkgs/urbit/shell.nix diff --git a/tests/hash_tests.c b/pkg/urbit/tests/hash_tests.c similarity index 100% rename from tests/hash_tests.c rename to pkg/urbit/tests/hash_tests.c diff --git a/tests/test.c b/pkg/urbit/tests/test.c similarity index 98% rename from tests/test.c rename to pkg/urbit/tests/test.c index 2f076e7dfd..86a75ec038 100644 --- a/tests/test.c +++ b/pkg/urbit/tests/test.c @@ -14,9 +14,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include "all.h" diff --git a/vere/ames.c b/pkg/vere/ames.c similarity index 99% rename from vere/ames.c rename to pkg/vere/ames.c index 4ebc00e57d..a9aa4032dc 100644 --- a/vere/ames.c +++ b/pkg/vere/ames.c @@ -9,9 +9,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/behn.c b/pkg/vere/behn.c similarity index 96% rename from vere/behn.c rename to pkg/vere/behn.c index 598b95b047..6da833eabf 100644 --- a/vere/behn.c +++ b/pkg/vere/behn.c @@ -6,9 +6,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include "all.h" diff --git a/vere/cttp.c b/pkg/vere/cttp.c similarity index 100% rename from vere/cttp.c rename to pkg/vere/cttp.c diff --git a/vere/dawn.c b/pkg/vere/dawn.c similarity index 100% rename from vere/dawn.c rename to pkg/vere/dawn.c diff --git a/vere/foil.c b/pkg/vere/foil.c similarity index 99% rename from vere/foil.c rename to pkg/vere/foil.c index 48c309f968..b43a847138 100644 --- a/vere/foil.c +++ b/pkg/vere/foil.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/vere/http.c b/pkg/vere/http.c similarity index 100% rename from vere/http.c rename to pkg/vere/http.c diff --git a/vere/ivory.c b/pkg/vere/ivory.c similarity index 100% rename from vere/ivory.c rename to pkg/vere/ivory.c diff --git a/vere/king.c b/pkg/vere/king.c similarity index 100% rename from vere/king.c rename to pkg/vere/king.c diff --git a/vere/newt.c b/pkg/vere/newt.c similarity index 99% rename from vere/newt.c rename to pkg/vere/newt.c index 253c8c2925..61940b683e 100644 --- a/vere/newt.c +++ b/pkg/vere/newt.c @@ -24,9 +24,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/pier.c b/pkg/vere/pier.c similarity index 99% rename from vere/pier.c rename to pkg/vere/pier.c index 994c112df5..5e0464dc7c 100644 --- a/vere/pier.c +++ b/pkg/vere/pier.c @@ -16,9 +16,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/reck.c b/pkg/vere/reck.c similarity index 99% rename from vere/reck.c rename to pkg/vere/reck.c index 08dcd72e41..4110fd6e0a 100644 --- a/vere/reck.c +++ b/pkg/vere/reck.c @@ -6,9 +6,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/save.c b/pkg/vere/save.c similarity index 100% rename from vere/save.c rename to pkg/vere/save.c diff --git a/vere/term.c b/pkg/vere/term.c similarity index 99% rename from vere/term.c rename to pkg/vere/term.c index 34b9912f73..21414c196d 100644 --- a/vere/term.c +++ b/pkg/vere/term.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/time.c b/pkg/vere/time.c similarity index 98% rename from vere/time.c rename to pkg/vere/time.c index d39efd9fea..2a36cf8220 100644 --- a/vere/time.c +++ b/pkg/vere/time.c @@ -6,9 +6,9 @@ #include #include #include -#include +#include #include -#include +#include #include "all.h" #include "vere/vere.h" diff --git a/vere/unix.c b/pkg/vere/unix.c similarity index 99% rename from vere/unix.c rename to pkg/vere/unix.c index e8eaaaeaf1..fb62ba5f2b 100644 --- a/vere/unix.c +++ b/pkg/vere/unix.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/vere/vere.h b/pkg/vere/vere.h similarity index 100% rename from include/vere/vere.h rename to pkg/vere/vere.h diff --git a/vere/walk.c b/pkg/vere/walk.c similarity index 99% rename from vere/walk.c rename to pkg/vere/walk.c index 9036230856..67c295c8ff 100644 --- a/vere/walk.c +++ b/pkg/vere/walk.c @@ -6,9 +6,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include "all.h" diff --git a/scripts/nixbuild b/scripts/nixbuild deleted file mode 100755 index 61308f3463..0000000000 --- a/scripts/nixbuild +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -nix-shell --pure --run './scripts/build -Dnix=true' diff --git a/subprojects/.gitignore b/subprojects/.gitignore deleted file mode 100644 index c30fb388a3..0000000000 --- a/subprojects/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# help me create an empty dir -fred diff --git a/subprojects/argon2 b/subprojects/argon2 deleted file mode 160000 index 4da94a611e..0000000000 --- a/subprojects/argon2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4da94a611ee62bad87ab2b131ffda3bcc0723d9c diff --git a/subprojects/ed25519 b/subprojects/ed25519 deleted file mode 160000 index 76385f2ebb..0000000000 --- a/subprojects/ed25519 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 76385f2ebbbc9580a9c236952d68d11d73a6135c diff --git a/subprojects/libent b/subprojects/libent deleted file mode 160000 index fe9f8a8aad..0000000000 --- a/subprojects/libent +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fe9f8a8aad6c4a6915ff8844850e64be4b4831a2 diff --git a/subprojects/libh2o b/subprojects/libh2o deleted file mode 160000 index 0ed9ac7075..0000000000 --- a/subprojects/libh2o +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0ed9ac70757a16ec45f91b8a347850d9699c3fb1 diff --git a/subprojects/libscrypt b/subprojects/libscrypt deleted file mode 160000 index 029693ff1c..0000000000 --- a/subprojects/libscrypt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2 diff --git a/subprojects/libsni b/subprojects/libsni deleted file mode 160000 index 173beb88ee..0000000000 --- a/subprojects/libsni +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 173beb88ee62bddd13874ca04ab338cdec704928 diff --git a/subprojects/libuv b/subprojects/libuv deleted file mode 160000 index 6429495dc9..0000000000 --- a/subprojects/libuv +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6429495dc9a80aaf1c243038b381451f12bc7dcf diff --git a/subprojects/murmur3 b/subprojects/murmur3 deleted file mode 160000 index 71a75d57ca..0000000000 --- a/subprojects/murmur3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca diff --git a/subprojects/secp256k1 b/subprojects/secp256k1 deleted file mode 160000 index b4e8798651..0000000000 --- a/subprojects/secp256k1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b4e87986511e01ea6477838dc686cc7c08c3c8c9 diff --git a/subprojects/softfloat3 b/subprojects/softfloat3 deleted file mode 160000 index ec4c7e31b3..0000000000 --- a/subprojects/softfloat3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ec4c7e31b32e07aad80e52f65ff46ac6d6aad986 diff --git a/vere/fuse.c b/vere/fuse.c deleted file mode 100644 index 6a61e012ff..0000000000 --- a/vere/fuse.c +++ /dev/null @@ -1,694 +0,0 @@ -/* v/fuse.c -** -** This file is in the public domain. -*/ - -#include "all.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vere/vere.h" - -/* helper routines adapted from FUSE example code -*/ - struct _fusedr_buf { - c3_c* buf_c; - c3_z siz_z; - }; - - static void - _fusedr_buf_add(fuse_req_t req_u, - struct _fusedr_buf* buf_u, - const c3_c* nam_c, - fuse_ino_t ino_i) - { - struct stat sat_u; - c3_z old_z = buf_u->siz_z; - - buf_u->siz_z += fuse_add_direntry(req_u, NULL, 0, nam_c, NULL, 0); - buf_u->buf_c = (c3_c*) realloc(buf_u->buf_c, buf_u->siz_z); - - memset(&sat_u, 0, sizeof(sat_u)); - sat_u.st_ino = ino_i; - - fuse_add_direntry(req_u, - buf_u->buf_c + old_z, - buf_u->siz_z - old_z, - nam_c, - &sat_u, - buf_u->siz_z); - } - - static void - _fuse_buf_reply(fuse_req_t req_u, - c3_c* buf_c, - c3_z siz_z, - c3_f off_f, - c3_z max_z) - { - if ( off_f < siz_z ) { - fuse_reply_buf(req_u, - buf_c + off_f, - c3_min(siz_z - off_f, max_z)); - } else { - fuse_reply_buf(req_u, NULL, 0); - } - } - -static void -_inode_init(void) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - - memset(fus_u, 0, sizeof(u3_fuse)); - { - fus_u->rot_u.ino_i = FUSE_ROOT_ID; - fus_u->rot_u.val_u = 0; - fus_u->rot_u.nam_c = strdup("/"); - fus_u->rot_u.pax_c = 0; - fus_u->rot_u.val_u = 0; - fus_u->rot_u.ref_w = 0x1fffffff; - fus_u->rot_u.par_u = 0; - fus_u->rot_u.kid_u = 0; - fus_u->rot_u.nex_u = 0; - } - { - fus_u->ion_u.ino_i = FUSE_ROOT_ID + 1; - fus_u->ion_u.len_w = 64; - fus_u->ion_u.nod_u = calloc(64, sizeof(struct fnod *)); - fus_u->ion_u.nod_u[FUSE_ROOT_ID] = &fus_u->rot_u; - } -} - -/* _inode_get(): look up an inode. -*/ -static u3_fnod* -_inode_get(fuse_ino_t ino_i) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - - c3_assert(ino_i < fus_u->ion_u.ino_i); - return fus_u->ion_u.nod_u[ino_i]; -} - -/* _inode_new(): create an inode. -*/ -static u3_fnod* -_inode_new(void) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - u3_fnod* nod_u = calloc(1, sizeof(u3_fnod)); - - nod_u->ino_i = fus_u->ion_u.ino_i; - fus_u->ion_u.nod_u[nod_u->ino_i] = nod_u; - fus_u->ion_u.ino_i++; - - if ( fus_u->ion_u.len_w == fus_u->ion_u.ino_i ) { - fus_u->ion_u.len_w *= 2; - fus_u->ion_u.nod_u = realloc(fus_u->ion_u.nod_u, - (fus_u->ion_u.len_w * - sizeof(struct fnod *))); - } - return nod_u; -} - -/* _inode_make(): set up an inode. -*/ -static u3_fnod* -_inode_make(u3_fnod* par_u, c3_c* nam_c) -{ - u3_fnod* nod_u = _inode_new(); - - nod_u->nam_c = nam_c; - nod_u->par_u = par_u; - nod_u->nex_u = par_u->kid_u; - par_u->kid_u = nod_u; - - return nod_u; -} - -/* _inode_stat(): fill stat buffer from inode; return c3y if available -*/ -static c3_o -_inode_stat(u3_fnod* nod_u, struct stat* buf_u) -{ - memset(buf_u, 0, sizeof(struct stat)); - - switch ( nod_u->typ_e ) { - case u3_fuse_type_unknown: return c3n; - case u3_fuse_type_file: { - if ( 0 == nod_u->val_u ) { - return c3n; - } - else { - buf_u->st_mode = S_IFREG | 0444; - buf_u->st_nlink = 1; - buf_u->st_size = nod_u->val_u->siz_z; - - return c3y; - } - } - case u3_fuse_type_directory: { - buf_u->st_mode = S_IFDIR | 0555; - buf_u->st_nlink = 2; - - return c3y; - } - } -} - -/* _inode_path(): map inode path to noun. -*/ -static u3_noun -_inode_path(u3_fnod* nod_u, u3_noun end) -{ - if ( nod_u->par_u == 0 ) { - return end; - } - else { - end = u3nc(u3i_string(nod_u->nam_c), end); - - return _inode_path(nod_u->par_u, end); - } -} - -/* _inode_load_arch(): load urbit's own "inode". -*/ -static u3_weak -_inode_load_arch(u3_noun hap) -{ - if ( u3_nul == u3A->own ) { - return u3_none; - } - else { - u3_noun our = u3dc("scot", 'p', u3k(u3h(u3A->own))); - u3_noun pax = u3nc(c3__cy, u3nq(our, c3__home, u3k(u3A->wen), hap)); - u3_noun val = u3v_peek(pax); - - if ( u3_nul == val ) { - return u3_none; - } else { - u3_noun ret = u3k(u3t(val)); - - u3z(val); - return ret; - } - } -} - -/* _inode_load_data(): load urbit file contents. -*/ -static u3_weak -_inode_load_data(u3_noun hap) -{ - if ( u3_nul == u3A->own ) { - return u3_none; - } - else { - u3_noun our = u3dc("scot", 'p', u3k(u3h(u3A->own))); - u3_noun pax = u3nc(c3__cx, u3nq(our, c3__home, u3k(u3A->wen), hap)); - u3_noun val = u3v_peek(pax); - - if ( u3_nul == val ) { - return u3_none; - } else { - u3_noun ret = u3k(u3t(val)); - - u3z(val); - if ( c3n == u3ud(ret) ) { - uL(fprintf(uH, "inode_load_data: not an atom\n")); - - u3z(ret); - ret = 0; - } - return ret; - } - } -} - -/* _inode_fill_directory(): fill directory inode. -*/ -static u3_fdir* -_inode_fill_directory(u3_fnod* par_u, u3_noun kiz) -{ - u3_fdir* dir_u; - - dir_u = malloc(sizeof(u3_fdir)); - dir_u->num_w = 0; - - { - u3_noun zik = kiz; - - while ( u3_nul != zik ) { - u3_noun ph_zik = u3h(u3h(zik)); - c3_c* nam_c = u3r_string(ph_zik); - u3_fent* fen_u = calloc(1, sizeof(u3_fent)); - - fen_u->nod_u = _inode_make(par_u, nam_c); - fen_u->nex_u = dir_u->fen_u; - dir_u->fen_u = fen_u; - - dir_u->num_w += 1; - zik = u3t(zik); - } - u3z(kiz); - } - return dir_u; -} - -/* _inode_fill_file(): fill file inode. -*/ -static u3_fval* -_inode_fill_file(u3_atom dat) -{ - u3_fval* val_u = calloc(1, sizeof(u3_fval)); - - val_u->siz_z = u3r_met(3, dat); - val_u->buf_y = malloc(val_u->siz_z); - - u3r_bytes(0, val_u->siz_z, val_u->buf_y, dat); - u3z(dat); - - return val_u; -} - -/* _inode_load(): load inode value. -*/ -static c3_o -_inode_load(u3_fnod* nod_u) -{ - if ( u3_nul == u3A->own ) { - return c3n; - } - else { - if ( nod_u->typ_e != u3_fuse_type_unknown ) { - return c3y; - } - else { - u3_noun hap = _inode_path(nod_u, u3_nul); - u3_weak ark = _inode_load_arch(u3k(hap)); - c3_o ret; - - if ( u3_none == ark ) { - ret = c3n; - } - else { - if ( u3_nul == u3h(ark) ) { - nod_u->typ_e = u3_fuse_type_directory; - nod_u->dir_u = _inode_fill_directory - (nod_u, u3qdb_tap(u3t(ark))); - } - else { - u3_noun dat; - - nod_u->typ_e = u3_fuse_type_file; - dat = _inode_load_data(u3k(hap)); - nod_u->val_u = _inode_fill_file(dat); - } - ret = c3y; - u3z(ark); - } - u3z(hap); - return ret; - } - } -} - - /** - * Initialize filesystem - * - * Called before any other filesystem method - * - * There's no reply to this function - * - * @param userdata the user data passed to fuse_lowlevel_new() - */ -static void -_fuse_ll_init(void* usr_v, - struct fuse_conn_info* con_u) -{ - uL(fprintf(uH, "ll_init\n")); - { - _inode_init(); - } -} - - /** - * Look up a directory entry by name and get its attributes. - * - * Valid replies: - * fuse_reply_entry - * fuse_reply_err - * - * @param req request handle - * @param parent inode number of the parent directory - * @param name the name to look up - */ -static void -_fuse_ll_lookup(fuse_req_t req_u, - fuse_ino_t pno_i, - const c3_c* nam_c) -{ - uL(fprintf(uH, "ll_lookup %ld %s\n", pno_i, nam_c)); - { - u3_fnod* par_u = _inode_get(pno_i); - u3_fnod* nod_u; - - // Find, then make. - { - for ( nod_u = par_u->kid_u; nod_u; nod_u = nod_u->nex_u ) { - if ( !strcmp(nam_c, nod_u->nam_c) ) { - break; - } - } - - if ( !nod_u ) { - nod_u = _inode_make(par_u, strdup(nam_c)); - } - } - - if ( c3n == _inode_load(nod_u) ) { - fuse_reply_err(req_u, ENOENT); - } - else { - struct fuse_entry_param ent_u; - - memset(&ent_u, 0, sizeof(ent_u)); - if ( c3n == _inode_stat(nod_u, &ent_u.attr) ) { - fuse_reply_err(req_u, ENOENT); - } - ent_u.ino = nod_u->ino_i; - ent_u.generation = 1; - ent_u.attr_timeout = 1.0; - ent_u.entry_timeout = 1.0; - - fuse_reply_entry(req_u, &ent_u); - } - } -} - - /** - * Get file attributes - * - * Valid replies: - * fuse_reply_attr - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi for future use, currently always NULL - */ -static void -_fuse_ll_getattr(fuse_req_t req_u, - fuse_ino_t ino_i, - struct fuse_file_info* ffi_u) -{ - uL(fprintf(uH, "ll_getattr %ld\n", ino_i)); - { - u3_fnod* nod_u = _inode_get(ino_i); - - if ( c3n == _inode_load(nod_u) ) { - fuse_reply_err(req_u, ENOENT); - } - else { - struct stat buf_u; - - if ( c3n == _inode_stat(nod_u, &buf_u) ) { - fuse_reply_err(req_u, ENOENT); - } - else { - fuse_reply_attr(req_u, &buf_u, 1.0); - } - } - } -} - - /** - * Read directory - * - * Send a buffer filled using fuse_add_direntry(), with size not - * exceeding the requested size. Send an empty buffer on end of - * stream. - * - * fi->fh will contain the value set by the opendir method, or - * will be undefined if the opendir method didn't set any value. - * - * Valid replies: - * fuse_reply_buf - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param size maximum number of bytes to send - * @param off offset to continue reading the directory stream - * @param fi file information - */ -static void -_fuse_ll_readdir(fuse_req_t req_u, - fuse_ino_t ino_i, - c3_z max_z, - c3_f off_f, - struct fuse_file_info* ffi_u) -{ - uL(fprintf(uH, "ll_readdir %ld %ld %" PRIu64 "\n", ino_i, max_z, off_f)); - { - u3_fnod* nod_u = _inode_get(ino_i); - - if ( c3n == _inode_load(nod_u) ) { - fuse_reply_err(req_u, ENOENT); - } - else if ( u3_fuse_type_directory != nod_u->typ_e ) { - fuse_reply_err(req_u, ENOTDIR); - } - else { - struct _fusedr_buf buf_u; - - memset(&buf_u, 0, sizeof(buf_u)); - _fusedr_buf_add(req_u, &buf_u, ".", ino_i); - _fusedr_buf_add(req_u, &buf_u, "..", nod_u->par_u - ? nod_u->par_u->ino_i - : ino_i); - { - u3_fent* fen_u; - - for ( fen_u = nod_u->dir_u->fen_u; fen_u; fen_u = fen_u->nex_u ) { - _fusedr_buf_add(req_u, - &buf_u, - fen_u->nod_u->nam_c, - fen_u->nod_u->ino_i); - } - } - _fuse_buf_reply(req_u, buf_u.buf_c, buf_u.siz_z, off_f, max_z); - } - } -} - - /** - * Open a file - * - * Open flags (with the exception of O_CREAT, O_EXCL, O_NOCTTY and - * O_TRUNC) are available in fi->flags. - * - * Filesystem may store an arbitrary file handle (pointer, index, - * etc) in fi->fh, and use this in other all other file operations - * (read, write, flush, release, fsync). - * - * Filesystem may also implement stateless file I/O and not store - * anything in fi->fh. - * - * There are also some flags (direct_io, keep_cache) which the - * filesystem may set in fi, to change the way the file is opened. - * See fuse_file_info structure in for more details. - * - * Valid replies: - * fuse_reply_open - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param fi file information - */ -static void -_fuse_ll_open(fuse_req_t req_u, - fuse_ino_t ino_i, - struct fuse_file_info* ffi_u) -{ - uL(fprintf(uH, "ll_open %ld\n", ino_i)); - { - u3_fnod* nod_u = _inode_get(ino_i); - - if ( c3n == _inode_load(nod_u) ) { - fuse_reply_err(req_u, ENOENT); - } - else if ( u3_fuse_type_file != nod_u->typ_e ) { - fuse_reply_err(req_u, ENOTDIR); - } - else if ( (ffi_u->flags & 3) != O_RDONLY ) { - fuse_reply_err(req_u, EACCES); - } - else { - fuse_reply_open(req_u, ffi_u); - } - } -} - - /** - * Read data - * - * Read should send exactly the number of bytes requested except - * on EOF or error, otherwise the rest of the data will be - * substituted with zeroes. An exception to this is when the file - * has been opened in 'direct_io' mode, in which case the return - * value of the read system call will reflect the return value of - * this operation. - * - * fi->fh will contain the value set by the open method, or will - * be undefined if the open method didn't set any value. - * - * Valid replies: - * fuse_reply_buf - * fuse_reply_err - * - * @param req request handle - * @param ino the inode number - * @param size number of bytes to read - * @param off offset to read from - * @param fi file information - */ -static void -_fuse_ll_read(fuse_req_t req_u, - fuse_ino_t ino_i, - c3_z max_z, - c3_f off_f, - struct fuse_file_info* ffi_u) -{ - uL(fprintf(uH, "ll_read %ld %ld %" PRIu64 "\n", ino_i, max_z, off_f)); - { - u3_fnod* nod_u = _inode_get(ino_i); - - if ( c3n == _inode_load(nod_u) ) { - fuse_reply_err(req_u, ENOENT); - } else { - _fuse_buf_reply(req_u, - (c3_c*)(nod_u->val_u->buf_y), - nod_u->val_u->siz_z, - off_f, - max_z); - } - } -} - -static struct fuse_lowlevel_ops fuse_api = { - .init = _fuse_ll_init, - .lookup = _fuse_ll_lookup, - .getattr = _fuse_ll_getattr, - .readdir = _fuse_ll_readdir, - .open = _fuse_ll_open, - .read = _fuse_ll_read, -}; - -/* _fuse_poll_cb(): -*/ -static void -_fuse_poll_cb(uv_poll_t* wax_u, - c3_i sas_i, - c3_i evt_i) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - - uL(fprintf(uH, "fuse_poll_cb\n")); - { - c3_z buf_z = fuse_chan_bufsize(fus_u->cha_u); - c3_y* buf_y = malloc(buf_z + 1); - c3_i res_i = fuse_chan_recv(&fus_u->cha_u, (c3_c *)buf_y, buf_z); - - if ( res_i < 0 ) { - if ( (res_i != -EINTR) && (res_i != -EAGAIN) ) { - uL(fprintf(uH, "fuse_poll_cb: error: %s\n", strerror(res_i))); - c3_assert(0); - } - } - else { - uL(fprintf(uH, "fuse_session_process\n")); - - fuse_session_process(fus_u->sez_u, - (c3_c *)buf_y, - buf_z, - fus_u->cha_u); - - uv_poll_start(&fus_u->wax_u, UV_READABLE, _fuse_poll_cb); - } - } -} - -/* u3_fuse_io_init(): initialize FUSE. -*/ -void -u3_fuse_io_init(void) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - -#if 0 - fus_u->mnt_c = malloc(strlen(u3_Host.dir_c) + 16); - strcpy(fus_u->mnt_c, u3_Host.dir_c); - strncat(fus_u->mnt_c, "/.urb/fun", 14); -#else - fus_u->mnt_c = strdup("/Users/cyarvin/urbit"); -#endif - mkdir(fus_u->mnt_c, 0755); - - uL(fprintf(uH, "fuse: mounting: %s\n", fus_u->mnt_c)); - - if ( !(fus_u->cha_u = fuse_mount(fus_u->mnt_c, 0)) ) { - uL(fprintf(uH, "fuse: could not mount %s\n", fus_u->mnt_c)); - } - - if ( !(fus_u->sez_u=fuse_lowlevel_new(0, &fuse_api, sizeof(fuse_api), 0)) ) { - uL(fprintf(uH, "fuse: could not create session\n")); - } - fuse_session_add_chan(fus_u->sez_u, fus_u->cha_u); - - { - c3_i fid_i = fuse_chan_fd(fus_u->cha_u); - c3_i err_i; - - uL(fprintf(uH, "fuse: fd: %d (loop %p)\n", fid_i, u3L)); - if ( (err_i = uv_poll_init(u3L, &fus_u->wax_u, fid_i)) < 0 ) { - uL(fprintf(uH, "fuse: poll_init failed: %s\n", uv_strerror(err_i))); - } - uv_poll_start(&fus_u->wax_u, UV_READABLE, _fuse_poll_cb); - } -} - - -/* u3_fuse_io_exit(): shut down FUSE. -*/ -void -u3_fuse_io_exit(void) -{ - u3_fuse* fus_u = &u3_Host.fus_u; - - uv_poll_stop(&fus_u->wax_u); - - fuse_session_remove_chan(fus_u->cha_u); - fuse_session_destroy(fus_u->sez_u); - fuse_unmount(fus_u->mnt_c, fus_u->cha_u); - - uL(fprintf(uH, "fuse: unmounted: %s\n", fus_u->mnt_c)); - -}