nish 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -555
- package/docs/AI.md +112 -33
- package/docs/INSTALL.md +79 -133
- package/llms.txt +2 -9
- package/package.json +17 -19
- package/runtime/nish.d.ts +21 -17
- package/runtime/nish.h +10 -0
- package/runtime/page-frame.d.ts +123 -0
- package/runtime/page-frame.mjs +736 -0
- package/runtime/page-game.d.ts +132 -0
- package/runtime/page-game.mjs +738 -0
- package/runtime/runtime-aes.c +85 -8
- package/runtime/runtime-bytes.c +88 -4
- package/runtime/runtime-net.c +32 -0
- package/runtime/runtime-sandbox.c +55 -28
- package/runtime/runtime-uring.c +1194 -0
- package/runtime/runtime-wasm.c +422 -0
- package/runtime/vite.mjs +1 -1
- package/scripts/build.sh +22 -6
- package/std/README.md +74 -87
- package/std/array.ts +36 -3
- package/std/collections.ts +51 -0
- package/std/crypto/hmac.ts +37 -10
- package/std/crypto/p256.ts +1388 -2664
- package/std/crypto/pki.ts +116 -4
- package/std/crypto/sha256.ts +34 -6
- package/std/crypto/x509.ts +7 -0
- package/std/host/game.ts +273 -0
- package/std/input.ts +56 -0
- package/std/json-tokenizer.ts +325 -112
- package/std/json-typed.ts +43 -8
- package/std/json-value.ts +144 -3
- package/std/json.ts +63 -8
- package/std/net/fetch.ts +22 -4
- package/std/net/http-server.ts +3382 -0
- package/std/net/http1-client-codec.ts +6 -2
- package/std/net/http1-codec.ts +137 -12
- package/std/net/http1-server.ts +83 -29
- package/std/net/http2.ts +47 -14
- package/std/net/http3-server.ts +29 -3
- package/std/net/http3.ts +180 -7
- package/std/net/prefork.ts +49 -13
- package/std/net/quic-recovery.ts +240 -9
- package/std/net/quic-stream.ts +21 -1
- package/std/net/quic.ts +98 -4
- package/std/net/router.ts +378 -31
- package/std/net/serve.ts +873 -65
- package/std/net/tls/verify.ts +19 -1
- package/std/net/url.ts +83 -35
- package/std/net/websocket.ts +74 -1
- package/std/net/webtransport.ts +7 -1
- package/std/raster.ts +837 -0
- package/std/release.ts +593 -0
- package/std/synth.ts +143 -0
- package/std/temporal.ts +3091 -0
- package/std/threads.ts +298 -0
- package/std/yaml-json.ts +368 -28
- package/std/yaml.ts +122 -27
- package/scripts/bootstrap.sh +0 -375
- package/scripts/build-id-smoke.sh +0 -28
- package/scripts/changelog-gen.mjs +0 -649
- package/scripts/changelog-section.sh +0 -28
- package/scripts/check-hardening.mjs +0 -202
- package/scripts/ci-profile.mjs +0 -200
- package/scripts/codes-registry.js +0 -85
- package/scripts/fuzz.sh +0 -280
- package/scripts/gen-diagnostic-codes.mjs +0 -243
- package/scripts/gen-json-pow5.mjs +0 -130
- package/scripts/gen-p256-table.mjs +0 -177
- package/scripts/gen-pow10-table.py +0 -80
- package/scripts/gen-regex-unicode.mjs +0 -822
- package/scripts/gen-union-scale.mjs +0 -294
- package/scripts/nish-compiler.sh +0 -19
- package/scripts/platform-package.mjs +0 -93
- package/scripts/security-scope.mjs +0 -139
- package/scripts/shard-costs.mjs +0 -429
- package/scripts/size-report.sh +0 -84
- package/scripts/smoke.sh +0 -105
- package/scripts/std-module-paths.mjs +0 -25
- package/scripts/undocumented.txt +0 -14
- package/scripts/verify-binaries.sh +0 -214
package/std/yaml.ts
CHANGED
|
@@ -271,6 +271,12 @@ const YAML_CLIP: i32 = 0
|
|
|
271
271
|
const YAML_STRIP: i32 = 1
|
|
272
272
|
const YAML_KEEP: i32 = 2
|
|
273
273
|
|
|
274
|
+
/**
|
|
275
|
+
* A flow scalar's `extras` when its body is its source span, byte for byte.
|
|
276
|
+
* @internal Copied by std/yaml-json.ts with no search for a line break.
|
|
277
|
+
*/
|
|
278
|
+
export const YAML_VERBATIM: i32 = 1
|
|
279
|
+
|
|
274
280
|
// ---- Options -------------------------------------------------------------------
|
|
275
281
|
|
|
276
282
|
/** How `parseYamlWith` reads a stream. Make one with `new YamlOptions()` and set what differs. */
|
|
@@ -319,7 +325,8 @@ export class YamlStream {
|
|
|
319
325
|
counts: i32[]
|
|
320
326
|
/**
|
|
321
327
|
* Per node: a block scalar's content indent, whether it was written, and its
|
|
322
|
-
* chomping, as `(indent + 1) * 8 + explicit * 4 + chomp
|
|
328
|
+
* chomping, as `(indent + 1) * 8 + explicit * 4 + chomp`; a flow scalar's
|
|
329
|
+
* `YAML_VERBATIM` when its source span is its body.
|
|
323
330
|
* @internal Used by `yamlDecode` and `YamlParser`.
|
|
324
331
|
*/
|
|
325
332
|
extras: i32[]
|
|
@@ -328,8 +335,12 @@ export class YamlStream {
|
|
|
328
335
|
* @internal Used by `YamlParser`.
|
|
329
336
|
*/
|
|
330
337
|
props: i32[]
|
|
331
|
-
/**
|
|
332
|
-
|
|
338
|
+
/**
|
|
339
|
+
* Every collection's children, one collection after another.
|
|
340
|
+
* @internal Used by `YamlParser`, and read by std/yaml-json.ts, which walks
|
|
341
|
+
* each collection's children in turn.
|
|
342
|
+
*/
|
|
343
|
+
kids: i32[]
|
|
333
344
|
/**
|
|
334
345
|
* Per property slot: the anchor's name (after `&`), the tag as written, and the anchor table entry.
|
|
335
346
|
* @internal Used by `YamlParser`.
|
|
@@ -413,10 +424,23 @@ export class YamlStream {
|
|
|
413
424
|
* @internal Used by `YamlPathWalker`.
|
|
414
425
|
*/
|
|
415
426
|
mergeStep: i32 = 0
|
|
427
|
+
/**
|
|
428
|
+
* How many sequence items the parser's merge checks have read, so a test
|
|
429
|
+
* can see that a shared merge sequence is read once, not once per use.
|
|
430
|
+
* @internal Used by `YamlParser`.
|
|
431
|
+
*/
|
|
432
|
+
mergeItemsChecked: i32 = 0
|
|
416
433
|
/**
|
|
417
434
|
* Whether a plain `<<` key is a merge key, as `YamlOptions.merge` said; paths follow merge keys while it is.
|
|
418
435
|
*/
|
|
419
436
|
merge: boolean = true
|
|
437
|
+
/**
|
|
438
|
+
* @internal Set by `YamlParser`, and read by std/yaml-json.ts. Whether the
|
|
439
|
+
* parser reported every map that repeats a key, as `YamlOptions.uniqueKeys`
|
|
440
|
+
* said; `false` for a stream built by hand, so a reader that relies on it
|
|
441
|
+
* checks for itself.
|
|
442
|
+
*/
|
|
443
|
+
uniqueKeys: boolean = false
|
|
420
444
|
|
|
421
445
|
/**
|
|
422
446
|
* An empty stream over `text`, for the parser to fill; get a parsed one from
|
|
@@ -1530,8 +1554,12 @@ const yamlDecodeBlock = (text: string, from: i32, to: i32, extras: i32, folded:
|
|
|
1530
1554
|
|
|
1531
1555
|
/** Internal: scalar `n`'s core-schema type, from its text and its tag. */
|
|
1532
1556
|
const yamlResolve = (stream: YamlStream, n: i32): i32 => {
|
|
1533
|
-
const tag: string = stream.tag(n)
|
|
1534
1557
|
const plain: boolean = stream.style(n) === YAML_PLAIN
|
|
1558
|
+
// A node with no properties has no tag, which spares reading its text.
|
|
1559
|
+
if (n < 0 || n >= stream.top || yamlAt(stream.props, n) < 0) {
|
|
1560
|
+
return plain ? yamlPlainType(stream.source, stream.start(n), stream.end(n)) : YAML_STRING
|
|
1561
|
+
}
|
|
1562
|
+
const tag: string = stream.tag(n)
|
|
1535
1563
|
if (tag === "") {
|
|
1536
1564
|
return plain ? yamlPlainType(stream.source, stream.start(n), stream.end(n)) : YAML_STRING
|
|
1537
1565
|
}
|
|
@@ -1567,26 +1595,12 @@ const yamlPlainType = (text: string, from: i32, to: i32): i32 => {
|
|
|
1567
1595
|
if (!letter && !yamlIsDigit(c) && c !== YAML_DOT && c !== YAML_DASH && c !== YAML_PLUS && c !== 126) {
|
|
1568
1596
|
return YAML_STRING
|
|
1569
1597
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
yamlIsWord(text, from, to, "null") ||
|
|
1573
|
-
yamlIsWord(text, from, to, "Null") ||
|
|
1574
|
-
yamlIsWord(text, from, to, "NULL")
|
|
1575
|
-
) {
|
|
1598
|
+
// Each word is told by its first byte, so a text is compared with its own three at most.
|
|
1599
|
+
if (c === 126 && to - from === 1) {
|
|
1576
1600
|
return YAML_NULL
|
|
1577
1601
|
}
|
|
1578
|
-
if (
|
|
1579
|
-
yamlIsWord(text, from, to, "true") ||
|
|
1580
|
-
yamlIsWord(text, from, to, "True") ||
|
|
1581
|
-
yamlIsWord(text, from, to, "TRUE") ||
|
|
1582
|
-
yamlIsWord(text, from, to, "false") ||
|
|
1583
|
-
yamlIsWord(text, from, to, "False") ||
|
|
1584
|
-
yamlIsWord(text, from, to, "FALSE")
|
|
1585
|
-
) {
|
|
1586
|
-
return YAML_BOOL
|
|
1587
|
-
}
|
|
1588
1602
|
if (letter) {
|
|
1589
|
-
return
|
|
1603
|
+
return yamlWordType(text, from, to, c)
|
|
1590
1604
|
}
|
|
1591
1605
|
if (yamlIntBase(text, from, to) > 0) {
|
|
1592
1606
|
return YAML_INT
|
|
@@ -1597,6 +1611,33 @@ const yamlPlainType = (text: string, from: i32, to: i32): i32 => {
|
|
|
1597
1611
|
return YAML_STRING
|
|
1598
1612
|
}
|
|
1599
1613
|
|
|
1614
|
+
/**
|
|
1615
|
+
* The type of the plain scalar `text[from, to)`, whose first byte `c` is one
|
|
1616
|
+
* of `nNtTfF`: `YAML_NULL` for a `null`, `YAML_BOOL` for a `true` or `false`,
|
|
1617
|
+
* in the core schema's three spellings each, and `YAML_STRING` otherwise.
|
|
1618
|
+
*/
|
|
1619
|
+
const yamlWordType = (text: string, from: i32, to: i32, c: i32): i32 => {
|
|
1620
|
+
if (c === 110 || c === 78) {
|
|
1621
|
+
const isNull: boolean =
|
|
1622
|
+
yamlIsWord(text, from, to, "null") ||
|
|
1623
|
+
yamlIsWord(text, from, to, "Null") ||
|
|
1624
|
+
yamlIsWord(text, from, to, "NULL")
|
|
1625
|
+
return isNull ? YAML_NULL : YAML_STRING
|
|
1626
|
+
}
|
|
1627
|
+
if (c === 116 || c === 84) {
|
|
1628
|
+
const isTrue: boolean =
|
|
1629
|
+
yamlIsWord(text, from, to, "true") ||
|
|
1630
|
+
yamlIsWord(text, from, to, "True") ||
|
|
1631
|
+
yamlIsWord(text, from, to, "TRUE")
|
|
1632
|
+
return isTrue ? YAML_BOOL : YAML_STRING
|
|
1633
|
+
}
|
|
1634
|
+
const isFalse: boolean =
|
|
1635
|
+
yamlIsWord(text, from, to, "false") ||
|
|
1636
|
+
yamlIsWord(text, from, to, "False") ||
|
|
1637
|
+
yamlIsWord(text, from, to, "FALSE")
|
|
1638
|
+
return isFalse ? YAML_BOOL : YAML_STRING
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1600
1641
|
/** The base of the core-schema integer `text[from, to)`, signed, decimal, `0x` or `0o`; `0` for none. */
|
|
1601
1642
|
const yamlIntBase = (text: string, from: i32, to: i32): i32 => {
|
|
1602
1643
|
let i: i32 = from
|
|
@@ -1811,6 +1852,11 @@ class YamlParser {
|
|
|
1811
1852
|
private scratch: i32[]
|
|
1812
1853
|
/** Hash sets for the duplicate check of maps past YAML_PAIRWISE_KEYS pairs, reused as maps nest and end. */
|
|
1813
1854
|
private keySets: YamlKeySet[]
|
|
1855
|
+
/**
|
|
1856
|
+
* Per sequence node an alias merge has named: `0` not yet checked, `1`
|
|
1857
|
+
* every item merges a map, `2` one does not, so a shared sequence is read once.
|
|
1858
|
+
*/
|
|
1859
|
+
private mergeVerdicts: u8[]
|
|
1814
1860
|
private pos: i32 = 0
|
|
1815
1861
|
private len: i32 = 0
|
|
1816
1862
|
private depth: i32 = 0
|
|
@@ -1857,10 +1903,12 @@ class YamlParser {
|
|
|
1857
1903
|
this.handlePrefixes = []
|
|
1858
1904
|
this.scratch = []
|
|
1859
1905
|
this.keySets = []
|
|
1906
|
+
this.mergeVerdicts = []
|
|
1860
1907
|
this.len = toI32(text.length)
|
|
1861
1908
|
this.maxDepth = options.maxDepth
|
|
1862
1909
|
this.uniqueKeys = options.uniqueKeys
|
|
1863
1910
|
this.stream.merge = options.merge
|
|
1911
|
+
this.stream.uniqueKeys = options.uniqueKeys
|
|
1864
1912
|
this.keepComments = options.keepComments
|
|
1865
1913
|
this.firstOnly = options.firstDocumentOnly
|
|
1866
1914
|
}
|
|
@@ -2489,6 +2537,8 @@ class YamlParser {
|
|
|
2489
2537
|
let indentReported: boolean = parentIndent < 0
|
|
2490
2538
|
let closed: boolean = false
|
|
2491
2539
|
let contentEnd: i32 = this.len
|
|
2540
|
+
// No break, escape or doubled quote met: the span is the body.
|
|
2541
|
+
let verbatim: boolean = true
|
|
2492
2542
|
while (i < this.len) {
|
|
2493
2543
|
const at: i32 = toI32(indexOfAny(this.text, single ? YAML_SINGLE_STOPS : YAML_DOUBLE_STOPS, i))
|
|
2494
2544
|
if (at < 0) {
|
|
@@ -2499,6 +2549,7 @@ class YamlParser {
|
|
|
2499
2549
|
const c: i32 = this.at(i)
|
|
2500
2550
|
if (c === YAML_SQUOTE) {
|
|
2501
2551
|
if (this.at(i + 1) === YAML_SQUOTE) {
|
|
2552
|
+
verbatim = false
|
|
2502
2553
|
i += 2
|
|
2503
2554
|
continue
|
|
2504
2555
|
}
|
|
@@ -2514,6 +2565,7 @@ class YamlParser {
|
|
|
2514
2565
|
break
|
|
2515
2566
|
}
|
|
2516
2567
|
if (c === YAML_BACKSLASH) {
|
|
2568
|
+
verbatim = false
|
|
2517
2569
|
const e: i32 = this.at(i + 1)
|
|
2518
2570
|
if (e < 0) {
|
|
2519
2571
|
i = this.len
|
|
@@ -2530,6 +2582,7 @@ class YamlParser {
|
|
|
2530
2582
|
continue
|
|
2531
2583
|
}
|
|
2532
2584
|
// A line break.
|
|
2585
|
+
verbatim = false
|
|
2533
2586
|
const after: i32 = yamlAfterBreak(this.text, i)
|
|
2534
2587
|
if (this.isDocMarker(after)) {
|
|
2535
2588
|
contentEnd = i
|
|
@@ -2552,6 +2605,9 @@ class YamlParser {
|
|
|
2552
2605
|
)
|
|
2553
2606
|
yamlPut(this.stream.firsts, node, start + 1)
|
|
2554
2607
|
yamlPut(this.stream.counts, node, contentEnd)
|
|
2608
|
+
if (verbatim && closed) {
|
|
2609
|
+
yamlPut(this.stream.extras, node, YAML_VERBATIM)
|
|
2610
|
+
}
|
|
2555
2611
|
this.pos = i
|
|
2556
2612
|
return node
|
|
2557
2613
|
}
|
|
@@ -2720,6 +2776,8 @@ class YamlParser {
|
|
|
2720
2776
|
private scanPlainScalar(parentIndent: i32): i32 {
|
|
2721
2777
|
const start: i32 = this.pos
|
|
2722
2778
|
let valueEnd: i32 = this.plainLineEnd(start)
|
|
2779
|
+
// The first line's end: a scalar that stops there has no break in its span.
|
|
2780
|
+
const firstEnd: i32 = valueEnd
|
|
2723
2781
|
let colonReported: boolean = false
|
|
2724
2782
|
const firstColon: i32 = this.plainColonAt(start, valueEnd)
|
|
2725
2783
|
if (firstColon >= 0) {
|
|
@@ -2770,6 +2828,9 @@ class YamlParser {
|
|
|
2770
2828
|
const node: i32 = this.stream.newNode(YAML_SCALAR, YAML_PLAIN, start, valueEnd)
|
|
2771
2829
|
yamlPut(this.stream.firsts, node, start)
|
|
2772
2830
|
yamlPut(this.stream.counts, node, valueEnd)
|
|
2831
|
+
if (valueEnd === firstEnd) {
|
|
2832
|
+
yamlPut(this.stream.extras, node, YAML_VERBATIM)
|
|
2833
|
+
}
|
|
2773
2834
|
return node
|
|
2774
2835
|
}
|
|
2775
2836
|
|
|
@@ -3199,7 +3260,9 @@ class YamlParser {
|
|
|
3199
3260
|
let valueEnd: i32 = this.trimEnd(start, i)
|
|
3200
3261
|
if (!yamlIsBreak(this.at(i))) {
|
|
3201
3262
|
this.pos = i
|
|
3202
|
-
|
|
3263
|
+
const one: i32 = this.plainNode(start, valueEnd)
|
|
3264
|
+
yamlPut(this.stream.extras, one, YAML_VERBATIM)
|
|
3265
|
+
return one
|
|
3203
3266
|
}
|
|
3204
3267
|
let scan: i32 = yamlAfterBreak(this.text, i)
|
|
3205
3268
|
while (true) {
|
|
@@ -3542,7 +3605,8 @@ class YamlParser {
|
|
|
3542
3605
|
* Reports the value of merge key `key` unless it is a map, an alias
|
|
3543
3606
|
* to one or a sequence of those; an empty value is reported on the key, a
|
|
3544
3607
|
* sequence on each item that is not, and an alias to a sequence on the alias.
|
|
3545
|
-
* An alias with no target is already reported.
|
|
3608
|
+
* An alias with no target is already reported. An aliased sequence's
|
|
3609
|
+
* verdict is kept, so a sequence many merges name is read once (YJ-5).
|
|
3546
3610
|
*/
|
|
3547
3611
|
private checkMerge(key: i32, value: i32): void {
|
|
3548
3612
|
const stream: YamlStream = this.stream
|
|
@@ -3553,15 +3617,18 @@ class YamlParser {
|
|
|
3553
3617
|
const onAlias: boolean = stream.kind(value) === YAML_ALIAS
|
|
3554
3618
|
const seq: i32 = onAlias ? stream.target(value) : value
|
|
3555
3619
|
if (seq >= 0 && stream.kind(seq) === YAML_SEQ) {
|
|
3620
|
+
if (onAlias) {
|
|
3621
|
+
if (!this.aliasedSeqMerges(seq)) {
|
|
3622
|
+
this.badMerge(stream.start(value), stream.end(value))
|
|
3623
|
+
}
|
|
3624
|
+
return
|
|
3625
|
+
}
|
|
3556
3626
|
const count: i32 = stream.count(seq)
|
|
3557
3627
|
let i: i32 = 0
|
|
3558
3628
|
while (i < count) {
|
|
3559
3629
|
const item: i32 = stream.child(seq, i)
|
|
3630
|
+
stream.mergeItemsChecked += 1
|
|
3560
3631
|
if (!this.mergesMap(item)) {
|
|
3561
|
-
if (onAlias) {
|
|
3562
|
-
this.badMerge(stream.start(value), stream.end(value))
|
|
3563
|
-
return
|
|
3564
|
-
}
|
|
3565
3632
|
this.badMerge(stream.start(item), stream.end(item))
|
|
3566
3633
|
}
|
|
3567
3634
|
i += 1
|
|
@@ -3571,6 +3638,34 @@ class YamlParser {
|
|
|
3571
3638
|
}
|
|
3572
3639
|
}
|
|
3573
3640
|
|
|
3641
|
+
/**
|
|
3642
|
+
* Whether every item of sequence `seq`, which an alias merge names, merges
|
|
3643
|
+
* a map: read up to its first item that does not the first time, then
|
|
3644
|
+
* answered from the verdict kept for it.
|
|
3645
|
+
*/
|
|
3646
|
+
private aliasedSeqMerges(seq: i32): boolean {
|
|
3647
|
+
const stream: YamlStream = this.stream
|
|
3648
|
+
this.mergeVerdicts = yamlRoomU8(this.mergeVerdicts, seq + 1)
|
|
3649
|
+
const verdicts: u8[] = this.mergeVerdicts
|
|
3650
|
+
if (seq < 0 || seq >= toI32(verdicts.length)) {
|
|
3651
|
+
return false
|
|
3652
|
+
}
|
|
3653
|
+
const kept: i32 = toI32(verdicts[seq])
|
|
3654
|
+
if (kept !== 0) {
|
|
3655
|
+
return kept === 1
|
|
3656
|
+
}
|
|
3657
|
+
const count: i32 = stream.count(seq)
|
|
3658
|
+
let good: boolean = true
|
|
3659
|
+
let i: i32 = 0
|
|
3660
|
+
while (good && i < count) {
|
|
3661
|
+
stream.mergeItemsChecked += 1
|
|
3662
|
+
good = this.mergesMap(stream.child(seq, i))
|
|
3663
|
+
i += 1
|
|
3664
|
+
}
|
|
3665
|
+
verdicts[seq] = good ? toU8(1) : toU8(2)
|
|
3666
|
+
return good
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3574
3669
|
/** Whether `n` is a map, an alias to one or an alias with no target, which merges nothing and is reported as such. */
|
|
3575
3670
|
private mergesMap(n: i32): boolean {
|
|
3576
3671
|
const stream: YamlStream = this.stream
|
package/scripts/bootstrap.sh
DELETED
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Build the self-hosted compiler: `src/`, compiled by `src/`.
|
|
3
|
-
#
|
|
4
|
-
# scripts/bootstrap.sh [-o <exe>] [--stages 1|2|3] [--profile speed|size|debug]
|
|
5
|
-
# [--work <dir>] [--verify] [--quiet]
|
|
6
|
-
#
|
|
7
|
-
# The chain is the one docs/wp14-selfhost.md §1 defines, with the seed as a
|
|
8
|
-
# parameter rather than a fixture (docs/wp19-stage0-retirement.md §3, G3):
|
|
9
|
-
#
|
|
10
|
-
# seed whatever compiles stage1 NISH_BOOTSTRAP, or build/seed
|
|
11
|
-
# stage1 src/, built by the seed
|
|
12
|
-
# stage2 src/, built by stage1 the default output
|
|
13
|
-
# stage3 src/, built by stage2 --verify only
|
|
14
|
-
#
|
|
15
|
-
# NISH_BOOTSTRAP=<path> names the seed, the way GOROOT_BOOTSTRAP names the Go
|
|
16
|
-
# that builds Go. It is either a released `nish`, executed directly, or a Node
|
|
17
|
-
# entry point (`.js`, `.mjs`, `.cjs`) wrapping one, executed as `node <path>`:
|
|
18
|
-
#
|
|
19
|
-
# NISH_BOOTSTRAP=~/nish-0.6.0-linux-x86_64 scripts/bootstrap.sh --verify
|
|
20
|
-
#
|
|
21
|
-
# Unset, the seed is build/seed/bin/nish, the last release as
|
|
22
|
-
# `scripts/fetch-seed.sh` unpacks it, and this runs that script first. When the
|
|
23
|
-
# fetch fails it stops and says so: a compiler has to come from somewhere, and
|
|
24
|
-
# the only place left is a release.
|
|
25
|
-
#
|
|
26
|
-
# stage2 is what this installs, because it is the first binary in the chain
|
|
27
|
-
# that no part of the seed emitted: the seed built the compiler that built it,
|
|
28
|
-
# and `--verify` is what says the two agree. `--stages 1` stops at the seed's
|
|
29
|
-
# own output, which is enough to *use* the self-hosted compiler and half the
|
|
30
|
-
# wait.
|
|
31
|
-
#
|
|
32
|
-
# --verify runs the equalities the proof is made of, byte for byte:
|
|
33
|
-
#
|
|
34
|
-
# IR(seed, src/) == IR(stage1, src/) reported, never asserted
|
|
35
|
-
# IR(stage1, src/) == IR(stage2, src/) the fixed point: self-hosted
|
|
36
|
-
# stage3 == stage2 as files, on ELF and on Mach-O
|
|
37
|
-
# alike; see below for what the
|
|
38
|
-
# Mach-O half took
|
|
39
|
-
#
|
|
40
|
-
# The last two are properties of the working tree and of nothing else: whatever
|
|
41
|
-
# built stage1, the compiler `src/` describes has to agree with itself and
|
|
42
|
-
# then reproduce itself. Both are asserted whatever the seed is.
|
|
43
|
-
#
|
|
44
|
-
# The third is a raw byte comparison, and on Mach-O two links of the same input
|
|
45
|
-
# did not produce the same bytes -- measured, at identical size, with every IR
|
|
46
|
-
# equality green (WP19 R2). WHICH bytes is measured too now, and so is what they
|
|
47
|
-
# vary with: LC_UUID, stable across two links to one output path and differing
|
|
48
|
-
# on a link to another, plus on arm64 the one code-directory slot that hashes
|
|
49
|
-
# the page it sits on. That is why `link_stage` below builds every comparable
|
|
50
|
-
# stage at one path, and with it the comparison holds as raw bytes on Mach-O as
|
|
51
|
-
# well -- measured end to end, whatever the UUID turns out to be a function of.
|
|
52
|
-
# Under that, on Darwin only, the script
|
|
53
|
-
# still asserts the size, strips what it can, and reports anything left over as
|
|
54
|
-
# *unattributed* rather than as a compiler difference -- narrower than raw bytes
|
|
55
|
-
# and wider than an exemption, which would accept a stage3 that is a different
|
|
56
|
-
# compiler. The comparison and the reasoning live in
|
|
57
|
-
# `scripts/verify-binaries.sh` -- a script rather than a block in here so that
|
|
58
|
-
# `tests/run.js` can drive both platforms' branches -- and its header has the
|
|
59
|
-
# measurement, byte offsets and all.
|
|
60
|
-
#
|
|
61
|
-
# The first one is reported and not asserted. With a released seed it is one
|
|
62
|
-
# implementation at two points in time: the IR HEAD emits for `src/` is the
|
|
63
|
-
# IR the last release emitted for it. Nothing in that sentence is about
|
|
64
|
-
# bootstrapping. It is a freeze on codegen between releases, and it fails on
|
|
65
|
-
# exactly the changes a release cycle exists to carry: the first improvement to
|
|
66
|
-
# land broke it, when a flow-sensitive bounds analysis proved 46 of `src/`'s
|
|
67
|
-
# 1,206 index checks redundant and 20 of 56 modules "differed" because the
|
|
68
|
-
# optimisation worked. So the difference is reported, and the report is
|
|
69
|
-
# information about this release rather than a verdict on the bootstrap.
|
|
70
|
-
#
|
|
71
|
-
# While stage0's `src/` existed, a stage0 seed made the same comparison the second half
|
|
72
|
-
# of Wheeler's diverse double-compiling, and it was asserted there
|
|
73
|
-
# (docs/wp19-stage0-retirement.md §1, G6). That claim went with stage0's `src/`.
|
|
74
|
-
#
|
|
75
|
-
# What the seeded run buys is not that equality. The rolling freeze — "a
|
|
76
|
-
# construct added in 0.N cannot be used by `src/` until 0.(N+1)" — is enforced
|
|
77
|
-
# by stage1 being built at all: a `src/` that reaches for something the seed
|
|
78
|
-
# has never heard of does not compile, does not link, and never gets as far as
|
|
79
|
-
# a comparison. That failure is loud here whatever the seed is, and it is the
|
|
80
|
-
# whole of what the seeded run proves about the freeze
|
|
81
|
-
# (docs/wp19-stage0-retirement.md §3, G3).
|
|
82
|
-
#
|
|
83
|
-
# `node tests/self/bootstrap.js` is the same check with the suite's reporting,
|
|
84
|
-
# and is what CI runs; this script is how the compiler gets built for use.
|
|
85
|
-
#
|
|
86
|
-
# The result is a complete compiler: it plans its own output, makes the
|
|
87
|
-
# directories and links through `scripts/build.sh` itself, so nothing has to
|
|
88
|
-
# stand between it and a build (docs/wp14-selfhost.md §7a).
|
|
89
|
-
#
|
|
90
|
-
# Needs a runnable seed, and clang + lld on PATH for the links
|
|
91
|
-
# (docs/INSTALL.md).
|
|
92
|
-
set -euo pipefail
|
|
93
|
-
|
|
94
|
-
# Read the seed before the `cd` below moves us: a relative NISH_BOOTSTRAP is
|
|
95
|
-
# relative to the directory the caller typed it in, not to the repository root.
|
|
96
|
-
seed_given="${NISH_BOOTSTRAP:-}"
|
|
97
|
-
case "$seed_given" in
|
|
98
|
-
""|/*) ;;
|
|
99
|
-
*) seed_given="$PWD/$seed_given" ;;
|
|
100
|
-
esac
|
|
101
|
-
|
|
102
|
-
cd "$(dirname "$0")/.."
|
|
103
|
-
|
|
104
|
-
out=build/nish
|
|
105
|
-
work=build/selfhost
|
|
106
|
-
profile=speed
|
|
107
|
-
stages=2
|
|
108
|
-
verify=0
|
|
109
|
-
quiet=0
|
|
110
|
-
|
|
111
|
-
usage() {
|
|
112
|
-
cat <<'EOF'
|
|
113
|
-
usage: scripts/bootstrap.sh [-o <exe>] [--stages 1|2|3] [--profile speed|size|debug]
|
|
114
|
-
[--work <dir>] [--verify] [--quiet]
|
|
115
|
-
|
|
116
|
-
Builds the self-hosted compiler. The seed builds stage1, stage1 builds stage2
|
|
117
|
-
(the default output), stage2 builds stage3. --verify compares the IR each stage
|
|
118
|
-
emits for src/ and the stage2/stage3 binaries, byte for byte. The result is
|
|
119
|
-
the command line itself: -o, --link, --profile and the rest.
|
|
120
|
-
|
|
121
|
-
IR(seed) == IR(stage1) asks whether codegen has changed since the seed was
|
|
122
|
-
built, so it is reported and not asserted; IR(stage1) == IR(stage2) and
|
|
123
|
-
stage3 == stage2 are asserted whatever the seed is.
|
|
124
|
-
|
|
125
|
-
The seed is NISH_BOOTSTRAP=<path> when it is set — a released `nish` binary, or
|
|
126
|
-
a .js/.mjs entry point run under node — and build/seed/bin/nish, the release
|
|
127
|
-
scripts/fetch-seed.sh unpacks, when it is not:
|
|
128
|
-
|
|
129
|
-
scripts/bootstrap.sh
|
|
130
|
-
NISH_BOOTSTRAP=~/nish-0.6.0-linux-x86_64 scripts/bootstrap.sh --verify
|
|
131
|
-
EOF
|
|
132
|
-
exit "${1:-2}"
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
while [ $# -gt 0 ]; do
|
|
136
|
-
case "$1" in
|
|
137
|
-
-o|--output) out="${2:-}"; [ -n "$out" ] || usage; shift 2 ;;
|
|
138
|
-
--work) work="${2:-}"; [ -n "$work" ] || usage; shift 2 ;;
|
|
139
|
-
--profile) profile="${2:-}"; [ -n "$profile" ] || usage; shift 2 ;;
|
|
140
|
-
--stages) stages="${2:-}"; shift 2 ;;
|
|
141
|
-
--verify) verify=1; shift ;;
|
|
142
|
-
--quiet) quiet=1; shift ;;
|
|
143
|
-
-h|--help) usage 0 ;;
|
|
144
|
-
*) echo "bootstrap: unknown argument \`$1\`" >&2; usage ;;
|
|
145
|
-
esac
|
|
146
|
-
done
|
|
147
|
-
|
|
148
|
-
case "$stages" in
|
|
149
|
-
1|2|3) ;;
|
|
150
|
-
*) echo "bootstrap: --stages takes 1, 2 or 3 (got \`$stages\`)" >&2; exit 2 ;;
|
|
151
|
-
esac
|
|
152
|
-
# `--stages` says which compiler to install; verifying the fixed point needs
|
|
153
|
-
# the stage that closes it built as well, whether or not it is the one kept.
|
|
154
|
-
install=$stages
|
|
155
|
-
build_to=$stages
|
|
156
|
-
[ "$verify" -eq 1 ] && build_to=3
|
|
157
|
-
|
|
158
|
-
# The published npm package ships bin/, runtime/, scripts/ and std/ but not
|
|
159
|
-
# src/ -- and, since 0.6.0, no compiler of its own at all -- so say which file
|
|
160
|
-
# is missing rather than failing inside the compiler.
|
|
161
|
-
if [ ! -f src/compile.ts ]; then
|
|
162
|
-
echo "bootstrap: src/compile.ts is missing; run this from a checkout of the repository" >&2
|
|
163
|
-
exit 3
|
|
164
|
-
fi
|
|
165
|
-
|
|
166
|
-
# One place that knows how to invoke the seed, so every stage below reads the
|
|
167
|
-
# same whichever kind of seed ran.
|
|
168
|
-
run_seed() {
|
|
169
|
-
if [ "$seed_kind" = node ]; then
|
|
170
|
-
node "$seed" "$@"
|
|
171
|
-
else
|
|
172
|
-
"$seed" "$@"
|
|
173
|
-
fi
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
seed_die() {
|
|
177
|
-
echo "bootstrap: $seed_origin $seed $1" >&2
|
|
178
|
-
echo "bootstrap: the seed is a released \`nish\` binary, or a .js/.mjs entry point run under node" >&2
|
|
179
|
-
exit 3
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
# Unset: the release scripts/fetch-seed.sh leaves in build/seed, fetched
|
|
183
|
-
# first when it is not there (a no-op, without the network, when it is).
|
|
184
|
-
if [ -z "$seed_given" ]; then
|
|
185
|
-
if ! sh scripts/fetch-seed.sh >&2 || [ ! -e build/seed/bin/nish ]; then
|
|
186
|
-
echo "bootstrap: no seed: NISH_BOOTSTRAP is unset and scripts/fetch-seed.sh could not" >&2
|
|
187
|
-
echo "bootstrap: fetch the last release into build/seed; set NISH_BOOTSTRAP=<nish>" >&2
|
|
188
|
-
exit 3
|
|
189
|
-
fi
|
|
190
|
-
seed_given="$PWD/build/seed/bin/nish"
|
|
191
|
-
seed_origin="the released seed"
|
|
192
|
-
else
|
|
193
|
-
seed_origin="NISH_BOOTSTRAP seed"
|
|
194
|
-
fi
|
|
195
|
-
seed=$seed_given
|
|
196
|
-
# The kind is decided by the extension, and deliberately not by the
|
|
197
|
-
# executable bit or by sniffing the bytes. The bit describes the download
|
|
198
|
-
# rather than the file — a binary unpacked from a release tarball or pulled
|
|
199
|
-
# out of a CI artifact can arrive without +x —
|
|
200
|
-
# whereas the suffix is the one thing whoever built the seed chose. Anything
|
|
201
|
-
# with no suffix is a binary, which is how a released `nish` arrives.
|
|
202
|
-
case "$seed" in
|
|
203
|
-
*.js|*.mjs|*.cjs) seed_kind=node; seed_label="$seed_origin (node $seed)" ;;
|
|
204
|
-
*) seed_kind=native; seed_label="$seed_origin ($seed)" ;;
|
|
205
|
-
esac
|
|
206
|
-
[ -e "$seed" ] || seed_die "does not exist"
|
|
207
|
-
[ -f "$seed" ] || seed_die "is not a file"
|
|
208
|
-
if [ "$seed_kind" = native ]; then
|
|
209
|
-
[ -x "$seed" ] || seed_die "is not executable"
|
|
210
|
-
else
|
|
211
|
-
[ -r "$seed" ] || seed_die "is not readable"
|
|
212
|
-
command -v node >/dev/null 2>&1 || seed_die "needs node on PATH, which is not there"
|
|
213
|
-
fi
|
|
214
|
-
# A seed that cannot answer `--version` cannot compile src/ either — a
|
|
215
|
-
# binary built for another platform, a .js that is not a compiler — and
|
|
216
|
-
# finding that out here names the variable and the path the caller set, where
|
|
217
|
-
# finding it out in the stage1 link names a temporary file three stages deep.
|
|
218
|
-
run_seed --version >/dev/null 2>&1 || seed_die "is not runnable (\`--version\` failed)"
|
|
219
|
-
if ! command -v clang >/dev/null 2>&1 && [ -z "${CC:-}" ]; then
|
|
220
|
-
echo "bootstrap: needs clang on PATH to link the stages (see docs/INSTALL.md)" >&2
|
|
221
|
-
exit 3
|
|
222
|
-
fi
|
|
223
|
-
|
|
224
|
-
say() { [ "$quiet" -eq 1 ] || printf '%s\n' "$*"; }
|
|
225
|
-
|
|
226
|
-
# `a` and `b` hold one `.ll` per module of `src/`. Both the module set and
|
|
227
|
-
# every byte of every module must match: a stage that emitted one module fewer
|
|
228
|
-
# has not agreed about the rest.
|
|
229
|
-
compare_ir() {
|
|
230
|
-
local a="$1" b="$2" label="$3" name
|
|
231
|
-
if ! diff <(cd "$a" && ls ./*.ll) <(cd "$b" && ls ./*.ll) >/dev/null; then
|
|
232
|
-
echo "bootstrap: $label: the two stages emitted different module sets" >&2
|
|
233
|
-
exit 1
|
|
234
|
-
fi
|
|
235
|
-
for name in "$a"/*.ll; do
|
|
236
|
-
if ! cmp -s "$name" "$b/$(basename "$name")"; then
|
|
237
|
-
echo "bootstrap: $label: $(basename "$name") differs" >&2
|
|
238
|
-
diff "$name" "$b/$(basename "$name")" | head -n 20 >&2
|
|
239
|
-
exit 1
|
|
240
|
-
fi
|
|
241
|
-
done
|
|
242
|
-
say " $label: $(ls "$a"/*.ll | wc -l | tr -d ' ') modules identical"
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
# IR(seed) vs IR(stage1), reported and never asserted. What it measures is
|
|
246
|
-
# whether codegen has moved since the seed was built, which is a fact about
|
|
247
|
-
# this release rather than a property of the bootstrap — the header says why.
|
|
248
|
-
# Nothing in here exits.
|
|
249
|
-
survey_ir() {
|
|
250
|
-
local a="$1" b="$2" total=0 differing=0 name
|
|
251
|
-
if ! diff <(cd "$a" && ls ./*.ll) <(cd "$b" && ls ./*.ll) >/dev/null; then
|
|
252
|
-
say " note: IR(seed) vs IR(stage1): the two emitted different module sets."
|
|
253
|
-
say " Not a bootstrap failure: this comparison is not asserted"
|
|
254
|
-
say " (see the header of this script)."
|
|
255
|
-
return 0
|
|
256
|
-
fi
|
|
257
|
-
for name in "$a"/*.ll; do
|
|
258
|
-
total=$((total + 1))
|
|
259
|
-
cmp -s "$name" "$b/$(basename "$name")" || differing=$((differing + 1))
|
|
260
|
-
done
|
|
261
|
-
if [ "$differing" -eq 0 ]; then
|
|
262
|
-
say " note: IR(seed) vs IR(stage1): all $total modules identical."
|
|
263
|
-
say " Not asserted: codegen simply has not moved for src/ since"
|
|
264
|
-
say " the seed was built."
|
|
265
|
-
else
|
|
266
|
-
say " note: IR(seed) vs IR(stage1): $differing of $total modules differ."
|
|
267
|
-
say " Not a bootstrap failure. Codegen has moved for src/ since the"
|
|
268
|
-
say " seed was built, which is what a release carries. See the header"
|
|
269
|
-
say " of this script and docs/wp19-stage0-retirement.md §3, G3."
|
|
270
|
-
fi
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
# Build one stage with another, at a path every stage shares, and move it into
|
|
274
|
-
# place afterwards.
|
|
275
|
-
#
|
|
276
|
-
# The shared path is what makes `stage3 == stage2` hold on Mach-O, and it is
|
|
277
|
-
# measured rather than tidy-mindedness: LC_UUID is stable across two links to
|
|
278
|
-
# one output path and differs on a link to another. Two links of one input to
|
|
279
|
-
# one path produce one UUID and byte-identical files; the same two to `.../one`
|
|
280
|
-
# and `.../two` differ in exactly those sixteen bytes. So stage2 at
|
|
281
|
-
# `$work/stage2` and stage3 at `$work/stage3` gave two different UUIDs to two
|
|
282
|
-
# compilers that had agreed about every other byte, and the comparison could
|
|
283
|
-
# only ever report that as unattributed. The output path is the leading reason
|
|
284
|
-
# and the probe cannot rule out an invocation counter -- docs/wp10-ci.md#ci-matrix
|
|
285
|
-
# has that, the offsets, and the remedy that did not work -- but the shared path
|
|
286
|
-
# was measured to work end to end either way, and build.sh's Darwin branch says
|
|
287
|
-
# why the flag that drops the load command is not the answer.
|
|
288
|
-
#
|
|
289
|
-
# It costs one rename per stage and weakens nothing: the comparison is still a
|
|
290
|
-
# raw `cmp` of the two files.
|
|
291
|
-
#
|
|
292
|
-
# stage1 is left out because nothing compares it to a binary -- `IR(seed) ==
|
|
293
|
-
# IR(stage1)` compares the .ll files its build wrote, and those are the same
|
|
294
|
-
# bytes wherever the executable landed.
|
|
295
|
-
link_stage() {
|
|
296
|
-
local by="$1" name="$2"
|
|
297
|
-
rm -rf "$stages/stage" "$stages/stage.modules"
|
|
298
|
-
"$by" src/compile.ts --link "$stages/stage" --profile "$profile" >/dev/null
|
|
299
|
-
rm -rf "${stages:?}/${name:?}" "${stages:?}/${name:?}.modules"
|
|
300
|
-
mv "$stages/stage" "$stages/$name"
|
|
301
|
-
mv "$stages/stage.modules" "$stages/$name.modules"
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
# Each stage is a compiler that links the next, and a compiler finds
|
|
305
|
-
# `scripts/build.sh`, `runtime/` and `std/` one level up from its own directory
|
|
306
|
-
# (`packageRootCandidates` in src/compile.ts). So the stages live in
|
|
307
|
-
# `$work/bin/`, and `$work` is given the checkout's three directories as
|
|
308
|
-
# symbolic links by absolute path: every stage finds this checkout through its
|
|
309
|
-
# own path, whatever `--work` names, and never through the working-directory
|
|
310
|
-
# fallback, which is what let a stage at `build/selfhost/stage1` find it before
|
|
311
|
-
# (docs/security/cli.md, CLI-9 and the bootstrap note). `ln -sfn` replaces a
|
|
312
|
-
# link from an earlier run in place rather than following it.
|
|
313
|
-
mkdir -p "$work/bin"
|
|
314
|
-
stages="$work/bin"
|
|
315
|
-
for dir in scripts runtime std; do
|
|
316
|
-
if [ -L "$work/$dir" ] || [ ! -e "$work/$dir" ]; then
|
|
317
|
-
ln -sfn "$PWD/$dir" "$work/$dir"
|
|
318
|
-
elif [ "$(cd "$work/$dir" && pwd -P)" != "$(cd "$dir" && pwd -P)" ]; then
|
|
319
|
-
echo "bootstrap: $work/$dir is in the way of the link to this checkout's $dir/" >&2
|
|
320
|
-
exit 1
|
|
321
|
-
fi
|
|
322
|
-
done
|
|
323
|
-
outdir=$(dirname "$out")
|
|
324
|
-
[ "$outdir" = "" ] || mkdir -p "$outdir"
|
|
325
|
-
|
|
326
|
-
# Every stage is built the same way, by the stage before it, with one
|
|
327
|
-
# `--link`: the compiler plans the output, makes `<exe>.modules/` and runs
|
|
328
|
-
# `scripts/build.sh` itself (docs/wp14-selfhost.md §7a). That leaves each
|
|
329
|
-
# stage's IR in `<exe>.modules/`, which is where the equalities read it, and
|
|
330
|
-
# means the chain exercises the same driver a user does.
|
|
331
|
-
say "stage1: src/ compiled by $seed_label"
|
|
332
|
-
rm -rf "$stages/stage1.modules"
|
|
333
|
-
# This is the step the rolling freeze is enforced by, so it says so when it
|
|
334
|
-
# fails rather than leaving a reader with the compiler's own diagnostic and no
|
|
335
|
-
# idea which rule it just met.
|
|
336
|
-
if ! run_seed src/compile.ts --link "$stages/stage1" --profile "$profile" >/dev/null; then
|
|
337
|
-
echo "bootstrap: $seed_label could not build stage1 from src/ (its output is above)" >&2
|
|
338
|
-
echo "bootstrap: if it refused the source, that is the freeze doing its job: a construct" >&2
|
|
339
|
-
echo "bootstrap: added in 0.N cannot be used by src/ until 0.(N+1) (docs/wp12-release.md," >&2
|
|
340
|
-
echo "bootstrap: \"The bootstrap seed\"; docs/wp19-stage0-retirement.md §3, G3)" >&2
|
|
341
|
-
exit 1
|
|
342
|
-
fi
|
|
343
|
-
|
|
344
|
-
if [ "$build_to" -ge 2 ]; then
|
|
345
|
-
say "stage2: src/ compiled by stage1"
|
|
346
|
-
link_stage "$stages/stage1" stage2
|
|
347
|
-
# The seed equality, reported and not asserted.
|
|
348
|
-
[ "$verify" -eq 1 ] && survey_ir "$stages/stage1.modules" "$stages/stage2.modules"
|
|
349
|
-
fi
|
|
350
|
-
|
|
351
|
-
if [ "$build_to" -ge 3 ]; then
|
|
352
|
-
say "stage3: src/ compiled by stage2"
|
|
353
|
-
link_stage "$stages/stage2" stage3
|
|
354
|
-
[ "$verify" -eq 1 ] && compare_ir "$stages/stage2.modules" "$stages/stage3.modules" "IR(stage1) == IR(stage2)"
|
|
355
|
-
# `stage3 == stage2`, in scripts/verify-binaries.sh: byte-identical, which
|
|
356
|
-
# both stages being linked at one path is what buys on Mach-O as well. Under
|
|
357
|
-
# that, on Darwin, it still asserts the size, strips debug information where
|
|
358
|
-
# a tool can strip it, and fails anything left over as *unattributed* -- a
|
|
359
|
-
# net now rather than the arm that decides a darwin row. The comparison lives
|
|
360
|
-
# in a script of its own so that tests/run.js can drive every branch of it
|
|
361
|
-
# from one machine -- its header is where the reasoning is, and NISH_UNAME_S
|
|
362
|
-
# is how the suite asks for the other platform's branch.
|
|
363
|
-
if [ "$verify" -eq 1 ]; then
|
|
364
|
-
if verdict="$(bash scripts/verify-binaries.sh "$stages/stage2" "$stages/stage3" 2>&1)"; then
|
|
365
|
-
printf '%s\n' "$verdict" | while IFS= read -r line; do say " $line"; done
|
|
366
|
-
else
|
|
367
|
-
printf '%s\n' "$verdict" >&2
|
|
368
|
-
exit 1
|
|
369
|
-
fi
|
|
370
|
-
fi
|
|
371
|
-
fi
|
|
372
|
-
|
|
373
|
-
cp "$stages/stage$install" "$out"
|
|
374
|
-
say "bootstrap: wrote $out ($(wc -c < "$out" | tr -d ' ') bytes, stage$install, $profile profile)"
|
|
375
|
-
say " it takes -o <file.ll>, -o <dir>/, --link <exe> and --profile"
|