mirror of
https://github.com/urbit/shrub.git
synced 2024-12-29 15:14:17 +03:00
commit
7ce50ad75e
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
bin/* filter=lfs diff=lfs merge=lfs -text
|
||||
bin/*/* filter=lfs diff=lfs merge=lfs -text
|
41
.gitignore
vendored
41
.gitignore
vendored
@ -1,32 +1,11 @@
|
||||
# subrepositories, downloaded pills
|
||||
/arvo/
|
||||
*.pill
|
||||
# autoconf
|
||||
/.MAKEFILE-VERSION
|
||||
/make.conf
|
||||
/.make.conf
|
||||
# intermediate
|
||||
*.swo
|
||||
*.swp
|
||||
*.o
|
||||
/outside/**/*.a
|
||||
/outside/re2/obj
|
||||
# build
|
||||
/vere.pkg
|
||||
.tags
|
||||
.etags
|
||||
GPATH
|
||||
GTAGS
|
||||
GRTAGS
|
||||
# scratch
|
||||
/zod/
|
||||
# dependencies
|
||||
node_modules/
|
||||
.sass-cache
|
||||
# OS
|
||||
.DS_Store
|
||||
# ??
|
||||
/inst
|
||||
cscope.*
|
||||
build/
|
||||
/out
|
||||
/result
|
||||
/result-*
|
||||
/work
|
||||
/zod
|
||||
/bus
|
||||
/fakezod*
|
||||
tags
|
||||
TAGS
|
||||
cross/
|
||||
release/
|
||||
|
30
.gitmodules
vendored
30
.gitmodules
vendored
@ -1,30 +0,0 @@
|
||||
[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
|
78
.travis.yml
78
.travis.yml
@ -1,57 +1,31 @@
|
||||
dist: xenial
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
|
||||
# Uncomment me if this gets annoying
|
||||
#
|
||||
# notifications:
|
||||
# email: false
|
||||
|
||||
before_install:
|
||||
- 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==0.44.1
|
||||
- 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 $?
|
||||
- cachix use urbit2
|
||||
- ./sh/cachix || true
|
||||
|
||||
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
|
||||
- make
|
||||
- make release
|
||||
|
||||
- sh/ci-tests
|
||||
|
||||
deploy:
|
||||
- skip_cleanup: true
|
||||
provider: gcs
|
||||
access_key_id: GOOGTADOPP55X5ZTH3IKAXQW
|
||||
secret_access_key:
|
||||
secure: rSPif0VHX3Q3QpWM9iUt/Z9sicCY8ABuwVFPeT3YUnAAmSXM46PIHKieoGs79kx9IelFyQsM8xS0XWyt4S/haR7VaTJY+zHJjf0AnA1sr5ZIV70t3K0SXzq4+E1ffOZRiC0VmHatPz10wjaIpHxpjcROqQV4M1dBCq2H/rpccIE=
|
||||
bucket: bootstrap.urbit.org
|
||||
local-dir: release/
|
||||
acl: public-read
|
||||
on:
|
||||
condition: "-d release/"
|
||||
repo: urbit/urbit
|
||||
all_branches: true
|
||||
|
@ -1 +0,0 @@
|
||||
664a819f15d707a36482171db30d0d7acb7694af
|
@ -1,56 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs')
|
||||
var runner = require('urbit-runner')
|
||||
var Urbit = runner.Urbit;
|
||||
var ERROR = runner.ERROR;
|
||||
var actions = runner.actions
|
||||
|
||||
var hash = fs.readFileSync('./pin-arvo-commit.txt', 'utf-8').slice(0, 10)
|
||||
var pill = 'https://bootstrap.urbit.org/git-' + hash + '.pill'
|
||||
|
||||
var args = ['-u', pill, '-cgPSF', 'zod', 'zod'];
|
||||
var urbit = new Urbit(args);
|
||||
|
||||
// vere hangs (always?) with run in travis-ci with -P
|
||||
// so we send ^Z if we hang for ~s30
|
||||
function exit() {
|
||||
setTimeout(function(){
|
||||
urbit.pty.write('\x1a');
|
||||
urbit.pty.on('exit', function(code, signal){
|
||||
process.exit(0);
|
||||
})
|
||||
}, 30 * 1000);
|
||||
|
||||
return urbit.exit(0);
|
||||
}
|
||||
|
||||
Promise.resolve(urbit)
|
||||
// XX temporary
|
||||
// send ctrl-x to select dojo
|
||||
//
|
||||
.then(function(){
|
||||
return urbit.expect(/talk\[\] /)
|
||||
.then(function() {
|
||||
return urbit.pty.write("\x18")
|
||||
})
|
||||
.then(function() { return urbit })
|
||||
})
|
||||
.then(actions.safeBoot)
|
||||
.then(actions.test)
|
||||
.then(function(){
|
||||
return urbit.line("|mass")
|
||||
.then(function(){
|
||||
return urbit.expectEcho("%ran-mass")
|
||||
.then(function(){ return urbit.resetListeners(); })
|
||||
})
|
||||
})
|
||||
.then(exit)
|
||||
.catch(function(err){
|
||||
// we still exit 0, Arvo errors are not our fault ...
|
||||
return urbit.waitSilent()
|
||||
.then(function(){
|
||||
return urbit.warn("Arvo test aborted:", err);
|
||||
})
|
||||
.then(exit);
|
||||
});
|
156
CONTRIBUTING.md
156
CONTRIBUTING.md
@ -1,18 +1,19 @@
|
||||
# Contributing to urbit
|
||||
# Contributing to Urbit
|
||||
|
||||
Thank you for your interest in contributing to urbit.
|
||||
|
||||
See [urbit.org/docs/getting-started](https://urbit.org/docs/getting-started/#arvo)
|
||||
for basic orientation and usage instructions.
|
||||
See [urbit.org/docs/getting-started][start] for basic orientation and usage
|
||||
instructions.
|
||||
|
||||
[start]: https://urbit.org/docs/getting-started/#arvo
|
||||
|
||||
## Fake ships
|
||||
|
||||
You may have an identity on the live network, but doing all your
|
||||
development on the live network would be cumbersome and unnecessary.
|
||||
Standard practice in urbit development is to work on a fake `~zod`.
|
||||
Fake ships use deterministic keys (derived from the ship address)
|
||||
and don't talk to the live network. They can talk to each other over
|
||||
the local loopback.
|
||||
You may have an identity on the live network, but doing all your development on
|
||||
the live network would be cumbersome and unnecessary. Standard practice in
|
||||
urbit development is to work on a fake `~zod`. Fake ships use deterministic
|
||||
keys (derived from the ship address) and don't talk to the live network. They
|
||||
can talk to each other over the local loopback.
|
||||
|
||||
To start a fake ship, simply specify the name with `-F`:
|
||||
|
||||
@ -23,20 +24,20 @@ $ urbit -F zod
|
||||
You can also pass a name for the *pier* (or ship directory):
|
||||
|
||||
```
|
||||
$ urbit -F zod my-fake-zod
|
||||
$ urbit -F zod -c my-fake-zod
|
||||
```
|
||||
|
||||
To resume a fake ship, just pass the name of the pier:
|
||||
|
||||
```
|
||||
$ urbit fake-zod/
|
||||
$ urbit my-fake-zod
|
||||
```
|
||||
|
||||
## Git practice
|
||||
|
||||
Since we use the GitHub issue tracker, it is helpful (though not
|
||||
required) to contribute via a GitHub pull request. If you already know
|
||||
what you are doing, skip down to the Style section.
|
||||
Since we use the GitHub issue tracker, it is helpful (though not required) to
|
||||
contribute via a GitHub pull request. If you already know what you are doing,
|
||||
skip down to the Style section.
|
||||
|
||||
Start by cloning the repository on your work machine:
|
||||
|
||||
@ -61,27 +62,25 @@ This is good practice for any project that uses git. You will pull
|
||||
upstream branches from urbit/urbit and push to your personal urbit fork
|
||||
by default.
|
||||
|
||||
Next, start a new branch to do your work on. For `urbit`, please use the
|
||||
latest tagged release as your starting point. For other repositories,
|
||||
anywhere pointed to by `master` is alright to start from.
|
||||
Next, start a new branch to do your work on. Normally you'll want to use the
|
||||
`master` branch as your starting point:
|
||||
|
||||
```
|
||||
$ git checkout -b [branch name] [starting point]
|
||||
$ git checkout -b [branch name] master
|
||||
```
|
||||
|
||||
Now you are free to do your work on this branch. When finished, you may
|
||||
want to clean up your commits:
|
||||
|
||||
```
|
||||
$ git rebase -i [starting point]
|
||||
$ git rebase -i master
|
||||
```
|
||||
|
||||
Then you can push to your public fork with `git push` and make a pull
|
||||
request via the GitHub UI.
|
||||
Then you can push to your public fork with `git push` and make a pull request
|
||||
via the GitHub UI.
|
||||
|
||||
After your changes are merged upstream, you can delete your branch (via
|
||||
github UI or `git push :[branch]` remotely, and with `git branch -d`
|
||||
locally).
|
||||
After your changes are merged upstream, you can delete your branch (via github
|
||||
UI or `git push :[branch]` remotely, and with `git branch -d` locally).
|
||||
|
||||
## Style
|
||||
|
||||
@ -92,81 +91,94 @@ compound statement. One thing to watch out for is top-level sections in
|
||||
source files that are denoted by comments and are actually indented one
|
||||
level.
|
||||
|
||||
Hoon will be a less familiar language to many contributors. More details
|
||||
are forthcoming; for now, the `%ford` vane (in
|
||||
[`sys/vane/ford.hoon`](https://github.com/urbit/arvo/blob/master/sys/vane/ford.hoon))
|
||||
is the highest quality code in the kernel.
|
||||
Hoon will be a less familiar language to many contributors. More details are
|
||||
forthcoming; for now, the `%ford` vane (in
|
||||
[`pkg/arvo/sys/vane/ford.hoon`][ford]) is some of the highest quality code in
|
||||
the kernel.
|
||||
|
||||
[ford]: https://github.com/urbit/urbit/blob/master/pkg/arvo/sys/vane/ford.hoon
|
||||
|
||||
## Kernel development
|
||||
|
||||
Working on either C or non-kernel Hoon should not bring any surprises, but
|
||||
the Hoon kernel (anything under `sys/` in [urbit/arvo](https://github.com/urbit/arvo))
|
||||
is bootstrapped from `urbit.pill`, and must be recompiled if any changes are
|
||||
made. This should happen automatically when you make changes, but if it doesn't,
|
||||
the command to manually recompile the kernel and install the new kernel
|
||||
is `|reset` in `dojo`. This rebuilds from the `sys` directory in the
|
||||
`home` desk in `%clay`. Currently, `|reset` does not reload apps like
|
||||
`dojo` itself, which will still reference the old kernel. To force them
|
||||
to reload, make a trivial edit to their main source file (under the
|
||||
`app` directory) in `%clay`.
|
||||
Working on either C or non-kernel Hoon should not bring any surprises, but the
|
||||
Hoon kernel (anything under [`pkg/arvo/sys/`][sys]) is bootstrapped from a
|
||||
so-called *pill*, and must be recompiled if any changes are made. This should
|
||||
happen automatically when you make changes, but if it doesn't, the command to
|
||||
manually recompile and install the new kernel is `|reset` in `dojo`. This
|
||||
rebuilds from the `sys` directory in the `home` desk in `%clay`.
|
||||
|
||||
Currently, `|reset` does not reload apps like `dojo` itself, which will still
|
||||
reference the old kernel. To force them to reload, make a trivial edit to their
|
||||
main source file (under the `app` directory) in `%clay`.
|
||||
|
||||
[arvo]: https://github.com/urbit/urbit/tree/master/pkg/arvo
|
||||
[sys]: https://github.com/urbit/urbit/tree/master/pkg/arvo/sys
|
||||
|
||||
## The kernel and pills
|
||||
|
||||
urbit bootstraps itself using a binary blob called `urbit.pill`. You
|
||||
probably remember it being fetched from `bootstrap.urbit.org` before
|
||||
your first boot. This is the compiled version of the kernel (which
|
||||
you can find in the `sys` directory of [urbit/arvo](https://github.com/urbit/arvo)),
|
||||
along with a complete copy of the Arvo repository as source.
|
||||
Urbit bootstraps itself using a binary blob called a pill (you can see it being
|
||||
fetched from `bootstrap.urbit.org` on boot). This is the compiled version of
|
||||
the kernel (which you can find in the `sys` directory of [Arvo][arvo]), along
|
||||
with a complete copy of the Arvo source.
|
||||
|
||||
The procedure for creating `urbit.pill` is often called "soliding". It
|
||||
is somewhat similar to `|reset`, but instead of replacing your running
|
||||
kernel, it writes the compiled kernel to a file. The command to solid
|
||||
is:
|
||||
The procedure for creating a pill is often called "soliding." It is somewhat
|
||||
similar to `|reset`, but instead of replacing your running kernel, it writes
|
||||
the compiled kernel to a file. The command to solid is:
|
||||
|
||||
```
|
||||
> .urbit/pill +solid
|
||||
```
|
||||
|
||||
When the compilation finishes, your `urbit.pill` will be found in the
|
||||
`[pier]/.urb/put/` directory.
|
||||
When the compilation finishes, your pill will be found in the
|
||||
`[pier]/.urb/put/` directory as `urbit.pill`.
|
||||
|
||||
You can boot a new ship from your local pill with `-B`:
|
||||
|
||||
```
|
||||
$ urbit -F zod -B path/to/urbit.pill fake-zod
|
||||
$ urbit -F zod -B path/to/urbit.pill my-fake-zod
|
||||
```
|
||||
|
||||
Ordinarily, `http://bootstrap.urbit.org/latest.pill` will be updated
|
||||
to match whatever's on `master` in the `arvo` repository with every
|
||||
merge to `master`. Older pills will be stored with the first 10
|
||||
characters of the `git` SHA1 of the relevant commit as `git-[sha1].pill`.
|
||||
Pills are cached at `https://bootstrap.urbit.org` and are indexed by the first
|
||||
10 characters of the `git` SHA1 of the relevant commit, i.e. as
|
||||
`git-[sha1].pill`. The continuous integration build uploads these pills for
|
||||
any successful build of a commit or pull request that affects the
|
||||
`pkg/arvo/sys/` directory.
|
||||
|
||||
The continuous-integration build of the `urbit/arvo` repository
|
||||
uploads these pills for any successful build (if the commit or pull-request
|
||||
affects the `sys/` directory).
|
||||
|
||||
You can boot from one of these pills by passing the path to an Arvo
|
||||
working copy with `-A` (and `-s` for *search*):
|
||||
You can boot from one of these pills by passing the path to an Arvo working
|
||||
copy with `-A` (and `-s` for *search*):
|
||||
|
||||
```
|
||||
$ git clone https://github.com/urbit/arvo
|
||||
$ urbit -F zod -A path/to/arvo -s fake-zod
|
||||
$ git clone https://github.com/urbit/urbit
|
||||
$ urbit -F zod -sA urbit/pkg/arvo -s my-fake-zod
|
||||
```
|
||||
|
||||
Pills are also cached in version control via [git LFS][git-lfs]. You can find
|
||||
the latest solid pill (as well as the latest so-called *brass* and *ivory*
|
||||
pills) in the `bin/` directory at the repository root:
|
||||
|
||||
```
|
||||
$ git lfs init
|
||||
$ git lfs pull
|
||||
```
|
||||
|
||||
[git-lfs]: https://git-lfs.github.com
|
||||
|
||||
## What to work on
|
||||
|
||||
If you are not thinking of contributing with a specific goal in mind,
|
||||
the GitHub issue tracker is the first place you should look for ideas.
|
||||
Issues are tagged with a priority and a difficulty. A good place to
|
||||
start is on either a low-difficulty issue or a low-priority issue.
|
||||
Higher priority issues are likely to be assigned to someone - if this is
|
||||
the case, then contacting that person to coordinate before starting to
|
||||
work is probably a good idea.
|
||||
If you are not thinking of contributing with a specific goal in mind, the
|
||||
GitHub issue tracker is the first place you should look for ideas. Issues are
|
||||
occasionally tagged with a priority and a difficulty; a good place to start is
|
||||
on a low-difficulty or low-priority issue. Higher-priority issues are likely
|
||||
to be assigned to someone -- if this is the case, then contacting that person
|
||||
to coordinate before starting to work is probably a good idea.
|
||||
|
||||
There is also a "help wanted" tag for things that we are especially
|
||||
eager to have outside contributions on. Check here first!
|
||||
There is also a "help wanted" tag for things that we are especially eager to
|
||||
have outside contributions on. Check here first!
|
||||
|
||||
## Staying in touch
|
||||
|
||||
Questions or other communications about contributing to Urbit can go to
|
||||
[support@urbit.org](mailto:support@urbit.org).
|
||||
[support@urbit.org][mail].
|
||||
|
||||
[mail]: mailto:support@urbit.org
|
||||
|
||||
|
28
Makefile
Normal file
28
Makefile
Normal file
@ -0,0 +1,28 @@
|
||||
.PHONY: build build-all install cross release test pills clean
|
||||
|
||||
build:
|
||||
nix-build -A urbit -A herb --no-out-link
|
||||
|
||||
build-all:
|
||||
nix-build --no-out-link
|
||||
|
||||
install:
|
||||
nix-env -f . -iA urbit -iA urbit-debug -iA herb
|
||||
|
||||
cross:
|
||||
sh/cross
|
||||
|
||||
release:
|
||||
sh/release
|
||||
|
||||
test:
|
||||
sh/test
|
||||
|
||||
pills:
|
||||
sh/update-solid-pill
|
||||
sh/update-brass-pill
|
||||
sh/update-ivory-pill
|
||||
|
||||
clean:
|
||||
rm -rf ./out ./work
|
||||
rm -f result result-*
|
117
README.md
117
README.md
@ -1,88 +1,83 @@
|
||||
# Urbit
|
||||
|
||||
> The Urbit address space is now live on the Ethereum blockchain. We’re calling it ‘Azimuth’ and you can find it at [`0x223c067f8cf28ae173ee5cafea60ca44c335fecb`](https://etherscan.io/address/0x223c067f8cf28ae173ee5cafea60ca44c335fecb) or [`azimuth.eth`](https://etherscan.io/address/azimuth.eth). Owners of Azimuth ‘points’ (galaxies, stars or planets) can use [Bridge](https://github.com/urbit/bridge/releases) to manage them and view their balance now. Azimuth points can boot Arvo, the Urbit OS, with their Azimuth point.
|
||||
A personal server operating function.
|
||||
|
||||
## Install instructions
|
||||
> The Urbit address space, Azimuth, is now live on the Ethereum blockchain. You
|
||||
> can find it at [`0x223c067f8cf28ae173ee5cafea60ca44c335fecb`][azim] or
|
||||
> [`azimuth.eth`][aens]. Owners of Azimuth points (galaxies, stars, or planets)
|
||||
> can view or manage them using [Bridge][brid], and can also use them to boot
|
||||
> [Arvo][arvo], the Urbit OS.
|
||||
|
||||
To install and run Urbit please follow the instructions at
|
||||
[urbit.org/docs/getting-started/](https://urbit.org/docs/getting-started/).
|
||||
Packages and source tarballs are available there. You'll be on the live network
|
||||
in a few minutes.
|
||||
[azim]: https://etherscan.io/address/0x223c067f8cf28ae173ee5cafea60ca44c335fecb
|
||||
[aens]: https://etherscan.io/address/azimuth.eth
|
||||
[brid]: https://github.com/urbit/bridge/releases
|
||||
[arvo]: https://github.com/urbit/arvo/
|
||||
|
||||
If you're doing development on Urbit, keep reading.
|
||||
## Install
|
||||
|
||||
## Build instructions
|
||||
To install and run Urbit, please follow the instructions at
|
||||
[urbit.org/docs/getting-started/][start]. You'll be on the live network in a
|
||||
few minutes.
|
||||
|
||||
[![Build Status](https://travis-ci.org/urbit/urbit.svg?branch=master)](https://travis-ci.org/urbit/urbit)
|
||||
If you're interested in Urbit development, keep reading.
|
||||
|
||||
### External dependencies
|
||||
[start]: https://urbit.org/docs/getting-started/
|
||||
|
||||
`vere`, the Urbit virtual machine, depends on the following:
|
||||
## Development
|
||||
|
||||
- C compiler ([gcc](https://gcc.gnu.org) or [clang](http://clang.llvm.org))
|
||||
- [Meson](http://mesonbuild.com/)
|
||||
- [GMP](https://gmplib.org)
|
||||
- [OpenSSL](https://www.openssl.org)
|
||||
- [libsigsegv](https://www.gnu.org/software/libsigsegv/)
|
||||
- [libcurl](https://curl.haxx.se/libcurl/)
|
||||
- [libuv](http://libuv.org)
|
||||
- curses implementation (ncurses on Linux distributions, OS curses otherwise)
|
||||
[![Build Status](https://travis-ci.org/urbit/urbit.svg?branch=master)][trav]
|
||||
|
||||
Most of these dependencies are unfortunate; we aim to drastically shrink the
|
||||
list in upcoming versions. `vere` proper makes use of GMP, OpenSSL, libcurl, and
|
||||
libsigsegv.
|
||||
Urbit uses [Nix][nix] to manage builds. On Linux and macOS you can install Nix
|
||||
via:
|
||||
|
||||
### Building
|
||||
```
|
||||
curl https://nixos.org/nix/install | sh
|
||||
```
|
||||
|
||||
Urbit uses Meson build system.
|
||||
The Makefile in the project's root directory contains useful phony targets for
|
||||
building, installing, testing, and so on. You can use it to avoid dealing with
|
||||
Nix explicitly.
|
||||
|
||||
Some libraries which are not found in major distributions:
|
||||
To build Urbit, for example, use:
|
||||
|
||||
- ed25519
|
||||
- libh2o
|
||||
- murmur3
|
||||
- softfloat3
|
||||
- scrypt
|
||||
```
|
||||
make build
|
||||
```
|
||||
|
||||
are included as git submodules. To build urbit from source, perform the following steps:
|
||||
The test suite can similarly be run via a simple:
|
||||
|
||||
### Configuration & compilation
|
||||
(For instructions for legacy meson, also see below)
|
||||
```
|
||||
make test
|
||||
```
|
||||
|
||||
1. Install all required dependencies.
|
||||
2. Run `./scripts/bootstrap`
|
||||
3. Run `./scripts/build`
|
||||
4. The executable should appear in `./build` directory.
|
||||
Note that some of the Makefile targets need access to pills tracked via [git
|
||||
LFS][git-lfs], so you'll also need to have those available locally:
|
||||
|
||||
#### Using meson & ninja
|
||||
```
|
||||
git lfs install
|
||||
git lfs pull
|
||||
```
|
||||
|
||||
To configure the project, enter the build directory and enter
|
||||
`meson configure -Dbuildtype=release`. To compile a debug build of urbit, use
|
||||
`meson configure -Dbuildtype=debug`.
|
||||
To set a prefix for installation use
|
||||
`meson configure -Dprefix=/usr`.
|
||||
|
||||
### Configuration & compilation for legacy meson
|
||||
|
||||
The syntax for legacy meson (Version `0.29`) is a bit different.
|
||||
|
||||
1. Manually create `build` directory and invoke meson as `meson . ./build`
|
||||
2. If you want to set options, this is done in one step.
|
||||
Use `meson -D [options] . ./build` to prepare customized build.
|
||||
|
||||
Once the project is configured, use `ninja` to build it.
|
||||
To install it into the default prefix, use `ninja install`.
|
||||
If you want to specify custom `DESTDIR`, use `DESTDIR=... ninja install`.
|
||||
[trav]: https://github.com/urbit/urbit.git
|
||||
[nix]: https://nixos.org/nix/
|
||||
[git-lfs]: https://git-lfs.github.com
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions of any form are more than welcome! If something doesn't seem right, and there is no issue about it yet, feel free to open one.
|
||||
Contributions of any form are more than welcome! If something doesn't seem
|
||||
right, and there is no issue about it yet, feel free to open one.
|
||||
|
||||
If you're looking to get involved, there are a few things you can do:
|
||||
|
||||
- Join the [urbit-dev](https://groups.google.com/a/urbit.org/forum/#!forum/dev) mailing list.
|
||||
- [Ask us about Hoon School](mailto:support@urbit.org), a course we run to teach the Hoon programming language and Urbit application development.
|
||||
- Check out [good contributor issues](https://github.com/urbit/urbit/labels/good%20contributor%20issue).
|
||||
- Reach out to [support@urbit.org](mailto:support@urbit.org) to say hi and ask any questions you might have.
|
||||
- Join the [urbit-dev][list] mailing list.
|
||||
- [Apply to Hoon School][mail], a course we run to teach the Hoon
|
||||
programming language and Urbit application development.
|
||||
- Check out [good contributor issues][good].
|
||||
|
||||
Once you've got your bearings, have a look at [CONTRIBUTING.md](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md) for some pointers on setting up your development environment.
|
||||
Once you've got your bearings, have a look at [CONTRIBUTING.md][cont] for some
|
||||
pointers on setting up your development environment.
|
||||
|
||||
[list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev
|
||||
[mail]: mailto:support@urbit.org
|
||||
[good]: https://github.com/urbit/urbit/labels/good%20contributor%20issue
|
||||
[cont]: https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md
|
||||
|
3
bin/brass.pill
Normal file
3
bin/brass.pill
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8f6e93cb3ee5fcb0970851bd10d2d2a640ff968292d147c35385623b86570296
|
||||
size 6662042
|
3
bin/ivory.pill
Normal file
3
bin/ivory.pill
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:42d7fae92d11b3dbc3ee9aaa1e2edc5328f308c047dcf126b6cd661862904782
|
||||
size 4352384
|
3
bin/solid.pill
Normal file
3
bin/solid.pill
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d46350623e56ebb6fa15761632923b99339088278d87e221657d64c3c5d501e3
|
||||
size 9349402
|
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -1,5 +0,0 @@
|
||||
urbit (0.6-0) unstable; urgency=high
|
||||
|
||||
* Memory-allocation bug fix in _box_slot in Vere. Breaking change.
|
||||
|
||||
-- Keaton Dunsford <keaton@tlon.io> Fri, 8 Jun 2018 14:31:08 -0700
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
||||
10
|
12
debian/control
vendored
12
debian/control
vendored
@ -1,12 +0,0 @@
|
||||
Source: urbit
|
||||
Section: net
|
||||
Priority: extra
|
||||
Maintainer: Ted Blackman <ted@tlon.io>
|
||||
Build-Depends: debhelper (>= 9), libgmp3-dev, libsigsegv-dev, openssl, libssl-dev,libtool, meson, re2c, libcurl4-gnutls-dev
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: http://urbit.org
|
||||
|
||||
Package: urbit
|
||||
Architecture: any
|
||||
Depends: libgmp3-dev, libsigsegv-dev, openssl, libcurl4-gnutls-dev
|
||||
Description: An operating function
|
27
debian/copyright
vendored
27
debian/copyright
vendored
@ -1,27 +0,0 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: urbit
|
||||
Source: <http://urbit.org>
|
||||
|
||||
Files: *
|
||||
License: MIT
|
||||
The MIT License (MIT)
|
||||
.
|
||||
Copyright (c) 2017 Urbit
|
||||
.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1
debian/debhelper-build-stamp
vendored
1
debian/debhelper-build-stamp
vendored
@ -1 +0,0 @@
|
||||
urbit
|
2
debian/docs
vendored
2
debian/docs
vendored
@ -1,2 +0,0 @@
|
||||
LICENSE.txt
|
||||
README.md
|
1
debian/install
vendored
1
debian/install
vendored
@ -1 +0,0 @@
|
||||
bin/urbit usr/bin
|
5
debian/rules
vendored
5
debian/rules
vendored
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
||||
3.0 (quilt)
|
35
default.nix
35
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 git 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
|
||||
|
@ -1083,7 +1083,7 @@ ZOO place where animals are kept for public exhibition
|
||||
ZUZ ancient Hebrew silver coin {OSPD4}
|
||||
ZZZ intj. representing the sound of snoring {OSPD4}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
----------------------------------------------------------------------
|
||||
San Jose Scrabble® Club No. 21
|
||||
Director: Rick Wong
|
||||
Last modified: T2Q (26 Feb 2009) Clarified status of this list.
|
@ -1,4 +1,4 @@
|
||||
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered
|
||||
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered
|
||||
pair of nouns.
|
||||
|
||||
nock(a) *a
|
@ -30,7 +30,7 @@ dependencies at all between Hoon the language and `u3`.)
|
||||
|
||||
## c3: C in Urbit
|
||||
|
||||
Under `u3` is the simple `c3` layer, which is just how we write C
|
||||
Under `u3` is the simple `c3` layer, which is just how we write C
|
||||
in Urbit.
|
||||
|
||||
When writing C in u3, please of course follow the conventions of
|
||||
@ -39,7 +39,7 @@ important that every function have a header comment, even if it
|
||||
says nothing interesting.
|
||||
|
||||
But some of our idiosyncrasies go beyond convention. Yes, we've
|
||||
done awful things to C. Here's what we did and why we did.
|
||||
done awful things to C. Here's what we did and why we did.
|
||||
|
||||
### c3: integer types
|
||||
|
||||
@ -188,7 +188,7 @@ pointer into the loom - see below. The structures are:
|
||||
|
||||
typedef struct {
|
||||
c3_w mug_w;
|
||||
u3_noun hed;
|
||||
u3_noun hed;
|
||||
u3_noun tel;
|
||||
} u3a_cell;
|
||||
|
||||
@ -205,7 +205,7 @@ be `u3_none`.
|
||||
### u3: reference counts
|
||||
|
||||
The only really essential thing you need to know about `u3` is
|
||||
how to handle reference counts. Everything else, you can skip
|
||||
how to handle reference counts. Everything else, you can skip
|
||||
and just get to work.
|
||||
|
||||
u3 deals with reference-counted, immutable, acyclic nouns.
|
||||
@ -247,7 +247,7 @@ callee, which "gives back" any return. For instance, if I have
|
||||
{
|
||||
u3_noun foo = u3i_string("foobar");
|
||||
u3_noun bar;
|
||||
|
||||
|
||||
bar = u3f_futz(foo);
|
||||
[...]
|
||||
u3z(bar);
|
||||
@ -265,7 +265,7 @@ need to write
|
||||
{
|
||||
u3_noun foo = u3i_string("foobar");
|
||||
u3_noun bar;
|
||||
|
||||
|
||||
bar = u3f_futz(foo);
|
||||
[...]
|
||||
u3z(foo);
|
||||
@ -299,7 +299,7 @@ what your function does. There is a convention for it, which
|
||||
depends on where it is, not what it does. Follow the convention.
|
||||
|
||||
### u3: reference conventions
|
||||
|
||||
|
||||
The `u3` convention is that, unless otherwise specified, *all
|
||||
functions have transfer semantics* - with the exception of the
|
||||
prefixes: `u3r`, `u3x`, `u3z`, `u3q` and `u3w`. Also, within
|
||||
@ -352,7 +352,7 @@ and stack can point in *either direction*. Therefore, inside
|
||||
a road, we can nest another road in the *opposite direction*.
|
||||
|
||||
When the opposite road completes, its heap is left on top of
|
||||
the opposite heap's stack. It's no more than the normal
|
||||
the opposite heap's stack. It's no more than the normal
|
||||
behavior of a stack machine for all subcomputations to push
|
||||
their results on the stack.
|
||||
|
||||
@ -361,7 +361,7 @@ the road - is that if the outer computation wants to preserve the
|
||||
results of the inner one, not just use them for temporary
|
||||
purposes, it has to *copy them*.
|
||||
|
||||
This is a trivial cost in some cases, a prohibitive cost in
|
||||
This is a trivial cost in some cases, a prohibitive cost in
|
||||
others. The upside, of course, is that all garbage accrued
|
||||
in the inner computation is discarded at zero cost.
|
||||
|
||||
@ -404,7 +404,7 @@ frame; `#` is free memory.
|
||||
|
||||
Pointer restrictions: pointers stored in `+` can point anywhere.
|
||||
Of course, pointing to `#` (free memory) would be a bug.
|
||||
Pointers in `-` can only point to `-` or `~`; pointers in `~`
|
||||
Pointers in `-` can only point to `-` or `~`; pointers in `~`
|
||||
only point to `~`.
|
||||
|
||||
To "leap" is to create a new inner road in the `###` free space.
|
||||
@ -491,7 +491,7 @@ road or in a deep road. You can test this by testing
|
||||
ie: does the pier's home road equal the current road pointer?
|
||||
|
||||
Normally in this context you assume you're obeying the rules of
|
||||
running on an inner road, ie, "deep memory." Remember, however,
|
||||
running on an inner road, ie, "deep memory." Remember, however,
|
||||
that the interpreter *can* run on surface memory - but anything
|
||||
you can do deep, you can do on the surface. The converse is by
|
||||
no means the case.
|
||||
@ -508,16 +508,16 @@ replacements, `u3a_malloc()`, `u3a_free()`, `u3a_realloc()`.)
|
||||
|
||||
A good example is the different meaning of `c3_assert()` inside
|
||||
and outside the interpreter. At either layer, you can use
|
||||
regular assert(), which will just kill your process. On the
|
||||
regular assert(), which will just kill your process. On the
|
||||
surface, `c3_assert()` will just... kill your process.
|
||||
|
||||
In deep execution, `c3_assert()` will issue an exception that
|
||||
queues an error event, complete with trace stack, on the Arvo
|
||||
queues an error event, complete with trace stack, on the Arvo
|
||||
event queue. Let's see how this happens.
|
||||
|
||||
### u3: exceptions
|
||||
|
||||
You produce an exception with
|
||||
You produce an exception with
|
||||
|
||||
/* u3m_bail(): bail out. Does not return.
|
||||
**
|
||||
@ -532,7 +532,7 @@ You produce an exception with
|
||||
** %meme :: out of memory
|
||||
** %time :: timed out
|
||||
** %oops :: assertion failure
|
||||
*/
|
||||
*/
|
||||
c3_i
|
||||
u3m_bail(c3_m how_m);
|
||||
|
||||
@ -593,7 +593,7 @@ functions are commented, but the comments may be cryptic.
|
||||
|
||||
### u3m: main control
|
||||
|
||||
To start `u3`, run
|
||||
To start `u3`, run
|
||||
|
||||
/* u3m_boot(): start the u3 system.
|
||||
*/
|
||||
@ -653,7 +653,7 @@ prettyprinting routines, none perfect, are available, mainly for
|
||||
debugging printfs: `u3m_pretty()`, `u3m_p()`, `u3m_tape()` and
|
||||
`u3m_wall()`.
|
||||
|
||||
It's sometimes nice to run a mark-and-sweep garbage collector,
|
||||
It's sometimes nice to run a mark-and-sweep garbage collector,
|
||||
`u3m_grab()`, which collects the world from a list of roots,
|
||||
and asserts if it finds any leaks or incorrect refcounts. This
|
||||
tool is for debugging and long-term maintenance only; refcounts
|
||||
@ -674,7 +674,7 @@ It's easy to assume that jets represent an architectural coupling
|
||||
between Hoon language semantics and Nock interpreter internals.
|
||||
Indeed such a coupling would be wholly wrongtious and un-Urbit.
|
||||
But the jet system is not Hoon-specific. It is specific to nock
|
||||
runtime systems that use a design pattern we call a `core`.
|
||||
runtime systems that use a design pattern we call a `core`.
|
||||
|
||||
#### u3j: core structure
|
||||
|
||||
@ -713,7 +713,7 @@ breaks the Nock compliance of the system as a whole. So don't.
|
||||
Now, a casual observer might look at `[battery payload]` and
|
||||
expect the simplest case of it to be `[formula subject]`. That
|
||||
is: to execute a simple core whose battery is a single formula,
|
||||
we compute
|
||||
we compute
|
||||
|
||||
nock(+.a -.a)
|
||||
|
||||
@ -752,9 +752,9 @@ The typical gate will thus be, for example,
|
||||
|
||||
[formula [sample [battery battery battery constant]]]
|
||||
|
||||
but we would be most foolish to restrict the jet mechanism to
|
||||
cores of this particular structure. We cannot constrain a
|
||||
payload to be `[sample static-core]`, or even `[sample core]`.
|
||||
but we would be most foolish to restrict the jet mechanism to
|
||||
cores of this particular structure. We cannot constrain a
|
||||
payload to be `[sample static-core]`, or even `[sample core]`.
|
||||
Any such constraint would not be rich enough to handle Hoon,
|
||||
let alone other languages.
|
||||
|
||||
@ -787,7 +787,7 @@ There is only one hot state, the global jet dashboard
|
||||
`u3j_Dash` or `u3D` for short. In the present implementation,
|
||||
u3D is a static structure not modified at runtime, except for
|
||||
numbering itself on process initialization. This structure -
|
||||
which embeds function pointers to all the jets - is defined
|
||||
which embeds function pointers to all the jets - is defined
|
||||
in `j/tree.c`. The data structures:
|
||||
|
||||
/* u3j_harm: driver arm.
|
||||
@ -806,8 +806,8 @@ in `j/tree.c`. The data structures:
|
||||
c3_c* cos_c; // control string
|
||||
struct _u3j_harm* arm_u; // blank-terminated static list
|
||||
struct _u3j_core* dev_u; // blank-terminated static list
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l jax_l; // dynamic jet index
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l jax_l; // dynamic jet index
|
||||
} u3j_core;
|
||||
|
||||
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
|
||||
@ -827,14 +827,14 @@ roads, we also nest jet state. The jet state in the road is:
|
||||
u3_noun das; // cold state
|
||||
} jed;
|
||||
|
||||
In case you understand Hoon, `das` (cold state) is a `++dash`,
|
||||
In case you understand Hoon, `das` (cold state) is a `++dash`,
|
||||
and `har_p` (warm state) is a map from battery to `++calx`:
|
||||
|
||||
++ bane ,@tas :: battery name
|
||||
++ bash ,@uvH :: label hash
|
||||
++ bosh ,@uvH :: local battery hash
|
||||
++ batt ,* :: battery
|
||||
++ calf ::
|
||||
++ calf ::
|
||||
$: jax=,@ud :: hot core index
|
||||
hap=(map ,@ud ,@ud) :: axis/hot arm index
|
||||
lab=path :: label as path
|
||||
@ -854,7 +854,7 @@ state has to be reset when we reload the pier in a new process.
|
||||
|
||||
Why is jet state nested? Nock of course is a functional system,
|
||||
so as we compute we don't explicitly create state. Jet state is
|
||||
an exception to this principle (which works only because it can't
|
||||
an exception to this principle (which works only because it can't
|
||||
be semantically detected from Nock/Hoon) - but it can't violate
|
||||
the fundamental rules of the allocation system.
|
||||
|
||||
@ -900,8 +900,8 @@ Typically the `context` is itself a library core, which itself
|
||||
has a jet binding. If so, the parent axis of this gate is `7`.
|
||||
|
||||
If the parent is already bound - and the parent *must* be already
|
||||
bound, in this road or a road containing it - we can hook this core
|
||||
bottom-up into a tree hierarchy. Normally the child core is
|
||||
bound, in this road or a road containing it - we can hook this core
|
||||
bottom-up into a tree hierarchy. Normally the child core is
|
||||
produced by an arm of the parent core, so this is not a problem -
|
||||
we wouldn't have the child if we hadn't already made the parent.
|
||||
|
||||
@ -924,7 +924,7 @@ instance, if the core is a Hoon gate - a function - we will call
|
||||
### u3j: the cold jet dashboard
|
||||
|
||||
For even more fun, the jet tree is not actually a tree of
|
||||
batteries. It's a tree of battery *labels*, where a label is
|
||||
batteries. It's a tree of battery *labels*, where a label is
|
||||
an [axis term] path from the root of the tree. (At the root,
|
||||
if the core pattern is always followed properly, is a core whose
|
||||
payload is an atomic constant, conventionally the Hoon version.)
|
||||
@ -1029,7 +1029,7 @@ formula within the battery) to driver arm index (into `arm_u` in
|
||||
other dynamic data that may speed up execution.
|
||||
|
||||
We construct `hap`, when we create the calx, by iterating through
|
||||
the arms registered in the `u3j_core`. Note the way a `u3j_harm`
|
||||
the arms registered in the `u3j_core`. Note the way a `u3j_harm`
|
||||
declares itself, with the string `fcs_c` which can contain either
|
||||
an axis or a name. Most jetted cores are of course gates, which
|
||||
have one formula at one axis within the core: `fcs_c` is `".3"`.
|
||||
@ -1064,10 +1064,10 @@ If it exists, the core matches a driver and the driver jets this
|
||||
arm. If not, we return `u3_none`.
|
||||
|
||||
Otherwise, we call `fun_f` in our `u3j_harm`. This obeys the
|
||||
same protocol as `u3j_kick()`; it can refuse to function by
|
||||
same protocol as `u3j_kick()`; it can refuse to function by
|
||||
returning `u3_none`, or consume the noun.
|
||||
|
||||
Besides the actual function pointer `fun_f`, we have some flags
|
||||
Besides the actual function pointer `fun_f`, we have some flags
|
||||
in the `u3j_harm` which tell us how to call the arm function.
|
||||
|
||||
If `ice` is yes (`&`, `0`), the jet is known to be perfect and we
|
||||
@ -1075,7 +1075,7 @@ can just trust the product of `fun_f`. Otherwise, we need to run
|
||||
*both* the Nock arm and `fun_f`, and compare their results.
|
||||
|
||||
(Note that while executing the C side of this test, we have to
|
||||
set `ice` to yes; on the Nock side, we have to set `liv` to no.
|
||||
set `ice` to yes; on the Nock side, we have to set `liv` to no.
|
||||
Otherwise, many non-exponential functions become exponential.
|
||||
When auto-testing jets in this way, the principle is that the
|
||||
test is on the outermost layer of recursion.)
|
||||
@ -1092,8 +1092,8 @@ c3__punt. This feature has a cost: the jet runs in a subroad.
|
||||
Finally, if `liv` is no (`|`, 1), the jet is off and doesn't run.
|
||||
|
||||
It should be easy to see how the tree of cores gets declared -
|
||||
precisely, in `j/dash.c`. We declare the hierarchy as a tree
|
||||
of `u3j_core` structures, each of which comes with a static list
|
||||
precisely, in `j/dash.c`. We declare the hierarchy as a tree
|
||||
of `u3j_core` structures, each of which comes with a static list
|
||||
of arms `arm_u` and sub-cores `dev_u`.
|
||||
|
||||
In `u3j_boot()`, we traverse the hierarchy, fill in parent
|
||||
@ -1110,7 +1110,7 @@ always be the case with a certain amount of core functionality.
|
||||
For instance, there are some jet functions that we need to call
|
||||
as part of loading the Arvo kernel - like `++cue` to unpack a
|
||||
noun from an atom. And obviously it makes sense, when jets are
|
||||
significant enough to compile into `u3`, to export their symbols
|
||||
significant enough to compile into `u3`, to export their symbols
|
||||
in headers and the linker.
|
||||
|
||||
There are three interface prefixes for standard jet functions:
|
||||
@ -1135,7 +1135,7 @@ is added for functions within subcores. The filename, under
|
||||
`j/`, follows the tier and the function name.
|
||||
|
||||
For instance, `++add` is `u3wa_add(cor)`, `u3qa_add(a, b)`, or
|
||||
`u3ka_add(a, b)`, in `j/a/add.c`. `++get` in `++by` is
|
||||
`u3ka_add(a, b)`, in `j/a/add.c`. `++get` in `++by` is
|
||||
`u3wdb_get(cor)`, `u3kdb_get(a, b)`, etc, in `j/d/by_get.c`.
|
||||
|
||||
For historical reasons, all internal jet code in `j/[a-f]`
|
||||
@ -1151,7 +1151,7 @@ structures are uninteresting and typical of a naive allocator.
|
||||
The two most-used `u3a` functions are `u3a_gain()` to add a
|
||||
reference count, and `u3a_lose()` to release one (and free the
|
||||
noun, if the use count is zero). For convenience, `u3a_gain()`
|
||||
returns its argument. The pair are generally abbreviated with
|
||||
returns its argument. The pair are generally abbreviated with
|
||||
the macros `u3k()` and `u3z()` respectively.
|
||||
|
||||
Normally we create nouns through `u3i` functions, and don't call
|
||||
@ -1249,12 +1249,12 @@ which slams a *gate* (`gat`) on a sample (`sam`). (In a normal
|
||||
programming language which didn't talk funny and was retarded,
|
||||
`u3n_slam_on()` would call a function on an argument.) We could
|
||||
write it most simply as:
|
||||
|
||||
u3_noun
|
||||
|
||||
u3_noun
|
||||
u3n_slam_on(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
u3_noun pro = u3n_nock_on
|
||||
(u3nc(u3k(u3h(gat)),
|
||||
(u3nc(u3k(u3h(gat)),
|
||||
u3nc(sam, u3k(u3t(u3t(gat))))),
|
||||
u3k(u3h(gat)));
|
||||
u3z(gat);
|
||||
@ -1265,7 +1265,7 @@ Simpler is `u3n_kick_on(u3_noun gat)`, which slams a gate (or,
|
||||
more generally, a *trap* - because sample structure is not even
|
||||
needed here) without changing its sample:
|
||||
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3n_kick_on(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3n_nock_on(gat, u3k(u3h(gat)));
|
||||
@ -1275,7 +1275,7 @@ The `_on` functions in `u3n` are all defined as pure Nock. But
|
||||
actually, even though we say we don't extend Nock, we do. But we
|
||||
don't. But we do.
|
||||
|
||||
Note that `u3` has a well-developed error handling system -
|
||||
Note that `u3` has a well-developed error handling system -
|
||||
`u3m_bail()` to throw an exception, `u3m_soft_*` to catch one.
|
||||
But Nock has no exception model at all. That's okay - all it
|
||||
means if that if an `_on` function bails, the exception is an
|
||||
@ -1309,8 +1309,8 @@ to a `fly` is a `++path`, just a list of text `span`.
|
||||
++ toon $% [%0 p=noun] :: success
|
||||
[%1 p=(list path)] :: blocking paths
|
||||
[%2 p=(list tank)] :: stack trace
|
||||
== ::
|
||||
++ tank :: printable
|
||||
== ::
|
||||
++ tank :: printable
|
||||
$% [%leaf p=tape] :: flat text
|
||||
$: %palm :: backstep list
|
||||
p=[p=tape q=tape r=tape s=tape] :: mid cap open close
|
||||
@ -1320,7 +1320,7 @@ to a `fly` is a `++path`, just a list of text `span`.
|
||||
p=[p=tape q=tape r=tape] :: mid open close
|
||||
q=(list tank) :: contents
|
||||
== ::
|
||||
==
|
||||
==
|
||||
|
||||
(Note that `tank` is overdesigned and due for replacement.)
|
||||
|
||||
@ -1329,7 +1329,7 @@ noun]`, or could not finish because it blocked on one or more
|
||||
global paths (`[1 (list path)]`), or it exited with a stack trace
|
||||
(`[2 (list tank)]`).
|
||||
|
||||
Note that of all the `u3` exceptions, only `%exit` is produced
|
||||
Note that of all the `u3` exceptions, only `%exit` is produced
|
||||
deterministically by the Nock definition. Therefore, only
|
||||
`%exit` produces a `2` result. Any other argument to
|
||||
`u3m_bail()` will unwind the virtualization stack all the way to
|
||||
@ -1397,7 +1397,7 @@ same nouns cannot have a different mug. It's important to
|
||||
understand the performance characteristics of `u3r_sing()`:
|
||||
the worst possible case is a comparison of duplicate nouns,
|
||||
which have the same value but were created separately. In this
|
||||
case, the tree is traversed
|
||||
case, the tree is traversed
|
||||
|
||||
`u3r_sung()` is a deeply funky and frightening version of
|
||||
`u3r_sing()` that unifies pointers to the duplicate nouns it
|
||||
@ -1471,13 +1471,13 @@ and save with
|
||||
u3_noun u3z_save_4(c3_m, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
|
||||
|
||||
where the value is the last argument. To eliminate duplicate
|
||||
nouns, there is also
|
||||
nouns, there is also
|
||||
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_uniq(u3_noun);
|
||||
|
||||
`u3z` functions retain keys and transfer values.
|
||||
|
||||
|
||||
The `u3z` cache, built on `u3h` hashes, is part of the current
|
||||
road, and goes away when it goes away. (In future, we may wish
|
||||
to promote keys/values which outlive the road, as we do with jet
|
||||
@ -1499,7 +1499,7 @@ core? Slightly pseudocoded:
|
||||
^- [(list ovum) _+>]
|
||||
!!
|
||||
++ keep |= [now=@da hap=path] :: 4
|
||||
^- (unit ,@da)
|
||||
^- (unit ,@da)
|
||||
!!
|
||||
++ load |= [yen=@ ova=(list ovum) nyf=pane] :: 86
|
||||
^- [(list ovum) _+>]
|
||||
@ -1555,13 +1555,13 @@ commented, but unfortunately it's hard to describe this API as
|
||||
clean at present. The problem is that `u3v` remains design
|
||||
coupled to the old `vere` event handling code written for `u2`.
|
||||
But let's describe the functions you should be calling, assuming
|
||||
you're not writing the next event system. There are only two.
|
||||
you're not writing the next event system. There are only two.
|
||||
|
||||
`u3v_wish(str_c)` wraps the `++wish` functionality in a cache
|
||||
(which is read-only unless you're on the surface road).
|
||||
|
||||
`u3v_do()` uses `wish` to provide a convenient interface for
|
||||
calling Hoon kernel functions by name. Even more conveniently,
|
||||
calling Hoon kernel functions by name. Even more conveniently,
|
||||
we tend to call `u3v_do()` with these convenient aliases:
|
||||
|
||||
#define u3do(txt_c, arg) u3v_do(txt_c, arg)
|
@ -1,3 +1,3 @@
|
||||
Extras Readme
|
||||
|
||||
This folder is for all the useful, but not strictly essential, stuff for developers.
|
||||
This folder is for all the useful, but not strictly essential, stuff for developers.
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
;; Copyright (C) 2014–2015 Urbit
|
||||
|
||||
;; Author:
|
||||
;; Author:
|
||||
;; * Adam Bliss https://github.com/abliss <abliss@gmail.com>
|
||||
;; Contributors:
|
||||
;; Contributors:
|
||||
;; * N Gvrnd https://github.com/ngvrnd
|
||||
;; * TJamesCorcoran https://github.com/TJamesCorcoran <jamescorcoran@gmail.com>
|
||||
;; * Rastus Vernon https://github.com/rastus-vernon <rastus.vernon@protonmail.ch>
|
||||
@ -133,7 +133,7 @@
|
||||
; 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...
|
||||
; 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
|
||||
@ -144,7 +144,7 @@
|
||||
|
||||
(defun hoon-mode-hack-the-modeline ()
|
||||
;; (setq mode-line-format
|
||||
;; '("%e"
|
||||
;; '("%e"
|
||||
;; mode-line-front-space
|
||||
;; mode-line-mule-info
|
||||
;; mode-line-client
|
||||
@ -159,7 +159,7 @@
|
||||
;; mode-line-modes
|
||||
;; mode-line-misc-info
|
||||
;; mode-line-end-spaces))
|
||||
;; (setq hoon-buffer-string
|
||||
;; (setq hoon-buffer-string
|
||||
;; (concat
|
||||
;; (nth 1 (reverse (split-string (file-name-directory (buffer-file-name)) "/")))
|
||||
;; "/"
|
||||
|
@ -4,105 +4,105 @@ 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#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', '', '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#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')
|
||||
@ -115,38 +115,38 @@ 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#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')
|
||||
|
@ -24,7 +24,7 @@ function! HoonIndent(lnum)
|
||||
return 0
|
||||
endif
|
||||
let prevl = substitute(getline(prevlnum),'::.*$','','')
|
||||
|
||||
|
||||
let ind = indent(prevlnum)
|
||||
if prevl =~ '++\s*\w*\s*$'
|
||||
" luslus operator
|
||||
|
@ -6,7 +6,7 @@ if exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
set autoindent
|
||||
map g/ /++
|
||||
map g/ /++
|
||||
nmap gs :let varname = '\<<C-R><C-W>\>'<CR>?++ <C-R>=varname<CR><CR>
|
||||
set tabstop=2
|
||||
" nmap gc :let &colorcolumn=join(range(81,999),",")<CR>
|
||||
@ -41,8 +41,8 @@ set tabstop=2
|
||||
syn case match
|
||||
|
||||
" Declarations
|
||||
hi def link hoonDeclaration Define
|
||||
hi def link hoonSymbol Constant
|
||||
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
|
||||
@ -54,7 +54,7 @@ hi def link hoonComment Comment
|
||||
hi def link hoonTodo Todo
|
||||
hi def link hoonString String
|
||||
|
||||
syn match hoonDeclaration "+[+-]" nextgroup=hoonSymbolDec skipwhite
|
||||
syn match hoonDeclaration "+[+-]" nextgroup=hoonSymbolDec skipwhite
|
||||
syn match hoonSymbol /%\%(\%(\%(\w\|-\)\+\)\|[|&$]\|\%(\.n\)\|\%(\.y\)\)/
|
||||
syn match hoonAtom /\%(@\w*\)\|\^/
|
||||
syn match hoonName "\w*" contained
|
||||
|
@ -1,4 +0,0 @@
|
||||
file bin/test_hash
|
||||
handle SIGSEGV nostop noprint
|
||||
start
|
||||
|
@ -1,18 +0,0 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#mesondefine URBIT_VERSION
|
||||
|
||||
#mesondefine U3_OS_linux
|
||||
#mesondefine U3_OS_bsd
|
||||
#mesondefine U3_OS_osx
|
||||
|
||||
#mesondefine U3_OS_ENDIAN_little
|
||||
#mesondefine U3_OS_ENDIAN_big
|
||||
|
||||
#mesondefine U3_MEMORY_DEBUG
|
||||
#mesondefine U3_CPU_DEBUG
|
||||
#mesondefine U3_EVENT_TIME_DEBUG
|
||||
#mesondefine U3_MEMORY_LOG
|
||||
|
||||
#endif /*CONFIG_H*/
|
92
jets/c/rip.c
92
jets/c/rip.c
@ -1,92 +0,0 @@
|
||||
/* j/3/rip.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qc_rip(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
u3_noun pir = u3_nul;
|
||||
c3_g a_g = a;
|
||||
c3_w i_w;
|
||||
|
||||
if ( a_g < 5 ) {
|
||||
c3_w met_w = u3r_met(a_g, b);
|
||||
c3_w mek_w = ((1 << (1 << a_g)) - 1);
|
||||
|
||||
for ( i_w = 0; i_w < met_w; i_w++ ) {
|
||||
c3_w pat_w = (met_w - (i_w + 1));
|
||||
c3_w bit_w = (pat_w << a_g);
|
||||
c3_w wor_w = (bit_w >> 5);
|
||||
c3_w sif_w = (bit_w & 31);
|
||||
c3_w src_w = u3r_word(wor_w, b);
|
||||
c3_w rip_w = ((src_w >> sif_w) & mek_w);
|
||||
|
||||
pir = u3nc(rip_w, pir);
|
||||
}
|
||||
return pir;
|
||||
}
|
||||
else {
|
||||
c3_w met_w = u3r_met(a_g, b);
|
||||
c3_w len_w = u3r_met(5, b);
|
||||
c3_g san_g = (a_g - 5);
|
||||
c3_w san_w = 1 << san_g;
|
||||
c3_w dif_w = (met_w << san_g) - len_w;
|
||||
c3_w tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w));
|
||||
|
||||
for ( i_w = 0; i_w < met_w; i_w++ ) {
|
||||
c3_w pat_w = (met_w - (i_w + 1));
|
||||
c3_w wut_w = (pat_w << san_g);
|
||||
c3_w sap_w = ((0 == i_w) ? tub_w : san_w);
|
||||
c3_w* sal_w = u3a_slab(sap_w);
|
||||
|
||||
if ( 0 == sal_w ) {
|
||||
return u3m_bail(c3__fail);
|
||||
} else {
|
||||
c3_w j_w;
|
||||
u3_atom rip;
|
||||
|
||||
for ( j_w = 0; j_w < sap_w; j_w++ ) {
|
||||
sal_w[j_w] = u3r_word(wut_w + j_w, b);
|
||||
}
|
||||
|
||||
rip = u3a_malt(sal_w);
|
||||
pir = u3nc(rip, pir);
|
||||
}
|
||||
len_w -= san_w;
|
||||
}
|
||||
}
|
||||
return pir;
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3wc_rip(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ||
|
||||
(c3n == u3ud(a)) ||
|
||||
(c3n == u3ud(b)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
return u3qc_rip(a, b);
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3kc_rip(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
u3_noun res = u3qc_rip(a, b);
|
||||
|
||||
u3z(a); u3z(b);
|
||||
return res;
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/* j/4/in_mer.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qdi_mer(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
if ( u3_nul == a ) {
|
||||
return u3k(b);
|
||||
}
|
||||
else if ( u3_nul == b ) {
|
||||
return u3k(a);
|
||||
}
|
||||
else {
|
||||
u3_noun l_a, n_a, r_a, lr_a; // XX copy tree boilerplate to other pt4
|
||||
u3_noun l_b, n_b, r_b, lr_b;
|
||||
u3_noun c;
|
||||
|
||||
if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else {
|
||||
if ( c3y == u3qc_mor(n_b, n_a) ) {
|
||||
c = a; a = b; b = c;
|
||||
c = n_a; n_a = n_b; n_b = c;
|
||||
c = lr_a; lr_a = lr_b; lr_b = c;
|
||||
}
|
||||
if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else if ( c3y == u3r_sing(n_a, n_b) ) {
|
||||
return u3nt(u3k(n_a),
|
||||
u3qdi_mer(l_a, l_b),
|
||||
u3qdi_mer(r_a, r_b));
|
||||
}
|
||||
else if ( c3y == u3qc_gor(n_b, n_a) ) {
|
||||
return u3qdi_mer(u3nt(n_a,
|
||||
u3qdi_mer(l_a,
|
||||
u3nt(n_b,
|
||||
l_b,
|
||||
u3_nul)),
|
||||
r_a),
|
||||
r_b);
|
||||
}
|
||||
else {
|
||||
return u3qdi_mer(u3nt(n_a,
|
||||
l_a,
|
||||
u3qdi_mer(r_a,
|
||||
u3nt(n_b,
|
||||
u3_nul,
|
||||
r_b))),
|
||||
l_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3wdi_mer(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else {
|
||||
return u3qdi_mer(a, b);
|
||||
}
|
||||
}
|
96
jets/e/cue.c
96
jets/e/cue.c
@ -1,96 +0,0 @@
|
||||
/* j/5/cue.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
|
||||
static u3_noun
|
||||
_cue_in(u3p(u3h_root) har_p,
|
||||
u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
u3_noun p, q;
|
||||
|
||||
if ( 0 == u3qc_cut(0, b, 1, a) ) {
|
||||
u3_noun x = u3qa_inc(b);
|
||||
u3_noun c = u3qe_rub(x, a);
|
||||
|
||||
p = u3qa_inc(u3k(u3h(c)));
|
||||
q = u3k(u3t(c));
|
||||
|
||||
u3h_put(har_p, u3k(b), u3k(q));
|
||||
|
||||
u3z(c);
|
||||
u3z(x);
|
||||
}
|
||||
else {
|
||||
u3_noun c = u3qa_add(2, b);
|
||||
u3_noun l = u3qa_inc(b);
|
||||
|
||||
if ( 0 == u3qc_cut(0, l, 1, a) ) {
|
||||
u3_noun u, v, w;
|
||||
u3_noun x, y;
|
||||
|
||||
u = _cue_in(har_p, a, c);
|
||||
x = u3qa_add(u3h(u), c);
|
||||
v = _cue_in(har_p, a, x);
|
||||
w = u3nc(u3k(u3h(u3t(u))), u3k(u3h(u3t(v))));
|
||||
|
||||
y = u3qa_add(u3h(u), u3h(v));
|
||||
p = u3qa_add(2, y);
|
||||
|
||||
q = w;
|
||||
u3h_put(har_p, u3k(b), u3k(q));
|
||||
|
||||
u3z(u); u3z(v); u3z(x); u3z(y);
|
||||
}
|
||||
else {
|
||||
u3_noun d = u3qe_rub(c, a);
|
||||
u3_noun x = u3h_get(har_p, u3k(u3t(d)));
|
||||
|
||||
p = u3qa_add(2, u3h(d));
|
||||
if ( u3_none == x ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
q = x;
|
||||
u3z(d);
|
||||
}
|
||||
u3z(l);
|
||||
u3z(c);
|
||||
}
|
||||
return u3nt(p, q, 0);
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3qe_cue(u3_atom a)
|
||||
{
|
||||
u3p(u3h_root) har_p = u3h_new();
|
||||
|
||||
u3_noun x = _cue_in(har_p, a, 0);
|
||||
u3_noun y = u3k(u3h(u3t(x)));
|
||||
|
||||
u3h_free(har_p);
|
||||
|
||||
u3z(x);
|
||||
return y;
|
||||
}
|
||||
u3_noun
|
||||
u3we_cue(u3_noun cor)
|
||||
{
|
||||
u3_noun a;
|
||||
|
||||
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
} else {
|
||||
return u3qe_cue(a);
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3ke_cue(u3_atom a)
|
||||
{
|
||||
u3_noun b = u3qe_cue(a);
|
||||
|
||||
u3z(a);
|
||||
return b;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
387
meson.build
387
meson.build
@ -1,387 +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/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_sans_main = [
|
||||
'vere/ames.c',
|
||||
'vere/behn.c',
|
||||
'vere/cttp.c',
|
||||
'vere/dawn.c',
|
||||
'vere/http.c',
|
||||
'vere/loop.c',
|
||||
'vere/raft.c',
|
||||
'vere/reck.c',
|
||||
'vere/save.c',
|
||||
'vere/sist.c',
|
||||
'vere/term.c',
|
||||
'vere/time.c',
|
||||
'vere/unix.c',
|
||||
'vere/walk.c'
|
||||
]
|
||||
|
||||
vere_src = vere_sans_main + [ 'vere/main.c' ]
|
||||
|
||||
src_list = [vere_src, noun_src, jets_all_src]
|
||||
|
||||
sources = []
|
||||
foreach s : src_list
|
||||
sources += s
|
||||
endforeach
|
||||
|
||||
incdir = include_directories('include/')
|
||||
|
||||
conf_data = configuration_data()
|
||||
conf_data.set('URBIT_VERSION', '"0.7.4"')
|
||||
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'])
|
||||
libent_dep = dependency('libent', version: '>=0.2.1', fallback: ['libent', 'libent_dep'])
|
||||
libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'libh2o_dep'])
|
||||
libscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep'])
|
||||
libsni_dep = dependency('libsni', version: '>=0.5.0', fallback: ['libsni', 'libsni_dep'])
|
||||
libuv_dep = dependency('libuv', version: '>=1.8.0', fallback:['libuv', 'libuv_dep'])
|
||||
murmur3_dep = dependency('murmur3', version: '>=0.1.0', fallback: ['murmur3', 'murmur3_dep'])
|
||||
secp256k1_dep = dependency('libsecp256k1', version: '>=0.1.0', fallback: ['secp256k1', 'secp256k1_dep'])
|
||||
softfloat3_dep = dependency('softfloat3', version: '>=3.0.0', fallback: ['softfloat3', 'softfloat3_dep'])
|
||||
|
||||
deps = [argon2_dep,
|
||||
curl_dep,
|
||||
ed25519_dep,
|
||||
gmp_dep,
|
||||
libent_dep,
|
||||
libh2o_dep,
|
||||
libscrypt_dep,
|
||||
libsni_dep,
|
||||
libuv_dep,
|
||||
murmur3_dep,
|
||||
openssl_dep,
|
||||
secp256k1_dep,
|
||||
sigsegv_dep,
|
||||
softfloat3_dep]
|
||||
|
||||
executable('urbit',
|
||||
sources : sources,
|
||||
include_directories : incdir,
|
||||
c_args : os_c_flags,
|
||||
link_args: os_link_flags,
|
||||
dependencies: deps + os_deps,
|
||||
install: true)
|
||||
|
||||
# XX shrink this list
|
||||
test_sources = noun_src + jets_all_src + vere_sans_main
|
||||
|
||||
test_hashtable = executable('test-hashtable',
|
||||
sources : test_sources + ['tests/hashtable_tests.c'],
|
||||
include_directories : incdir,
|
||||
c_args : os_c_flags,
|
||||
link_args: os_link_flags,
|
||||
dependencies: deps + os_deps,
|
||||
install: false)
|
||||
|
||||
test('test-hashtable', test_hashtable)
|
||||
|
||||
test_mem = executable('test-mem',
|
||||
sources : test_sources + ['tests/test.c'],
|
||||
include_directories : incdir,
|
||||
c_args : os_c_flags,
|
||||
link_args: os_link_flags,
|
||||
dependencies: deps + os_deps,
|
||||
install: false)
|
||||
|
||||
test('test-mem', test_mem, should_fail: true)
|
||||
|
||||
test_hash = executable('test-hash',
|
||||
sources : test_sources + ['tests/hash_tests.c'],
|
||||
include_directories : incdir,
|
||||
c_args : os_c_flags,
|
||||
link_args: os_link_flags,
|
||||
dependencies: deps + os_deps,
|
||||
install: false)
|
||||
|
||||
test('test-hash', test_hash)
|
@ -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.')
|
23
nix/cachix/local.nix
Normal file
23
nix/cachix/local.nix
Normal file
@ -0,0 +1,23 @@
|
||||
# All the non-release builds that should be cached in `cachix`.
|
||||
|
||||
let
|
||||
|
||||
pkgs = import ../pkgs {};
|
||||
deps = import ../deps {};
|
||||
|
||||
# Cache the result of cloning source repos.
|
||||
repos = {
|
||||
argon2-src = deps.argon2.src;
|
||||
ed25519-src = deps.ed25519.src;
|
||||
h2o-src = deps.h2o.src;
|
||||
murmur3-src = deps.murmur3.src;
|
||||
scrypt-src = deps.scrypt.src;
|
||||
secp256k1-src = deps.secp256k1.src;
|
||||
sni-src = deps.sni.src;
|
||||
softfloat3-src = deps.softfloat3.src;
|
||||
uv-src = deps.uv.src;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
deps // pkgs // repos
|
11
nix/cachix/release.nix
Normal file
11
nix/cachix/release.nix
Normal file
@ -0,0 +1,11 @@
|
||||
let
|
||||
|
||||
util = import ./util.nix;
|
||||
nixcrpkgs = import ../nixcrpkgs.nix;
|
||||
release = import ../release.nix;
|
||||
all_releases = util.flattenSetPrefix release;
|
||||
crosstools = { inherit (nixcrpkgs.native) pkgconf; };
|
||||
|
||||
in
|
||||
|
||||
crosstools // all_releases
|
26
nix/cachix/util.nix
Normal file
26
nix/cachix/util.nix
Normal file
@ -0,0 +1,26 @@
|
||||
# Some utility functions:
|
||||
|
||||
rec {
|
||||
|
||||
# The inverse of builtins.listToAttrs
|
||||
attrsToList = o:
|
||||
map (a: { name=a; value=builtins.getAttr a o; })
|
||||
(builtins.attrNames o);
|
||||
|
||||
# ∀o,x,y. produce o' such that o'.y == o.x.y (assuming no conflicts)
|
||||
flattenSet = o:
|
||||
builtins.foldl' (acc: v: acc // v) {}
|
||||
(builtins.attrValues o);
|
||||
|
||||
prefixSetAttrs = prefix: o:
|
||||
builtins.listToAttrs
|
||||
(map ({name, value}: { name=prefix + name; value=value; })
|
||||
(attrsToList o));
|
||||
|
||||
# ∀o,x,y. produce o' such that o'.x-y == o.x.y
|
||||
flattenSetPrefix = o:
|
||||
(builtins.foldl' (acc: o: acc // o) {}
|
||||
(map ({name, value}: prefixSetAttrs name value)
|
||||
(attrsToList o)));
|
||||
|
||||
}
|
13
nix/crossdeps.nix
Normal file
13
nix/crossdeps.nix
Normal file
@ -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; };
|
||||
}
|
31
nix/deps-env.nix
Normal file
31
nix/deps-env.nix
Normal file
@ -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 lmdb ];
|
||||
|
||||
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 ge-additions ];
|
||||
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "urbit-deps-env";
|
||||
env = pkgs.buildEnv { name = name; paths = buildInputs; };
|
||||
buildInputs = tools ++ libs ++ osx ++ vendor;
|
||||
}
|
14
nix/deps/argon2/builder.sh
Normal file
14
nix/deps/argon2/builder.sh
Normal file
@ -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
|
17
nix/deps/argon2/cross.nix
Normal file
17
nix/deps/argon2/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
13
nix/deps/argon2/default.nix
Normal file
13
nix/deps/argon2/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
13
nix/deps/default.nix
Normal file
13
nix/deps/default.nix
Normal file
@ -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; };
|
||||
}
|
29
nix/deps/ed25519/builder.sh
Normal file
29
nix/deps/ed25519/builder.sh
Normal file
@ -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
|
16
nix/deps/ed25519/cross.nix
Normal file
16
nix/deps/ed25519/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
12
nix/deps/ed25519/default.nix
Normal file
12
nix/deps/ed25519/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
109
nix/deps/h2o/builder.sh
Normal file
109
nix/deps/h2o/builder.sh
Normal file
@ -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
|
17
nix/deps/h2o/cross.nix
Normal file
17
nix/deps/h2o/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
26
nix/deps/h2o/cross.sh
Normal file
26
nix/deps/h2o/cross.sh
Normal file
@ -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
|
13
nix/deps/h2o/default.nix
Normal file
13
nix/deps/h2o/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
11
nix/deps/murmur3/builder.sh
Normal file
11
nix/deps/murmur3/builder.sh
Normal file
@ -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
|
16
nix/deps/murmur3/cross.nix
Normal file
16
nix/deps/murmur3/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
12
nix/deps/murmur3/default.nix
Normal file
12
nix/deps/murmur3/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
27
nix/deps/scrypt/builder.sh
Normal file
27
nix/deps/scrypt/builder.sh
Normal file
@ -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
|
16
nix/deps/scrypt/cross.nix
Normal file
16
nix/deps/scrypt/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
12
nix/deps/scrypt/default.nix
Normal file
12
nix/deps/scrypt/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
11
nix/deps/secp256k1/builder.sh
Normal file
11
nix/deps/secp256k1/builder.sh
Normal file
@ -0,0 +1,11 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src ./src
|
||||
chmod -R u+w ./src
|
||||
cd src
|
||||
|
||||
libtoolize
|
||||
bash ./autogen.sh
|
||||
bash ./configure --prefix=$out --host=$host $configureFlags
|
||||
make
|
||||
make install
|
25
nix/deps/secp256k1/cross.nix
Normal file
25
nix/deps/secp256k1/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
25
nix/deps/secp256k1/default.nix
Normal file
25
nix/deps/secp256k1/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
13
nix/deps/sni/builder.sh
Normal file
13
nix/deps/sni/builder.sh
Normal file
@ -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/
|
18
nix/deps/sni/cross.nix
Normal file
18
nix/deps/sni/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
||||
|
||||
|
12
nix/deps/sni/default.nix
Normal file
12
nix/deps/sni/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
15
nix/deps/softfloat3/builder.sh
Normal file
15
nix/deps/softfloat3/builder.sh
Normal file
@ -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
|
16
nix/deps/softfloat3/cross.nix
Normal file
16
nix/deps/softfloat3/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
12
nix/deps/softfloat3/default.nix
Normal file
12
nix/deps/softfloat3/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
9
nix/deps/uv/builder.sh
Normal file
9
nix/deps/uv/builder.sh
Normal file
@ -0,0 +1,9 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src ./src
|
||||
chmod -R a+w ./src
|
||||
cd ./src
|
||||
|
||||
LIBTOOLIZE=libtoolize ./autogen.sh
|
||||
bash ./configure --prefix=$out --host=$host $configureFlags
|
||||
make install
|
17
nix/deps/uv/cross.nix
Normal file
17
nix/deps/uv/cross.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
27
nix/deps/uv/default.nix
Normal file
27
nix/deps/uv/default.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
12
nix/nixcrpkgs.nix
Normal file
12
nix/nixcrpkgs.nix
Normal file
@ -0,0 +1,12 @@
|
||||
let
|
||||
|
||||
nixpkgs = import ./nixpkgs.nix;
|
||||
|
||||
osx_sdk = builtins.fetchurl {
|
||||
sha256 = "89aa34dfe5bcbc7d53d3c55a84b35ac810ecfbcdd16a64c9667992b0c36c60c4";
|
||||
url = "https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.11.sdk.tar.xz";
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
import ./nixcrpkgs/top.nix { inherit osx_sdk nixpkgs; }
|
4
nix/nixcrpkgs/.gitignore
vendored
Normal file
4
nix/nixcrpkgs/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/result*
|
||||
/support/results
|
||||
macos/MacOSX10.12.sdk.tar.xz
|
||||
macos/MacOSX10.13.sdk.tar.xz
|
31
nix/nixcrpkgs/LICENSE.nixpkgs
Normal file
31
nix/nixcrpkgs/LICENSE.nixpkgs
Normal file
@ -0,0 +1,31 @@
|
||||
Copyright (c) 2003-2017 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
======================================================================
|
||||
|
||||
Note: the license above does not apply to the packages built by the
|
||||
Nix Packages collection, merely to the package descriptions (i.e., Nix
|
||||
expressions, build scripts, etc.). Also, the license does not apply
|
||||
to some of the binaries used for bootstrapping Nixpkgs (e.g.,
|
||||
pkgs/stdenv/linux/tools/bash). It also might not apply to patches
|
||||
included in Nixpkgs, which may be derivative works of the packages to
|
||||
which they apply. The aforementioned artifacts are all covered by the
|
||||
licenses of the respective packages.
|
25
nix/nixcrpkgs/LICENSE.txt
Normal file
25
nix/nixcrpkgs/LICENSE.txt
Normal file
@ -0,0 +1,25 @@
|
||||
Copyright (c) 2017 Pololu Corporation. For more information, see
|
||||
|
||||
http://www.pololu.com/
|
||||
http://forum.pololu.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
175
nix/nixcrpkgs/README.md
Normal file
175
nix/nixcrpkgs/README.md
Normal file
@ -0,0 +1,175 @@
|
||||
# nixcrpkgs
|
||||
|
||||
[www.pololu.com](https://www.pololu.com/)
|
||||
|
||||
*nixcrpkgs* is a collection of tools for cross-compiling statically-linked,
|
||||
standalone software applications. With nixcrpkgs, you can specify what
|
||||
platforms you want to target, what libraries and build tools you depend on, and
|
||||
the commands that build your software. When you build your software, nixcrpkgs
|
||||
will automatically take care of building or retrieving everything you need,
|
||||
including cross-compilers and libraries.
|
||||
|
||||
nixcrpkgs primarily consists of *Nix expressions*, which are recipes for
|
||||
building software with [Nix, the purely functional package
|
||||
manager][nix]. These recipes build on top of the [Nix
|
||||
Packages collection (Nixpkgs)][nixpkgs].
|
||||
|
||||
## Features
|
||||
|
||||
- Supported target platforms:
|
||||
- Windows (32-bit or 64-bit) using [mingw-w64](https://mingw-w64.org/) and [GCC](https://gcc.gnu.org/) 6.3.0
|
||||
- Linux (32-bit, 64-bit, and ARM) using [musl](https://www.musl-libc.org/) and [GCC](https://gcc.gnu.org/) 6.3.0
|
||||
- macOS using [Clang](https://clang.llvm.org/) 5.0.0
|
||||
- Supported languages for cross-compiling:
|
||||
- C
|
||||
- C++
|
||||
- Supported build platforms:
|
||||
- Linux
|
||||
- Supported build tools:
|
||||
- [CMake](https://cmake.org/)
|
||||
- [GNU Make](https://www.gnu.org/software/make/)
|
||||
- [Ninja](https://ninja-build.org/)
|
||||
- pkg-config (as implemented by [pkgconf](https://github.com/pkgconf/pkgconf))
|
||||
- [GNU Bash](https://www.gnu.org/software/bash/)
|
||||
- [Ruby](https://www.ruby-lang.org/)
|
||||
- Notable supported libraries:
|
||||
- [Qt](https://www.qt.io/) 5.9.6
|
||||
- [libusb](https://libusb.info/)
|
||||
- [libusbp](https://github.com/pololu/libusbp)
|
||||
- [Windows API](https://en.wikipedia.org/wiki/Windows_API) (thanks to mingw-w64)
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To get started, you should first install Nix on a Linux machine by following the
|
||||
instructions on the [Nix website][nix].
|
||||
|
||||
Next, run `df -h` to make sure you have enough disk space.
|
||||
|
||||
- The filesystem that holds `/nix` should have several gigabytes of free
|
||||
space. Each GCC cross-compiler takes about 300 MB while each Qt installation
|
||||
takes about 800 MB.
|
||||
- The filesystem that holds `/tmp` should have at least 4 gigabytes of free
|
||||
space, which will be needed while building cross-compilers. If that is not the
|
||||
case on your system, you can set the `TMPDIR` environment variable to tell
|
||||
`nix-build` to perform its builds in a different directory on a filesystem with
|
||||
more free space.
|
||||
|
||||
Next, clone or download this repository and use `cd` to change into the
|
||||
top-level directory.
|
||||
|
||||
To build a simple "Hello, World!" program for Windows, run:
|
||||
|
||||
nix-build -A win32.hello
|
||||
|
||||
The first time you run this command, it will take a while because Nix has to
|
||||
build a cross-compiling toolchain. When `nix-build` is done, it will print the
|
||||
name of a directory in `/nix/store` that holds the resulting program, and it
|
||||
will create a symbolic link in the current directory named `result` that points
|
||||
to that directory.
|
||||
|
||||
If you copy `result/bin/hello.exe` to a Windows machine and run it, you should
|
||||
see a message box appear that says "Hello, World!".
|
||||
|
||||
If you run `nix-build -A win32.hello` a second time, Nix will detect that
|
||||
nothing about the build recipes has changed, so it will simply print the
|
||||
directory name and remake the symbolic link.
|
||||
|
||||
To see how the `hello` package is specified in nixcrpkgs, you can look in
|
||||
`pkgs.nix` and the `pkgs/hello` directory. To see how the GCC cross-compiler
|
||||
for Windows was specified, you can look in the `mingw-w64` directory. If you
|
||||
change any of the build recipes for `hello` or its dependencies and then run the
|
||||
`nix-build` command again, Nix will automatically rebuild those dependencies and
|
||||
anything that depends on them, ensuring that you always get a consistent build.
|
||||
|
||||
|
||||
### Obtaining the macOS SDK
|
||||
|
||||
If you are trying to build software for macOS, you will need to get a
|
||||
macOS SDK tarball and put it in the the right place. Otherwise, you
|
||||
will get an error like this:
|
||||
|
||||
error: getting attributes of path '/home/yourname/nixcrpkgs/macos/MacOSX.sdk.tar.xz': No such file or directory
|
||||
|
||||
To generate the tarball, follow these steps:
|
||||
|
||||
1. On a macOS machine, install [Xcode](https://developer.apple.com/xcode/).
|
||||
2. Download this repository to the machine.
|
||||
3. In a Terminal window, run the `macos/gen_sdk_package.sh` script from this repository.
|
||||
4. After several minutes, the current directory should have a tarball with a name like
|
||||
`MacOSX10.12.sdk.tar.xz` and a size of about 25 MB.
|
||||
5. Copy the SDK tarball file to the machine where you will be building software,
|
||||
and put it in the `macos` directory.
|
||||
6. The nixcrpkgs build recipe for the SDK is hardcoded to look for a file named
|
||||
`MacOSX.sdk.tar.xz`, so rename the tarball to that.
|
||||
7. Consider keeping a backup of the tarball so you can always rebuild any software you
|
||||
made with it.
|
||||
|
||||
Now you should be able to build your software for macOS.
|
||||
|
||||
|
||||
## Integrating nixcrpkgs into your project
|
||||
|
||||
The instructions above show how to cross-compile a "Hello, World!" program that
|
||||
is included with nixcrpkgs. Instead of including your project in nixcrpkgs like
|
||||
the hello program, you will probably want to just use nixcrpkgs as a tool in
|
||||
your project. To get an idea of how to do that, you can look at other projects
|
||||
that have done the same. In the projects listed below, you should look for a
|
||||
file named `default.nix` in the top-level directory and look for build
|
||||
instructions that explain what `nix-build` commands to run.
|
||||
|
||||
* The [Pololu Tic Stepper Motor Controller software](https://github.com/pololu/pololu-tic-software) is a C/C++ project that uses CMake and nixcrpkgs.
|
||||
* The [Pololu USB AVR Programmer v2 software](https://github.com/pololu/pololu-usb-avr-programmer-v2) is a C++ project that uses CMake and nixcrpkgs.
|
||||
* The [Pololu USB Bootloader Utility (p-load)](https://github.com/pololu/p-load) is a C++ project that uses CMake and nixcrpkgs.
|
||||
|
||||
[nix]: http://nixos.org/nix/
|
||||
[nixpkgs]: http://nixos.org/nixpkgs/
|
||||
|
||||
## Updating package versions
|
||||
|
||||
Each build recipe in nixcrpkgs specifies a version number for the software that it builds. It is relatively easy to update the recipes even if you have not worked with Nix before. The general procedure is:
|
||||
|
||||
1) Find the build recipe you want to update. For example, if you wanted to update the version of GCC used to build Linux programs, you would update the build recipe in `linux/gcc/default.nix`.
|
||||
2) Find the part of the build recipe where the software sources are downloaded from the internet. It is usually a `fetchurl` command with two parameters: `url` and `sha256`. The `url` parameter usually refers to a version string defined nearby, so update that version string and/or the `url` parameter as desired.
|
||||
3) In a shell, run `nix-prefetch-url URL`, where URL is the new URL specified in your modified build recipe with all version variables fully expanded). This command will download the URL you specified, store it in the Nix store, and output the hash of it in the proper format for Nix build recipes.
|
||||
3) Update the `sha256` hash string in the build recipe by replacing it with the hash that was printed in the output of `nix-prefetch-url`. Updating the hash in the build recipe is important: Nix uses it to determine whether you already downloaded the right file, so if you don't update the hash then Nix might use the wrong file (e.g. an older version of the software that you downloaded earlier).
|
||||
4) Run the usual `nix-build` command that you use to build your software. For example, you could go to the top-level directory of nixcrpkgs and run `nix-build -A rpi.hello` to build a "Hello world" program for the Raspberry Pi, or you could run `nix-build -A rpi.gcc` to just build the cross-compiler.
|
||||
5) Fix any error messages that happen, one at a time. (Tip: to make a `.patch` file, run `diff -ur old new` where `old` and `new` are directories that contain the unpatched and patched versions of the source code, respectively.)
|
||||
6) Once things are working, consider publishing your work on Github so others can benefit from what you figured out.
|
||||
|
||||
|
||||
## Maintaining the nixcrpkgs system
|
||||
|
||||
You should occasionally run `nix-collect-garbage` to remove items that are no
|
||||
longer needed and reclaim your disk space. However, note that Nix will
|
||||
typically remove all of your cross compilers and libraries when you run this
|
||||
command, so be prepared to do a lengthy mass rebuild. The Nix manual has more
|
||||
information about [Nix garbage
|
||||
collection](http://nixos.org/nix/manual/#sec-garbage-collection).
|
||||
|
||||
You should occasionally run `nix-channel --update` to update to the latest
|
||||
version of Nixpkgs. However, when doing this, be aware that the new version of
|
||||
Nixpkgs might require you to do a mass rebuild.
|
||||
|
||||
You should occasionally update your checkout of the nixcrpkgs repository to get
|
||||
the latest versions of build tools, new features, and bug fixes. Once again,
|
||||
this might require a mass rebuild.
|
||||
|
||||
If you want your builds to be very stable and reliable, you could make forks of
|
||||
nixcrpkgs and/or Nixpkgs and update them at your own pace, carefully considering
|
||||
any changes made by others before merging them in. That's one of the beauties
|
||||
of Nix when compared to other package management systems: you will never be
|
||||
forced to upgrade your build tools, and using old tools is just as easy as using
|
||||
new ones. You can use the `NIX_PATH` environment variable to tell `nix-build`
|
||||
to use your forked versions.
|
||||
|
||||
|
||||
## Related projects
|
||||
|
||||
* [osxcross]: Cross-compiling toolchain targeting macOS.
|
||||
* [musl-cross-make]: Makefile-based build tool for creating cross-compilers targeting musl.
|
||||
* [musl_nix_arm]: A fork of nixcrpkgs with a focus on building Docker images for ARM Linux.
|
||||
|
||||
[osxcross]: https://github.com/tpoechtrager/osxcross
|
||||
[musl-cross-make]: https://github.com/richfelker/musl-cross-make
|
||||
[musl_nix_arm]: https://github.com/filleduchaos/musl_nix_arm
|
8
nix/nixcrpkgs/bundle_builder.sh
Normal file
8
nix/nixcrpkgs/bundle_builder.sh
Normal file
@ -0,0 +1,8 @@
|
||||
source $setup
|
||||
names=($names)
|
||||
dirs=($dirs)
|
||||
mkdir $out
|
||||
cd $out
|
||||
for ((i=0;i<${#names[@]};i++)); do
|
||||
ln -s "${dirs[i]}" "${names[i]}"
|
||||
done
|
8
nix/nixcrpkgs/cmake_toolchain/builder.sh
Normal file
8
nix/nixcrpkgs/cmake_toolchain/builder.sh
Normal file
@ -0,0 +1,8 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cat > $out <<EOF
|
||||
set(CMAKE_SYSTEM_NAME ${cmake_system_name})
|
||||
set(CMAKE_C_COMPILER ${host}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${host}-g++)
|
||||
set(CMAKE_RC_COMPILER ${host}-windres)
|
||||
EOF
|
7
nix/nixcrpkgs/cmake_toolchain/default.nix
Normal file
7
nix/nixcrpkgs/cmake_toolchain/default.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{ nixpkgs, host, cmake_system_name }:
|
||||
|
||||
nixpkgs.stdenv.mkDerivation {
|
||||
name = "cmake_toolchain-${host}.txt";
|
||||
builder = ./builder.sh;
|
||||
inherit host cmake_system_name;
|
||||
}
|
4
nix/nixcrpkgs/default.nix
Normal file
4
nix/nixcrpkgs/default.nix
Normal file
@ -0,0 +1,4 @@
|
||||
import ./top.nix {
|
||||
nixpkgs = import <nixpkgs> {};
|
||||
osx_sdk = ./macos/MacOSX.sdk.tar.xz;
|
||||
}
|
14
nix/nixcrpkgs/linux/README.md
Normal file
14
nix/nixcrpkgs/linux/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
## Linux GCC toolchain
|
||||
|
||||
The files in this directory define how we build our GCC cross-compiler that
|
||||
targets Linux, using the musl libc.
|
||||
|
||||
### A note about `-rdynamic`
|
||||
|
||||
Do not pass `-rdynamic` to GCC when building an executable; it will cause the compiled executable to depend on a musl libc dynamic loader in `/lib` that probably doesn't exist, and defeats the point of static linking. The `-static` option overrides `-rdynamic`, so adding`-static` to the linker flags of a project using `-rdynamic` is one way to fix the issue.
|
||||
|
||||
CMake will pass `-rdynamic` unless you set [CMP0065](https://cmake.org/cmake/help/v3.8/policy/CMP0065.html) to new as shown below, or set your [CMake policy version](https://cmake.org/cmake/help/v3.8/command/cmake_policy.html) to 3.4 or later.
|
||||
|
||||
# Don't use -rdynamic since it causes Musl static linking to not work.
|
||||
cmake_policy(SET CMP0065 NEW)
|
||||
|
26
nix/nixcrpkgs/linux/binutils/builder.sh
Normal file
26
nix/nixcrpkgs/linux/binutils/builder.sh
Normal file
@ -0,0 +1,26 @@
|
||||
source $stdenv/setup
|
||||
|
||||
unset CC CXX CFLAGS LDFLAGS LD AR AS RANLIB SIZE STRINGS NM STRIP OBJCOPY
|
||||
|
||||
tar -xf $src
|
||||
|
||||
cd binutils-$version
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Clear the default library search path (noSysDirs)
|
||||
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
|
||||
|
||||
cd ..
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
../binutils-$version/configure --prefix=$out $configure_flags
|
||||
|
||||
make
|
||||
|
||||
make install
|
||||
|
26
nix/nixcrpkgs/linux/binutils/default.nix
Normal file
26
nix/nixcrpkgs/linux/binutils/default.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{ native, host }:
|
||||
|
||||
native.make_derivation rec {
|
||||
name = "binutils-${version}-${host}";
|
||||
|
||||
version = "2.27";
|
||||
|
||||
src = native.nixpkgs.fetchurl {
|
||||
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
|
||||
sha256 = "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./deterministic.patch
|
||||
];
|
||||
|
||||
native_inputs = [ native.nixpkgs.bison native.nixpkgs.zlib ];
|
||||
|
||||
configure_flags =
|
||||
"--target=${host} " +
|
||||
"--enable-shared " +
|
||||
"--enable-deterministic-archives " +
|
||||
"--disable-werror ";
|
||||
|
||||
builder = ./builder.sh;
|
||||
}
|
12
nix/nixcrpkgs/linux/binutils/deterministic.patch
Normal file
12
nix/nixcrpkgs/linux/binutils/deterministic.patch
Normal file
@ -0,0 +1,12 @@
|
||||
Make binutils output deterministic by default.
|
||||
--- orig/ld/ldlang.c
|
||||
+++ new/ld/ldlang.c
|
||||
@@ -3095,6 +3095,8 @@
|
||||
ldfile_output_machine))
|
||||
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
|
||||
|
||||
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
|
||||
+
|
||||
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
|
||||
if (link_info.hash == NULL)
|
||||
einfo (_("%P%F: can not create hash table: %E\n"));
|
78
nix/nixcrpkgs/linux/default.nix
Normal file
78
nix/nixcrpkgs/linux/default.nix
Normal file
@ -0,0 +1,78 @@
|
||||
{ native, arch, gcc_options ? "" }:
|
||||
let
|
||||
nixpkgs = native.nixpkgs;
|
||||
|
||||
host = "${arch}-linux-musleabi";
|
||||
|
||||
os = "linux";
|
||||
|
||||
compiler = "gcc";
|
||||
|
||||
exe_suffix = "";
|
||||
|
||||
binutils = import ./binutils { inherit native host; };
|
||||
|
||||
linux_arch =
|
||||
if arch == "i686" || arch == "x86_64" then "x86"
|
||||
else if arch == "armv6" || arch == "armv7" then "arm"
|
||||
else throw "not sure what Linux architecture code to use";
|
||||
|
||||
headers = native.make_derivation rec {
|
||||
name = "linux-headers-${linux_arch}-${version}";
|
||||
inherit linux_arch;
|
||||
version = "4.4.10";
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${version}.tar.xz";
|
||||
sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
|
||||
};
|
||||
builder = ./headers_builder.sh;
|
||||
};
|
||||
|
||||
gcc = import ./gcc {
|
||||
inherit native host binutils headers gcc_options;
|
||||
};
|
||||
|
||||
license = native.make_derivation {
|
||||
name = "linux-license";
|
||||
inherit (gcc) musl_src gcc_src;
|
||||
linux_src = headers.src;
|
||||
builder = ./license_builder.sh;
|
||||
};
|
||||
|
||||
global_license_set = { _global = license; };
|
||||
|
||||
cmake_toolchain = import ../cmake_toolchain {
|
||||
cmake_system_name = "Linux";
|
||||
inherit nixpkgs host;
|
||||
};
|
||||
|
||||
crossenv = {
|
||||
is_cross = true;
|
||||
|
||||
# Build tools available on the PATH for every derivation.
|
||||
default_native_inputs = native.default_native_inputs ++
|
||||
[ gcc binutils native.pkgconf native.wrappers ];
|
||||
|
||||
# Target info environment variables.
|
||||
inherit host arch os compiler exe_suffix;
|
||||
|
||||
# CMake toolchain file.
|
||||
inherit cmake_toolchain;
|
||||
|
||||
# A wide variety of programs and build tools.
|
||||
inherit nixpkgs;
|
||||
|
||||
# Some native build tools made by nixcrpkgs.
|
||||
inherit native;
|
||||
|
||||
# License information that should be shipped with any software
|
||||
# compiled by this environment.
|
||||
inherit global_license_set;
|
||||
|
||||
# Make it easy to refer to the build tools.
|
||||
inherit headers gcc binutils;
|
||||
|
||||
make_derivation = import ../make_derivation.nix crossenv;
|
||||
};
|
||||
in
|
||||
crossenv
|
34
nix/nixcrpkgs/linux/gcc/builder.sh
Normal file
34
nix/nixcrpkgs/linux/gcc/builder.sh
Normal file
@ -0,0 +1,34 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $gcc_src
|
||||
mv gcc-* gcc
|
||||
cd gcc
|
||||
for patch in $gcc_patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
cd ..
|
||||
|
||||
tar -xf $musl_src
|
||||
mv musl-* musl
|
||||
|
||||
mkdir -p $out/$host
|
||||
cp -r --no-preserve=mode $headers/include $out/$host
|
||||
|
||||
mkdir build_gcc
|
||||
cd build_gcc
|
||||
../gcc/configure --prefix=$out $gcc_conf
|
||||
cd ..
|
||||
make -C build_gcc all-gcc
|
||||
mkdir build_musl
|
||||
cd build_musl
|
||||
../musl/configure --prefix=$out/$host $musl_conf \
|
||||
CC="../build_gcc/gcc/xgcc -B ../build_gcc/gcc" \
|
||||
LIBCC=../build_gcc/$host/libgcc/libgcc.a
|
||||
cd ..
|
||||
make -C build_musl install-headers
|
||||
make -C build_gcc all-target-libgcc
|
||||
make -C build_musl
|
||||
make -C build_musl install
|
||||
make -C build_gcc
|
||||
make -C build_gcc install
|
81
nix/nixcrpkgs/linux/gcc/default.nix
Normal file
81
nix/nixcrpkgs/linux/gcc/default.nix
Normal file
@ -0,0 +1,81 @@
|
||||
{ native, host, binutils, headers, gcc_options }:
|
||||
|
||||
let
|
||||
nixpkgs = native.nixpkgs;
|
||||
isl = nixpkgs.isl_0_14;
|
||||
inherit (nixpkgs) stdenv lib fetchurl;
|
||||
inherit (nixpkgs) gmp libmpc libelf mpfr zlib;
|
||||
in
|
||||
|
||||
native.make_derivation rec {
|
||||
name = "gcc-${gcc_version}-${host}";
|
||||
|
||||
gcc_version = "6.3.0";
|
||||
gcc_src = fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2";
|
||||
sha256 = "17xjz30jb65hcf714vn9gcxvrrji8j20xm7n33qg1ywhyzryfsph";
|
||||
};
|
||||
|
||||
musl_version = "1.1.16";
|
||||
musl_src = nixpkgs.fetchurl {
|
||||
url = "https://www.musl-libc.org/releases/musl-${musl_version}.tar.gz";
|
||||
sha256 = "048h0w4yjyza4h05bkc6dpwg3hq6l03na46g0q1ha8fpwnjqawck";
|
||||
};
|
||||
|
||||
inherit host headers;
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
gcc_patches = [
|
||||
# These patches are from nixpkgs.
|
||||
./use-source-date-epoch.patch
|
||||
./libstdc++-target.patch
|
||||
|
||||
# Without this, we cannot build a simple hello world program for ARM.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31798
|
||||
./link_gcc_c_sequence_spec.patch
|
||||
|
||||
# Fix a compiler error in GCC's ubsan.c: ISO C++ forbids comparison
|
||||
# between pointer and integer.
|
||||
./ubsan.patch
|
||||
];
|
||||
|
||||
native_inputs = [ binutils ];
|
||||
|
||||
gcc_conf =
|
||||
"--target=${host} " +
|
||||
gcc_options +
|
||||
"--with-gnu-as " +
|
||||
"--with-gnu-ld " +
|
||||
"--with-as=${binutils}/bin/${host}-as " +
|
||||
"--with-ld=${binutils}/bin/${host}-ld " +
|
||||
"--with-isl=${isl} " +
|
||||
"--with-gmp-include=${gmp.dev}/include " +
|
||||
"--with-gmp-lib=${gmp.out}/lib " +
|
||||
"--with-libelf=${libelf}" +
|
||||
"--with-mpfr=${mpfr.dev} " +
|
||||
"--with-mpfr-include=${mpfr.dev}/include " +
|
||||
"--with-mpfr-lib=${mpfr.out}/lib " +
|
||||
"--with-mpc=${libmpc.out} " +
|
||||
"--with-zlib-include=${zlib.dev}/include " +
|
||||
"--with-zlib-lib=${zlib.out}/lib " +
|
||||
"--enable-deterministic-archives " +
|
||||
"--enable-languages=c,c++ " +
|
||||
"--enable-libstdcxx-time " +
|
||||
"--enable-static " +
|
||||
"--enable-tls " +
|
||||
"--disable-gnu-indirect-function " +
|
||||
"--disable-libmudflap " +
|
||||
"--disable-libmpx " +
|
||||
"--disable-libsanitizer " +
|
||||
"--disable-multilib " +
|
||||
"--disable-shared " +
|
||||
"--disable-werror";
|
||||
|
||||
musl_conf =
|
||||
"--target=${host} " +
|
||||
"--disable-shared";
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
}
|
||||
|
32
nix/nixcrpkgs/linux/gcc/libstdc++-target.patch
Normal file
32
nix/nixcrpkgs/linux/gcc/libstdc++-target.patch
Normal file
@ -0,0 +1,32 @@
|
||||
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
||||
I noticed that building the mingw32 cross compiler.
|
||||
Looking at the build script for mingw in archlinux, I think that only nixos
|
||||
needs this patch. I don't know why.
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 93f66b6..d691917 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
||||
AR="$(AR_FOR_TARGET)"; export AR; \
|
||||
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
||||
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
||||
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
||||
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
||||
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
||||
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
||||
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
||||
RAW_CXX_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
NORMAL_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
# Where to find GMP
|
||||
HOST_GMPLIBS = @gmplibs@
|
12
nix/nixcrpkgs/linux/gcc/link_gcc_c_sequence_spec.patch
Normal file
12
nix/nixcrpkgs/linux/gcc/link_gcc_c_sequence_spec.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -ur gcc-6.3.0-orig/gcc/config/gnu-user.h gcc-6.3.0/gcc/config/gnu-user.h
|
||||
--- gcc-6.3.0-orig/gcc/config/gnu-user.h 2017-08-13 19:03:08.671572528 -0700
|
||||
+++ gcc-6.3.0/gcc/config/gnu-user.h 2017-08-13 19:15:00.768588499 -0700
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
- "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
|
||||
+ "--start-group %G %L --end-group"
|
||||
|
||||
/* Use --as-needed -lgcc_s for eh support. */
|
||||
#ifdef HAVE_LD_AS_NEEDED
|
10
nix/nixcrpkgs/linux/gcc/ubsan.patch
Normal file
10
nix/nixcrpkgs/linux/gcc/ubsan.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- gcc-6.3.0-orig/gcc/ubsan.c
|
||||
+++ gcc-6.3.0/gcc/ubsan.c
|
||||
@@ -1471,7 +1471,7 @@
|
||||
|
||||
expanded_location xloc = expand_location (loc);
|
||||
if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
|
||||
- || xloc.file == '\0' || xloc.file[0] == '\xff'
|
||||
+ || xloc.file == NULL || xloc.file[0] == '\xff'
|
||||
|| xloc.file[1] == '\xff')
|
||||
return false;
|
52
nix/nixcrpkgs/linux/gcc/use-source-date-epoch.patch
Normal file
52
nix/nixcrpkgs/linux/gcc/use-source-date-epoch.patch
Normal file
@ -0,0 +1,52 @@
|
||||
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html
|
||||
|
||||
diff --git a/libcpp/macro.c b/libcpp/macro.c
|
||||
index 1e0a0b5..a52e3cb 100644
|
||||
--- a/libcpp/macro.c
|
||||
+++ b/libcpp/macro.c
|
||||
@@ -349,14 +349,38 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
|
||||
slow on some systems. */
|
||||
time_t tt;
|
||||
struct tm *tb = NULL;
|
||||
+ char *source_date_epoch;
|
||||
|
||||
- /* (time_t) -1 is a legitimate value for "number of seconds
|
||||
- since the Epoch", so we have to do a little dance to
|
||||
- distinguish that from a genuine error. */
|
||||
- errno = 0;
|
||||
- tt = time(NULL);
|
||||
- if (tt != (time_t)-1 || errno == 0)
|
||||
- tb = localtime (&tt);
|
||||
+ /* Allow the date and time to be set externally by an exported
|
||||
+ environment variable to enable reproducible builds. */
|
||||
+ source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
|
||||
+ if (source_date_epoch)
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ tt = (time_t) strtol (source_date_epoch, NULL, 10);
|
||||
+ if (errno == 0)
|
||||
+ {
|
||||
+ tb = gmtime (&tt);
|
||||
+ if (tb == NULL)
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid date",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ else
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid number",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* (time_t) -1 is a legitimate value for "number of seconds
|
||||
+ since the Epoch", so we have to do a little dance to
|
||||
+ distinguish that from a genuine error. */
|
||||
+ errno = 0;
|
||||
+ tt = time(NULL);
|
||||
+ if (tt != (time_t)-1 || errno == 0)
|
||||
+ tb = localtime (&tt);
|
||||
+ }
|
||||
|
||||
if (tb)
|
||||
{
|
13
nix/nixcrpkgs/linux/headers_builder.sh
Normal file
13
nix/nixcrpkgs/linux/headers_builder.sh
Normal file
@ -0,0 +1,13 @@
|
||||
source $setup
|
||||
shopt -u nullglob
|
||||
|
||||
tar -xf $src
|
||||
mv linux-$version linux
|
||||
|
||||
mkdir -p obj/staged
|
||||
make -C linux headers_install \
|
||||
ARCH=$linux_arch \
|
||||
O=$(pwd)/obj \
|
||||
INSTALL_HDR_PATH=$out
|
||||
|
||||
find $out '(' -name .install -o -name ..install.cmd ')' -exec rm {} +
|
45
nix/nixcrpkgs/linux/license_builder.sh
Normal file
45
nix/nixcrpkgs/linux/license_builder.sh
Normal file
@ -0,0 +1,45 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $gcc_src
|
||||
mv gcc-* gcc
|
||||
|
||||
tar -xf $musl_src
|
||||
mv musl-* musl
|
||||
|
||||
tar -xf $linux_src
|
||||
mv linux-* linux
|
||||
|
||||
license_gcc=$(cat gcc/COPYING3.LIB)
|
||||
license_musl=$(cat musl/COPYRIGHT)
|
||||
license_linux=$(cat linux/COPYING)
|
||||
|
||||
cat > $out <<EOF
|
||||
<p>
|
||||
The third-party software included with this software may
|
||||
have been patched or otherwise modified.
|
||||
</p>
|
||||
|
||||
<h2>GCC run-time libraries</h2>
|
||||
|
||||
<p>
|
||||
The GCC run-time libraries libgcc and libstdc++ are licensed under the GNU
|
||||
General Public License Version 3 (GPLv3) as shown below.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$license_gcc
|
||||
</pre>
|
||||
|
||||
<h2>musl libc</h2>
|
||||
|
||||
<pre>
|
||||
$license_musl
|
||||
</pre>
|
||||
|
||||
<h2>Linux headers</h2>
|
||||
|
||||
<pre>
|
||||
$license_linux
|
||||
</pre>
|
||||
|
||||
EOF
|
1
nix/nixcrpkgs/macos/.gitignore
vendored
Normal file
1
nix/nixcrpkgs/macos/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/MacOSX.sdk.tar.xz
|
46
nix/nixcrpkgs/macos/ar_builder.sh
Normal file
46
nix/nixcrpkgs/macos/ar_builder.sh
Normal file
@ -0,0 +1,46 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv cctools-port-* cctools-port
|
||||
|
||||
cd cctools-port
|
||||
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Similar to but not the same as the other _structs.h.
|
||||
rm cctools/include/foreign/mach/i386/_structs.h
|
||||
|
||||
# Causes a troublesome undefined reference.
|
||||
rm cctools/libstuff/vm_flush_cache.c
|
||||
|
||||
cd ..
|
||||
|
||||
mv cctools-port/cctools/ar .
|
||||
mv cctools-port/cctools/include .
|
||||
mv cctools-port/cctools/libstuff .
|
||||
rm -r cctools-port
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Werror -Wfatal-errors -O2 -g -I../include -I../include/foreign -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= -D__DARWIN_UNIX03 -DPACKAGE_NAME=\\\"cctools\\\" -DPACKAGE_VERSION=\\\"$apple_version\\\" -DEMULATED_HOST_CPU_TYPE=16777223 -DEMULATED_HOST_CPU_SUBTYPE=3"
|
||||
|
||||
CXXFLAGS="-std=gnu++11 $CFLAGS"
|
||||
|
||||
LDFLAGS="-ldl -lpthread"
|
||||
|
||||
for f in ../ar/*.c ../libstuff/*.c; do
|
||||
echo "compiling $f"
|
||||
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
gcc *.o $LDFLAGS -o $host-ar
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp $host-ar $out/bin/
|
||||
|
||||
# ar looks for ranlib in this directory
|
||||
ln -s $ranlib/bin/$host-ranlib $out/bin/
|
11
nix/nixcrpkgs/macos/cctools-bytesex.patch
Normal file
11
nix/nixcrpkgs/macos/cctools-bytesex.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/bytesex.h cctools-port-bytesex/cctools/include/stuff/bytesex.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/bytesex.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-bytesex/cctools/include/stuff/bytesex.h 2017-11-10 19:07:26.338161875 -0800
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <mach/m88k/thread_status.h>
|
||||
#include <mach/i860/thread_status.h>
|
||||
#include <mach/i386/thread_status.h>
|
||||
+#include <mach/i386/_structs.h>
|
||||
#include <mach/hppa/thread_status.h>
|
||||
#include <mach/sparc/thread_status.h>
|
||||
/* cctools-port: need to undef these to avoid warnings */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user